StocksNew/Modules/Order/resources/views/order/partials/action.blade.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

207 lines
6.8 KiB
PHP

<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('Customer')->class('form-label') }}
{{ html()->select('customer_id', $customerList)->class('form-control')->placeholder('Select Customer')->required() }}
{{ html()->div('Please select customer')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Order No.')->class('form-label') }}
{{ html()->text('order_code')->class('form-control')->placeholder('Enter Order No')->attributes(['id' => 'cleave-prefix']) }}
</div>
<div class="col-md-4">
{{ html()->label('VAT No.')->class('form-label') }}
{{ html()->text('vat_no')->class('form-control')->placeholder('Enter VAT No') }}
</div>
<div class="col-md-4">
{{ html()->label('Order Date')->class('form-label') }}
{{ html()->date('order_date')->class('form-control')->placeholder('Choose Order Date')->required() }}
{{ html()->div('Please choose order date')->class('invalid-feedback') }}
</div>
<div class="col-md-4">
{{ html()->label('Delivery Date')->class('form-label') }}
{{ html()->date('delivery_date')->class('form-control')->placeholder('Choose Bill Issue Date')->required() }}
{{ html()->div('Please choose order date')->class('invalid-feedback') }}
</div>
</div>
<div class="row gy-1 my-2">
<h5 class="text-primary text-center">Buyer Details</h5>
<div class="border border-dashed"></div>
<div class="col-md-4">
{{ html()->label('Buyer')->class('form-label') }}
{{ html()->select('buyer_id', $supplierList)->class('form-control')->placeholder('Select Buyer') }}
</div>
<div class="col-md-4">
{{ html()->label('Address No.')->class('form-label') }}
{{ html()->text('buyer_address')->class('form-control')->placeholder('Enter Address') }}
</div>
<div class="col-md-4">
{{ html()->label('VAT No.')->class('form-label') }}
{{ html()->text('vat_no')->class('form-control')->placeholder('Enter Buyer VAT No') }}
</div>
<div class="col-md-4">
{{ html()->label('Sales Date')->class('form-label') }}
{{ html()->date('sales_date')->class('form-control')->placeholder('Enter Sales Date') }}
</div>
<div class="col-md-4">
{{ html()->label('Mode of Payment')->class('form-label') }}
{{ html()->select('buyer_id', [1 => 'Cash', 2 => 'Bank', 3 => 'Credit'])->class('form-control')->placeholder('Select Payment Mode') }}
</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>
@include('order::order.clone-product')
<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="discoumt_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="mb-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 = $('.product-card').length
$.ajax({
type: 'get',
url: '{{ route('cloneProduct') }}',
data: {
numberInc: numberInc
},
success: function(response) {
$('.appendProductCard').append(response.view)
// $('#order-container').html(response.view).fadeIn()
},
error: function(xhr) {
},
});
});
$("body").on('click', '.btn-remove', function() {
if ($('.product-card').length > 1) {
$(this).parents(".product-card").remove();
}
recalculate();
});
function amountKeyup() {
$("body").on('keyup', '.product-price', function() {
var priceInput = $(this);
var qtyInput = priceInput.closest(".row").find(".product-quantity");
var linePrice = priceInput.closest(".row").find(".product-line-price");
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
});
$("body").on('keyup', '.product-quantity', function() {
var priceInput = $(this);
var qtyInput = priceInput.closest(".row").find(".product-price");
var linePrice = priceInput.closest(".row").find(".product-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;
$(".product-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(total.toFixed(2));
// $("#totalamountInput").val(total.toFixed(2));
// $("#amountTotalPay").val(total.toFixed(2));
}
</script>
@endpush