changes
This commit is contained in:
@ -0,0 +1,219 @@
|
||||
<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('Sales Date')->class('form-label') }}
|
||||
{{ html()->date('sales_date')->class('form-control')->placeholder('Choose Sales Date')->required() }}
|
||||
{{ html()->div('Please choose Sales date')->class('invalid-feedback') }}
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
{{ 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>
|
||||
|
||||
|
||||
|
||||
{{-- <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 && $salesEntry->salesEntryDetail->isNotEmpty())
|
||||
@foreach ($salesEntry->salesEntryDetail as $item)
|
||||
@include('salesEntry::salesEntry.clone-product')
|
||||
@endforeach
|
||||
@else
|
||||
@include('salesEntry::salesEntry.clone-product')
|
||||
@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">
|
||||
<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 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: '{{ url('clone-sales-product') }}',
|
||||
|
||||
data: {
|
||||
numberInc: numberInc
|
||||
},
|
||||
success: function(response) {
|
||||
$('.appendProductCard').append(response.view)
|
||||
// $('#salesEntry-container').html(response.view).fadeIn()
|
||||
},
|
||||
error: function(xhr) {
|
||||
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$("body").on('click', '.btn-remove', function() {0
|
||||
if ($('.product-card').length > 1) {
|
||||
$(this).parents(".product-card").remove();
|
||||
}
|
||||
recalculate();
|
||||
});
|
||||
|
||||
$(window).on('load', function() {
|
||||
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(subtotal.toFixed(2));
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('body').on('change', '.product_id', function() {
|
||||
var selectedId = $(this).find(':selected').val();
|
||||
var formRow = $(this).closest('.row');
|
||||
|
||||
if (selectedId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '{{ route('get-product-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(".product-line-price");
|
||||
|
||||
|
||||
updateQuantity(priceInput.val(), qtyInput.val(), linePrice);
|
||||
},
|
||||
error: function(xhr) {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
Reference in New Issue
Block a user