Как использовать восстановление данных с помощью jquery в моем контроллере? - PullRequest
0 голосов
/ 21 июня 2019

Я восстанавливаю ARRAY из таблицы данных (matricule, salaire, date), использующей jquery, и теперь я хочу отправить его своему контроллеру, но в моем примере он просто отображает «salaire, nbrj, prime», plz help: my datatable:

<form action="/mois" method="POST">
         {{csrf_field()}}

 <div id='form2'>
    <h3>form group 2</h3>
    <h4>DATE : <span id="dateE"></span></h4>
    <h4>chantier : <span id="ch"></span></h4>
      <div class="form-group col-md-offset-5 ">
        <button class="btn btn-success add-all" type="submit" id="hide">Pointage</button>
      </div>
   <table class="table table-bordered" id="mytable">
        <tr>
            <th>Archive</th>
            <th><input type="checkbox" id="check_all"></th>
            <th>S.No.</th>
            <th>matricule</th>
            <th>nom & prenom</th>
            <th>salaire net</th>
            <th>nbre de jour </th>
            <th>prime</th>
        </tr>
        @if($salaries->count())
            @foreach($salaries as $key => $salarie)
                <tr id="tr_{{$salarie->id}}">
                  <td>archive</td>
                  <td><input type="checkbox" class="checkbox" data-id="{{$salarie->id}}"></td>
                  <td>{{ ++$key }}</td>
                  <td>{{ $salarie->matricule }}</td>
                  <td >{{ $salarie->nom }} {{ $salarie->prenom }}</td>
                  <td><input type="hidden" name="salaire" value="{{ $salarie->salairenet }}">{{ $salarie->salairenet }}</td>
                  <td ><input type="text" class='input2' name="nbreJ" class="form-control" ></td>
                  <td><input type="text" name="prime" class="form-control" value="0"></td>
                </tr>
            @endforeach
        @endif
    </table>
 </div>
</form>

код jquery:

 $('.add-all').on('click', function() {
    var items = [];
    let valu = $('#datePicker').val();


    $("tr").each(function(i,r){
      if ( i > 0 && $(r).find("input").first().prop("checked"))
     {
       items.push({"matricule": r.cells[3].innerText, "salaire": r.cells[5].innerText, "date" : valu })
      }
                              });
      console.log(items);   
                                       }); 

мой контроллер:

public function addMultiple(Request $request){

        dd($request->all());
            }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...