NonInventPurchasingSystem/CPRNIMS.WebApps/Views/Shared/PagesView/PO/_OtherCharges.cshtml

81 lines
3.2 KiB
Plaintext

<div class="col-6">
<div class="form-group">
<div style="background-color: teal; color: white; border-radius: 5px;">
<h5 class="modal-title">List of Charges</h5>
</div>
<div class="table-dest-container">
<table id="DestChargesTable" class="row-border" style="width: 100%;">
<thead style="background-color: teal; color: white; font-size: .8rem;">
<tr>
<th style="display: none;">otherChargesId</th>
<th style="width:80%;">ChargeName</th>
<th style="width:12%;">Amount</th>
<th style="width:8%;">Action</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="charges-right-align">
<i class="bx bxs-message-rounded-add"
style="color: green; font-size: 1.5rem; cursor: pointer;" onclick="viewCharges()"></i>
</div>
</div>
</div>
<script>
$(function() {
$("#currency").autocomplete({
source: function (request, response) {
console.log('Autocomplete source called with:', request.term);
$.ajax({
url: endpoint.GetCurrencies,
data: { query: request.term },
success: function (result) {
console.log('AJAX success:', result);
if (result && result.success && Array.isArray(result.data)) {
var formattedData = result.data.map(item => ({
label: item.label || '',
value: item.value !== undefined && item.value !== null ? item.value.toString() : '',
value2: item.value2 !== undefined && item.value2 !== null ? item.value2.toString() : ''
}));
response(formattedData);
} else {
console.error('Invalid data format received:', result);
response([]);
}
},
error: function(xhr, status, error) {
console.error('AJAX error:', status, error);
console.log('Response:', xhr.responseText);
response([]);
}
});
},
minLength: 2,
select: function (event, ui) {
$('#currency').val(ui.item.label);
$('#currencyId').val(ui.item.value);
return false;
},
focus: function (event, ui) {
event.preventDefault();
},
open: function () {
var dropdown = $(".ui-autocomplete");
dropdown.css({
"max-height": "200px",
"overflow-y": "auto"
});
},
messages: {
noResults: '',
results: function (count) {
return count + (count > 1 ? ' results' : ' result');
}
}
});
});
</script>