salesentry filters
This commit is contained in:
@ -1,30 +1,45 @@
|
||||
<div class="card card-body product-card card-border-secondary mb-2 border">
|
||||
<div class="row gy-2 mb-2">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Category')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('category_id[]', $categoryList, $item->category_id)->class('form-select category_id')->attributes(['id' => 'category_id'])->placeholder('Enter Category')->required() }}
|
||||
@else
|
||||
{{ html()->select('category_id[]', $categoryList)->class('form-select category_id')->attributes(['id' => 'category_id'])->placeholder('Enter Category')->required() }}
|
||||
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{{ html()->label('Product')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('product_id[]', $productList, $item->product_id)->class('form-select product_id')->attributes(['id' => 'product_id'])->placeholder('Enter Product Name')->required() }}
|
||||
{{ html()->select('product_id[]', $productList, $item->product_id)->class('form-select product_id')->attributes(['id' => 'product_id'])->placeholder('')->required() }}
|
||||
@else
|
||||
{{ html()->select('product_id[]', [], null)->class('form-select product_id')->attributes(['id' => 'product_id'])->placeholder('')->required()->disabled() }}
|
||||
|
||||
@endif
|
||||
{{ html()->select('product_id[]', $productList)->class('form-select product_id')->attributes(['id' => 'product_id'])->placeholder('Enter Product Name')->required() }}
|
||||
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Stock')->class('form-label') }}
|
||||
@if (isset($editable) && $editable)
|
||||
{{ html()->select('stock_id[]', $stockList, $item->stock_id)->class('form-select stock_id')->attributes(['id' => 'stock_id'])->placeholder('')->required() }}
|
||||
@else
|
||||
{{ html()->select('stock_id[]', $stockList)->class('form-select stock_id')->attributes(['id' => 'stock_id'])->placeholder('')->required()->disabled() }}
|
||||
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ html()->label('Size')->class('form-label') }}
|
||||
{{ html()->select('size_id[]', $sizes)->class('form-select ')->placeholder('size') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
{{ html()->label('Unit')->class('form-label') }}
|
||||
{{ html()->text('unit[]', isset($editable) && $editable ? $item->unit : null)->class('form-control unit')->placeholder('Enter Unit')->required()->attributes(['id' => 'unit']) }}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-1">
|
||||
{{ html()->label('Rate')->class('form-label') }}
|
||||
{{ html()->text('rate[]', isset($editable) && $editable ? $item->rate : null)->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Rate')->attributes(['id' => 'rate']) }}
|
||||
{{ html()->text('rate[]', isset($editable) && $editable ? $item->rate : null)->class('form-control product-price cleave-numeral rate~~')->placeholder('Enter Rate')->attributes(['id' => 'rate', 'onkeyup' => 'validateNumericInput(this)']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="col-md-1">
|
||||
{{ html()->label('Quantity')->class('form-label') }}
|
||||
{{ html()->text('qty[]', isset($editable) && $editable ? $item->quantity : null)->class('form-control product-quantity cleave-numeral qty')->placeholder('Enter QTY')->attributes(['id' => 'qty']) }}
|
||||
{{ html()->text('qty[]', isset($editable) && $editable ? $item->quantity : null)->class('form-control product-quantity cleave-numeral qty')->placeholder('Enter QTY')->attributes(['id' => 'qty', 'onkeyup' => 'validateNumericInput(this)']) }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
|
@ -1,8 +1,9 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<div class="page-content">
|
||||
<div class="container-fluid">
|
||||
@include('salesEntry::salesEntry.partials.menu')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
@ -24,20 +25,22 @@
|
||||
<th>Customer</th>
|
||||
<th>Sales Date</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Action</th>
|
||||
{{-- <th>Action</th> --}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($salesEntries as $key => $item)
|
||||
{{-- @dd($item) --}}
|
||||
<tr>
|
||||
<td>{{ $key + 1 }}</td>
|
||||
<td>{{ $item->customer->customer_name }}</td>
|
||||
<td>{{ $item->sales_date }}</td>
|
||||
<td>{{ $item->total_amt }}</td>
|
||||
<td>
|
||||
{{-- <td>
|
||||
<div class="hstack flex-wrap gap-3">
|
||||
<a href="javascript:void(0);" class="link-info fs-15 view-item-btn"
|
||||
data-bs-toggle="modal" data-bs-target="#viewModal">
|
||||
data-bs-toggle="modal" data-bs-target="#viewModal" data-link="{{ route('salesEntry.show', $item->id) }}">
|
||||
|
||||
<i class="ri-eye-line"></i>
|
||||
</a>
|
||||
<a href="{{ route('salesEntry.edit', $item->id) }}"
|
||||
@ -51,7 +54,7 @@
|
||||
class="ri-delete-bin-line"></i></a>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</td> --}}
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
|
@ -80,7 +80,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 my-2">
|
||||
<div class="row gy-1 my-2 mb-4">
|
||||
<h5 class="text-primary text-center">Payment Details</h5>
|
||||
<div class="border border-dashed"></div>
|
||||
|
||||
@ -102,7 +102,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-4 text-end">
|
||||
<div class="mb-4 mt-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
|
||||
@ -117,12 +117,11 @@
|
||||
numberInc = $('.product-card').length
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{ url('clone-sales-product') }}',
|
||||
|
||||
url: '{{ route('salesEntry.cloneSalesProduct') }}',
|
||||
data: {
|
||||
numberInc: numberInc
|
||||
},
|
||||
success: function(response) {
|
||||
success: function(response) {
|
||||
$('.appendProductCard').append(response.view)
|
||||
// $('#salesEntry-container').html(response.view).fadeIn()
|
||||
},
|
||||
@ -143,6 +142,11 @@
|
||||
recalculate();
|
||||
})
|
||||
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9]/g, '');
|
||||
}
|
||||
|
||||
|
||||
function amountKeyup() {
|
||||
$("body").on('keyup', '.product-price', function() {
|
||||
@ -187,8 +191,10 @@
|
||||
// $("#shipping").val(shipping.toFixed(2));
|
||||
$("#total").val(subtotal.toFixed(2));
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.product_id').prop('disabled', true);
|
||||
$('.stock_id').prop('disabled', true);
|
||||
$('body').on('change', '.product_id', function() {
|
||||
var selectedId = $(this).find(':selected').val();
|
||||
var formRow = $(this).closest('.row');
|
||||
@ -214,6 +220,72 @@
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// When category is selected, load products dynamically
|
||||
$('body').on('change', '.category_id', function () {
|
||||
var categoryId = $(this).val();
|
||||
var formRow = $(this).closest('.row');
|
||||
var productSelect = formRow.find('.product_id');
|
||||
var stockSelect = formRow.find('.stock_id');
|
||||
|
||||
// Reset stock field
|
||||
|
||||
if (categoryId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('products-by-category') }}', // Route to get products by category
|
||||
data: {category_id:categoryId},
|
||||
success: function (response) {
|
||||
productSelect.empty().append('<option value="">Select Product</option>');
|
||||
productSelect.prop('disabled', false);
|
||||
|
||||
$.each(response.products, function (id, name) {
|
||||
productSelect.append('<option value="' + id + '">' + name + '</option>');
|
||||
});
|
||||
},
|
||||
error: function (xhr) {
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
stockSelect.empty().prop('disabled', true);
|
||||
|
||||
} else {
|
||||
productSelect.prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
// When product is selected, load stocks dynamically
|
||||
$('body').on('change', '.product_id', function () {
|
||||
var productId = $(this).val();
|
||||
var formRow = $(this).closest('.row');
|
||||
var productSelect = formRow.find('.product_id');
|
||||
var stockSelect = formRow.find('.stock_id');
|
||||
|
||||
|
||||
if (productId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('stocks-by-product') }}', // Route to get stocks by product
|
||||
data: {product_id:productId},
|
||||
success: function (response) {
|
||||
stockSelect.empty().append('<option value="">Select Stock</option>');
|
||||
stockSelect.prop('disabled', false);
|
||||
|
||||
$.each(response.stocks, function (id, title) {
|
||||
stockSelect.append('<option value="' + id + '">' + title + '</option>');
|
||||
});
|
||||
},
|
||||
error: function (xhr) {
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
} else {
|
||||
stockSelect.prop('disabled', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
|
@ -0,0 +1,74 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row g-2">
|
||||
<div class="col-sm-12">
|
||||
{{ html()->form('GET')->route('salesEntry.index')->open() }}
|
||||
<div class="row g-8">
|
||||
{{-- <div class="col-xl-3">
|
||||
<div class="search-box">
|
||||
{{ html()->text('search')->class('form-control search')->value(request('search'))->placeholder('Search...') }}
|
||||
<i class="ri-search-line search-icon"></i>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="">
|
||||
{{ html()->text('date')->class('form-control')->value(request('date'))->placeholder('Date Range')->attributes([
|
||||
'id' => 'datepicker-range',
|
||||
'data-provider' => 'flatpickr',
|
||||
'data-date-format' => 'Y-m-d',
|
||||
'data-range-date' => 'true',
|
||||
]) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<div class="search-box">
|
||||
{{ html()->select('category_id', $categoryList)->class('form-control select2')->value(request('category_id'))->placeholder('By Category') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="search-box">
|
||||
{{ html()->select('stock_id', $stockList)->class('form-control select2')->value(request('stock_id'))->placeholder('By Stock') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="search-box">
|
||||
{{ html()->select('product_id', $productList)->class('form-control select2')->value(request('product_id'))->placeholder('By Product') }}
|
||||
</div>
|
||||
</div>
|
||||
<!--end col-->
|
||||
{{-- <div class="align-item-right"> --}}
|
||||
<div class="col-sm-1 offset-lg-1">
|
||||
<div>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i class="ri-equalizer-fill me-2"></i>Filters</button>
|
||||
{{-- <a href="{{ route('task.index') }}" class="btn btn-danger">
|
||||
<i class="ri-bin-fill me-2"></i>Reset</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<div>
|
||||
<a href="{{ route('salesEntry.index') }}" class="btn btn-primary">
|
||||
<i class="ri-loop-right-line me-2"></i>Reset</a>
|
||||
{{-- <a href="{{ route('task.index') }}" class="btn btn-danger">
|
||||
<i class="ri-bin-fill me-2"></i>Reset</a> --}}
|
||||
</div>
|
||||
</div>
|
||||
{{-- </div> --}}
|
||||
<!--end col-->
|
||||
</div>
|
||||
<!--end row-->
|
||||
{{ html()->form()->close() }}
|
||||
|
||||
</div>
|
||||
<!--end col-->
|
||||
|
||||
</div>
|
||||
<!--end row-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user