Server : Apache System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64 User : vapecompany ( 2719) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/vapecompany/demo.vapecompany.com.bd/resources/views/backend/stock/ |
Upload File : |
@extends('backend.layout.app') @section('content') <style> @media print { .noPrint {display:none;} } .lds-dual-ring.hidden { display: none; } .lds-dual-ring { display: inline-block; margin: 0 10px; } .lds-dual-ring:after { content: " "; display: block; width: 30px; height: 30px; margin: 5% auto; border-radius: 50%; border: 6px solid #fff; border-color: #fff transparent #fff transparent; animation: lds-dual-ring 1.2s linear infinite; } @keyframes lds-dual-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .overlay { position: fixed; background: rgba(0,0,0,.8); z-index: 999; opacity: 1; transition: all 0.5s; } </style> <!-- ============================================================== --> <!-- Page wrapper --> <!-- ============================================================== --> <div class="page-wrapper"> <!-- ============================================================== --> <!-- Bread crumb and right sidebar toggle --> <!-- ============================================================== --> <div class="page-breadcrumb"> <div class="row"> <div class="col-5 align-self-center"> <h4 class="page-title">Add Product IMEI</h4> <div class="d-flex align-items-center"> <nav aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="#">Home</a></li> <li class="breadcrumb-item active" aria-current="page">Stock In</li> </ol> </nav> </div> </div> </div> </div> <!-- ============================================================== --> <!-- End Bread crumb and right sidebar toggle --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- Container fluid --> <!-- ============================================================== --> <div class="container-fluid"> <!-- ============================================================== --> <!-- Start Page Content --> <!-- ============================================================== --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <form id="imporForm" action="#" method="POST" name="importform" enctype="multipart/form-data"> @include('backend.layout.verror_message') @csrf <div class="form-group row"> <label for="brand" class="col-sm-3 text-right control-label col-form-label">Stock Date</label> <div class="col-sm-9"> <div class="input-group"> <input type="text" name="stock_date" class="form-control" id="datepicker-autoclose" placeholder="mm/dd/yyyy"> <div class="input-group-append"> <span class="input-group-text"><i class="icon-calender"></i></span> </div> </div> </div> </div> <div class="form-group row"> <label for="brand" class="col-sm-3 text-right control-label col-form-label">Bill No.</label> <div class="col-sm-9"> <input type="text" class="form-control" id="bill_no" name="bill_no" placeholder="Bill No."> </div> </div> <div class="form-group row"> <label for="brand" class="col-sm-3 text-right control-label col-form-label">Supplier</label> <div class="col-sm-9"> <select name="supplier" class="form-control select2 "> <option value="">Select</option> @foreach($suppliers as $supplier) <option value="{{$supplier->supplier_id}}">{{$supplier->supplier_name}}</option> @endforeach </select> </div> </div> <div class="form-group row"> <label for="brand" class="col-sm-3 text-right control-label col-form-label">C&F Name</label> <div class="col-sm-9"> <select name="cnf" class="form-control select2 "> <option value="">Select C&F</option> @foreach($cnfs as $cnf) <option value="{{$cnf->cnf_id}}">{{$cnf->cnf_name}}</option> @endforeach </select> </div> </div> <div class="form-group row"> <label for="brand" class="col-sm-3 text-right control-label col-form-label">Brand</label> <div class="col-sm-9"> <select onchange="get_product();" name="brand" id="brand" class="form-control select2 "> <option value="">Select</option> @foreach($brands as $brand) <option value="{{$brand->brand_id}}">{{$brand->brand_name}}</option> @endforeach </select> </div> </div> <div class="form-group row"> <label for="brand" class="col-sm-3 text-right control-label col-form-label">Product</label> <div class="col-sm-9"> <select onchange="enablefile()" id="product" name="product" class="form-control select2 "> <option value="">Select Product</option> </select> </div> </div> <div class="form-group row"> <div class="col-sm-4"> </div> <div class="col-sm-8"> <input disabled="" type="file" id="import_file" name="import_file" class="form-control"> <div id="loader" class="lds-dual-ring hidden overlay"></div> <input type="hidden" id="is_import" name="is_import" value="0"> </div> </div> <div class="form-group mb-0 text-right"> <button disabled="disabled" class="btn btn-success">Import File</button> </div> <div class="form-group mb-0 text-center"> </div> <div id="dataimport" class="panel panel-default"></div> </form> </div> </div> </div> </div> <!-- ============================================================== --> <!-- End PAge Content --> <!-- ============================================================== --> <!-- ============================================================== --> <!-- Right sidebar --> <!-- ============================================================== --> <!-- .right-sidebar --> <!-- ============================================================== --> <!-- End Right sidebar --> <!-- ============================================================== --> </div> <!-- ============================================================== --> <!-- End Container fluid --> @endsection @section('script') <script src="{{ asset('public/backend/js/jquery.validate.min.js"></script> <link rel="stylesheet" type="text/css" href="./public/css/bootstrap-datepicker.min.css"> <script src="{{ asset('public/backend/js/bootstrap-datepicker.min.js"></script> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <script src="{{ asset('public/backend/js/tinymce.min.js"></script> <script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script> <script type="text/javascript"> //load product and date var date = new Date(); var today = new Date(date.getFullYear(), date.getMonth(), date.getDate()); $('#datepicker-autoclose').datepicker({ format: 'dd-mm-yyyy', autoclose: true, todayHighlight: true }); $( '#datepicker-autoclose').datepicker( 'setDate', today ); function get_product(){ var id=$('#brand').val(); //console.log("{{url('get_productById')}}/"+id); $.ajax({ type : 'POST', url : "{{url('get_productById')}}", data:{brand_id:id}, dataType: 'json', success : function (data) { //var d=JSON.parse(data); var color="<option value=''>Select Product</option>"; $.each(data,function(){ console.log(this.product_id); color +="<option value='"+this.product_id+"'> "+this.product_name+" </option>"; }); // console.log(color); $('#product').html(color); }, error : function (data) { //console.log(data); } }); } function enablefile(){ var id=$('#product').val(); if($('#import_file').val()){ $("#import_file").val(null); $("#import_file").change(); } if(id){ $("#import_file").prop("disabled",false); }else{ $("#import_file").prop("disabled",true); } } function get_product_color(){ var id=$('#product').val(); $.ajax({ type : 'POST', url : "{{url('get_productById')}}", data:{id:id}, // dataType: 'json', success : function (data) { $('#color').html(data); }, error : function (data) { //console.log(data); } }); } //end load product and date $('#import_file').change(function(){ $('#is_import').val(0); if($('#import_file').val()){ var data1 = new FormData(document.getElementById('imporForm'));console.log(data1); $.ajax({ type : 'POST', url : "{{url('import-excel')}}", data : data1, cache:false, contentType: false, processData: false, beforeSend: function() { $('#loader').removeClass('hidden') }, //dataType: 'json', success : function (data) { console.log(data); $('#quantity').val(data-1); $('#quantity_view').val(data-1); $('#dataimport').html(data); },error: function(response) { //console.log(response); }, complete: function(){ $('#loader').addClass('hidden'); $('button').attr("disabled", false); $('#is_import').val(1); }, }); }else{ $('#dataimport').html(""); $('button').attr("disabled", true); } }); $("#imporForm").validate({ ignore: "", rules: { supplier: { required: true, }, bill_no:{ required: true, }, stock_date:{ required: true, }, brand: { required: true, }, product: { required: true, }, color: { required: true, }, quantity: { required: true, }, }, messages: { 'product_id[]': "Please Add Product", }, submitHandler: submitForm }); function submitForm(){ event.preventDefault(); var data1 = new FormData(document.getElementById('imporForm')); //console.log(data1); $.ajax({ type : 'POST', url : "{{url('import-excel')}}", data : data1, cache:false, contentType: false, processData: false, dataType: 'json', beforeSend: function() { $('#loader').removeClass('hidden'); $('button').attr("disabled", true); }, success : function (data) { console.log(data); if(data.errors=='0'){ $('.alert-success').show(); $('.alert-danger').hide(); $('.alert-success').append('<p>'+data.success+'</p>'); $("#imporForm").get(0).reset(); $("#cart_items").html(""); $('#is_import').val(0); $('#dataimport').html(""); }else if(data.errors=='1'){ var val=""; $.each(data.error, function(key, value){ $('.alert-danger').show(); $('.alert-success').hide(); val+= '<p> row:'+(data.row[key]+1)+' , Column:'+(parseInt(data.keys[key])+1)+' value ('+data.values[key]+')'+value+'</p>'; }); $('.alert-danger').html(val); }else{ $('.alert-danger').show(); $('.alert-success').hide(); var val=""; $('.alert-danger').html(data.errors); // console.log(data.errors); } },error: function(response) { //console.log(response); }, complete: function(data){ // console.log("s"); // console.log(data); //$("#imporForm").get(0).reset(); $('#loader').addClass('hidden'); // $('button').attr("disabled", false); //location.reload('{{url('add_iemi')}}'); }, }); return false; } //end validation and insert </script> @endsection