load( local!pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1 ), local!fidSearchFilter, local!searchResults, local!affectedModuleFIDMapping, local!boolean: toboolean(false), { a!sectionLayout( label: "Hard Peg FID", firstColumnContents: { a!textField( label: "FID", labelPosition: "ADJACENT", value: local!fidSearchFilter, saveInto: local!fidSearchFilter, required: true, validationGroup: "search" ) }, secondColumnContents: { a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Search", value: "Search", saveInto: { a!save( local!searchResults, rule!ICAMS_getModuleFIDMappingsByFID( fid: local!fidSearchFilter/*selection: local!querySelection,*/ /*pagingInfo: local!gridSelection.pagingInfo*/ ) ), /*a!save(ri!searchResults, local!searchResults.data),*/ if( or( ( count( local!searchResults.data ) < 1 ), isnull( local!searchResults.data ) ), {a!save(local!boolean, true)}, a!save( local!affectedModuleFIDMapping, rule!ICAMS_getModuleFIDMappingsBySerialNumberExcludeFID( fid: local!fidSearchFilter, serialNumbers: local!searchResults.data.serialNumber ) ) ), a!save( ri!fid, local!fidSearchFilter )/*a!save(ri!affectedModuleFIDMapping, local!affectedModuleFIDMapping.data)*/ }, validate: true, validationGroup: "search" ) } ) } ), if( or( ( count( local!searchResults.data ) < 1 ), isnull( local!searchResults.data ) ), { if( local!boolean, a!richTextDisplayField( value: a!richTextItem(text: "There is no such FID to slot", style: "STRONG") ), {} ) }, { a!sectionLayout( label: "FID - " & ri!fid, firstColumnContents: { a!gridField( label: "Modules to be slotted", totalCount: count( local!searchResults.data ), columns: { a!gridTextColumn( label: "Serial Number", field: "serialNumber", data: index( local!searchResults.data, "serialNumber", {} ) ) }, value: local!pagingInfo, saveInto: value: local!pagingInfo ) }, secondColumnContents: {} ), if( or( ( count( local!affectedModuleFIDMapping.data ) < 1 ), isnull( local!affectedModuleFIDMapping.data ) ), {a!richTextDisplayField( value: a!richTextItem(text: "No other FID/s will be affected", style: "STRONG") )}, { a!sectionLayout( label: "FID's Affected", firstColumnContents: { a!gridField( label: "Affected FIDs", totalCount: count( local!affectedModuleFIDMapping.data ), columns: { a!gridTextColumn( label: "FID", field: "fid", data: index( local!affectedModuleFIDMapping.data, "fid", {} ) ), a!gridTextColumn( label: "Serial Number", field: "serialNumber", data: index( local!affectedModuleFIDMapping.data, "serialNumber", {} ) ) }, value: local!pagingInfo, saveInto: value: local!pagingInfo ) }, secondColumnContents: {} ) } ), a!buttonLayout( primaryButtons: { a!buttonWidget( label: cons!ICAMS_USER_ACTION_SLOT_MODULES, style: "PRIMARY", value: cons!ICAMS_USER_ACTION_SLOT_MODULES, saveInto: { ri!userAction, a!save( ri!fid, local!fidSearchFilter ) }, disabled: isnull( ri!fid ) ) }, secondaryButtons: { a!buttonWidget( label: cons!ICAMS_USER_ACTION_CANCEL, style: "NORMAL", value: cons!ICAMS_USER_ACTION_CANCEL, saveInto: ri!userAction ) } ) } ) } )