/
home
/
sjslayjy
/
public_html
/
mosaram
/
resources
/
views
/
dashboard
/
invoice
/
Upload File
HOME
@extends('dashboard.layouts.app') @section('title', 'Field Collection') @section('style') {{ Html::style('assets/css/bootstrap-datepicker3.min.css') }} @endsection @section('content') <div class="main-content"> <div class="main-content-inner"> <div class="breadcrumbs ace-save-state" id="breadcrumbs"> <ul class="breadcrumb"> <li> <i class="ace-icon fa fa-home home-icon"></i> <a href="#">{{ __('messages.Home') }}</a> </li> <li class="active">Field Collection</li> </ul> </div> <div class="page-content"> <div class="row"> <div class="col-xs-12"> <h3 class="header smaller lighter blue">Field Collection</h3> <div class="row"> <div class="col-xs-12"> <form action="" method="POST" role="form"> <div class="row"> {{ csrf_field() }} <div class="col-md-3"> <div class="form-group"> <label for="collection_user"> Collection user </label> <select class="form-control select2" name="collection_user" id="collection_user"> <option value=""> Select Collection User </option> @foreach ($collection_user_list as $item) <option value="{{ $item->user_id }}" {{ isset($collection_user_id) && $collection_user_id == $item->user_id ? 'selected' : '' }}> {{ $item->user->name }} </option> @endforeach </select> @if ($errors->has('collection_user')) <span class="label label-danger">{{ $errors->first('collection_user') }}</span> @endif </div> </div> <div class="col-md-3"> <div class="form-group"> <label for="collection_payment_mode">Collection Payment Mode</label> <select class="form-control select2" name="collection_payment_mode" id="collection_payment_mode"> <option value="">Select Mode</option> <option value="Cash" selected>Cash</option> <option value="cheque">Cheque</option> </select> @if ($errors->has('collection_payment_mode')) <span class="label label-danger">{{ $errors->first('collection_payment_mode') }}</span> @endif </div> </div> <div class="col-md-3"> <div class="form-group"> <button type="submit" id="filter" class="btn btn-primary">Submit</button> </div> </div> </div> </form> </div> </div> @if (session('success')) <div class="alert alert-success"> {{ session('success') }} </div> @endif @if (session('error')) <div class="alert alert-danger"> {{ session('error') }} </div> @endif <div class="clearfix"> <div class="pull-right tableTools-container"> </div> </div> <div class="table-header">Total Cash Amount<span class="badge badge-success" style="margin-left:5px; font-size: 14px;"><i class="fa fa-rupee"></i> @if (isset($field_collections_amount)) {{ $field_collections_amount }} @endif </span><span class="badge badge-warning" data-toggle="modal" href='#Denomination' style="margin-left:5px; font-size: 14px;">See Note Denomination</span> <div class="widget-toolbar no-border"> <!--<a class="btn btn-xs bigger btn-warning" href="{{ URL('/user/pending-company-di') }}">--> <!-- Pending Company DIs--> <!-- <i class="ace-icon fa fa-eye icon-on-right"></i>--> <!--</a>--> <!--<a class="btn btn-xs bigger btn-danger" href="{{ URL('/user/generate-company-di') }}">--> <!-- Generate Company DI--> <!-- <i class="ace-icon fa fa-plus icon-on-right"></i>--> <!--</a>--> </div> </div> @if(isset($field_collections)) @if(count($field_collections)>0) <div class="table-responsive"> <form name="frm-example" id="frm-example"> <div class="dataTables_borderWrap"> <table id="dynamic-table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th>ID</th> <th>Collection User</th> <th>Dealer</th> <th>Retailer</th> <th>Retailer Location</th> <th>Amount</th> <!-- <th>Payment Mode</th> --> <th>Payment Remark</th> <th>Status</th> {{-- <th>Action</th> --}} </tr> </thead> <tbody> @foreach($field_collections as $field_collection) <tr id="tr_{{$field_collection->id}}"> <td>{{$field_collection->id}}</td> <td>{{$field_collection->user->name}}</td> <td>{{getModelById('Dealer',$field_collection->dealer_id)->name}}</td> <td>{{getModelById('Retailer',$field_collection->retailer_id)->name}}</td> <td>{{getModelById('Retailer',$field_collection->retailer_id)->address}}</td> <td>{{$field_collection->amount}}</td> <!-- <td>{{$field_collection->mode}}</td> --> <td>{{$field_collection->reference_no}}</td> <!--<td>{{$field_collection->status}}</td>--> <td> @if($field_collection->status == 0) <span class="badge badge-warning">Pending</span> @elseif($field_collection->status == 1) <span class="badge badge-success">Approved</span> @elseif($field_collection->status == 2) <span class="badge badge-danger">Rejected</span> @endif </td> {{-- <td> @if ($role_id == '1' || $role_id == '7') @if($field_collection->status == 0) <button class="btn btn-xs btn-primary" data-toggle="tooltip" title="Set Status" onclick="setStatusModal('{{$field_collection->id}}')" > Update Status </button> @endif @endif </td> --}} </tr> @endforeach </tbody> <tfoot> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> <td><B>TOTAL = </B>{{ $field_collections_amount }}</td> </tr> </tfoot> </table> <button type="button" id="collectionBtn" class="btn btn-primary" style="float: right;margin-right: 100px;">Collection </button> </div> </form> </div> @else <p style="font-size: 17px;text-align: center;margin-top: 28px;font-weight: bold;">This user has no pending collections</p> @endif @endif </div> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <!--status update--> <div class="modal fade" id="editItemModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Update Status</h4> </div> <div class="modal-body" id="EditBodyItem"> </div> </div> </div> </div> <div class="modal fade" id="Denomination"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Note Denomination</h4> </div> <div class="modal-body"> <table class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Currency</th> <th>Count</th> <th>Amount</th> </tr> </thead> @if(isset($field_collections) && count($field_collections)>0) <tbody> @php $total_amount=0; $obj = $field_collections[0]['multipals_cheque_no']; $arr = json_decode($obj,true); @endphp @foreach($arr as $currency =>$value) @php $currencyCount = 0; @endphp <tr> <td>{{$currency}}</td> <td> @foreach($field_collections as $val) @php $arr1 = json_decode($val->multipals_cheque_no,true); $currencyCount += $arr1[$currency]; @endphp @endforeach {{$currencyCount}} </td> <td>{{$currency*$currencyCount}} @php $total_amount += $currency*$currencyCount @endphp</td> </tr> @endforeach </tbody> <tfoot> <tr> <td colspan="2"> <label class="pull-right">Total Amount:</label> </td> <td><b>{{$total_amount}}</b></td> </tr> </tfoot> @endif </table> </div> <div class="modal-footer"> <!-- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> --> <button type="button" id="" data-dismiss="modal" class="btn btn-primary">Close</button> </div> </div> </div> </div> @section('script') {{ Html::script('assets/js/jquery.dataTables.min.js') }} {{ Html::script('assets/js/jquery.dataTables.bootstrap.min.js') }} {{ Html::script('assets/js/dataTables.buttons.min.js') }} {{ Html::script('assets/js/dataTables.checkboxes.min.js') }} {{ Html::script('assets/js/buttons.flash.min.js') }} {{ Html::script('assets/js/buttons.html5.min.js') }} {{ Html::script('assets/js/buttons.print.min.js') }} {{ Html::script('assets/js/buttons.colVis.min.js') }} {{ Html::script('assets/js/dataTables.select.min.js') }} {{ Html::script('assets/js/ace-elements.min.js') }} {{ Html::script('assets/js/ace.min.js') }} {{ Html::script('assets/js/bootstrap-datepicker.min.js') }} {{-- <script src="https://gyrocode.github.io/jquery-datatables-checkboxes/1.2.12/js/dataTables.checkboxes.min.js"></script> --}} <script type="text/javascript"> jQuery(function($) { //initiate dataTables plugin var myTable = $('#dynamic-table').DataTable({ bAutoWidth: false, "aaSorting": [], 'columnDefs': [{ 'targets': 0, 'checkboxes': { 'selectRow': true } }], 'select': { 'style': 'multi' }, }); $.fn.dataTable.Buttons.defaults.dom.container.className = 'dt-buttons btn-overlap btn-group btn-overlap'; new $.fn.dataTable.Buttons(myTable, { buttons: [{ "extend": "colvis", "text": "<i class='fa fa-search bigger-110 blue'></i> <span class='hidden'>Show/hide columns</span>", "className": "btn btn-white btn-primary btn-bold", columns: ':not(:first):not(:last)' }, { "extend": "copy", "text": "<i class='fa fa-copy bigger-110 pink'></i> <span class='hidden'>Copy to clipboard</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "csv", "text": "<i class='fa fa-database bigger-110 orange'></i> <span class='hidden'>Export to CSV</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "excel", "text": "<i class='fa fa-file-excel-o bigger-110 green'></i> <span class='hidden'>Export to Excel</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "pdf", "text": "<i class='fa fa-file-pdf-o bigger-110 red'></i> <span class='hidden'>Export to PDF</span>", "className": "btn btn-white btn-primary btn-bold" }, { "extend": "print", "text": "<i class='fa fa-print bigger-110 grey'></i> <span class='hidden'>Print</span>", "className": "btn btn-white btn-primary btn-bold", autoPrint: false, message: 'This print was produced using the Print button for DataTables' } ] }); myTable.buttons().container().appendTo($('.tableTools-container')); //style the message box var defaultCopyAction = myTable.button(1).action(); myTable.button(1).action(function(e, dt, button, config) { defaultCopyAction(e, dt, button, config); $('.dt-button-info').addClass('gritter-item-wrapper gritter-info gritter-center white'); }); var defaultColvisAction = myTable.button(0).action(); myTable.button(0).action(function(e, dt, button, config) { defaultColvisAction(e, dt, button, config); if ($('.dt-button-collection > .dropdown-menu').length == 0) { $('.dt-button-collection') .wrapInner( '<ul class="dropdown-menu dropdown-light dropdown-caret dropdown-caret" />') .find('a').attr('href', '#').wrap("<li />") } $('.dt-button-collection').appendTo('.tableTools-container .dt-buttons') }); $('#collectionBtn').click(function(e) { e.preventDefault(); var form = this; var rows_selected = myTable.column(0).checkboxes.selected(); var id = [] // Iterate over all selected checkboxes $.each(rows_selected, function(index, rowId) { id.push(rowId) }); $.ajax({ url: "/user/set-status/" + id, type: 'GET', success: function(data) { // console.log(data); $('#EditBodyItem').html(data); $('#editItemModal').modal('toggle'); } }); }); }) function setStatusModal(id) { if (id == "") { swal('Error', 'Id is missing', 'warning'); } else { $.ajax({ url: "/user/set-status/" + id, type: 'GET', success: function(data) { // console.log(data); $('#EditBodyItem').html(data); $('#editItemModal').modal('toggle'); // OnLoad(); } }); } } // function updateStatus() { // $status = $('#status').val(); // $remark = $('#remark').val(); // $.ajaxSetup({ // headers: { // 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') // } // }); // // $.ajax({ // // url: "/user/set-pr-status", // // type: "post", // // data: $('#editStatusForm').serialize(), // // success:function(data){ // // console.log(data); // // if (!data.flag) { // // showError('edit_status_error', data.errors.status); // // } else { // // swal({ // // title: "Success!", // // text: data.message, // // type: "success" // // }); // // window.location.reload(); // // } // // } // // }); // } </script> @endsection @endsection