/
home
/
sjslayjy
/
public_html
/
olddevlok
/
storage
/
framework
/
views
/
Upload File
HOME
<?php $__env->startSection('title','Token'); ?> <?php $__env->startSection('style'); ?> <?php echo e(Html::style("assets/css/bootstrap-datepicker3.min.css")); ?> <?php $__env->stopSection(); ?> <?php $__env->startSection('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="#"><?php echo e(__('messages.Home')); ?></a> </li> <li class="active"><?php echo e(__('messages.Token')); ?></li> </ul> </div> <div class="page-content"> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title"> <?php echo e(__('messages.Token')); ?> <?php echo e(__('messages.generateNew')); ?></h3> </div> <div class="panel-body"> <form action="" role="form" id="generateTokenForm"> <div class="container"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="token_type"><?php echo e(__('messages.tokentype')); ?></label> <select class="form-control select2" name="token_type" id="token_type" onchange="handleTokenType(this.value)"> <option value="1" selected><?php echo e(__('messages.Rake')); ?> <?php echo e(__('messages.Token')); ?></option> <option value="2"><?php echo e(__('messages.WarehouseToken')); ?></option> </select> </div> </div> <div class="col-md-4" id="rake_div"> <div class="form-group"> <label for="master_rake_id"><?php echo e(__('messages.masterrake')); ?></label> <select class="form-control select2" name="master_rake_id" id="master_rake_id" onchange="getMasterRakeDetails(this.value)"> <option value=""> <?php echo e(__('messages.masterrake')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $master_rakes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rake): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($rake->id); ?>"><?php echo e($rake->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_rake_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4" id="warehouse_div" style="display: none;"> <div class="form-group"> <label for="from_warehouse_id"><?php echo e(__('messages.From')); ?> <?php echo e(__('messages.Warehouses')); ?></label> <select class="form-control select2" name="from_warehouse_id" id="from_warehouse_id" onchange="getInventoryDetails(this.value);"> <option value=""><?php echo e(__('messages.Select')); ?> <?php echo e(__('messages.Warehouses')); ?></option> <?php $__currentLoopData = $warehouses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $warehouse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($warehouse->id); ?>"><?php echo e($warehouse->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_from_warehouse_id_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-4"> <div class="form-group"> <label for="company_id"><?php echo e(__('messages.company')); ?></label> <select class="form-control select2" name="company_id" id="company_id"> <?php $__currentLoopData = $companies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $company): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($company->id); ?>" <?php echo e($acting_company == $company->id ? "selected":""); ?>><?php echo e($company->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="to_type"><?php echo e(__('messages.To')); ?></label> <select class="form-control select2" name="to_type" id="to_type" onchange="handleToType(this.value)"> <option value="1"><?php echo e(__('messages.Warehouses')); ?></option> <option value="2"><?php echo e(__('messages.Retailers')); ?></option> <option value="3"><?php echo e(__('messages.Dealer')); ?></option> </select> </div> </div> <div class="col-md-4" id="warehouses_section"> <div class="form-group"> <label for="warehouse_id"><?php echo e(__('messages.Warehouses')); ?></label> <select class="form-control select2" name="warehouse_id" id="warehouse_id"> <option value=""> <?php echo e(__('messages.Warehouses')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $warehouses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $warehouse): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($warehouse->id); ?>"><?php echo e($warehouse->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_warehouse_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4" id="retailer_section" style="display: none;"> <div class="form-group"> <label for="retailer_id"><?php echo e(__('messages.Retailers')); ?></label> <select class="form-control select2" name="retailer_id" id="retailer_id"> <option value=""><?php echo e(__('messages.Retailers')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $retailers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $retailer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($retailer->id); ?>"><?php echo e($retailer->name); ?>(<?php echo e($retailer->address); ?>)</option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_warehouse_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4" id="dealer_section" style="display: none;"> <div class="form-group"> <label for="dealer_id"><?php echo e(__('messages.Dealer')); ?></label> <select class="form-control select2" name="dealer_id" id="dealer_id" onchange="handleDealer(this.value)"> <option value=""><?php echo e(__('messages.Dealer')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $dealers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dealer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($dealer->id); ?>"><?php echo e($dealer->name); ?> (<?php echo e($dealer->address1); ?>)</option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_dealer_id_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-4"> <div class="form-group"> <label for="date_of_generation"><?php echo e(__('messages.Date')); ?></label> <input type="text" class="form-control date-picker" name="date_of_generation" id="date_of_generation" placeholder="Date" value="<?php echo e(date('m/d/Y')); ?>"> <span class="label label-danger" id="add_date_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="product_company_id"><?php echo e(__('messages.ProductCompany')); ?></label> <select class="form-control select2" name="product_company_id" id="product_company_id"> <option value=""> <?php echo e(__('messages.ProductCompany')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $product_companies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product_company): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($product_company->id); ?>"><?php echo e($product_company->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_product_company_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="account_from_id"><?php echo e(__('messages.AccountFrom')); ?></label> <select class="form-control select2" name="account_from_id" id="account_from_id" onchange="getRakeAllotmentDetails(this.value)"> <option value=""><?php echo e(__('messages.Accounts')); ?> <?php echo e(__('messages.Select')); ?></option> </select> <span class="label label-danger" id="add_account_from_id_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-4"> <div class="form-group"> <label for="product_id"><?php echo e(__('messages.Product')); ?></label> <select class="form-control select2" name="product_id" id="product_id" onchange="getAllotedProductDetails(this.value)"> <option value=""><?php echo e(__('messages.Product')); ?> <?php echo e(__('messages.Select')); ?></option> </select> <span class="label label-danger" id="add_product_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="remaining_quantity"><?php echo e(__('messages.RemainingQuantity')); ?></label> <input type="text" class="form-control" name="remaining_quantity" id="remaining_quantity" placeholder="Remaining Quantity" readonly="readonly"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="quantity"><?php echo e(__('messages.Quantity')); ?></label> <input type="text" class="form-control" name="quantity" id="quantity" placeholder="Quantity" onkeyup="checkQuantity(this.value)"> <span class="label label-danger" id="add_quantity_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-4"> <div class="form-group"> <label for="unit_id"><?php echo e(__('messages.Unit')); ?></label> <select class="form-control select2" name="unit_id" id="unit_id"> <option value=""><?php echo e(__('messages.Unit')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $units; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $unit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($unit->id); ?>"><?php echo e($unit->unit); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_unit_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="rate"><?php echo e(__('messages.Rate')); ?></label> <input type="text" class="form-control" name="rate" id="rate" placeholder="Rate"> <span class="label label-danger" id="add_rate_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="transporter_id"><?php echo e(__('messages.Transporter')); ?></label> <select class="form-control select2" name="transporter_id" id="transporter_id"> <option value=""><?php echo e(__('messages.Transporter')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $transporters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transporter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($transporter->id); ?>"><?php echo e($transporter->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_transporter_id_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-4"> <div class="form-group"> <label for="warehouse_keeper_id"><?php echo e(__('messages.WarehouseKeeper')); ?></label> <select class="form-control select2" name="warehouse_keeper_id" id="warehouse_keeper_id"> <option value=""> <?php echo e(__('messages.WarehouseKeeper')); ?> <?php echo e(__('messages.Select')); ?></option> <?php $__currentLoopData = $warehouse_keepers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $warehouse_keeper): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($warehouse_keeper->id); ?>"><?php echo e($warehouse_keeper->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> <span class="label label-danger" id="add_Warehouse_keeper_id_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="truck_number"><?php echo e(__('messages.TruckNumber')); ?></label> <input type="text" class="form-control" name="truck_number" id="truck_number" placeholder="Truck Number"> <span class="label label-danger" id="add_truck_number_error" style="display: none;"></span> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="delivery_payment_mode"><?php echo e(__('messages.FreightPaymentMode')); ?></label> <select class="form-control select2" name="delivery_payment_mode" id="delivery_payment_mode"> <option value="EX">EX</option> <option value="FOR">FOR</option> </select> <span class="label label-danger" id="add_delivery_payment_mode_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-4"> <div class="form-group"> <label for="description"><?php echo e(__('messages.Description')); ?></label> <textarea name="description" id="description" class="form-control" rows="3" required="required"></textarea> <span class="label label-danger" id="add_description_error" style="display: none;"></span> </div> </div> </div> </div> <a href="<?php echo e(URL('/user/generate-token')); ?>" class="btn btn-default" >Reset</a> <button type="button" id="generateTokenBtn" class="btn btn-primary">Submit</button> </form> </div> </div> </div> </div><!-- /.page-content --> </div><!-- /.main-content --> <?php $__env->startSection('script'); ?> <?php echo e(Html::script("assets/js/ace-elements.min.js")); ?> <?php echo e(Html::script("assets/js/ace.min.js")); ?> <?php echo e(Html::script("assets/js/bootstrap-datepicker.min.js")); ?> <script type="text/javascript"> $(document).ready(function() { $('.date-picker').datepicker({ autoclose: true, todayHighlight: true }) .next().on(ace.click_event, function(){ $(this).prev().focus(); }); $('#generateTokenBtn').click(function(e){ e.preventDefault(); $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } }); $('.loading-bg').show(); $.ajax({ url: $('#generateTokenForm').attr('action'), method: 'POST', data: $('#generateTokenForm').serialize(), success: function(data){ $('.loading-bg').hide(); if(!data.flag){ showError('add_rake_id_error',data.errors.master_rake_id); showError('add_from_warehouse_id_error',data.errors.from_warehouse_id); showError('add_company_id_error',data.errors.company_id); 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_warehouse_id_error',data.errors.warehouse_id); showError('add_quantity_error',data.errors.quantity); showError('add_rate_error',data.errors.rate); showError('add_unit_id_error',data.errors.unit_id); showError('add_date_error',data.errors.date_of_generation); showError('add_account_from_id_error',data.errors.account_from_id); showError('add_delivery_payment_mode_error',data.errors.delivery_payment_mode); }else{ swal({ title: "Success!", text: data.message, type: "success" }, function() { var print_url = "<?php echo e(URL('/')); ?>"+'/user/print-token/'+data.token.id; window.location.href = print_url; }); } } }); }); }); function handleTokenType(id){ if(id==1){ $('#rake_div').show(); $('#warehouse_div').hide(); $('#to_type').val(3).trigger('change'); }else if(id==2){ $('#rake_div').hide(); $('#to_type').val(2).trigger('change'); $('#warehouse_div').show(); } } function handleToType(type){ $('.loading-bg').show(); if(type == 1){ $('#warehouses_section').show(); $('#retailer_section').hide(); $('#dealer_section').hide(); }else if(type == 2){ $('#warehouses_section').hide(); $('#retailer_section').show(); $('#dealer_section').hide(); }else if(type == 3){ $('#warehouses_section').hide(); $('#retailer_section').hide(); $('#dealer_section').show(); } $('.loading-bg').hide(); } function handleDealer(id){ console.log(id); $('.loading-bg').show(); $('#account_from_id').val(id).trigger('change'); $('.loading-bg').hide(); } function getMasterRakeDetails(id){ if(id == ""){ swal('Error','Master Rake id is missing','warning'); }else{ $('.loading-bg').show(); $.ajax({ url: "<?php echo e(url('/get-master-rake-details/')); ?>"+"/"+id, type: 'GET', success:function(data){ console.log(data); $('.loading-bg').hide(); if(data.flag){ var company_option = "<option value='"+data.master_rake.product_company.id+"'>"+data.master_rake.product_company.name+"</option>" $('#product_company_id').html(company_option).trigger('change'); var account_from_option = "<option value=''>Select Product</option>"; $.each(data.master_rake.rake_allotments, function(i, value) { account_from_option += "<option value="+value.dealer_id+">"+value.dealer.name+"("+value.dealer.address1+")</option>"; }); $('#account_from_id').html(account_from_option); }else{ swal('Error',data.message,'warning'); } } }); } } function getInventoryDetails(id){ if(id == ""){ swal('Error','Warehouse id is missing','warning'); }else{ $('.loading-bg').show(); $.ajax({ url: "<?php echo e(url('/get-warehouse-parties/')); ?>"+"/"+id, type: 'GET', success:function(data){ console.log(data); $('.loading-bg').hide(); if(data.flag){ var company_option = "<option value=''>Select Product Company</option>"; $.each(data.product_companies, function(i, value) { company_option += "<option value="+value.product_brand_id+">"+value.product_brand.name+"("+value.product_brand.brand_name+")</option>"; }); $('#product_company_id').html(company_option).trigger('change'); var account_from_option = "<option value=''>Select Account From</option>"; $.each(data.parties, function(i, value) { account_from_option += "<option value="+value.id+">"+value.name+"("+value.address1+")</option>"; }); $('#account_from_id').html(account_from_option); }else{ swal('Error',data.message,'warning'); } } }); } } function getRakeAllotmentDetails(dealer_id){ var token_type = $('#token_type option:selected').val(); if(token_type == 1){ var master_rake_id = $('#master_rake_id option:selected').val(); if(master_rake_id == ""){ $('#master_rake_id option:selected').focus(); $('#dealer_id').val(''); swal('Error','Please Select Master Rake','warning'); }else if(dealer_id == ""){ }else{ $('.loading-bg').show(); $.ajax({ url: "<?php echo e(url('/get-dealer-rake-allotment/')); ?>"+"/"+master_rake_id+"/"+dealer_id, type: 'GET', success:function(data){ console.log(data); $('.loading-bg').hide(); if(data.flag){ $('#product_id').html(data.product_options); $('#account_id').val(dealer_id).trigger('change'); }else{ $('#company_id').val(''); swal('Error',data.message,'warning'); } } }); } }else{ var from_warehouse_id = $('#from_warehouse_id option:selected').val(); var product_company_id = $('#product_company_id option:selected').val(); if(from_warehouse_id == ""){ $('#from_warehouse_id option:selected').focus(); $('#dealer_id').val(''); swal('Error','Please Select Warehouse','warning'); }else if(product_company_id == ""){ $('#product_company_id option:selected').focus(); $('#product_company_id').val(''); swal('Error','Please Select Product Company id','warning'); }else{ $('.loading-bg').show(); $.ajax({ url: "<?php echo e(url('/get-party-products/')); ?>"+"/"+from_warehouse_id+"/"+product_company_id+"/"+dealer_id, type: 'GET', success:function(data){ console.log(data); $('.loading-bg').hide(); if(data.flag){ var product_options = "<option value=''>Select Product</option>"; $.each(data.products, function(i, value) { product_options += "<option value="+value.product_id+">"+value.product.name+"</option>"; }); $('#product_id').html(product_options); }else{ $('#company_id').val(''); swal('Error',data.message,'warning'); } } }); } } } function getAllotedProductDetails(product_id){ var token_type = $('#token_type option:selected').val(); if(token_type == 1){ var master_rake_id = $('#master_rake_id option:selected').val(); var dealer_id = $('#account_from_id option:selected').val(); if(master_rake_id == ""){ $('#master_rake_id option:selected').focus(); $('#dealer_id').val(''); swal('Error','Please Select Master Rake','warning'); }else if(dealer_id == ""){ }else if(product_id == ""){ $('#product_id').val(''); swal('Error','Product missing','warning'); }else{ $('.loading-bg').show(); $.ajax({ url: "<?php echo e(url('/get-alloted-product-details/')); ?>"+"/"+master_rake_id+"/"+dealer_id+"/"+product_id, type: 'GET', success:function(data){ console.log(data); $('.loading-bg').hide(); if(data.flag){ $('#remaining_quantity').val(data.product_details.remaining_quantity); $('#quantity').val(data.product_details.remaining_quantity); $('#unit_id').val(data.product_details.unit_id).trigger('change'); }else{ $('#product_id').val(''); swal('Error',data.message,'warning'); } } }); } }else{ var from_warehouse_id = $('#from_warehouse_id option:selected').val(); var product_company_id = $('#product_company_id option:selected').val(); var party = $('#account_from_id option:selected').val(); if(from_warehouse_id == ""){ $('#from_warehouse_id option:selected').focus(); $('#dealer_id').val(''); swal('Error','Please Select Warehouse','warning'); }else if(product_company_id == ""){ $('#product_company_id option:selected').focus(); $('#product_company_id').val(''); swal('Error','Please Select Product Company id','warning'); }else if(party == ""){ $('#product_company_id option:selected').focus(); $('#product_company_id').val(''); swal('Error','Please Select Party','warning'); }else if(product_id == ""){ $('#product_id').val(''); swal('Error','Product missing','warning'); }else{ $('.loading-bg').show(); $.ajax({ url: "<?php echo e(url('/warehouse-inventory-product-details/')); ?>"+"/"+from_warehouse_id+"/"+product_company_id+"/"+product_id, type: 'GET', success:function(data){ console.log(data); $('.loading-bg').hide(); if(data.flag){ $('#remaining_quantity').val(data.product_details.quantity); $('#unit_id').val(data.product_details.unit_id).trigger('change'); }else{ $('#product_id').val(''); swal('Error',data.message,'warning'); } } }); } } } function checkQuantity(value){ var token_type = $('#token_type option:selected').val(); if(token_type == 2){ var remaining_quantity = parseInt($('#remaining_quantity').val()); if(remaining_quantity < parseInt(value)){ ('#quantity').val(''); swal('Error','Entered Quantity ('+parseInt(value)+') should not be greater tha remaining quantity('+remaining_quantity+')','error'); } } } function showError(id,error){ if(typeof(error) === "undefined"){ $('#'+id).hide(); }else{ $('#'+id).show(); $('#'+id).text(error); } } </script> <?php $__env->stopSection(); ?> <?php $__env->stopSection(); ?> <?php echo $__env->make('dashboard.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/pmmsanvp/public_html/srt/resources/views/dashboard/token/generate-token.blade.php ENDPATH**/ ?>