photo remaining
This commit is contained in:
@ -142,9 +142,9 @@
|
||||
<tbody class="purchase-details-section">
|
||||
<tr class="purchase-detail">
|
||||
<td class="text-center bbsn">1</td>
|
||||
<td width=40%> <?php fillComboWithValue("item_id[]", "", "", "tbl_items", "title", "item_id"); ?></td>
|
||||
<td width=40%> <?php fillComboWithValue("item_id[]", "", "", "tbl_items", "title", "item_id", "", "select_item"); ?></td>
|
||||
<td width=10%> <input type="text" class="form-control input-group-sm" name="quantity[]"></td>
|
||||
<td width=5%><input type="text" class="form-control" name="pcs/dozen/kgs" required> </td>
|
||||
<td width=5%><input type="text" class="form-control item_unit" name="pcs/dozen/kgs" required> </td>
|
||||
<td width=15%><input type="text" class="form-control" name="rate[]"></td>
|
||||
<td width=15%><input type="text" class="form-control" name="total[]"></td>
|
||||
<td width="5%">
|
||||
@ -331,6 +331,33 @@
|
||||
var newPurchaseDetail = purchaseDetailClone.clone();
|
||||
$(".purchase-details-section").append(newPurchaseDetail);
|
||||
});
|
||||
|
||||
$(document).on('change', '.select_item', function(){
|
||||
|
||||
var selectedOption = $(this).find(':selected');
|
||||
var selectedValue = selectedOption.val();
|
||||
var unitInput = $(this).closest('.purchase-detail').find('.item_unit');
|
||||
if (selectedValue) {
|
||||
$.ajax({
|
||||
url: "<?php echo site_url("inventory/Purchases/getunitbyitem/"); ?>" + selectedValue,
|
||||
async: true,
|
||||
dataType:"json",
|
||||
method: 'POST',
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
var unitName = response.title;
|
||||
unitInput.val(unitName);
|
||||
},
|
||||
error: function() {
|
||||
console.log(error);
|
||||
alert("Error retrieving unit data.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
unitInput.val('');
|
||||
alert("No item selected.");
|
||||
}
|
||||
});
|
||||
// Remove Purchase Detail
|
||||
$(document).on("click", ".remove-purchase-detail", function() {
|
||||
$(this).closest(".purchase-detail").remove();
|
||||
|
Reference in New Issue
Block a user