...
on loading page on frontend side fetch all possible node values for each address field (in useEffect)
on selecting any of value from dropdown of any field this api will be called by passing
queryString=selectedValue of node
andsearchType=type of selected field
Frontend changes to be done in add consignment(crm) alongwith customer-portal and counter-booking(crm). (@saarthak to confirm all screens(frontend) where this change has to be done).
What to do if any of middle node in hierarchy data is not found commented in above code snippet in catch block because it will hinder fetching data of other higher level (is it possible to occur in prod DB)
Should disable all highe level nodes irrespective of the case that their value is fetched or not OR disable only those fields for which value is fetched. @saarthak
Frontend changes:
In case allowOverrideHierarchy
is false , we will let user only enter values from dropdown only
...
Code Block |
---|
{!this.state.allowOverrideHierarchy && getFieldDecorator('sender_country', { rules: [{ required: false, message: t('cannot_be_empty') }], })( <Select showSearch optionFilterProp="children" onChange={(value) => this.saveAddressUsingAddressHierarchy(value, 'country', 'sender')} placeholder={t("Country")} disabled={this.state.senderDisableCountry} onSearch={this.loadCountries} allowClear > {this.state?.countriesList?.map(opt => <Option key={opt.id} value={opt.code}>{t(opt.name)} ({opt.code})</Option>)} </Select>, )} {this.state.allowOverrideHierarchy && getFieldDecorator('sender_country', { rules: [{ required: false, message: t('cannot_be_empty') }], })( <AutoComplete options={this.state?.countriesList?.map(item => ({ label: `${item.name} (${item.code})`, value: item.code }))} onSearch={this.loadCountries} onSelect={(value) => this.saveAddressUsingAddressHierarchy(value, 'country', 'sender')} onChange={(value) => this.handleAddressFields('country', value, !this.state.allowOverrideHierarchy, 'sender')} disabled={this.state.senderDisableCountry} allowClear > <Input allowClear placeholder={t("Country")} /> </AutoComplete>, |
Instead of showing only Name of options in dropdown it will now be shown as Name (Code)
. This will require another update in find query in common/models/customer-portal-parts/address-node-api-helper.js
→ getAddressNodeData
.