Custom PO working already all features
This commit is contained in:
parent
798f8f67ea
commit
84bcc7aaa7
@ -42,6 +42,7 @@ namespace CPRNIMS.Domain.Contracts.PO
|
|||||||
Task<List<POItemDetail>> GetPOItemDetail(PODto pODto);
|
Task<List<POItemDetail>> GetPOItemDetail(PODto pODto);
|
||||||
Task<List<CreatedPO>> GetMyCreatedPO(PODto pODto);
|
Task<List<CreatedPO>> GetMyCreatedPO(PODto pODto);
|
||||||
Task<List<Incoterm>> GetIncoterms(PODto itemDto);
|
Task<List<Incoterm>> GetIncoterms(PODto itemDto);
|
||||||
|
Task<List<Incoterm>> GetIncotermsByName(PODto itemDto);
|
||||||
Task<List<PRPOSummaryCount>> GetPRPOSummaryReport(PODto itemDto);
|
Task<List<PRPOSummaryCount>> GetPRPOSummaryReport(PODto itemDto);
|
||||||
Task<List<PRPOSummaryItem>> GetPRPOSummaryItem(PODto itemDto);
|
Task<List<PRPOSummaryItem>> GetPRPOSummaryItem(PODto itemDto);
|
||||||
PODto CreatePoDto(POVM PODto, byte docRequirementId, int otherChargesId, long prDetailsId
|
PODto CreatePoDto(POVM PODto, byte docRequirementId, int otherChargesId, long prDetailsId
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using CPRNIMS.Domain.Contracts.PO;
|
using CPRNIMS.Domain.Contracts.PO;
|
||||||
using CPRNIMS.Infrastructure.Database;
|
using CPRNIMS.Infrastructure.Database;
|
||||||
using CPRNIMS.Infrastructure.Dto.PO;
|
using CPRNIMS.Infrastructure.Dto.PO;
|
||||||
|
using CPRNIMS.Infrastructure.Dto.PR;
|
||||||
using CPRNIMS.Infrastructure.Entities.Canvass;
|
using CPRNIMS.Infrastructure.Entities.Canvass;
|
||||||
using CPRNIMS.Infrastructure.Entities.Common;
|
using CPRNIMS.Infrastructure.Entities.Common;
|
||||||
using CPRNIMS.Infrastructure.Entities.LocalDb.NonInvent;
|
using CPRNIMS.Infrastructure.Entities.LocalDb.NonInvent;
|
||||||
@ -57,7 +58,15 @@ namespace CPRNIMS.Domain.Services.PO
|
|||||||
}
|
}
|
||||||
public async Task<List<Incoterm>> GetIncoterms(PODto itemDto)
|
public async Task<List<Incoterm>> GetIncoterms(PODto itemDto)
|
||||||
{
|
{
|
||||||
return await _dbContext.Incoterms.ToListAsync();
|
return await _dbContext.Incoterms
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
public async Task<List<Incoterm>> GetIncotermsByName(PODto itemDto)
|
||||||
|
{
|
||||||
|
return await _dbContext.Incoterms
|
||||||
|
.Where(t => t.IncotermsName.Contains(itemDto.IncotermsName))
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
public async Task<List<OtherCharges>> GetOtherCharges(PODto itemDto)
|
public async Task<List<OtherCharges>> GetOtherCharges(PODto itemDto)
|
||||||
{
|
{
|
||||||
@ -259,6 +268,7 @@ namespace CPRNIMS.Domain.Services.PO
|
|||||||
{
|
{
|
||||||
var allItems = await _dbContext.PaymentTerms
|
var allItems = await _dbContext.PaymentTerms
|
||||||
.Where(t => t.PaymentTerms.Contains(pODto.PaymentTerms))
|
.Where(t => t.PaymentTerms.Contains(pODto.PaymentTerms))
|
||||||
|
.AsNoTracking()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
return allItems ?? new List<PaymentTerm>();
|
return allItems ?? new List<PaymentTerm>();
|
||||||
|
|||||||
@ -41,6 +41,7 @@ namespace CPRNIMS.Domain.UIContracts.PO
|
|||||||
Task<List<POVM>?> GetPortOfDischarge(User user, POVM viewModels);
|
Task<List<POVM>?> GetPortOfDischarge(User user, POVM viewModels);
|
||||||
Task<List<POVM>?> GetIncomingShipment(User user, POVM viewModels);
|
Task<List<POVM>?> GetIncomingShipment(User user, POVM viewModels);
|
||||||
Task<List<POVM>?> GetPOListByTerm(User user, POVM viewModels);
|
Task<List<POVM>?> GetPOListByTerm(User user, POVM viewModels);
|
||||||
|
Task<List<POVM>?> GetIncotermsByName(User user, POVM viewModels);
|
||||||
#endregion
|
#endregion
|
||||||
#region Post Put
|
#region Post Put
|
||||||
Task<POVM> PostApprovedSupplier(User user, POVM viewModel);
|
Task<POVM> PostApprovedSupplier(User user, POVM viewModel);
|
||||||
|
|||||||
@ -127,6 +127,11 @@ namespace CPRNIMS.Domain.UIServices.PO
|
|||||||
|
|
||||||
#region Get
|
#region Get
|
||||||
|
|
||||||
|
public async Task<List<POVM>?> GetIncotermsByName(User user, POVM viewModel)
|
||||||
|
{
|
||||||
|
return await SendGetApiRequest(user, viewModel,
|
||||||
|
_configuration["LLI:NonInvent:POMgmt:GetIncotermsByName"]);
|
||||||
|
}
|
||||||
public async Task<List<POVM>?> GetPOListByTerm(User user, POVM viewModel)
|
public async Task<List<POVM>?> GetPOListByTerm(User user, POVM viewModel)
|
||||||
{
|
{
|
||||||
return await SendGetApiRequest(user, viewModel,
|
return await SendGetApiRequest(user, viewModel,
|
||||||
|
|||||||
@ -330,6 +330,14 @@ namespace CPRNIMS.WebApi.Controllers.PO
|
|||||||
nameof(GetIncoterms),false
|
nameof(GetIncoterms),false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
[HttpPost("GetIncotermsByName")]
|
||||||
|
public async Task<IActionResult> GetIncotermsByName(PODto itemDto)
|
||||||
|
{
|
||||||
|
return await ExecuteWithErrorHandling(
|
||||||
|
() => _purchaseOrder.GetIncotermsByName(itemDto),
|
||||||
|
nameof(GetIncoterms), false
|
||||||
|
);
|
||||||
|
}
|
||||||
[HttpPost("GetPOItemDetail")]
|
[HttpPost("GetPOItemDetail")]
|
||||||
public async Task<IActionResult> GetPOItemDetail(PODto PODto)
|
public async Task<IActionResult> GetPOItemDetail(PODto PODto)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -449,6 +449,23 @@ namespace CPRNIMS.WebApps.Controllers.PO
|
|||||||
response = await _purchaseOrder.GetPOItemDetail(GetUser(), viewModels);
|
response = await _purchaseOrder.GetPOItemDetail(GetUser(), viewModels);
|
||||||
return GetResponse(response);
|
return GetResponse(response);
|
||||||
}
|
}
|
||||||
|
public async Task<IActionResult> GetIncotermsByName(string query)
|
||||||
|
{
|
||||||
|
var viewModels = new POVM();
|
||||||
|
viewModels.IncotermsName = query;
|
||||||
|
response = await _purchaseOrder.GetIncotermsByName(GetUser(), viewModels);
|
||||||
|
if (response == null)
|
||||||
|
{
|
||||||
|
response = new List<POVM>();
|
||||||
|
}
|
||||||
|
var formattedData = response.Select(item => new
|
||||||
|
{
|
||||||
|
label = item.IncotermsName,
|
||||||
|
value = item.IncotermsId
|
||||||
|
});
|
||||||
|
|
||||||
|
return Json(new { success = true, data = formattedData });
|
||||||
|
}
|
||||||
public async Task<IActionResult> GetIncoterms(POVM viewModels)
|
public async Task<IActionResult> GetIncoterms(POVM viewModels)
|
||||||
{
|
{
|
||||||
response = await _purchaseOrder.GetIncoterms(GetUser(), viewModels);
|
response = await _purchaseOrder.GetIncoterms(GetUser(), viewModels);
|
||||||
|
|||||||
@ -80,8 +80,8 @@
|
|||||||
<label for="docRequiredId">Incoterms</label>
|
<label for="docRequiredId">Incoterms</label>
|
||||||
<i class="bx bxs-message-rounded-add" style="color: green; font-size: 1rem; cursor: pointer;"
|
<i class="bx bxs-message-rounded-add" style="color: green; font-size: 1rem; cursor: pointer;"
|
||||||
onclick="viewIncoterms()"></i>
|
onclick="viewIncoterms()"></i>
|
||||||
<select name="incotermsName" id="incotermsName"
|
|
||||||
class="form-control" style="margin-bottom:5px;"></select>
|
<input type="search" name="incotermsName" id="incotermsName" class="form-control" style="margin-bottom:5px;">
|
||||||
<input type="hidden" id="incoTermsId" name="incoTermsId" />
|
<input type="hidden" id="incoTermsId" name="incoTermsId" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<div id="loader" class="loader"></div>
|
<div id="loader" class="loader"></div>
|
||||||
</div>
|
</div>
|
||||||
<link href="~/css/common/rowhighlighter.css" rel="stylesheet" />
|
<link href="~/css/common/rowhighlighter.css" rel="stylesheet" />
|
||||||
<script src="~/jsfunctions/po/ComponentsV3.js"></script>
|
<script src="~/jsfunctions/po/ComponentsV4.js"></script>
|
||||||
<script src="~/jsfunctions/common/componentid.js"></script>
|
<script src="~/jsfunctions/common/componentid.js"></script>
|
||||||
<script src="~/jsfunctions/common/indexcard.js"></script>
|
<script src="~/jsfunctions/common/indexcard.js"></script>
|
||||||
<script src="~/jsfunctions/common/termsV2.js"></script>
|
<script src="~/jsfunctions/common/termsV2.js"></script>
|
||||||
@ -18,11 +18,11 @@
|
|||||||
<script src="~/jsfunctions/po/POButtonV9.js"></script>
|
<script src="~/jsfunctions/po/POButtonV9.js"></script>
|
||||||
<script src="~/jsfunctions/po/PrintingV2.js"></script>
|
<script src="~/jsfunctions/po/PrintingV2.js"></script>
|
||||||
<script src="~/JsFunctions/PO/POColumn.js"></script>
|
<script src="~/JsFunctions/PO/POColumn.js"></script>
|
||||||
<script src="~/jsfunctions/po/ApiV3.js"></script>
|
<script src="~/jsfunctions/po/ApiV4.js"></script>
|
||||||
<script src="~/jsfunctions/po/populatetable.js"></script>
|
<script src="~/jsfunctions/po/populatetable.js"></script>
|
||||||
<script src="~/jsfunctions/po/POVarV6.js"></script>
|
<script src="~/jsfunctions/po/POVarV6.js"></script>
|
||||||
<script src="~/jsfunctions/po/POViewV4.js"></script>
|
<script src="~/jsfunctions/po/POViewV4.js"></script>
|
||||||
<script src="~/jsfunctions/po/PopulateDopdownV3.js"></script>
|
<script src="~/jsfunctions/po/PopulateDopdownV4.js"></script>
|
||||||
<script src="~/jsfunctions/po/POPutPostV3.js"></script>
|
<script src="~/jsfunctions/po/POPutPostV3.js"></script>
|
||||||
<script src="~/jsfunctions/po/rowCallBackV4.js"></script>
|
<script src="~/jsfunctions/po/rowCallBackV4.js"></script>
|
||||||
|
|
||||||
|
|||||||
@ -45,6 +45,7 @@
|
|||||||
"GetDepartment": "api/ItemMgmt/GetDepartment/",
|
"GetDepartment": "api/ItemMgmt/GetDepartment/",
|
||||||
"GetItemLocalization": "api/ItemMgmt/GetItemLocalization/",
|
"GetItemLocalization": "api/ItemMgmt/GetItemLocalization/",
|
||||||
"GetItemCateg": "api/ItemMgmt/GetItemCateg/",
|
"GetItemCateg": "api/ItemMgmt/GetItemCateg/",
|
||||||
|
"GetProjectCodeByTerm": "api/ItemMgmt/GetProjectCodeByTerm/",
|
||||||
"GetItemCart": "api/ItemMgmt/GetItemCart/",
|
"GetItemCart": "api/ItemMgmt/GetItemCart/",
|
||||||
"PostPutItem": "api/ItemMgmt/PostPutItem/",
|
"PostPutItem": "api/ItemMgmt/PostPutItem/",
|
||||||
"PutItemDetail": "api/ItemMgmt/PutItemDetail/",
|
"PutItemDetail": "api/ItemMgmt/PutItemDetail/",
|
||||||
@ -58,15 +59,21 @@
|
|||||||
"PutItemDetail": "api/PRMgmt/PutItemDetail/",
|
"PutItemDetail": "api/PRMgmt/PutItemDetail/",
|
||||||
"PutSupplierAlterOffer": "api/PRMgmt/PutSupplierAlterOffer/",
|
"PutSupplierAlterOffer": "api/PRMgmt/PutSupplierAlterOffer/",
|
||||||
"PRItemRemoval": "api/PRMgmt/PRItemRemoval/",
|
"PRItemRemoval": "api/PRMgmt/PRItemRemoval/",
|
||||||
|
"PostPutAttachment": "api/PRMgmt/PostPutAttachment/",
|
||||||
"ApprovedSelectedPRItem": "api/PRMgmt/ApprovedSelectedPRItem/",
|
"ApprovedSelectedPRItem": "api/PRMgmt/ApprovedSelectedPRItem/",
|
||||||
|
"PostPutProjectCode": "api/PRMgmt/PostPutProjectCode/",
|
||||||
"GetAllPR": "api/PRMgmt/GetAllPR/",
|
"GetAllPR": "api/PRMgmt/GetAllPR/",
|
||||||
|
"GetApprovedPR": "api/PRMgmt/GetApprovedPR/",
|
||||||
|
"GetRemovedPR": "api/PRMgmt/GetRemovedPR/",
|
||||||
"GetPRArchived": "api/PRMgmt/GetPRArchived/",
|
"GetPRArchived": "api/PRMgmt/GetPRArchived/",
|
||||||
"GetMyPR": "api/PRMgmt/GetMyPR/",
|
"GetMyPR": "api/PRMgmt/GetMyPR/",
|
||||||
"GetApproverName": "api/PRMgmt/GetApproverName/",
|
"GetApproverName": "api/PRMgmt/GetApproverName/",
|
||||||
|
"GetApproverNameByPRNo": "api/PRMgmt/GetApproverNameByPRNo/",
|
||||||
"GetPRListByPRNo": "api/PRMgmt/GetPRListByPRNo/",
|
"GetPRListByPRNo": "api/PRMgmt/GetPRListByPRNo/",
|
||||||
"GetDashBoard": "api/PRMgmt/GetDashBoard/",
|
"GetDashBoard": "api/PRMgmt/GetDashBoard/",
|
||||||
"GetPRStatusById": "api/PRMgmt/GetPRStatusById/",
|
"GetPRStatusById": "api/PRMgmt/GetPRStatusById/",
|
||||||
"GetPRByRRId": "api/PRMgmt/GetPRByRRId/",
|
"GetPRByRRId": "api/PRMgmt/GetPRByRRId/",
|
||||||
|
"GetProjectCodes": "api/PRMgmt/GetProjectCodes/",
|
||||||
"GetPRDetailByPRNo": "api/PRMgmt/GetPRDetailByPRNo/",
|
"GetPRDetailByPRNo": "api/PRMgmt/GetPRDetailByPRNo/",
|
||||||
"GetDetailedPRTracking": "api/PRMgmt/GetDetailedPRTracking/",
|
"GetDetailedPRTracking": "api/PRMgmt/GetDetailedPRTracking/",
|
||||||
"GetSupplierAlternativeOffer": "api/PRMgmt/GetSupplierAlternativeOffer/",
|
"GetSupplierAlternativeOffer": "api/PRMgmt/GetSupplierAlternativeOffer/",
|
||||||
@ -142,9 +149,12 @@
|
|||||||
"GetMyCreatedPO": "api/POMgmt/GetMyCreatedPO/",
|
"GetMyCreatedPO": "api/POMgmt/GetMyCreatedPO/",
|
||||||
"GetPOItemDetail": "api/POMgmt/GetPOItemDetail/",
|
"GetPOItemDetail": "api/POMgmt/GetPOItemDetail/",
|
||||||
"GetIncoterms": "api/POMgmt/GetIncoterms/",
|
"GetIncoterms": "api/POMgmt/GetIncoterms/",
|
||||||
|
"GetPOListByTerm": "api/POMgmt/GetPOListByTerm/",
|
||||||
|
"GetPOFormData": "api/POMgmt/GetPOFormData/",
|
||||||
"GetPRPOSummaryReport": "api/POMgmt/GetPRPOSummaryReport/",
|
"GetPRPOSummaryReport": "api/POMgmt/GetPRPOSummaryReport/",
|
||||||
"GetPRPOSummaryItem": "api/POMgmt/GetPRPOSummaryItem/",
|
"GetPRPOSummaryItem": "api/POMgmt/GetPRPOSummaryItem/",
|
||||||
"GetIndexCard": "api/POMgmt/GetIndexCard/",
|
"GetIndexCard": "api/POMgmt/GetIndexCard/",
|
||||||
|
"GetIncotermsByName": "api/POMgmt/GetIncotermsByName/",
|
||||||
"GetPortOfDischarge": "api/POMgmt/GetPortOfDischarge/",
|
"GetPortOfDischarge": "api/POMgmt/GetPortOfDischarge/",
|
||||||
"GetIncomingShipment": "api/POMgmt/GetIncomingShipment/"
|
"GetIncomingShipment": "api/POMgmt/GetIncomingShipment/"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -16,6 +16,7 @@
|
|||||||
GetSupplierBidById: "/POMgmt/GetSupplierBidById",
|
GetSupplierBidById: "/POMgmt/GetSupplierBidById",
|
||||||
GetPortOfDischarge: "/POMgmt/GetPortOfDischarge",
|
GetPortOfDischarge: "/POMgmt/GetPortOfDischarge",
|
||||||
GetPOListByTerm: "/POMgmt/GetPOListByTerm",
|
GetPOListByTerm: "/POMgmt/GetPOListByTerm",
|
||||||
|
GetIncotermsByName: "/POMgmt/GetIncotermsByName",
|
||||||
|
|
||||||
PutPOCancel: "/POMgmt/PutPOCancel",
|
PutPOCancel: "/POMgmt/PutPOCancel",
|
||||||
PutPOItemDetail: "/POMgmt/PutPOItemDetail",
|
PutPOItemDetail: "/POMgmt/PutPOItemDetail",
|
||||||
@ -51,6 +51,9 @@ async function customFormPOElemComponent(id) {
|
|||||||
$("#C-paymentTerms").off('keyup').on('keyup', function () {
|
$("#C-paymentTerms").off('keyup').on('keyup', function () {
|
||||||
populateTerms();
|
populateTerms();
|
||||||
});
|
});
|
||||||
|
$("#incotermsName").off('keyup').on('keyup', function () {
|
||||||
|
popIncotermsByName();
|
||||||
|
});
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
@ -64,7 +67,6 @@ async function customFormPOElemComponent(id) {
|
|||||||
await populatePOElem(id);
|
await populatePOElem(id);
|
||||||
|
|
||||||
// 3. NOW read from those inputs
|
// 3. NOW read from those inputs
|
||||||
populateIncoterms();
|
|
||||||
getPONoType(id);
|
getPONoType(id);
|
||||||
getPOType(id);
|
getPOType(id);
|
||||||
|
|
||||||
@ -22,7 +22,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
async function fetchAndPopulatePOFormData(poType, poId = null) {
|
async function fetchAndPopulatePOFormData(poType, poId = null) {
|
||||||
loader = $('#overlay, #loader').css('z-index', 1060);
|
loader = $('#overlay, #loader').css('z-index', 1060);
|
||||||
|
|
||||||
@ -77,12 +76,9 @@ async function fetchAndPopulatePOFormData(poType, poId = null) {
|
|||||||
$('#finalAmount').val(d.header.finalAmountPHP || 0);
|
$('#finalAmount').val(d.header.finalAmountPHP || 0);
|
||||||
$('#grossAmount').val(d.header.grossAmountPHP || 0);
|
$('#grossAmount').val(d.header.grossAmountPHP || 0);
|
||||||
|
|
||||||
console.log('d.header.incotermsName', d.header.incotermsName);
|
|
||||||
|
|
||||||
$('#incoTermsId').val(d.header.incotermsId);
|
$('#incoTermsId').val(d.header.incotermsId);
|
||||||
|
|
||||||
$('#incotermsName').val(d.header.incotermsName || '');
|
$('#incotermsName').val(d.header.incotermsName || '');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- DataTable: Line Items ---
|
// --- DataTable: Line Items ---
|
||||||
@ -128,6 +124,7 @@ async function fetchAndPopulatePOFormData(poType, poId = null) {
|
|||||||
}
|
}
|
||||||
function enablePONoAutocomplete() {
|
function enablePONoAutocomplete() {
|
||||||
poDataTable.clear().draw();
|
poDataTable.clear().draw();
|
||||||
|
|
||||||
document.getElementById('customPOHeading').innerHTML = 'Custom P.O. Modification';
|
document.getElementById('customPOHeading').innerHTML = 'Custom P.O. Modification';
|
||||||
customFormPOElemComponent(4);
|
customFormPOElemComponent(4);
|
||||||
document.getElementById("poNo").removeAttribute("readonly");
|
document.getElementById("poNo").removeAttribute("readonly");
|
||||||
@ -135,7 +132,6 @@ function enablePONoAutocomplete() {
|
|||||||
document.getElementById("poNo").focus();
|
document.getElementById("poNo").focus();
|
||||||
document.getElementById("poType").value = "0";
|
document.getElementById("poType").value = "0";
|
||||||
popPONo();
|
popPONo();
|
||||||
|
|
||||||
}
|
}
|
||||||
// =====================================================================
|
// =====================================================================
|
||||||
// UTILITIES
|
// UTILITIES
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
$('#poTypeId').val(ui.item.value2);
|
$('#poTypeId').val(ui.item.value2);
|
||||||
|
|
||||||
populatePOModificationForm(ui.item.value2);
|
populatePOModificationForm(ui.item.value2);
|
||||||
populateIncoterms();
|
|
||||||
fetchAndPopulatePOFormData(ui.item.value2,ui.item.value);
|
fetchAndPopulatePOFormData(ui.item.value2,ui.item.value);
|
||||||
|
|
||||||
$("#supplierName").off('keyup').on('keyup', function () {
|
$("#supplierName").off('keyup').on('keyup', function () {
|
||||||
@ -80,6 +80,10 @@ async function populatePOModificationForm(id) {
|
|||||||
$("#C-paymentTerms").off('keyup').on('keyup', function () {
|
$("#C-paymentTerms").off('keyup').on('keyup', function () {
|
||||||
populateTerms();
|
populateTerms();
|
||||||
});
|
});
|
||||||
|
$("#incotermsName").off('keyup').on('keyup', function () {
|
||||||
|
popIncotermsByName();
|
||||||
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
@ -151,6 +155,52 @@ function populateIncoterms() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function popIncotermsByName() {
|
||||||
|
$("#incotermsName").autocomplete({
|
||||||
|
source: function (request, response) {
|
||||||
|
$.ajax({
|
||||||
|
url: endpoint.GetIncotermsByName,
|
||||||
|
data: { query: request.term },
|
||||||
|
success: function (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() : ''
|
||||||
|
}));
|
||||||
|
|
||||||
|
response(formattedData);
|
||||||
|
} else {
|
||||||
|
console.error('Invalid data format received:', result);
|
||||||
|
response([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
minLength: 2,
|
||||||
|
select: function (event, ui) {
|
||||||
|
$('#incotermsName').val(ui.item.label);
|
||||||
|
$('#incoTermsId').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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function popTerms() {
|
function popTerms() {
|
||||||
$("#P-paymentTerms").autocomplete({
|
$("#P-paymentTerms").autocomplete({
|
||||||
source: function (request, response) {
|
source: function (request, response) {
|
||||||
Loading…
Reference in New Issue
Block a user