/
home
/
sjslayjy
/
public_html
/
devlok
/
resources
/
views
/
dashboard
/
stock
/
Upload File
HOME
@extends('dashboard.layouts.app') @section('title','Master Rakes') @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="#">Home</a> </li> <li class="active">Stock Transfer Warehouse</li> </ul> </div> <div class="page-content"> <div class="row"> <div class="col-xs-12"> <h3 class="header smaller lighter blue">Stock Transfer Warehouse</h3> <div class="clearfix"> <div class="pull-right tableTools-container"> </div> </div> <div class="table-header"> Results for "Latest Registered Master Rakes" <div class="widget-toolbar no-border"> <a class="btn btn-xs bigger btn-danger dropdown-toggle" data-toggle="modal" href='#stockWarehouseTransferModal'> Add <i class="ace-icon fa fa-plus icon-on-right"></i> </a> </div> </div> <div class="table-responsive"> <div class="dataTables_borderWrap"> <table id="dynamic-table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th>#</th> <th>Rake_id</th> <th>Warehouse</th> <th>Product</th> <th>Fresh Qty</th> <th>Damage Qty</th> <th>Vehicle No</th> <th>Transporter Mode</th> <th>Driver No.</th> <th>Transporter</th> <th>Transfer Date</th> <th></th> </tr> </thead> <tbody> @foreach($rake_warehouse_transfers as $rake_warehouse_transfer) <tr> <td>{{$rake_warehouse_transfer->id}}</td> <td>{{getModelById("RakePoint",$rake_warehouse_transfer->rake_id)->rake_point}}</td> <td>{{getModelById("Warehouse",$rake_warehouse_transfer->warehouse_id)->name}}</td> <td> @php $productIds = collect($rake_warehouse_transfer_product_details) ->where('rake_transfer_id', $rake_warehouse_transfer->id) ->pluck('product_id')->unique(); $productsNames = collect($products) ->whereIn('id', $productIds) ->pluck('name')->join(', '); @endphp {{$productsNames}} </td> <td> @php $freshQty = collect($rake_warehouse_transfer_product_details) ->where('rake_transfer_id', $rake_warehouse_transfer->id) ->map(function($product) { return $product->fresh_qty; })->sum(); @endphp {{ $freshQty }} </td> <td> @php $damageQty = collect($rake_warehouse_transfer_product_details) ->where('rake_transfer_id', $rake_warehouse_transfer->id) ->map(function($product) { return $product->damage_qty; })->sum(); @endphp {{ $damageQty }} </td> <td>{{$rake_warehouse_transfer->vehicle_no}}</td> <td>{{getModelById("TransportMode",$rake_warehouse_transfer->transporter_mode)->name}}</td> <td>{{$rake_warehouse_transfer->driver_no}}</td> <td>{{getModelById("Transporter",$rake_warehouse_transfer->transporter_id)->name}}</td> <td>{{date('d/m/Y',strtotime($rake_warehouse_transfer->transfer_date))}}</td> <td> {{-- <a href="#" class="btn btn-xs btn-info"> <i class="ace-icon fa fa-pencil bigger-120"></i> </a> --}} @if($rake_warehouse_transfer->status==1) <a href="/user/print-token/{{$rake_warehouse_transfer->id}}" class="btn btn-xs btn-info"> <i class="ace-icon fa fa-print bigger-120"></i> </a> @endif @if($rake_warehouse_transfer->status==0) <a href="#" class="btn btn-xs btn-info" onclick="stock_transfer({{$rake_warehouse_transfer->id}})"> <i class="ace-icon fa fa-share bigger-120"></i> </a> @endif </td> </tr> @endforeach </tbody> </table> </div> </div> <!-- <div class="table-responsive"> <div class="dataTables_borderWrap"> <table id="dynamic-table" class="table table-striped table-bordered table-hover"> <thead> <tr> <th>Name</th> <th>Session</th> <th>Rake Point</th> <th>Product Company</th> <th>Placement Time</th> <th>Unloading Time</th> <th>Date</th> <th>RR Document</th> <th></th> </tr> </thead> <tbody> </tbody> </table> </div> </div> --> </div> </div> </div><!-- /.page-content --> </div> </div><!-- /.main-content --> <!-- Add Master Rake Modal --> <div class="modal fade" id="stockWarehouseTransferModal"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Add New Stock Transfer Warehouse</h4> </div> <div class="modal-body"> <form action="" role="form" id="stocktransferwarehouse" method="POST"> <div class="row"> <div class="clearfix"></div> <div class="col-md-6"> <div class="form-group"> <label for="rake_point">Rake Point</label> <select class="form-control select2" name="rake_point" id="rake_point" onchange="get_product_qty(this, 'rake_point')"> <option value="">Select Rake Point</option> @foreach($rake_points as $rake_point) <option value="{{$rake_point->id}}">{{$rake_point->rake_point}}</option> @endforeach() </select> <span class="label label-danger" id="add_rake_point_error" style="display: none;"></span> </div> </div> <div class="col-md-5"> <div class="form-group"> <label for="name">Warehouse</label> <select class="form-control select2" name="warehouse_id" id="warehouse_id"> <option value="">Select Warehouse</option> @foreach($warehouse as $warehouses) <option value="{{$warehouses->id}}">{{$warehouses->name}}</option> @endforeach() </select> <span class="label label-danger" id="add_product_company_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="product_id">{{__('messages.Product')}}</label> <table class="table table-striped table-bordered"> <thead> <tr> <th> Product Name</th> <th> Quantity</th> <th> Fresh Quantity</th> <th> Damage Quantity</th> </tr> </thead> <tbody id="tbody"> </tbody> </table> <span class="label label-danger" id="add_product_id_error" style="display: none;"></span> </div> </div> <!-- <div class="col-md-3"> <div class="form-group"> <label for="rate">Fresh Quantity</label> <input type="text" class="form-control checkIfValid" name="fresh_qty" placeholder="Quantity"> <span class="label label-danger" id="add_quantity_error" style="display: none;"></span> </div> </div> <div class="col-md-2"> <div class="form-group"> <label for="wharfage">Damage Qty</label> <input type="text" class="form-control" name="damage_qty" id="Damage" placeholder="Damage"> <span class="label label-danger" id="add_wharfage_error" style="display: none;"></span> </div> </div> --> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="name">Transporter</label> <select class="form-control select2" name="transporter_id" id="transporter_id" > <option value="">Select Order</option> @foreach($transporters as $transporter) <option value="{{$transporter->id}}">{{$transporter->name}} </option> @endforeach </select> <span class="label label-danger" id="add_transporter_id_error" style="display: none;"></span> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="order_from">Transport Mode</label> <select class="form-control select2" name="transport_mode"> <option value="">Select Transport Mode</option> @foreach($transport_modes as $transport_mode) <option value="{{$transport_mode->id}}"> {{$transport_mode->name}} </option> @endforeach </select> <span class="label label-danger" id="add_transport_mode_error" style="display: none;"></span> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="vehicle_no">Vehicle No</label> <input type="text" class="form-control" name="vehicle_no" id="vehicle_no" placeholder="Vehicle No" required=""> <span class="label label-danger" id="add_vehicle_no_error" style="display: none;"></span> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="driver_no">Driver No</label> <input type="text" class="form-control" name="driver_no" id="driver_no" placeholder="Driver No" required=""> <span class="label label-danger" id="add_driver_no_error" style="display: none;"></span> </div> </div> </div> <!-- <div id="addMoreRowSection"> </div> <div class="pull-left"> <button type="button" id="addMoreRow" class="btn btn-danger"><i class="fa fa-plus"></i> Add More </button> </div> --> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" id="stocktransferwarehouseBtn" class="btn btn-primary">Submit</button> </div> </form> </div> </div> </div> <!-- Add Master Rake Modal --> <!-- Edit Master Rake Modal --> <div class="modal fade" id="editMasterRakeModal"> <div class="modal-dialog modal-lg"> <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 Master Rake</h4> </div> <div class="modal-body" id="EditBody"> </div> </div> </div> </div> <!-- Edit Master Rake Modal --> <!-------Start lock page modal----------> <div class="modal fade" id="lockMasterRakeModal"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">Lock Master Rake</h4> </div> <div class="modal-body" id="lockBody"> <div class="row"> <input type="hidden" value="" name="master_rake_id" id="master_rake_id"> <span class="label label-danger" id="edit_name_error" style="display: none;">All fields must be active*</span> <div class="widget-main"> <div class="row"> <div class="col-xs-6"> <label> Is Demurrage Field? </label> </div> <div class="col-xs-3"> <label> <input name="is_demurrage_field" class="ace ace-switch ace-switch-4 btn-flat checkIfValids" type="checkbox" value="10" > <span class="lbl"></span> </label> </div> </div> <div class="row"> <div class="col-xs-6"> <label> Is Wharfage Field? </label> </div> <div class="col-xs-3"> <label> <input name="is_wharfage_field" id="validate_check" class="ace ace-switch ace-switch-4 btn-flat checkIfValids" type="checkbox" value="11" > <span class="lbl"></span> </label> </div> </div> <div class="row"> <div class="col-xs-6"> <label> All labour payment done? </label> </div> <div class="col-xs-3"> <label> <input name="all_labour_payment_done" id="validate_check" class="ace ace-switch ace-switch-4 btn-flat checkIfValids" type="checkbox" value="11" > <span class="lbl"></span> </label> </div> </div> <div class="row"> <div class="col-xs-6"> <label> Frieght payment done? </label> </div> <div class="col-xs-3"> <label> <input name="frieght_payment_done" id="validate_check" class="ace ace-switch ace-switch-4 btn-flat checkIfValids" type="checkbox" value="11" > <span class="lbl"></span> </label> </div> </div> <div class="row"> <div class="col-xs-6"> <label> Wagon Unloading payment done? </label> </div> <div class="col-xs-3"> <label> <input name="wagon_unloading_payment_done" id="validate_check" class="ace ace-switch ace-switch-4 btn-flat checkIfValids" type="checkbox" value="11" > <span class="lbl"></span> </label> </div> </div> <div class="row"> <div class="col-xs-6"> <label> Unloading labour payment done? </label> </div> <div class="col-xs-3"> <label> <input name="unloading_labour_payment_done" id="validate_check" class="ace ace-switch ace-switch-4 btn-flat checkIfValids" type="checkbox" value="11" > <span class="lbl"></span> </label> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" id="lockMasterRakeBtnEnabled" class="btn btn-primary" >Close Now</button> </div> </div> </div> </div> </div> </div> <!----------End of lock page modal---------> @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/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/mdtimepicker.min.js")}} {{ Html::script("assets/js/bootstrap-datepicker.min.js")}} <script type="text/javascript"> // <script type="text/javascript"> // // $('.select2').select2(); // function getEdit(id){ // if(id == ""){ // swal('Error','Product id is missing','warning'); // }else{ // $.ajax({ // url: "{{url('/user/edit-product/')}}"+"/"+id, // type: 'GET', // success:function(data){ // $('#EditBody').html(data); // $('#editProductModal').modal('toggle'); // OnLoad(); // } // }); // } // } jQuery(function($) { //initiate dataTables plugin var myTable = $('#dynamic-table').DataTable( { bAutoWidth: false, "aaSorting": [], } ); $.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') }); }) function stock_transfer(id) { var data = {}; data.id = id; var url = `{{url('/user/stock-transfer/')}}`; console.log(url); if(id == ""){ swal('Error','Transfer id is missing','warning'); }else{ swal({ title: "Are you sure?", text: "Stock Transfer.", type: "warning", showCancelButton: true, confirmButtonColor: '#DD6B55', confirmButtonText: 'Yes, I am sure!', cancelButtonText: "No, cancel it!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm){ $.ajax({ url: url, type:'get', data: data, dataType:'json', success:function(response){ if(response.flag == true) { swal({ title: "Success!", text: response.message, type: "success" }, function() { window.location.reload(); }); }else{ swal("Error", response.message, "error"); } console.log(response); } }); } else { swal("Cancelled", "Your Stock is safe :)", "error"); } }); } } function get_product_qty(t, name) { //alert(); var warehouse_id = $(t).val(); var data = {}; data.warehouse_id = warehouse_id; data.name = name; data._token = '{{csrf_token()}}'; var url = window.location.origin+'/stock/get-product-qty'; $.ajax({ url: url, type:'get', data: data, dataType:'json', success:function(response){ //console.log(response); if(response.success == true) { html = ''; // $('#product_id').html(); $("#tbody").html(''); $.each(response.product_qtys, function(key, product){ console.log(product); //html += `<option value="`+product['product_id']+`">`+product['product']['name']+` - `+product['damage_qty']+` `+product['unit']['unit']+`</option>`; if(product.quantity!=0){ html += `<tr id="product_`+product.product_id+`"> <input type="hidden" name="product_brand_id" value="${product.product_brand_id}"> <td><input type="hidden" name="product_id[]" value="${product.product_id}"><input type="hidden" id="input_`+product.product_id+`" onkeypress="return onlyCurrency(event)" onblur="check_zero(this)" data-id="id_`+product.product_id+`_`+product.product_id+`" name="product_name[`+product.product_id+`]" onkeyup="getvalue(this,`+product.product_id+`)" value="`+product.product.name+`" style="width:100px;" />${product.product.name} </td> <td>`+product.quantity+`</td> <td><input type="text" id="input1_`+product.product_id+`" onkeyup="is_valid(`+product.quantity+`,`+product.product_id+`)" data-id="id_`+product.product_id+`_`+product.product_id+`" name="fresh_qty[`+product.product_id+`]"/></td> <td><input type="text" id="input2_`+product.product_id+`" onkeyup="is_valid(`+product.quantity+`,`+product.product_id+`)" data-id="id_`+product.product_id+`_`+product.product_id+`"name="demage_qty[`+product.product_id+`]"/></td> </tr>`; } }); $('#tbody').append(html); //$('.product_id').html(html); // html = ''; // // $('#product_id').html(); // $.each(response.product_qtys, function(key, product){ // //console.log(product.product_id); // //html += `<option value="`+product['product_id']+`">`+product['product']['name']+` - `+product['quantity']+` `+product['unit']['unit']+`</option>`; // }); // //$('#product_id').html(html); } if(response.error == true) { swal("No product found !", {icon: "warning"}, ); } }, error:function(error){ console.log(error); } }); } function is_valid(qty,id){ var fq=parseInt($("#input1_"+id).val()); var dq=parseInt($("#input2_"+id).val()); if((fq != '') && (fq > qty)) { swal('Error','Fresh Quantity can not be Greater Than Quantity. please enter valid quantity!!','error'); $("#stocktransferwarehouseBtn").attr("disabled", true); } else if(dq != '' && (dq > qty)) { swal('Error','Damage Quantity can not be Greater Than Quantity. please enter valid quantity!!','error'); $("#stocktransferwarehouseBtn").attr("disabled", true); } else if(dq+fq != '' && (fq+dq > qty)) { swal('Error','Damage+Fresh Quantity can not be Greater Than Quantity. please enter valid quantity!!','error'); $("#stocktransferwarehouseBtn").attr("disabled", true); } else { $("#stocktransferwarehouseBtn").attr("disabled", false); } } $(document).ready(function() { console.log($('#stocktransferwarehouse').attr('action')); $('#stocktransferwarehouseBtn').click(function(e){ $('.loading-bg').show(); // alert($('#stocktransferwarehouse').attr('action')); e.preventDefault(); $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); $.ajax({ url: $('#stocktransferwarehouse').attr('action'), method: 'POST', data: $('#stocktransferwarehouse').serialize(), success: function(data){ $('.loading-bg').hide(); if(!data.flag){ showError('add_transporter_id_error',data.errors.transporter_id); // showError('add_rake_point_error',data.errors.rake_point); // showError('add_from_warehouse_id_error',data.errors.from_warehouse_id); // showError('add_despatch_location_error',data.errors.despatch_location); // showError('add_dealer_id_error',data.errors.dealer_id); // showError('add_product_company_id_error',data.errors.product_company_id); // showError('add_product_id_error',data.errors.product_id); // showError('add_retailer_id_error',data.errors.retailer_id); // showError('add_quantity_error',data.errors.quantity); // showError('add_unit_id_error',data.errors.unit_id); }else{ swal({ title: "Success!", text: data.message, type: "success" },function() { window.location.reload(); }); $('#modalPopup').modal('toggle') $('#dynamic-table').DataTable().draw(); // window.location.reload(); } } }); }); }); function showError(id,error){ if(typeof(error) === "undefined"){ $('#'+id).hide(); }else{ $('#'+id).show(); $('#'+id).text(error); } }; function removeRow(id){ $('#newRow'+id).remove(); } $('#addMoreRow').click(function(){ var count = $('.row').length + 1; console.log(count); var newRow = `<div class="row" id="newRow`+count+`"> <div class="col-md-6"> <div class="form-group"> <label for="product_id">{{__('messages.Product')}}</label> <select class="form-control select2" name="product_id" id="product_id" > <option value="">{{__('messages.Product')}} {{__('messages.Select')}}</option> </select> <span class="label label-danger" id="add_product_id_error" style="display: none;"></span> </div> </div> <div class="col-md-3"> <div class="form-group"> <label for="rate">Fresh Quantity</label> <input type="text" class="form-control checkIfValid" name="quantity" placeholder="Quantity"> <span class="label label-danger" id="add_quantity_error" style="display: none;"></span> </div> </div> <div class="col-md-2"> <div class="form-group"> <label for="wharfage">Damage Qty</label> <input type="text" class="form-control" name="Damage" id="Damage" placeholder="Damage"> <span class="label label-danger" id="add_wharfage_error" style="display: none;"></span> </div> </div> <div class="col-md-1" style="margin-top: 30px;"> <a href="javascript:;" onclick="removeRow(`+count+`)"><i class="fa fa-close fa-2x"></i></a> </div> </div> `; $('#addMoreRowSection').append(newRow); $('.select2').select2(); }); </script> @endsection @endsection