restaurant changes
This commit is contained in:
@ -0,0 +1,271 @@
|
||||
<div class="row gy-1">
|
||||
<h5 class="text-primary text-center">Order Details</h5>
|
||||
<div class="border border-dashed"></div>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Purchase Date')->class('form-label') }}
|
||||
{{ html()->date('purchase_date')->class('form-control')->placeholder('Choose Purchase Date')->required() }}
|
||||
{{ html()->div('Please choose Purchase date')->class('invalid-feedback') }}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{{ html()->label('Supplier')->class('form-label') }}
|
||||
{{ html()->select('supplier_id', $supplierList)->class('form-control')->placeholder('Select Supplier')->required() }}
|
||||
{{ html()->div('Please select supplier')->class('invalid-feedback') }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{{-- <div class="row mt-2">
|
||||
<p class="text-primary">Shipping Details</p>
|
||||
<div class="border border-dashed"></div>
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Address')->class('form-label') }}
|
||||
{{ html()->text('address')->class('form-control')->placeholder('Enter Address') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Shipping Date')->class('form-label') }}
|
||||
{{ html()->date('shiiping_date')->class('form-control')->placeholder('Enter Temporary Address') }}
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="row gy-1 gx-2 mt-1">
|
||||
<div class="d-flex justify-content-end">
|
||||
<button type="button" class="btn btn-info btn-icon add-btn text-end"><i class="ri-add-line"></i></button>
|
||||
</div>
|
||||
@if ($editable && $purchaseEntry->purchaseEntryDetail->isNotEmpty())
|
||||
@foreach ($purchaseEntry->purchaseEntryDetail as $item)
|
||||
@include('purchaseEntry::purchaseEntry.clone-ingredient')
|
||||
@endforeach
|
||||
@else
|
||||
@include('purchaseEntry::purchaseEntry.clone-ingredient')
|
||||
@endif
|
||||
<div class="appendProductCard"></div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end w-30 mb-2">
|
||||
<table class="table-borderless align-middle">
|
||||
<tbody>
|
||||
{{-- <tr>
|
||||
<th scope="row">Sub Total</th>
|
||||
<td style="width:150px;">
|
||||
<input type="text" name="sub_total" class="form-control bg-light border-0" id="subtotal"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Estimated Tax (11%)</th>
|
||||
<td>
|
||||
<input type="text" name="tax" class="form-control bg-light border-0" id="tax"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Discount</th>
|
||||
<td>
|
||||
<input type="text" name="discount_amt" class="form-control bg-light border-0" id="discount"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr> --}}
|
||||
<tr class="border-top border-top-dashed">
|
||||
<th scope="row">Total Amount</th>
|
||||
<td>
|
||||
<input type="text" name="total_amt" class="form-control bg-light border-0" id="total"
|
||||
placeholder="$0.00" readonly="">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row gy-1 my-2 mb-4">
|
||||
<h5 class="text-primary text-center">Payment Details</h5>
|
||||
<div class="border border-dashed"></div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Payment')->class('form-label') }}
|
||||
{{ html()->text('payment')->class('form-control')->placeholder('Enter Payment') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Mode of Payment')->class('form-label') }}
|
||||
{{ html()->select('paymentmode_id', $paymentModes)->class('form-select select2')->placeholder('Select Payment Mode') }}
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
{{ html()->label('Payment Reference')->class('form-label') }}
|
||||
{{ html()->text('paymentref')->class('form-control')->placeholder('Enter Payment Reference') }}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-4 mt-4 text-end">
|
||||
<button type="submit" class="btn btn-success w-sm">Save</button>
|
||||
</div>
|
||||
|
||||
|
||||
@push('js')
|
||||
<script src="{{ asset('assets/libs/cleave.js/cleave.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/js/pages/form-masks.init.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$("body").on('click', '.add-btn', function(e) {
|
||||
e.preventDefault();
|
||||
numberInc = $('.ingredient-card').length
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{ route('purchaseEntry.clonePurchaseProduct') }}',
|
||||
data: {
|
||||
numberInc: numberInc
|
||||
},
|
||||
success: function(response) {
|
||||
$('.appendProductCard').append(response.view)
|
||||
// $('#purchaseEntry-container').html(response.view).fadeIn()
|
||||
},
|
||||
error: function(xhr) {
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '.btn-remove', function() {0
|
||||
if ($('.ingredient-card').length > 1) {
|
||||
$(this).parents(".ingredient-card").remove();
|
||||
}
|
||||
recalculate();
|
||||
});
|
||||
|
||||
$(window).on('load', function() {
|
||||
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', '.ingredient-price', function() {
|
||||
var priceInput = $(this);
|
||||
var qtyInput = priceInput.closest(".row").find(".ingredient-quantity");
|
||||
var linePrice = priceInput.closest(".row").find(".ingredient-line-price");
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
});
|
||||
|
||||
$("body").on('keyup', '.ingredient-quantity', function() {
|
||||
var priceInput = $(this);
|
||||
var qtyInput = priceInput.closest(".row").find(".ingredient-price");
|
||||
var linePrice = priceInput.closest(".row").find(".ingredient-line-price");
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
});
|
||||
}
|
||||
|
||||
amountKeyup()
|
||||
|
||||
function updateQuantity(rate, qty, linePriceInput) {
|
||||
var amount = (rate * qty).toFixed(2);
|
||||
linePriceInput.val(amount);
|
||||
recalculate();
|
||||
}
|
||||
|
||||
function recalculate() {
|
||||
var subtotal = 0;
|
||||
$(".ingredient-line-price").each(function() {
|
||||
if ($(this).val()) {
|
||||
subtotal += parseFloat($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
// var tax = subtotal * 0.125;
|
||||
// var discount = subtotal * 0.15;
|
||||
// var shipping = subtotal > 0 ? 65 : 0;
|
||||
// var total = subtotal + tax + shipping - discount;
|
||||
|
||||
// $("#subtotal").val(subtotal.toFixed(2));
|
||||
// $("#tax").val(tax.toFixed(2));
|
||||
// $("#discount").val(discount.toFixed(2));
|
||||
// $("#shipping").val(shipping.toFixed(2));
|
||||
$("#total").val(subtotal.toFixed(2));
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.ingredient_id').prop('disabled', true);
|
||||
// $('.stock_id').prop('disabled', true);
|
||||
$('body').on('change', '.ingredient_id', function() {
|
||||
var selectedId = $(this).find(':selected').val();
|
||||
var formRow = $(this).closest('.row');
|
||||
|
||||
if (selectedId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('get-ingredient-detail') }}',
|
||||
data: {
|
||||
id: selectedId
|
||||
},
|
||||
success: function(response) {
|
||||
var qtyInput = formRow.find('#qty').val(response.data.qty);
|
||||
formRow.find('#unit').val(response.data.unit);
|
||||
var priceInput = formRow.find('#rate').val(response.data.price);
|
||||
var linePrice = priceInput.closest(".row").find(".ingredient-line-price");
|
||||
|
||||
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
},
|
||||
error: function(xhr) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// When category is selected, load ingredients dynamically
|
||||
$('body').on('change', '.ingredient_category_id', function () {
|
||||
var ingredientCategoryId = $(this).val();
|
||||
var formRow = $(this).closest('.row');
|
||||
var ingredientSelect = formRow.find('.ingredient_id');
|
||||
// var stockSelect = formRow.find('.stock_id');
|
||||
|
||||
// Reset stock field
|
||||
|
||||
if (ingredientCategoryId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('ingredients-by-category') }}', // Route to get ingredients by category
|
||||
data: {ingredient_category_id:ingredientCategoryId},
|
||||
success: function (response) {
|
||||
ingredientSelect.empty().append('<option value="">Select Product</option>');
|
||||
ingredientSelect.prop('disabled', false);
|
||||
|
||||
$.each(response.ingredients, function (id, name) {
|
||||
ingredientSelect.append('<option value="' + id + '">' + name + '</option>');
|
||||
});
|
||||
},
|
||||
error: function (xhr) {
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
// stockSelect.empty().prop('disabled', true);
|
||||
|
||||
} else {
|
||||
ingredientSelect.prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function validateNumericInput(input) {
|
||||
// Allow only numbers and remove any non-numeric input
|
||||
input.value = input.value.replace(/[^0-9.]/g, '');
|
||||
input.value = input.value.replace(/(\..*)\./g, '$1');
|
||||
input.value = input.value.replace(/^(\d+)(\.\d{0,2})?.*/, '$1$2');
|
||||
}
|
||||
</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('purchaseEntry.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('ingredient_category_id', $ingredientCategoryList)->class('form-control select2')->value(request('ingredient_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('ingredient_id', $ingredientList)->class('form-control select2')->value(request('ingredient_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('purchaseEntry.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