/
home
/
sjslayjy
/
public_html
/
devlok
/
resources
/
views
/
dashboard
/
stock
/
Upload File
HOME
@extends('dashboard.layouts.app') @section('title','Stock Report') @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">Warehouse Stock</li> </ul> </div> <div class="page-content"> <h3 class="header smaller lighter blue">Warehouse Stock</h3> <div class="row"> <div class="col-xs-12"> <form action="{{ url('stock/warehouse-stock') }}" method="GET" role="form"> <div class="row"> @csrf <div class="col-md-3"> <div class="form-group"> <label for="warehouse_id">Warehouse Stock</label> <select class="form-control select2" name="warehouse_id" id="warehouse_id"> <option value="">All Warehouses</option> @foreach($warehouses as $warehouse) <option value="{{ $warehouse->id }}" {{ isset($selectedWarehouse) && $selectedWarehouse == $warehouse->id ? 'selected' : '' }}> {{ $warehouse->name }} </option> @endforeach </select> </div> </div> <div class="col-md-3"> <div class="form-group"> <input type="submit" class="btn btn-sm btn-primary" value="Filter" style="margin-top: 20px;"> </div> </div> </div> </form> <div class="clearfix"> <div class="pull-right tableTools-container"> </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="table-header"> Warehouse Report <div class="widget-toolbar no-border"> <a class="btn btn-xs bigger btn-danger dropdown-toggle" data-toggle="modal" href='#addWarehouseStockModal'> Opening Stock <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>Id</th> <th>Product Company</th> <th>Warehouse</th> <th>Product Brand</th> <th>Product</th> <th>Unit</th> <th>quantity</th> <th>Damage Qty</th> @if(Auth::check() && Auth::user()->role_id == 1 && Auth::user()->email == 'admin@gmail.com') <th>Action</th> @endif </tr> </thead> <tbody> @foreach($inventories as $invntry=>$inventorie) <tr> <td>{{$invntry+1}}</td> <td>{{$inventorie->product_companies_name}}</td> <td>{{$inventorie->warehouse_name}}</td> <td>{{$inventorie->brand_name}}</td> <td>{{$inventorie->product_name}}</td> <td>{{$inventorie->units}}</td> <td>{{$inventorie->quantity}}</td> <td>{{$inventorie->damage_qty}}</td> @if(Auth::check() && Auth::user()->role_id == 1 && Auth::user()->email == 'admin@gmail.com') <td> <div class="btn-group"> <a class="btn btn-xs btn-info" onclick="getEdit({{ $inventorie->id }})"><i class="ace-icon fa fa-pencil bigger-120"></i></a> </div> </td> @endif </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div> </div> <!-- Add Warehouse stock Modal --> <div class="modal fade" id="addWarehouseStockModal"> <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 Warehouse Stock</h4> </div> <div class="modal-body"> <form action="" role="form" id="addWarehouseStockForm"> @csrf <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="name">Warehouse List</label> <select class="form-control select2" name="warehouse_id" id="warehouse_id"> <option value="">Select Warehouse List</option> @foreach($warehouses as $key=> $warehosue) <option value="{{$warehosue->id}}">{{$warehosue->name}}</option> @endforeach </select> <span class="label label-danger" id="add_warehouse_ist_error" style="display: none;"></span> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="name">Product Company</label> <select class="form-control select2" name="product_company_id" id="product_company_id1"> <option value="">Select Product Company</option> <option value="1">HeidelbergCement India Limited</option> </select> <span class="label label-danger" id="add_product_company_error" style="display: none;"></span> </div> </div> <div class="clearfix"></div> <div class="col-md-6"> <div class="form-group"> <label for="name">Date</label> <input type="date" class="form-control date-picker" name="date" id="date" placeholder="Date" > <span class="label label-danger" id="add_date_error" style="display: none;"></span> </div> </div> </div> <div class="row"> <div class="col-md-5"> <div class="form-group"> <label for="proruct">Product</label> <select class="form-control select2 checkIfValid" name="product_id[]" id="product_id"> <option value="">Select Product</option> @foreach($products as $key=> $product) <option value="{{$product->id}}" id="product_{{$product->id}}">{{$product->name}}</option> @endforeach </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="fresh_qty[]" placeholder="Fresh Quantity"> <span class="label label-danger" id="add_quantity_error" style="display: none;"></span> </div> </div> <div class="col-md-3"> <div class="form-group"> <label for="rate">Damage Quantity</label> <input type="text" class="form-control checkIfValid" name="damage_qty[]" placeholder="Damage Quantity"> <span class="label label-danger" id="add_quantity_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="addMasterRakeBtn" class="btn btn-primary">Submit</button> --> <input type="submit" value="submit" class="btn btn-primary" id="openingStockBtn"> </div> </form> </div> </div> </div> <!-- Add Warehouse stock Modal --> <!-- Edit Session Modal --> <div class="modal fade" id="editInventoryModal"> <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 Warehouse Stock</h4> </div> <div class="modal-body" id="EditBody"> </div> </div> </div> </div> <!-- Edit Session 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")}} <script type="text/javascript"> $('#filter').click(function(){ var warehouse_name = $('#warehouse_name').val(); if(dealer_id !='') { $('#dynamic-table').DataTable().destroy(); display(warehouse_name); }else if(warehouse_name!=''){ $('#dynamic-table').DataTable().destroy(); display(warehouse_name); }else{ alert('Warehouse is required'); } }); jQuery(function($) { $('#openingStockBtn').click(function(e){ e.preventDefault(); var data = $('#addWarehouseStockForm').serialize(); $.ajax({ url: "{{url('/stock/add-opening-balance')}}", type: 'POST', data: data, success:function(data){ if(data.flag){ swal({ title: "Success!", text: data.message, type: "success" }, function() { window.location.reload(); }); }else{ console.log(data.message); swal({ title: "Error", text: data.message, type: "error" }, function() { window.location.reload(); }); } } }); }); //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: true, message: 'IManager', exportOptions: { columns: ':visible' } } ] } ); }) 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-5"> <div class="form-group"> <label for="product">Product</label> <select class="form-control select2 checkIfValid" name="product_id[]" id="product_id"> <option value="">Select Product</option> @foreach($products as $key=> $product) <option value="{{$product->id}}" id="product_{{$product->id}}">{{$product->name}}</option> @endforeach </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="fresh_qty[]" placeholder="Fresh Quantity"> <span class="label label-danger" id="add_quantity_error" style="display: none;"></span> </div> </div> <div class="col-md-3"> <div class="form-group"> <label for="rate">Damage Quantity</label> <input type="text" class="form-control checkIfValid" name="damage_qty[]" placeholder="Damage Quantity"> <span class="label label-danger" id="add_quantity_error" style="display: none;"></span> </div> </div> <div class="col-md-1" style="margin-top: 33px;"> <a href="javascript:;" onclick="removeRow(`+count+`)"><i class="fa fa-close fa-2x"></i></a> </div> </div> `; $('#addMoreRowSection').append(newRow); $('.select2').select2(); }); function getEdit(id){ if(id == ""){ swal('Error','Inventory id is missing','warning'); }else{ $.ajax({ url: "{{url('/user/edit-stock/')}}"+"/"+id, type: 'GET', success:function(data){ $('#EditBody').html(data); $('#editInventoryModal').modal('toggle'); } }); } } $(document).on('submit', '#editInventoryModal form', function (e) { e.preventDefault(); // Prevent default form submission var form = this; // Use `this` directly as it refers to the form var formData = new FormData(form); // Pass the form element to FormData $.ajax({ url: "{{ url('/user/edit-inventory') }}", type: 'POST', data: formData, processData: false, // Prevent jQuery from processing the data contentType: false, // Prevent jQuery from setting the content type success: function (response) { if (response.flag) { swal({ title: "Success!", text: response.message, type: "success" }, function () { window.location.reload(); }); } else { swal({ title: "Error", text: response.message, type: "error" }); } }, error: function (xhr) { swal({ title: "Error", text: "An error occurred while updating the inventory.", type: "error" }); } }); }); </script> @endsection @endsection