with( local!casPoc, local!suppliers: rule!ICAMS_getAllSupppliers(), local!logGroupSupplierName: if( ri!fromDeal, index( rule!ICAMS_getSupplierById( id: index( rule!ICAMS_getDealById( id: ri!dealId ), "supplierId", "" ) ), "supplierName", "" ), if( rule!APN_isBlank( ri!logisticsGroup.supplierId ), {}, index( rule!ICAMS_getSupplierById( id: ri!logisticsGroup.supplierId ), "supplierName", "" ) ) ), local!allCoreAcquisitionNumbers: union( touniformstring( rule!ICAMS_getAllAcquisitionNumber() ), touniformstring( rule!ICAMS_getAllAcquisitionNumber() ) ), /*local!uniqueSupplierNames: union(touniformstring(rule!ICAMS_getAllEnteredSupplierNames()), tostring({})),*/ local!deal: if( rule!APN_isBlank( ri!logisticsGroup.dealId ), { if( ri!fromDeal rule!ICAMS_getDealById( id: ri!dealId ), if(rule!APN_isBlank(ri!coreAcquisitionNumber), {}, rule!ICAMS_getDealById(id: index(rule!ICAMS_getDealIdByCoreAcquisitionNumber(coreAcquisitionNumber: ri!coreAcquisitionNumber), "id", ""))) ) }, rule!ICAMS_getDealById( id: ri!logisticsGroup.dealId ) ), /*local!toolLocations: rule!ICAMS_getToolLocations(),*/ { /*a!textField(value: index(local!deal, "supplierId", "")),*/ a!sectionLayout( firstColumnContents: { a!textField( label: "Group Name", labelPosition: "ADJACENT", value: ri!logisticsGroup.name, saveInto: ri!logisticsGroup.name, required: true, validationGroup: "addLogisticsGroup" ), a!dropdownField( label: "Supplier", labelPosition: "ADJACENT", placeholderLabel: "--Select a Supplier--", choiceLabels: local!suppliers.supplierName, choiceValues: local!suppliers.id, value: if( rule!APN_isBlank( ri!logisticsGroup.dealId ), if( ri!fromDeal, index(local!deal, "supplierId", ""), if(rule!APN_isEmpty(ri!coreAcquisitionNumber), ri!logisticsGroup.supplierId, index(local!deal, "supplierId", "") ) ), index(local!deal, "supplierId", "") ), /*if(*/ /* ri!fromDeal,*/ /* index(*/ /* rule!ICAMS_getSupplierById(*/ /* id: index(*/ /* rule!ICAMS_getDealById(*/ /* id: ri!dealId*/ /* ),*/ /* "supplierId",*/ /* ""*/ /* )*/ /* ),*/ /* "id",*/ /* ""*/ /* ),*/ /* if(or(rule!APN_isEmpty(ri!coreAcquisitionNumber), rule!APN_isBlank(*/ /* ri!logisticsGroup.dealId*/ /* )),*/ /* ri!logisticsGroup.supplierId,*/ /* index(local!deal, "supplierId", "")*/ /* )*/ /*),*/ saveInto: { ri!logisticsGroup.supplierId, a!save( ri!supplierContact, rule!ICAMS_getSupplierContactsBySupplierId( supplierId: if( rule!APN_isBlank( ri!logisticsGroup.dealId ), ri!logisticsGroup.supplierId, local!deal.supplierId ) ).data ) } ), a!dropdownField( label: "Country of Supplier", labelPosition: "ADJACENT", placeholderLabel: "--Select Country--", choiceLabels: rule!ICAMS_getAllCountryOfSuppliers(), choiceValues: rule!ICAMS_getAllCountryOfSuppliers(), value: ri!logisticsGroup.countryOfSupplier, saveInto: ri!logisticsGroup.countryOfSupplier ), a!dropdownField( label: "RAM/IDAC", labelPosition: "ADJACENT", placeholderLabel: "--RAM/IDAC--", choiceLabels: rule!ICAMS_getRamIDacValues(), choiceValues: rule!ICAMS_getRamIDacValues(), value: ri!logisticsGroup.ramOrdIdac, saveInto: ri!logisticsGroup.ramOrdIdac ), a!textField( label: "Deinstall", value: ri!logisticsGroup.deinstall, saveInto: ri!logisticsGroup.deinstall, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Planned Core Release Date", value: ri!logisticsGroup.plannedCoreReleasedDate, saveInto: ri!logisticsGroup.plannedCoreReleasedDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Planned Rigging / Crating Date", value: ri!logisticsGroup.plannedRiggingCrating, saveInto: ri!logisticsGroup.plannedRiggingCrating, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Planned Core Receipt Date", value: ri!logisticsGroup.plannedReceiptDate, saveInto: ri!logisticsGroup.plannedReceiptDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Documentation Actual", value: ri!logisticsGroup.actualDocumentationDate, saveInto: ri!logisticsGroup.actualDocumentationDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Villach Invoice Date", value: ri!logisticsGroup.villachInvoiceClearingDate, saveInto: ri!logisticsGroup.villachInvoiceClearingDate, readOnly: false, labelPosition: "ADJACENT" ), a!dropdownField( label: "Forecasted Receipt Quarter", placeholderLabel: "-- Select Quarter --", labelPosition: "ADJACENT", choiceLabels: rule!ICAMS_getForecastedReceiptQuarterValues(), choiceValues: rule!ICAMS_getForecastedReceiptQuarterValues(), value: ri!logisticsGroup.forecastedReceiptQuarter, saveInto: ri!logisticsGroup.forecastedReceiptQuarter, readOnly: false ), }, secondColumnContents: { a!dropdownField( label: "CA Number", labelPosition: "ADJACENT", placeholderLabel: "-- Select CA # --", choiceLabels: local!allCoreAcquisitionNumbers, choiceValues: local!allCoreAcquisitionNumbers, value: if( ri!fromDeal, index( local!deal, "coreAcquisitionNumber", {} ), ri!coreAcquisitionNumber ), saveInto: ri!coreAcquisitionNumber, disabled: ri!fromDeal ), if( rule!APN_isBlank( ri!logisticsGroup.dealId ), if( ri!fromDeal, a!dropdownField( label: "Deal Type", labelPosition: "ADJACENT", placeholderLabel: "--Deal Type--", choiceLabels: rule!ICAMS_getDealTypes(), choiceValues: rule!ICAMS_getDealTypes(), value: local!deal.dealType, disabled: true ), if(rule!APN_isEmpty(ri!coreAcquisitionNumber), a!dropdownField( label: "Deal Type", labelPosition: "ADJACENT", placeholderLabel: "--Deal Type--", choiceLabels: rule!ICAMS_getDealTypes(), choiceValues: rule!ICAMS_getDealTypes(), disabled: true ), a!dropdownField( label: "Deal Type", labelPosition: "ADJACENT", placeholderLabel: "--Deal Type--", choiceLabels: rule!ICAMS_getDealTypes(), choiceValues: rule!ICAMS_getDealTypes(), value: local!deal.dealType, disabled: true() ) ) ), a!dropdownField( label: "Deal Type", labelPosition: "ADJACENT", placeholderLabel: "--Deal Type--", choiceLabels: rule!ICAMS_getDealTypes(), choiceValues: rule!ICAMS_getDealTypes(), value: local!deal.dealType, disabled: true() ) ), a!dropdownField( label: "Exporter of Record", labelPosition: "ADJACENT", placeholderLabel: "-- Select Exporter of Record --", choiceLabels: if( rule!APN_isBlank( ri!logisticsGroup.dealId ), if( rule!APN_isBlank( ri!logisticsGroup.supplierId ), { cons!ICAMS_EXPORTER_OF_RECORD_LAM, cons!ICAMS_EXPORTER_OF_RECORD_OTHER }, { cons!ICAMS_EXPORTER_OF_RECORD_LAM, local!logGroupSupplierName, cons!ICAMS_EXPORTER_OF_RECORD_OTHER } ), { cons!ICAMS_EXPORTER_OF_RECORD_LAM, index( rule!ICAMS_getSupplierById( id: local!deal.supplierId ), "supplierName", {} ), cons!ICAMS_EXPORTER_OF_RECORD_OTHER } ), choiceValues: if( rule!APN_isBlank( ri!logisticsGroup.dealId ), if( rule!APN_isBlank( ri!logisticsGroup.supplierId ), { cons!ICAMS_EXPORTER_OF_RECORD_LAM, cons!ICAMS_EXPORTER_OF_RECORD_OTHER }, { cons!ICAMS_EXPORTER_OF_RECORD_LAM, local!logGroupSupplierName, cons!ICAMS_EXPORTER_OF_RECORD_OTHER } ), { cons!ICAMS_EXPORTER_OF_RECORD_LAM, rule!ICAMS_getSupplierById( id: local!deal.supplierId ), cons!ICAMS_EXPORTER_OF_RECORD_OTHER } ), value: ri!logisticsGroup.exporterOfRecord, saveInto: ri!logisticsGroup.exporterOfRecord, readOnly: false ), a!dropdownField( label: "Payment Released", labelPosition: "ADJACENT", placeholderLabel: "--Yes/No/Multiple--", choiceLabels: rule!ICAMS_getAllPaymentReleasedOptions(), choiceValues: rule!ICAMS_getAllPaymentReleasedOptions(), value: ri!logisticsGroup.paymentReleased, saveInto: ri!logisticsGroup.paymentReleased ), a!textField( label: "Decon Complete?*", value: ri!logisticsGroup.plannedCoreReleasedDate, saveInto: ri!logisticsGroup.plannedCoreReleasedDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Actual Core Release Date", value: ri!logisticsGroup.actualCoreReleasedDate, saveInto: ri!logisticsGroup.actualCoreReleasedDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Actual Rigging / Crating Date", value: ri!logisticsGroup.actualRiggingCrating, saveInto: ri!logisticsGroup.actualRiggingCrating, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Actual Core Receipt Date", value: ri!logisticsGroup.actualReceiptDate, saveInto: ri!logisticsGroup.actualReceiptDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "RAM/IDAC Transaction Date", value: ri!logisticsGroup.RAMIDACTransactionDate, saveInto: ri!logisticsGroup.RAMIDACTransactionDate, readOnly: false, labelPosition: "ADJACENT" ), a!dateField( label: "Invoice Clearing Date", value: ri!logisticsGroup.invoiceClearingDate, saveInto: ri!logisticsGroup.invoiceClearingDate, readOnly: false, labelPosition: "ADJACENT" ) }, validations: if( or( rule!APN_isBlank( ri!logisticsGroup.name ), isnull( ri!logisticsGroup.name ) ), {}, if( rule!ICAMS_checkDuplicateLogisticsGroupName( name: ri!logisticsGroup.name ), "Logistics Group Name Already Exists", {} ) ) ), a!sectionLayout( firstColumnContents: { a!paragraphField( label: "Comments", labelPosition: "ADJACENT", value: ri!logisticsGroup.logGroupComments, saveInto: ri!logisticsGroup.logGroupComments ) } ), a!sectionLayout( label: "Contacts?", firstColumnContents: { rule!ICAMS_supplierContactsSection( readOnly: false, contacts: ri!supplierContact ) } ) } )