restaurant changes

This commit is contained in:
Sampanna Rimal
2024-09-19 18:33:08 +05:45
parent 0b438e302d
commit 2fa9d47a73
115 changed files with 3489 additions and 67 deletions

View File

@ -0,0 +1,76 @@
<div class="card card-body ingredient-card card-border-secondary mb-2 border">
<div class="row gy-2 mb-2">
<div class="col-md-2">
{{ html()->label('Category')->class('form-label') }}
@if (isset($editable) && $editable)
{{ html()->select('ingredient_category_id[]', $ingredientCategoryList, $item->ingredient_category_id)->class('form-select ingredient_category_id')->attributes(['id' => 'ingredient_category_id'])->placeholder('Enter Category')->required() }}
@else
{{ html()->select('ingredient_category_id[]', $ingredientCategoryList)->class('form-select ingredient_category_id')->attributes(['id' => 'ingredient_category_id'])->placeholder('Enter Category')->required() }}
@endif
</div>
<div class="col-md-3">
{{ html()->label('Ingredient')->class('form-label') }}
@if (isset($editable) && $editable)
{{ html()->select('ingredient_id[]', $ingredientList, $item->ingredient_id)->class('form-select ingredient_id')->attributes(['id' => 'ingredient_id'])->placeholder('')->required() }}
@else
{{ html()->select('ingredient_id[]', [], null)->class('form-select ingredient_id')->attributes(['id' => 'ingredient_id'])->placeholder('')->required()->disabled() }}
@endif
</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('Price')->class('form-label') }}
{{ html()->text('price[]', isset($editable) && $editable ? $item->price : null)->class('form-control ingredient-price cleave-numeral rate~~')->placeholder('Price')->attributes(['id' => 'rate', 'onkeyup' => 'validatePriceInput(this)']) }}
</div>
<div class="col-md-2">
{{ html()->label('Unit')->class('form-label') }}
@if (isset($editable) && $editable)
{{ html()->select('unit_id[]', $unitList, $item->unit_id)->class('form-select unit_id')->attributes(['id' => 'unit_id'])->placeholder('')->required() }}
@else
{{ html()->select('unit_id[]', $unitList)->class('form-select unit_id')->attributes(['id' => 'unit_id'])->placeholder('')->required() }}
@endif
</div>
{{-- <div class="col-md-2">
{{ html()->label('Unit')->class('form-label') }}
{{ html()->text('unit[]', isset($editable) && $editable ? $item->unit : null)->class('form-control ingredient-unit cleave-numeral rate~~')->placeholder('Enter Unit')->required()}}
</div> --}}
<div class="col-md-1">
{{ html()->label('Quantity')->class('form-label') }}
{{ html()->text('qty[]', isset($editable) && $editable ? $item->quantity : null)->class('form-control ingredient-quantity cleave-numeral qty')->placeholder('QTY')->attributes(['id' => 'qty', 'onkeyup' => 'validateNumericInput(this)']) }}
</div>
<div class="col-md-2">
{{ html()->label('Amount')->class('form-label') }}
{{ html()->text('amt[]', isset($editable) && $editable ? $item->amount : null)->class('form-control ingredient-line-price bg-light')->placeholder('Enter Amount')->isReadOnly() }}
</div>
<div class="col-md-6">
{{ html()->label('Description')->class('form-label') }}
{{ html()->text('desc[]', isset($editable) && $editable ? $item->desc : null)->class('form-control')->placeholder('Enter Description') }}
</div>
<div class="col-md-6 d-flex justify-content-end align-items-end">
<button type="button" class="btn btn-danger btn-icon waves-effect btn-remove waves-light"><i
class="ri-delete-bin-5-line"></i></button>
</div>
</div>
</div>

View File

@ -0,0 +1,27 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
@include('layouts.partials.breadcrumb', ['title' => $title])
<!-- end page title -->
<div class="card">
<div class="card-body">
<form action="{{ route('purchaseEntry.store') }}" class="needs-validation" novalidate method="post">
@csrf
@include('purchaseEntry::purchaseEntry.partials.action')
</form>
</div>
</div>
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,47 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box d-sm-flex align-items-center justify-content-between">
<h4 class="mb-sm-0">{{ $title }}</h4>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Dashboards</a></li>
<li class="breadcrumb-item active">{{ $title }}</li>
</ol>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
{{ html()->modelForm($order, 'PUT')->route('order.update', $id)->class(['needs-validation'])->attributes(['novalidate'])->open() }}
@include('order::order.partials.action')
{{ html()->closeModelForm() }}
</div>
</div>
</div>
</div>
<!--end row-->
</div>
<!-- container-fluid -->
</div>
@endsection
@push('js')
<script src="{{ asset('assets/js/pages/form-validation.init.js') }}"></script>
@endpush

View File

@ -0,0 +1,71 @@
@extends('layouts.app')
@section('content')
<div class="page-content">
<div class="container-fluid">
@include('purchaseEntry::purchaseEntry.partials.menu')
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header align-items-center d-flex">
<h5 class="card-title flex-grow-1 mb-0">{{ $title }}</h5>
<div class="flex-shrink-0">
<a href="{{ route('purchaseEntry.create') }}" class="btn btn-success waves-effect waves-light"><i
class="ri-add-fill me-1 align-bottom"></i> Add</a>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="buttons-datatables" class="display table-sm table-bordered table"
style="width:100%">
<thead>
<tr>
<th>S.N</th>
<th>Supplier</th>
<th>Purchase Date</th>
<th>Total Amount</th>
{{-- <th>Action</th> --}}
</tr>
</thead>
<tbody>
@forelse ($purchaseEntries as $key => $item)
{{-- @dd($item) --}}
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $item->supplier->supplier_name }}</td>
<td>{{ $item->purchase_date }}</td>
<td>{{ $item->total_amt }}</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-link="{{ route('purchaseEntry.show', $item->id) }}">
<i class="ri-eye-line"></i>
</a>
<a href="{{ route('purchaseEntry.edit', $item->id) }}"
class="link-success fs-15 edit-item-btn"><i
class="ri-edit-2-line"></i></a>
<a href="javascript:void(0);"
data-link="{{ route('purchaseEntry.destroy', $item->id) }}"
data-id="{{ $item->id }}"
class="link-danger fs-15 remove-item-btn"><i
class="ri-delete-bin-line"></i></a>
</div>
</td> --}}
</tr>
@empty
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--end row-->
</div>
</div>
@endsection

View File

@ -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

View File

@ -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>