@redneckz/wildless-cms-uni-blocks 0.14.724 → 0.14.726
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +1810 -1827
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/bundle/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/bundle/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/bundle/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/bundle/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/bundle/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/bundle/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/bundle/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/bundle/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/bundle/components/CreditCardForm/renderStep.d.ts +1 -1
- package/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/bundle/components/CreditForm/formStateMap.d.ts +1 -1
- package/bundle/components/CreditForm/getCalcData.d.ts +1 -1
- package/bundle/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/bundle/components/CreditForm/renderInfo.d.ts +1 -1
- package/bundle/components/CreditForm/renderInputs.d.ts +2 -2
- package/bundle/components/CreditForm/renderStep.d.ts +1 -1
- package/bundle/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/bundle/components/CreditForm/utils.d.ts +1 -1
- package/bundle/hooks/useLeadFormData.d.ts +2 -2
- package/bundle/hooks/useRetailFormStore.d.ts +10 -10
- package/bundle/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/bundle/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/bundle/services/retail/external/types.d.ts +10 -0
- package/bundle/services/retail/external/utils.d.ts +2 -0
- package/bundle/services/retail/inputs.d.ts +75 -0
- package/{dist/api/RetailAPI → bundle/services/retail}/model/LeadFormData.d.ts +1 -1
- package/bundle/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.d.ts +18 -18
- package/bundle/services/retail/model/RetailFormContent.d.ts +63 -0
- package/bundle/{components/CreditCardForm → services/retail/utils}/calculateInputs.d.ts +2 -2
- package/bundle/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/bundle/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/bundle/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/bundle/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/bundle/ui-kit/FormField/SelectField.d.ts +2 -2
- package/bundle/ui-kit/FormField/getField.d.ts +2 -1
- package/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/bundle/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/bundle/ui-kit/FormField/getPremium.d.ts +1 -1
- package/bundle/ui-kit/FormField/validators.d.ts +3 -2
- package/dist/components/ApplicationForm/ApplicationForm.js +1 -3
- package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/dist/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/dist/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/dist/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/dist/components/ApplicationLeadForm/consents.js +0 -3
- package/dist/components/ApplicationLeadForm/consents.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/dist/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/{mobile/dist/components/ApplicationForm → dist/components/ApplicationLeadForm}/renderInputs.js +4 -3
- package/dist/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/dist/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/dist/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/dist/components/CreditCardForm/formStateMap.js +1 -1
- package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/dist/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/dist/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/dist/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/dist/components/CreditCardForm/renderInputs.js +2 -1
- package/dist/components/CreditCardForm/renderInputs.js.map +1 -1
- package/dist/components/CreditCardForm/renderStep.d.ts +1 -1
- package/dist/components/CreditCardForm/renderStep.js +1 -1
- package/dist/components/CreditCardForm/renderStep.js.map +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/dist/components/CreditForm/formStateMap.d.ts +1 -1
- package/dist/components/CreditForm/getCalcData.d.ts +1 -1
- package/dist/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/dist/components/CreditForm/renderInfo.d.ts +1 -1
- package/dist/components/CreditForm/renderInfo.js.map +1 -1
- package/dist/components/CreditForm/renderInputs.d.ts +2 -2
- package/dist/components/CreditForm/renderInputs.js +2 -1
- package/dist/components/CreditForm/renderInputs.js.map +1 -1
- package/dist/components/CreditForm/renderStep.d.ts +1 -1
- package/dist/components/CreditForm/renderStep.js +1 -1
- package/dist/components/CreditForm/renderStep.js.map +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/dist/components/CreditForm/useCreditFormAPI.js +1 -1
- package/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/dist/components/CreditForm/utils.d.ts +1 -1
- package/dist/hooks/useCreditFormStore.d.ts +0 -0
- package/dist/hooks/useCreditFormStore.js +1 -0
- package/dist/hooks/useCreditFormStore.js.map +1 -0
- package/dist/hooks/useLeadFormData.d.ts +2 -2
- package/dist/hooks/useLeadFormData.js.map +1 -1
- package/dist/hooks/useRetailFormStore.d.ts +10 -10
- package/dist/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/dist/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/dist/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/dist/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/dist/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/dist/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/dist/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/dist/services/retail/external/types.d.ts +10 -0
- package/dist/services/retail/external/types.js +2 -0
- package/dist/services/retail/external/types.js.map +1 -0
- package/dist/services/retail/external/utils.d.ts +2 -0
- package/dist/services/retail/external/utils.js +7 -0
- package/dist/services/retail/external/utils.js.map +1 -0
- package/dist/services/retail/inputs.d.ts +75 -0
- package/dist/services/retail/inputs.js +137 -0
- package/dist/services/retail/inputs.js.map +1 -0
- package/dist/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/{bundle/api/RetailAPI → dist/services/retail}/model/LeadFormData.d.ts +1 -1
- package/dist/services/retail/model/LeadFormData.js.map +1 -0
- package/{lib/components/ApplicationLeadForm → dist/services/retail/model}/LeadFormState.d.ts +18 -18
- package/dist/services/retail/model/LeadFormState.js.map +1 -0
- package/dist/services/retail/model/RetailFormContent.d.ts +63 -0
- package/dist/services/retail/model/RetailFormContent.js +4 -0
- package/dist/services/retail/model/RetailFormContent.js.map +1 -0
- package/{bundle/components/CreditForm → dist/services/retail/utils}/calculateInputs.d.ts +2 -2
- package/dist/services/retail/utils/calculateInputs.js.map +1 -0
- package/dist/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/dist/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/dist/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/dist/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.js +3 -4
- package/dist/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/dist/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/dist/ui-kit/DraftDialog/utils.js.map +1 -1
- package/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/dist/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +10 -0
- package/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/dist/ui-kit/FormField/SelectField.d.ts +2 -2
- package/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/dist/ui-kit/FormField/getField.d.ts +2 -1
- package/dist/ui-kit/FormField/getField.js +4 -131
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +70 -60
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/FormField/getPremium.d.ts +1 -1
- package/dist/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/dist/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/dist/ui-kit/FormField/validators.d.ts +3 -2
- package/dist/ui-kit/FormField/validators.js +5 -3
- package/dist/ui-kit/FormField/validators.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationForm.js +1 -3
- package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/lib/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/lib/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/lib/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/lib/components/ApplicationLeadForm/consents.js +0 -3
- package/lib/components/ApplicationLeadForm/consents.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.js +4 -3
- package/lib/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/lib/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/lib/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/lib/components/CreditCardForm/formStateMap.js +1 -1
- package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/lib/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/lib/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/lib/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/lib/components/CreditCardForm/renderInputs.js +2 -1
- package/lib/components/CreditCardForm/renderInputs.js.map +1 -1
- package/lib/components/CreditCardForm/renderStep.d.ts +1 -1
- package/lib/components/CreditCardForm/renderStep.js +1 -1
- package/lib/components/CreditCardForm/renderStep.js.map +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/lib/components/CreditForm/formStateMap.d.ts +1 -1
- package/lib/components/CreditForm/getCalcData.d.ts +1 -1
- package/lib/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/lib/components/CreditForm/renderInfo.d.ts +1 -1
- package/lib/components/CreditForm/renderInfo.js.map +1 -1
- package/lib/components/CreditForm/renderInputs.d.ts +2 -2
- package/lib/components/CreditForm/renderInputs.js +2 -1
- package/lib/components/CreditForm/renderInputs.js.map +1 -1
- package/lib/components/CreditForm/renderStep.d.ts +1 -1
- package/lib/components/CreditForm/renderStep.js +1 -1
- package/lib/components/CreditForm/renderStep.js.map +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/lib/components/CreditForm/useCreditFormAPI.js +1 -1
- package/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/lib/components/CreditForm/utils.d.ts +1 -1
- package/lib/hooks/useCreditFormStore.d.ts +0 -0
- package/lib/hooks/useCreditFormStore.js +1 -0
- package/lib/hooks/useCreditFormStore.js.map +1 -0
- package/lib/hooks/useLeadFormData.d.ts +2 -2
- package/lib/hooks/useLeadFormData.js.map +1 -1
- package/lib/hooks/useRetailFormStore.d.ts +10 -10
- package/lib/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/lib/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/lib/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/lib/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/lib/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/lib/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/lib/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/lib/services/retail/external/types.d.ts +10 -0
- package/lib/services/retail/external/types.js +2 -0
- package/lib/services/retail/external/types.js.map +1 -0
- package/lib/services/retail/external/utils.d.ts +2 -0
- package/lib/services/retail/external/utils.js +3 -0
- package/lib/services/retail/external/utils.js.map +1 -0
- package/lib/services/retail/inputs.d.ts +75 -0
- package/lib/services/retail/inputs.js +135 -0
- package/lib/services/retail/inputs.js.map +1 -0
- package/lib/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/lib/{api/RetailAPI → services/retail}/model/LeadFormData.d.ts +1 -1
- package/lib/services/retail/model/LeadFormData.js.map +1 -0
- package/{dist/components/ApplicationLeadForm → lib/services/retail/model}/LeadFormState.d.ts +18 -18
- package/lib/services/retail/model/LeadFormState.js.map +1 -0
- package/lib/services/retail/model/RetailFormContent.d.ts +63 -0
- package/lib/services/retail/model/RetailFormContent.js +4 -0
- package/lib/services/retail/model/RetailFormContent.js.map +1 -0
- package/{dist/components/CreditCardForm → lib/services/retail/utils}/calculateInputs.d.ts +2 -2
- package/lib/services/retail/utils/calculateInputs.js.map +1 -0
- package/lib/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/lib/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/lib/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/{mobile/lib/api/RetailAPI → lib/services/retail}/utils/getUpdateUserProfile.js +1 -2
- package/lib/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/lib/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/lib/ui-kit/DraftDialog/utils.js.map +1 -1
- package/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/lib/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +8 -0
- package/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/lib/ui-kit/FormField/SelectField.d.ts +2 -2
- package/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/lib/ui-kit/FormField/getField.d.ts +2 -1
- package/lib/ui-kit/FormField/getField.js +4 -131
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +70 -60
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/FormField/getPremium.d.ts +1 -1
- package/lib/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/lib/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/lib/ui-kit/FormField/validators.d.ts +3 -2
- package/lib/ui-kit/FormField/validators.js +3 -2
- package/lib/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +1810 -1827
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/mobile/bundle/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/mobile/bundle/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/mobile/bundle/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/mobile/bundle/components/CreditCardForm/renderStep.d.ts +1 -1
- package/mobile/bundle/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/formStateMap.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/getCalcData.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/renderInfo.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/renderInputs.d.ts +2 -2
- package/mobile/bundle/components/CreditForm/renderStep.d.ts +1 -1
- package/mobile/bundle/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/mobile/bundle/components/CreditForm/utils.d.ts +1 -1
- package/mobile/bundle/hooks/useLeadFormData.d.ts +2 -2
- package/mobile/bundle/hooks/useRetailFormStore.d.ts +10 -10
- package/mobile/bundle/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/bundle/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/mobile/bundle/services/retail/external/types.d.ts +10 -0
- package/mobile/bundle/services/retail/external/utils.d.ts +2 -0
- package/mobile/bundle/services/retail/inputs.d.ts +75 -0
- package/mobile/bundle/{api/RetailAPI → services/retail}/model/LeadFormData.d.ts +1 -1
- package/mobile/bundle/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.d.ts +18 -18
- package/mobile/bundle/services/retail/model/RetailFormContent.d.ts +63 -0
- package/{dist/components/CreditForm → mobile/bundle/services/retail/utils}/calculateInputs.d.ts +2 -2
- package/mobile/bundle/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/mobile/bundle/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/bundle/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/mobile/bundle/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/mobile/bundle/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/mobile/bundle/ui-kit/FormField/SelectField.d.ts +2 -2
- package/mobile/bundle/ui-kit/FormField/getField.d.ts +2 -1
- package/mobile/bundle/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/getPremium.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/validators.d.ts +3 -2
- package/mobile/dist/components/ApplicationForm/ApplicationForm.js +1 -3
- package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/mobile/dist/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/mobile/dist/components/ApplicationLeadForm/consents.js +0 -3
- package/mobile/dist/components/ApplicationLeadForm/consents.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/renderInputs.d.ts +2 -0
- package/{dist/components/ApplicationForm → mobile/dist/components/ApplicationLeadForm}/renderInputs.js +4 -3
- package/mobile/dist/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/mobile/dist/components/CreditCardForm/renderInputs.js +2 -1
- package/mobile/dist/components/CreditCardForm/renderInputs.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/renderStep.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/renderStep.js +1 -1
- package/mobile/dist/components/CreditCardForm/renderStep.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/dist/components/CreditForm/formStateMap.d.ts +1 -1
- package/mobile/dist/components/CreditForm/getCalcData.d.ts +1 -1
- package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/mobile/dist/components/CreditForm/renderInfo.d.ts +1 -1
- package/mobile/dist/components/CreditForm/renderInfo.js.map +1 -1
- package/mobile/dist/components/CreditForm/renderInputs.d.ts +2 -2
- package/mobile/dist/components/CreditForm/renderInputs.js +2 -1
- package/mobile/dist/components/CreditForm/renderInputs.js.map +1 -1
- package/mobile/dist/components/CreditForm/renderStep.d.ts +1 -1
- package/mobile/dist/components/CreditForm/renderStep.js +1 -1
- package/mobile/dist/components/CreditForm/renderStep.js.map +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js +1 -1
- package/mobile/dist/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/dist/components/CreditForm/utils.d.ts +1 -1
- package/mobile/dist/hooks/useCreditFormStore.d.ts +0 -0
- package/mobile/dist/hooks/useCreditFormStore.js +1 -0
- package/mobile/dist/hooks/useCreditFormStore.js.map +1 -0
- package/mobile/dist/hooks/useLeadFormData.d.ts +2 -2
- package/mobile/dist/hooks/useLeadFormData.js.map +1 -1
- package/mobile/dist/hooks/useRetailFormStore.d.ts +10 -10
- package/mobile/dist/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/mobile/dist/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/mobile/dist/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/mobile/dist/services/retail/external/types.d.ts +10 -0
- package/mobile/dist/services/retail/external/types.js +2 -0
- package/mobile/dist/services/retail/external/types.js.map +1 -0
- package/mobile/dist/services/retail/external/utils.d.ts +2 -0
- package/mobile/dist/services/retail/external/utils.js +7 -0
- package/mobile/dist/services/retail/external/utils.js.map +1 -0
- package/mobile/dist/services/retail/inputs.d.ts +75 -0
- package/mobile/dist/services/retail/inputs.js +137 -0
- package/mobile/dist/services/retail/inputs.js.map +1 -0
- package/mobile/dist/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/mobile/dist/services/retail/model/LeadFormData.d.ts +7 -0
- package/mobile/dist/services/retail/model/LeadFormData.js.map +1 -0
- package/mobile/dist/services/retail/model/LeadFormState.d.ts +146 -0
- package/mobile/dist/services/retail/model/LeadFormState.js.map +1 -0
- package/mobile/dist/services/retail/model/RetailFormContent.d.ts +63 -0
- package/mobile/dist/services/retail/model/RetailFormContent.js +4 -0
- package/mobile/dist/services/retail/model/RetailFormContent.js.map +1 -0
- package/mobile/dist/services/retail/utils/calculateInputs.d.ts +5 -0
- package/mobile/dist/services/retail/utils/calculateInputs.js.map +1 -0
- package/mobile/dist/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/mobile/dist/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/mobile/dist/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/mobile/dist/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.js +3 -4
- package/mobile/dist/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/mobile/dist/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/mobile/dist/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/mobile/dist/ui-kit/DraftDialog/utils.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +10 -0
- package/mobile/dist/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/mobile/dist/ui-kit/FormField/SelectField.d.ts +2 -2
- package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getField.d.ts +2 -1
- package/mobile/dist/ui-kit/FormField/getField.js +4 -131
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +70 -60
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getPremium.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/mobile/dist/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/validators.d.ts +3 -2
- package/mobile/dist/ui-kit/FormField/validators.js +5 -3
- package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationForm.js +1 -3
- package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadForm.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/ApplicationLeadFormContent.d.ts +0 -9
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.d.ts +8 -1
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js +2 -1
- package/mobile/lib/components/ApplicationLeadForm/GroupedConsents.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/consents.d.ts +2 -2
- package/mobile/lib/components/ApplicationLeadForm/consents.js +0 -3
- package/mobile/lib/components/ApplicationLeadForm/consents.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -2
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/pasreEsiaProfile.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/renderInputs.d.ts +2 -0
- package/mobile/lib/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.js +4 -3
- package/mobile/lib/components/ApplicationLeadForm/renderInputs.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useSaveUserData.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardFormContent.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/getInitialFormState.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/renderInputs.d.ts +2 -2
- package/mobile/lib/components/CreditCardForm/renderInputs.js +2 -1
- package/mobile/lib/components/CreditCardForm/renderInputs.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/renderStep.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/renderStep.js +1 -1
- package/mobile/lib/components/CreditCardForm/renderStep.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.d.ts +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
- package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
- package/mobile/lib/components/CreditForm/formStateMap.d.ts +1 -1
- package/mobile/lib/components/CreditForm/getCalcData.d.ts +1 -1
- package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +1 -1
- package/mobile/lib/components/CreditForm/renderInfo.d.ts +1 -1
- package/mobile/lib/components/CreditForm/renderInfo.js.map +1 -1
- package/mobile/lib/components/CreditForm/renderInputs.d.ts +2 -2
- package/mobile/lib/components/CreditForm/renderInputs.js +2 -1
- package/mobile/lib/components/CreditForm/renderInputs.js.map +1 -1
- package/mobile/lib/components/CreditForm/renderStep.d.ts +1 -1
- package/mobile/lib/components/CreditForm/renderStep.js +1 -1
- package/mobile/lib/components/CreditForm/renderStep.js.map +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.d.ts +2 -2
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js +1 -1
- package/mobile/lib/components/CreditForm/useCreditFormAPI.js.map +1 -1
- package/mobile/lib/components/CreditForm/utils.d.ts +1 -1
- package/mobile/lib/hooks/useCreditFormStore.d.ts +0 -0
- package/mobile/lib/hooks/useCreditFormStore.js +1 -0
- package/mobile/lib/hooks/useCreditFormStore.js.map +1 -0
- package/mobile/lib/hooks/useLeadFormData.d.ts +2 -2
- package/mobile/lib/hooks/useLeadFormData.js.map +1 -1
- package/mobile/lib/hooks/useRetailFormStore.d.ts +10 -10
- package/mobile/lib/services/retail/adaptors/getAdditionalInfoData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getCalculatorData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getCardOptionsData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getCreditFormTaskData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getDeliveryCreditData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getEmploymentData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.d.ts +1 -1
- package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js +1 -1
- package/mobile/lib/services/retail/adaptors/getFamilyStatusAndIncomeData.js.map +1 -1
- package/mobile/lib/services/retail/adaptors/getPersonalInfoData.d.ts +1 -1
- package/mobile/lib/services/retail/external/types.d.ts +10 -0
- package/mobile/lib/services/retail/external/types.js +2 -0
- package/mobile/lib/services/retail/external/types.js.map +1 -0
- package/mobile/lib/services/retail/external/utils.d.ts +2 -0
- package/mobile/lib/services/retail/external/utils.js +3 -0
- package/mobile/lib/services/retail/external/utils.js.map +1 -0
- package/mobile/lib/services/retail/inputs.d.ts +75 -0
- package/mobile/lib/services/retail/inputs.js +135 -0
- package/mobile/lib/services/retail/inputs.js.map +1 -0
- package/mobile/lib/services/retail/model/EOrganizationActivityTypes.js.map +1 -0
- package/mobile/lib/services/retail/model/LeadFormData.d.ts +7 -0
- package/mobile/lib/services/retail/model/LeadFormData.js.map +1 -0
- package/mobile/lib/services/retail/model/LeadFormState.d.ts +146 -0
- package/mobile/lib/services/retail/model/LeadFormState.js.map +1 -0
- package/mobile/lib/services/retail/model/RetailFormContent.d.ts +63 -0
- package/mobile/lib/services/retail/model/RetailFormContent.js +4 -0
- package/mobile/lib/services/retail/model/RetailFormContent.js.map +1 -0
- package/mobile/lib/services/retail/utils/calculateInputs.d.ts +5 -0
- package/mobile/lib/services/retail/utils/calculateInputs.js.map +1 -0
- package/mobile/lib/services/retail/utils/getOrganizationParams.d.ts +17 -0
- package/mobile/lib/services/retail/utils/getOrganizationParams.js.map +1 -0
- package/mobile/lib/services/retail/utils/getUpdateUserProfile.d.ts +3 -0
- package/{lib/api/RetailAPI → mobile/lib/services/retail}/utils/getUpdateUserProfile.js +1 -2
- package/mobile/lib/services/retail/utils/getUpdateUserProfile.js.map +1 -0
- package/mobile/lib/ui-kit/DraftDialog/parseDraftTask.d.ts +1 -1
- package/mobile/lib/ui-kit/DraftDialog/utils.d.ts +2 -2
- package/mobile/lib/ui-kit/DraftDialog/utils.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/CustomFieldProps.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressBranchField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/DesiredMeetingDateField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js +8 -0
- package/mobile/lib/ui-kit/FormField/Fields/consentToReceiveMaterialsField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +6 -1
- package/mobile/lib/ui-kit/FormField/SelectField.d.ts +2 -2
- package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getField.d.ts +2 -1
- package/mobile/lib/ui-kit/FormField/getField.js +4 -131
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getNamesFromInput.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +70 -60
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getPremium.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/updateOrganizationFields.js +1 -1
- package/mobile/lib/ui-kit/FormField/updateOrganizationFields.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/validators.d.ts +3 -2
- package/mobile/lib/ui-kit/FormField/validators.js +3 -2
- package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +8 -10
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +1 -1
- package/mobile/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +0 -10
- package/mobile/src/components/ApplicationLeadForm/GroupedConsents.tsx +14 -4
- package/mobile/src/components/ApplicationLeadForm/consents.ts +2 -5
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -3
- package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +1 -1
- package/mobile/src/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.tsx +6 -8
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +2 -2
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/useLeadFormStore.ts +1 -1
- package/mobile/src/components/ApplicationLeadForm/useSaveUserData.ts +1 -1
- package/mobile/src/components/CreditCardForm/CreditCardFormContent.ts +1 -1
- package/mobile/src/components/CreditCardForm/formStateMap.tsx +2 -2
- package/mobile/src/components/CreditCardForm/getCreditCardFormTaskData.ts +1 -1
- package/mobile/src/components/CreditCardForm/getDeliveryCreditCardData.ts +1 -1
- package/mobile/src/components/CreditCardForm/getInitialFormState.tsx +1 -1
- package/mobile/src/components/CreditCardForm/renderInputs.tsx +4 -3
- package/mobile/src/components/CreditCardForm/renderStep.tsx +6 -2
- package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +2 -2
- package/mobile/src/components/CreditForm/CreditFormStep.tsx +1 -1
- package/mobile/src/components/CreditForm/formStateMap.tsx +1 -1
- package/mobile/src/components/CreditForm/getCalcData.ts +1 -1
- package/mobile/src/components/CreditForm/getInitialFormState.tsx +1 -1
- package/mobile/src/components/CreditForm/renderInfo.tsx +1 -1
- package/mobile/src/components/CreditForm/renderInputs.tsx +4 -3
- package/mobile/src/components/CreditForm/renderStep.tsx +2 -2
- package/mobile/src/components/CreditForm/useCreditFormAPI.tsx +3 -3
- package/mobile/src/components/CreditForm/utils.ts +1 -1
- package/mobile/src/hooks/useCreditFormStore.tsx +0 -0
- package/mobile/src/hooks/useLeadFormData.ts +4 -4
- package/mobile/src/hooks/useRetailFormStore.tsx +5 -5
- package/mobile/src/services/retail/adaptors/getAdditionalInfoData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getCalculatorData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getCardOptionsData.tsx +1 -1
- package/mobile/src/services/retail/adaptors/getCreditFormTaskData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getDeliveryCreditData.ts +1 -1
- package/mobile/src/services/retail/adaptors/getEmploymentData.tsx +1 -1
- package/mobile/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
- package/mobile/src/services/retail/adaptors/getPersonalInfoData.tsx +1 -1
- package/mobile/src/services/retail/external/types.ts +10 -0
- package/mobile/src/services/retail/external/utils.ts +2 -0
- package/mobile/src/services/retail/inputs.tsx +140 -0
- package/mobile/src/{api/RetailAPI → services/retail}/model/LeadFormData.ts +1 -1
- package/mobile/src/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.ts +20 -18
- package/mobile/src/services/retail/model/RetailFormContent.ts +101 -0
- package/mobile/src/{components/CreditCardForm → services/retail/utils}/calculateInputs.ts +4 -4
- package/mobile/src/{api/RetailAPI → services/retail}/utils/getOrganizationParams.ts +6 -6
- package/mobile/src/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.ts +3 -4
- package/mobile/src/ui-kit/DraftDialog/parseDraftTask.ts +1 -1
- package/mobile/src/ui-kit/DraftDialog/utils.ts +2 -2
- package/mobile/src/ui-kit/FormField/CustomFieldProps.ts +2 -2
- package/mobile/src/ui-kit/FormField/Fields/AddressBranchField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +5 -1
- package/mobile/src/ui-kit/FormField/Fields/EmailField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/PartnerCommentsField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/consentToReceiveMaterialsField.tsx +14 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +76 -63
- package/mobile/src/ui-kit/FormField/SelectField.tsx +3 -3
- package/mobile/src/ui-kit/FormField/getField.tsx +11 -135
- package/mobile/src/ui-kit/FormField/getNamesFromInput.tsx +1 -1
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +75 -61
- package/mobile/src/ui-kit/FormField/getPremium.tsx +1 -1
- package/mobile/src/ui-kit/FormField/updateOrganizationFields.ts +3 -3
- package/mobile/src/ui-kit/FormField/validators.ts +8 -4
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationForm.tsx +8 -10
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.tsx +1 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadFormContent.ts +0 -10
- package/src/components/ApplicationLeadForm/GroupedConsents.tsx +14 -4
- package/src/components/ApplicationLeadForm/consents.ts +2 -5
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -3
- package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +1 -1
- package/src/components/ApplicationLeadForm/pasreEsiaProfile.ts +1 -1
- package/src/components/{ApplicationForm → ApplicationLeadForm}/renderInputs.tsx +6 -8
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +2 -2
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +1 -1
- package/src/components/ApplicationLeadForm/useLeadFormStore.ts +1 -1
- package/src/components/ApplicationLeadForm/useSaveUserData.ts +1 -1
- package/src/components/CreditCardForm/CreditCardFormContent.ts +1 -1
- package/src/components/CreditCardForm/formStateMap.tsx +2 -2
- package/src/components/CreditCardForm/getCreditCardFormTaskData.ts +1 -1
- package/src/components/CreditCardForm/getDeliveryCreditCardData.ts +1 -1
- package/src/components/CreditCardForm/getInitialFormState.tsx +1 -1
- package/src/components/CreditCardForm/renderInputs.tsx +4 -3
- package/src/components/CreditCardForm/renderStep.tsx +6 -2
- package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +2 -2
- package/src/components/CreditForm/CreditFormStep.tsx +1 -1
- package/src/components/CreditForm/formStateMap.tsx +1 -1
- package/src/components/CreditForm/getCalcData.ts +1 -1
- package/src/components/CreditForm/getInitialFormState.tsx +1 -1
- package/src/components/CreditForm/renderInfo.tsx +1 -1
- package/src/components/CreditForm/renderInputs.tsx +4 -3
- package/src/components/CreditForm/renderStep.tsx +2 -2
- package/src/components/CreditForm/useCreditFormAPI.tsx +3 -3
- package/src/components/CreditForm/utils.ts +1 -1
- package/src/hooks/useCreditFormStore.tsx +0 -0
- package/src/hooks/useLeadFormData.ts +4 -4
- package/src/hooks/useRetailFormStore.tsx +5 -5
- package/src/icons/IconName.ts +4 -4
- package/src/services/retail/adaptors/getAdditionalInfoData.ts +1 -1
- package/src/services/retail/adaptors/getCalculatorData.ts +1 -1
- package/src/services/retail/adaptors/getCardOptionsData.tsx +1 -1
- package/src/services/retail/adaptors/getCreditFormTaskData.ts +1 -1
- package/src/services/retail/adaptors/getDeliveryCreditData.ts +1 -1
- package/src/services/retail/adaptors/getEmploymentData.tsx +1 -1
- package/src/services/retail/adaptors/getFamilyStatusAndIncomeData.ts +2 -2
- package/src/services/retail/adaptors/getPersonalInfoData.tsx +1 -1
- package/src/services/retail/external/types.ts +10 -0
- package/src/services/retail/external/utils.ts +2 -0
- package/src/services/retail/inputs.tsx +140 -0
- package/src/{api/RetailAPI → services/retail}/model/LeadFormData.ts +1 -1
- package/src/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.ts +20 -18
- package/src/services/retail/model/RetailFormContent.ts +101 -0
- package/{mobile/src/components/CreditForm → src/services/retail/utils}/calculateInputs.ts +4 -4
- package/src/{api/RetailAPI → services/retail}/utils/getOrganizationParams.ts +6 -6
- package/src/{api/RetailAPI → services/retail}/utils/getUpdateUserProfile.ts +3 -4
- package/src/ui-kit/DraftDialog/parseDraftTask.ts +1 -1
- package/src/ui-kit/DraftDialog/utils.ts +2 -2
- package/src/ui-kit/FormField/CustomFieldProps.ts +2 -2
- package/src/ui-kit/FormField/Fields/AddressBranchField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/DesiredMeetingDateField.tsx +5 -1
- package/src/ui-kit/FormField/Fields/EmailField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/PartnerCommentsField.tsx +1 -1
- package/src/ui-kit/FormField/Fields/consentToReceiveMaterialsField.tsx +14 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +76 -63
- package/src/ui-kit/FormField/SelectField.tsx +3 -3
- package/src/ui-kit/FormField/getField.tsx +11 -135
- package/src/ui-kit/FormField/getNamesFromInput.tsx +1 -1
- package/src/ui-kit/FormField/getObjectValidator.tsx +75 -61
- package/src/ui-kit/FormField/getPremium.tsx +1 -1
- package/src/ui-kit/FormField/updateOrganizationFields.ts +3 -3
- package/src/ui-kit/FormField/validators.ts +8 -4
- package/bundle/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/bundle/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/dist/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/dist/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/dist/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/dist/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/dist/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/dist/components/ApplicationForm/renderInputs.js.map +0 -1
- package/dist/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/dist/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/dist/components/CreditForm/calculateInputs.js.map +0 -1
- package/lib/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/lib/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/lib/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/lib/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/lib/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/lib/components/ApplicationForm/renderInputs.js.map +0 -1
- package/lib/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/lib/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/lib/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/lib/components/CreditForm/calculateInputs.d.ts +0 -5
- package/lib/components/CreditForm/calculateInputs.js.map +0 -1
- package/mobile/bundle/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/mobile/bundle/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/mobile/bundle/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/mobile/bundle/components/CreditForm/calculateInputs.d.ts +0 -5
- package/mobile/dist/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/mobile/dist/api/RetailAPI/model/LeadFormData.d.ts +0 -7
- package/mobile/dist/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/mobile/dist/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/mobile/dist/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/mobile/dist/components/ApplicationForm/renderInputs.d.ts +0 -2
- package/mobile/dist/components/ApplicationForm/renderInputs.js.map +0 -1
- package/mobile/dist/components/ApplicationLeadForm/LeadFormState.d.ts +0 -146
- package/mobile/dist/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/mobile/dist/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/mobile/dist/components/CreditCardForm/calculateInputs.js +0 -31
- package/mobile/dist/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/mobile/dist/components/CreditForm/calculateInputs.d.ts +0 -5
- package/mobile/dist/components/CreditForm/calculateInputs.js +0 -31
- package/mobile/dist/components/CreditForm/calculateInputs.js.map +0 -1
- package/mobile/lib/api/RetailAPI/model/EOrganizationActivityTypes.js.map +0 -1
- package/mobile/lib/api/RetailAPI/model/LeadFormData.d.ts +0 -7
- package/mobile/lib/api/RetailAPI/model/LeadFormData.js.map +0 -1
- package/mobile/lib/api/RetailAPI/utils/getOrganizationParams.d.ts +0 -17
- package/mobile/lib/api/RetailAPI/utils/getOrganizationParams.js.map +0 -1
- package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.d.ts +0 -3
- package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +0 -1
- package/mobile/lib/components/ApplicationForm/renderInputs.d.ts +0 -2
- package/mobile/lib/components/ApplicationForm/renderInputs.js.map +0 -1
- package/mobile/lib/components/ApplicationLeadForm/LeadFormState.d.ts +0 -146
- package/mobile/lib/components/ApplicationLeadForm/LeadFormState.js.map +0 -1
- package/mobile/lib/components/CreditCardForm/calculateInputs.d.ts +0 -5
- package/mobile/lib/components/CreditCardForm/calculateInputs.js +0 -27
- package/mobile/lib/components/CreditCardForm/calculateInputs.js.map +0 -1
- package/mobile/lib/components/CreditForm/calculateInputs.d.ts +0 -5
- package/mobile/lib/components/CreditForm/calculateInputs.js +0 -27
- package/mobile/lib/components/CreditForm/calculateInputs.js.map +0 -1
- package/src/components/CreditCardForm/calculateInputs.ts +0 -51
- package/src/components/CreditForm/calculateInputs.ts +0 -51
- /package/bundle/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/dist/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/dist/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/dist/{components/CreditCardForm → services/retail/utils}/calculateInputs.js +0 -0
- /package/dist/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/lib/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/lib/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/lib/{components/CreditCardForm → services/retail/utils}/calculateInputs.js +0 -0
- /package/lib/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/mobile/bundle/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/mobile/dist/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/{dist/components/CreditForm → mobile/dist/services/retail/utils}/calculateInputs.js +0 -0
- /package/mobile/dist/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.d.ts +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.js +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/model/LeadFormData.js +0 -0
- /package/mobile/lib/{components/ApplicationLeadForm → services/retail/model}/LeadFormState.js +0 -0
- /package/{lib/components/CreditForm → mobile/lib/services/retail/utils}/calculateInputs.js +0 -0
- /package/mobile/lib/{api/RetailAPI → services/retail}/utils/getOrganizationParams.js +0 -0
- /package/mobile/src/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.ts +0 -0
- /package/src/{api/RetailAPI → services/retail}/model/EOrganizationActivityTypes.ts +0 -0
|
@@ -1563,8 +1563,6 @@
|
|
|
1563
1563
|
const isValidationSuccess = (info) => !info?.length;
|
|
1564
1564
|
const validator = (predicate) => (message) => (_) => predicate(_) ? [] : [message];
|
|
1565
1565
|
|
|
1566
|
-
const pattern = (regexp) => validator((_) => typeof _ === 'string' && regexp.test(_));
|
|
1567
|
-
|
|
1568
1566
|
const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
|
|
1569
1567
|
|
|
1570
1568
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
@@ -1580,7 +1578,8 @@
|
|
|
1580
1578
|
const serieValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 4)(errorMsg);
|
|
1581
1579
|
const numberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 6)(errorMsg);
|
|
1582
1580
|
const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
|
|
1583
|
-
const
|
|
1581
|
+
const phoneValidate = (email) => /^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/.test(email);
|
|
1582
|
+
const phoneValidator = (errorMsg) => validator(phoneValidate)(errorMsg);
|
|
1584
1583
|
const agreementValidator = validator((_) => typeof _ === 'boolean' && _)('Согласие обязательно');
|
|
1585
1584
|
const snilsValidate = (snils) => {
|
|
1586
1585
|
const snl = String(snils).replace(/[^0-9]+/g, '');
|
|
@@ -1619,74 +1618,62 @@
|
|
|
1619
1618
|
};
|
|
1620
1619
|
const limitedBirthdayValidator = () => validator(limitedBirthdayValidate)(AGE_ERROR_MESSAGE);
|
|
1621
1620
|
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1621
|
+
const validatorConsentsObj = {
|
|
1622
|
+
processPersonalDataFlg: agreementValidator,
|
|
1623
|
+
consentProviderFlg: agreementValidator,
|
|
1624
|
+
consentInformFlg: agreementValidator,
|
|
1625
|
+
consentPfrFlg: agreementValidator,
|
|
1626
|
+
consentOthersFlg: agreementValidator,
|
|
1627
|
+
};
|
|
1628
|
+
const validatorCreditCardObj = {
|
|
1629
|
+
addressCourier: addressDaDataValidator(),
|
|
1630
|
+
paymentSystem: defaultValidator('Укажите тип платежной системы'),
|
|
1631
|
+
currency: defaultValidator('Укажите валюту'),
|
|
1632
|
+
cardCategory: defaultValidator('Укажите категорию карты'),
|
|
1633
|
+
codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
|
|
1634
|
+
confirmationIncome: defaultSelectValidator(),
|
|
1635
|
+
methodObtain: defaultValidator(),
|
|
1636
|
+
deliveryDate: defaultValidator('Укажите дату доставки'),
|
|
1637
|
+
};
|
|
1638
|
+
const validatorRetailObj = {
|
|
1639
|
+
organization: defaultSelectValidator('Выберите тип организации'),
|
|
1640
|
+
organizationAddress: addressOrganizationValidator(),
|
|
1631
1641
|
organizationPhone: phoneValidator('Укажите номер телефона'),
|
|
1632
|
-
|
|
1642
|
+
organizationName: defaultValidator('Укажите наименование организации'),
|
|
1643
|
+
legalForm: defaultValidator('Укажите ОПФ'),
|
|
1644
|
+
generalSeniority: jobNumberValidator('Укажите количество лет стажа'),
|
|
1645
|
+
lastJobExperience: jobNumberValidator('Укажите стаж на последнем месте работы'),
|
|
1646
|
+
experience5Years: jobNumberValidator('Укажите общий стаж за последние 5 лет'),
|
|
1647
|
+
jobsNumber: jobNumberValidator('Укажите количество мест работы за последние 5 лет'),
|
|
1648
|
+
beginDate: defaultValidator('Укажите дату заключения трудового договора'),
|
|
1649
|
+
addressFact: addressDaDataValidator(),
|
|
1650
|
+
addressRegistration: addressDaDataValidator(),
|
|
1651
|
+
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
1652
|
+
addressMatch: defaultValidator(),
|
|
1653
|
+
sex: defaultValidator('Укажите свой пол'),
|
|
1633
1654
|
limitedBirthday: limitedBirthdayValidator(),
|
|
1634
1655
|
birthPlace: defaultValidator('Укажите место рождения'),
|
|
1635
1656
|
education: defaultSelectValidator('Выберите ваше образование'),
|
|
1636
1657
|
housing: defaultSelectValidator('Выберите тип жилья'),
|
|
1637
|
-
employment: defaultSelectValidator('Выберите информацию о трудоустройстве'),
|
|
1638
|
-
organization: defaultSelectValidator('Выберите тип организации'),
|
|
1639
1658
|
amountWorkers: defaultSelectValidator('Выберите информацию о количестве сотрудников'),
|
|
1659
|
+
employment: defaultSelectValidator('Выберите информацию о трудоустройстве'),
|
|
1640
1660
|
employerActivities: defaultSelectValidator('Выберите вид деятельности организации'),
|
|
1641
1661
|
employerOrganization: defaultSelectValidator('Выберите вид организации'),
|
|
1642
1662
|
positionOrganization: defaultSelectValidator('Выберите вашу должность'),
|
|
1643
|
-
dulSerie: serieValidator('Укажите серию паспорта'),
|
|
1644
|
-
dulNumber: numberValidator('Укажите номер паспорта'),
|
|
1645
|
-
dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
|
|
1646
|
-
dulSubdivisionCode: numberValidator('Укажите код подразделения'),
|
|
1647
|
-
dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
|
|
1648
|
-
email: emailValidator('Укажите электронную почту'),
|
|
1649
|
-
fullName: defaultValidator(),
|
|
1650
|
-
inn: innValidator('Укажите ИНН'),
|
|
1651
|
-
legalForm: defaultValidator('Укажите ОПФ'),
|
|
1652
|
-
organizationName: defaultValidator('Укажите наименование организации'),
|
|
1653
|
-
generalSeniority: jobNumberValidator('Укажите количество лет стажа'),
|
|
1654
|
-
lastJobExperience: jobNumberValidator('Укажите стаж на последнем месте работы'),
|
|
1655
|
-
experience5Years: jobNumberValidator('Укажите общий стаж за последние 5 лет'),
|
|
1656
|
-
jobsNumber: jobNumberValidator('Укажите количество мест работы за последние 5 лет'),
|
|
1657
|
-
beginDate: defaultValidator('Укажите дату заключения трудового договора'),
|
|
1658
|
-
addressFact: addressDaDataValidator(),
|
|
1659
|
-
partnerComments: defaultValidator(),
|
|
1660
|
-
collectionCount: defaultValidator(),
|
|
1661
|
-
comment: defaultValidator(),
|
|
1662
|
-
acquiringType: defaultSelectValidator(),
|
|
1663
|
-
feedbackMethod: defaultSelectValidator(),
|
|
1664
|
-
serviceType: defaultSelectValidator(),
|
|
1665
|
-
serviceDirection: defaultSelectValidator(),
|
|
1666
|
-
regionRetail: defaultSelectValidator('Выберите регион'),
|
|
1667
|
-
meetingDay: defaultValidator(),
|
|
1668
|
-
product: defaultValidator(),
|
|
1669
|
-
localities: defaultValidator(),
|
|
1670
|
-
consentDataProcessing: agreementValidator,
|
|
1671
|
-
annualRevenue: defaultValidator(),
|
|
1672
|
-
consentToReceiveMaterials: agreementValidator,
|
|
1673
|
-
processPersonalDataFlg: agreementValidator,
|
|
1674
|
-
consentProviderFlg: agreementValidator,
|
|
1675
|
-
consentPfrFlg: agreementValidator,
|
|
1676
|
-
consentOthersFlg: agreementValidator,
|
|
1677
|
-
consentInformFlg: agreementValidator,
|
|
1678
1663
|
familyStatus: defaultSelectValidator('Выберите семейное положение'),
|
|
1679
|
-
children: lengthStringValidator(2, 'Укажите количество детей'),
|
|
1680
1664
|
familyMembers: lengthStringValidator(2, 'Укажите количество членов семьи'),
|
|
1665
|
+
children: lengthStringValidator(2, 'Укажите количество детей'),
|
|
1681
1666
|
dependents: lengthStringValidator(2, 'Укажите количество иждивенцев'),
|
|
1682
1667
|
totalIncome: lengthStringValidator(19, 'Укажите среднемесячный доход от основной зарплаты'),
|
|
1683
1668
|
expenses: lengthStringValidator(10, 'Укажите сумму обязательных выплат'),
|
|
1684
1669
|
snils: snilsValidator('Некорректный номер СНИЛС'),
|
|
1685
1670
|
conscription: defaultValidator(),
|
|
1686
1671
|
armyIdFlg: agreementValidator,
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1672
|
+
dulSerie: serieValidator('Укажите серию паспорта'),
|
|
1673
|
+
dulNumber: numberValidator('Укажите номер паспорта'),
|
|
1674
|
+
dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
|
|
1675
|
+
dulSubdivisionCode: numberValidator('Укажите код подразделения'),
|
|
1676
|
+
dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
|
|
1690
1677
|
participantDateRegistration: defaultValidator('Укажите дату регистрации'),
|
|
1691
1678
|
retirementIncome: defaultValidator(),
|
|
1692
1679
|
otherIncome: defaultValidator(),
|
|
@@ -1698,15 +1685,37 @@
|
|
|
1698
1685
|
legalEntityName: defaultValidator(),
|
|
1699
1686
|
bankEmployeeCode: defaultValidator(),
|
|
1700
1687
|
partInBusiness: defaultValidator(),
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1688
|
+
regionRetail: defaultSelectValidator('Выберите регион'),
|
|
1689
|
+
};
|
|
1690
|
+
const validatorObj = {
|
|
1691
|
+
fullName: defaultValidator(),
|
|
1692
|
+
addressBranch: defaultSelectValidator(),
|
|
1693
|
+
desiredMeetingDate: defaultValidator(),
|
|
1694
|
+
product: defaultValidator(),
|
|
1695
|
+
localities: defaultValidator(),
|
|
1696
|
+
partnerComments: defaultValidator(),
|
|
1697
|
+
collectionCount: defaultValidator(),
|
|
1698
|
+
acquiringType: defaultSelectValidator(),
|
|
1699
|
+
serviceType: defaultSelectValidator(),
|
|
1700
|
+
annualRevenue: defaultValidator(),
|
|
1701
|
+
feedbackMethod: defaultSelectValidator(),
|
|
1702
|
+
serviceDirection: defaultSelectValidator(),
|
|
1703
|
+
secondaryPhone: phoneValidator('Укажите номер телефона'),
|
|
1704
|
+
region: defaultSelectValidator(),
|
|
1705
|
+
surname: nameValidator('Укажите свою фамилию'),
|
|
1706
|
+
name: nameValidator('Укажите своё имя'),
|
|
1707
|
+
middleName: nameValidator('Укажите своё отчество'),
|
|
1708
|
+
birthday: defaultValidator('Укажите дату рождения'),
|
|
1709
|
+
phone: phoneValidator('Укажите номер телефона'),
|
|
1710
|
+
email: emailValidator('Укажите электронную почту'),
|
|
1711
|
+
inn: innValidator('Укажите ИНН'),
|
|
1712
|
+
comment: defaultValidator(),
|
|
1713
|
+
typeForm: defaultValidator(),
|
|
1714
|
+
consentToReceiveMaterials: agreementValidator,
|
|
1715
|
+
consentDataProcessing: agreementValidator,
|
|
1716
|
+
...validatorConsentsObj,
|
|
1717
|
+
...validatorRetailObj,
|
|
1718
|
+
...validatorCreditCardObj,
|
|
1710
1719
|
};
|
|
1711
1720
|
const getObjectValidator = (inputs) => {
|
|
1712
1721
|
const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
|
|
@@ -1851,825 +1860,412 @@
|
|
|
1851
1860
|
})), ...getValidation(field('addressBranch'), validatorObj.addressBranch, input?.required), isSearch: true }));
|
|
1852
1861
|
});
|
|
1853
1862
|
|
|
1854
|
-
const
|
|
1855
|
-
const
|
|
1856
|
-
const
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
1861
|
-
}
|
|
1862
|
-
}, [value, field('addressRegistration').value]);
|
|
1863
|
-
const onDaDataChange = useCallback((item) => {
|
|
1864
|
-
field?.(fieldName)?.onChange?.({
|
|
1865
|
-
apartment: item?.data?.flat,
|
|
1866
|
-
city: item?.data?.city,
|
|
1867
|
-
district: item?.data?.area_with_type,
|
|
1868
|
-
fullAddress: item?.value,
|
|
1869
|
-
fiasCode: item?.data?.fias_id,
|
|
1870
|
-
house: item?.data?.house,
|
|
1871
|
-
locality: item?.data?.settlement_with_type,
|
|
1872
|
-
okatoRegionCode: item?.data?.okato,
|
|
1873
|
-
postcode: item?.data?.postal_code,
|
|
1874
|
-
region: item?.data?.region,
|
|
1875
|
-
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
1876
|
-
street: item?.data?.house,
|
|
1877
|
-
qc: item?.data?.qc,
|
|
1878
|
-
qcComplete: item?.data?.qc_complete,
|
|
1879
|
-
qcHouse: item?.data?.qc_house,
|
|
1880
|
-
});
|
|
1881
|
-
}, []);
|
|
1882
|
-
const onChange = useCallback((val) => {
|
|
1883
|
-
field?.(fieldName)?.onChange?.({
|
|
1884
|
-
apartment: '',
|
|
1885
|
-
city: '',
|
|
1886
|
-
district: '',
|
|
1887
|
-
fullAddress: val,
|
|
1888
|
-
fiasCode: '',
|
|
1889
|
-
house: '',
|
|
1890
|
-
locality: '',
|
|
1891
|
-
okatoRegionCode: '',
|
|
1892
|
-
postcode: '',
|
|
1893
|
-
region: '',
|
|
1894
|
-
regionCode: '',
|
|
1895
|
-
street: '',
|
|
1896
|
-
qc: '',
|
|
1897
|
-
qcComplete: '',
|
|
1898
|
-
qcHouse: '',
|
|
1899
|
-
});
|
|
1900
|
-
}, []);
|
|
1901
|
-
return (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", disabled: value, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
|
|
1902
|
-
});
|
|
1903
|
-
|
|
1904
|
-
const ESIA_FIELD_NAME = 'esiaAccountTypeCd';
|
|
1905
|
-
const isEsiaAuthorize = (field, name) => Boolean(field(ESIA_FIELD_NAME)?.value?.key) && field(name).value;
|
|
1906
|
-
|
|
1907
|
-
const AddressField = JSX(({ field, input }) => {
|
|
1908
|
-
const fieldName = input?.name || 'addressRegistration';
|
|
1909
|
-
const fieldValue = field(fieldName).value;
|
|
1910
|
-
const onDaDataChange = useCallback((item) => {
|
|
1911
|
-
field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
|
|
1912
|
-
}, []);
|
|
1913
|
-
const onChange = useCallback((value) => {
|
|
1914
|
-
field?.(fieldName)?.onChange?.({
|
|
1915
|
-
apartment: '',
|
|
1916
|
-
city: '',
|
|
1917
|
-
district: '',
|
|
1918
|
-
fullAddress: value,
|
|
1919
|
-
fiasCode: '',
|
|
1920
|
-
house: '',
|
|
1921
|
-
locality: '',
|
|
1922
|
-
okatoRegionCode: '',
|
|
1923
|
-
postcode: '',
|
|
1924
|
-
region: '',
|
|
1925
|
-
regionCode: '',
|
|
1926
|
-
street: '',
|
|
1927
|
-
qc: '',
|
|
1928
|
-
qcComplete: '',
|
|
1929
|
-
qcHouse: '',
|
|
1930
|
-
});
|
|
1863
|
+
const useNormalizedInput = (props, { normalize, format }) => {
|
|
1864
|
+
const { value, onFocus, onBlur, onChange } = props;
|
|
1865
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1866
|
+
const handleFocus = useCallback((ev) => {
|
|
1867
|
+
setIsFocused(true);
|
|
1868
|
+
onFocus && onFocus(ev);
|
|
1931
1869
|
}, []);
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
postcode: item?.data?.postal_code,
|
|
1944
|
-
region: item?.data?.region,
|
|
1945
|
-
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
1946
|
-
street: item?.data?.street,
|
|
1947
|
-
qc: item?.data?.qc,
|
|
1948
|
-
qcComplete: item?.data?.qc_complete,
|
|
1949
|
-
qcHouse: item?.data?.qc_house,
|
|
1950
|
-
});
|
|
1870
|
+
const handleBlur = useCallback(() => {
|
|
1871
|
+
setIsFocused(false);
|
|
1872
|
+
onChange && onChange(normalize(value));
|
|
1873
|
+
onBlur && onBlur();
|
|
1874
|
+
}, [onChange, value]);
|
|
1875
|
+
return {
|
|
1876
|
+
value: (isFocused || !format ? value : format(value)),
|
|
1877
|
+
onFocus: handleFocus,
|
|
1878
|
+
onBlur: handleBlur,
|
|
1879
|
+
};
|
|
1880
|
+
};
|
|
1951
1881
|
|
|
1952
|
-
const
|
|
1953
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill: pathFill, ...options }, i) => {
|
|
1954
|
-
const resultOptions = { ...commonOptions, ...options };
|
|
1955
|
-
return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
|
|
1956
|
-
}) }));
|
|
1957
|
-
});
|
|
1882
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
1958
1883
|
|
|
1959
|
-
|
|
1884
|
+
function parseDecimal(value) {
|
|
1885
|
+
const rawValue = (value || '').replace(/\D/g, '');
|
|
1886
|
+
const unsafeDecimal = parseInt(rawValue, 10);
|
|
1887
|
+
return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
|
|
1888
|
+
}
|
|
1960
1889
|
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
e.preventDefault();
|
|
1975
|
-
onChange && onChange(!value);
|
|
1976
|
-
}, [onChange, disabled, value]);
|
|
1977
|
-
const icon = isRadio ? (jsx("div", { className: "absolute left-1 w-3 h-3 rounded-full bg-primary-main" })) : (jsx(SVG, { paths: CHECK_PATHS, className: "absolute left-1 ml-px block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }));
|
|
1978
|
-
return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$3(text)] }) }));
|
|
1979
|
-
});
|
|
1980
|
-
const renderText$3 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
|
|
1981
|
-
const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
|
|
1982
|
-
const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
|
|
1983
|
-
const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
|
|
1984
|
-
|
|
1985
|
-
const CheckboxWithError = JSX(({ className, text, value, key, disabled, error, onChange }) => (jsxs("div", { className: style('shrink-0', className), children: [jsx(Checkbox, { text: text, value: value, disabled: disabled, onChange: onChange }, key), renderErrorText(error)] })));
|
|
1890
|
+
function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
|
|
1891
|
+
const rangeValue = list.length ? list.indexOf(value) : value;
|
|
1892
|
+
const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
|
|
1893
|
+
const percentage = (rangeValueShift * 100) / (max - min);
|
|
1894
|
+
const inputStyle = {
|
|
1895
|
+
backgroundSize: `${percentage.toFixed(2)}% 100%`,
|
|
1896
|
+
};
|
|
1897
|
+
return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
|
|
1898
|
+
const rawValue = parseDecimal(ev.target?.value);
|
|
1899
|
+
const newValue = list.length ? list[rawValue] : rawValue;
|
|
1900
|
+
onChange && onChange(newValue || 0);
|
|
1901
|
+
}) }) })] }));
|
|
1902
|
+
}
|
|
1986
1903
|
|
|
1987
|
-
const
|
|
1988
|
-
|
|
1904
|
+
const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
|
|
1905
|
+
const DEFAULT_MIN = 1;
|
|
1906
|
+
const DEFAULT_MAX = 100;
|
|
1907
|
+
const InputRange = JSX((props) => {
|
|
1908
|
+
const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
|
|
1909
|
+
const normalizedProps = useNormalizedInput(props, {
|
|
1910
|
+
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
1911
|
+
format: toLocalNumberFormat(),
|
|
1912
|
+
});
|
|
1913
|
+
const handleChange = useCallback((ev) => {
|
|
1914
|
+
onChange && onChange(parseDecimal(ev.target?.value));
|
|
1915
|
+
}, [onChange]);
|
|
1916
|
+
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
1989
1917
|
});
|
|
1918
|
+
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
1919
|
+
const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
|
|
1990
1920
|
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
1996
|
-
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
1997
|
-
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
1998
|
-
if (isLoad || !points) {
|
|
1999
|
-
return;
|
|
2000
|
-
}
|
|
2001
|
-
map.geoObjects.removeAll();
|
|
2002
|
-
if (!points.length) {
|
|
2003
|
-
return;
|
|
2004
|
-
}
|
|
2005
|
-
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
2006
|
-
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
2007
|
-
if (points.length && points.every((_) => 'type' in _)) {
|
|
2008
|
-
const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
|
|
2009
|
-
const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
|
|
2010
|
-
const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
|
|
2011
|
-
officeClusterer.add(officesGeoObjects);
|
|
2012
|
-
remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
|
|
2013
|
-
map.geoObjects.add(remoteWorkplaceClusterer);
|
|
2014
|
-
map.geoObjects.add(officeClusterer);
|
|
2015
|
-
}
|
|
2016
|
-
else {
|
|
2017
|
-
const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
|
|
2018
|
-
officeClusterer.add(geoObjects);
|
|
2019
|
-
map.geoObjects.add(officeClusterer);
|
|
2020
|
-
}
|
|
2021
|
-
map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
|
|
2022
|
-
if (map.getZoom() > 10) {
|
|
2023
|
-
map.setZoom(10);
|
|
2024
|
-
}
|
|
2025
|
-
});
|
|
2026
|
-
}
|
|
2027
|
-
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
2028
|
-
return new yandexMaps.Clusterer({
|
|
2029
|
-
clusterIcons: [
|
|
2030
|
-
{
|
|
2031
|
-
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2032
|
-
size: [78, 84],
|
|
2033
|
-
offset: [-35, -50],
|
|
2034
|
-
},
|
|
2035
|
-
],
|
|
2036
|
-
clusterIconContentLayout,
|
|
2037
|
-
clusterHideIconOnBalloonOpen: false,
|
|
2038
|
-
geoObjectHideIconOnBalloonOpen: false,
|
|
2039
|
-
});
|
|
2040
|
-
};
|
|
2041
|
-
const defineGeoObjects = (pointArr, type, yandexMaps) => {
|
|
2042
|
-
return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
|
|
2043
|
-
balloonContentHeader: content?.header,
|
|
2044
|
-
balloonContentBody: content?.body,
|
|
2045
|
-
balloonContentFooter: content?.footer,
|
|
2046
|
-
hintContent: content?.hint,
|
|
2047
|
-
}, {
|
|
2048
|
-
iconLayout: 'default#image',
|
|
2049
|
-
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2050
|
-
iconImageSize: [78, 84],
|
|
2051
|
-
iconImageOffset: [-35, -50],
|
|
2052
|
-
}));
|
|
2053
|
-
};
|
|
1921
|
+
const MIN_CREDIT_AMOUNT = 1000;
|
|
1922
|
+
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
1923
|
+
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
1924
|
+
const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
|
|
2054
1925
|
|
|
2055
|
-
const
|
|
2056
|
-
focus: 'focus:border-primary-text focus:border',
|
|
2057
|
-
hover: 'hover:bg-primary-hover',
|
|
2058
|
-
active: 'active:bg-primary-active',
|
|
2059
|
-
font: 'text-center font-sans',
|
|
2060
|
-
};
|
|
1926
|
+
const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
|
|
2061
1927
|
|
|
2062
|
-
const
|
|
2063
|
-
...defaultStyle,
|
|
2064
|
-
border: 'border border-transparent rounded-md',
|
|
2065
|
-
position: 'absolute flex items-center justify-center',
|
|
2066
|
-
};
|
|
2067
|
-
const renderUserGeolocation = (map, yandexMaps, className) => {
|
|
2068
|
-
const setUserGeoLocation = () => {
|
|
2069
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2070
|
-
// @ts-ignore
|
|
2071
|
-
yandexMaps.geolocation
|
|
2072
|
-
.get({
|
|
2073
|
-
provider: 'yandex',
|
|
2074
|
-
autoReverseGeocode: true,
|
|
2075
|
-
mapStateAutoApply: true,
|
|
2076
|
-
})
|
|
2077
|
-
.then(function (result) {
|
|
2078
|
-
map.current.geoObjects.add(result.geoObjects);
|
|
2079
|
-
});
|
|
2080
|
-
};
|
|
2081
|
-
return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
|
|
2082
|
-
};
|
|
1928
|
+
const BankEmpoleeField = JSX(({ field }) => (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })));
|
|
2083
1929
|
|
|
2084
|
-
const
|
|
2085
|
-
|
|
2086
|
-
const script = document.getElementById(url);
|
|
2087
|
-
if (script) {
|
|
2088
|
-
const ns = getNS(namespaceName);
|
|
2089
|
-
if (ns) {
|
|
2090
|
-
return Promise.resolve(ns);
|
|
2091
|
-
}
|
|
2092
|
-
else {
|
|
2093
|
-
return new Promise((resolve) => {
|
|
2094
|
-
script.addEventListener('load', () => {
|
|
2095
|
-
resolve(getNS(namespaceName));
|
|
2096
|
-
});
|
|
2097
|
-
});
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
else {
|
|
2101
|
-
return new Promise((resolve, reject) => {
|
|
2102
|
-
const newScript = document.createElement('script');
|
|
2103
|
-
newScript.src = url;
|
|
2104
|
-
newScript.async = true;
|
|
2105
|
-
newScript.id = url;
|
|
2106
|
-
newScript.addEventListener('load', () => {
|
|
2107
|
-
resolve(getNS(namespaceName));
|
|
2108
|
-
});
|
|
2109
|
-
newScript.addEventListener('error', (error) => {
|
|
2110
|
-
reject(error);
|
|
2111
|
-
});
|
|
2112
|
-
document.head.appendChild(newScript);
|
|
2113
|
-
});
|
|
2114
|
-
}
|
|
2115
|
-
};
|
|
2116
|
-
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
2117
|
-
const [externalNS, setExternalNS] = useState(undefined);
|
|
1930
|
+
const useElementSpace = (ref, heightEl) => {
|
|
1931
|
+
const [spaceAbove, setSpaceAbove] = useState(false);
|
|
2118
1932
|
useEffect(() => {
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2125
|
-
})
|
|
2126
|
-
.catch((error) => {
|
|
2127
|
-
console.error(`Failed to initialize external namespace: ${error}`);
|
|
2128
|
-
});
|
|
2129
|
-
return () => {
|
|
2130
|
-
isMounted = false;
|
|
2131
|
-
if (unmountNS) {
|
|
2132
|
-
const script = document.getElementById(url);
|
|
2133
|
-
if (script) {
|
|
2134
|
-
document.head.removeChild(script);
|
|
2135
|
-
}
|
|
2136
|
-
setExternalNS(undefined);
|
|
1933
|
+
const handleResize = () => {
|
|
1934
|
+
if (ref?.current) {
|
|
1935
|
+
const { top } = ref.current.getBoundingClientRect();
|
|
1936
|
+
const hasSpaceAbove = top > heightEl;
|
|
1937
|
+
setSpaceAbove(hasSpaceAbove);
|
|
2137
1938
|
}
|
|
2138
1939
|
};
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
const useYandexMaps = () => {
|
|
2145
|
-
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
2146
|
-
return useExternalNS(YMAPS_NAMESPACE, url, false);
|
|
1940
|
+
handleResize();
|
|
1941
|
+
window.addEventListener('resize', handleResize);
|
|
1942
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
1943
|
+
}, [ref]);
|
|
1944
|
+
return spaceAbove;
|
|
2147
1945
|
};
|
|
2148
1946
|
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
1947
|
+
const DAY_COUNT = 6;
|
|
1948
|
+
const WEEK_COUNT = 7;
|
|
1949
|
+
const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
|
|
1950
|
+
const calendarCells = [];
|
|
1951
|
+
let dayCounter = 1;
|
|
1952
|
+
for (let i = 0; i < DAY_COUNT; i++) {
|
|
1953
|
+
const rowCells = [];
|
|
1954
|
+
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
1955
|
+
if (i === 0 && j < firstDayOfWeek) {
|
|
1956
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1957
|
+
}
|
|
1958
|
+
else if (dayCounter > totalDays) {
|
|
1959
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
const currentDate = new Date(currentYear, currentMonth, dayCounter);
|
|
1963
|
+
const isToday = checkIsToday(currentDate, today);
|
|
1964
|
+
const isDisabled = checkIsDisabled(currentDate, min, max);
|
|
1965
|
+
rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
|
|
1966
|
+
dayCounter++;
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
1970
|
+
}
|
|
1971
|
+
return calendarCells;
|
|
2153
1972
|
};
|
|
2154
|
-
|
|
2155
|
-
const
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
// Ready function may be called few times, but must be called once
|
|
2181
|
-
if (map.current) {
|
|
2182
|
-
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
2183
|
-
return;
|
|
2184
|
-
}
|
|
2185
|
-
map.current = new yandexMaps.Map(parentDiv.current, {
|
|
2186
|
-
center: getCenterPoint(points),
|
|
2187
|
-
zoom,
|
|
2188
|
-
controls: [],
|
|
2189
|
-
suppressMapOpenBlock: true,
|
|
2190
|
-
});
|
|
2191
|
-
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
2192
|
-
});
|
|
2193
|
-
}
|
|
2194
|
-
// zoom к выбранному отделению банка в рамках задачи по retail
|
|
2195
|
-
if (map.current && selectedAddress) {
|
|
2196
|
-
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
2197
|
-
const firstGeoObject = res.geoObjects.get(0);
|
|
2198
|
-
const coords = firstGeoObject.geometry.getCoordinates();
|
|
2199
|
-
map.current.setCenter(coords);
|
|
2200
|
-
map.current.setZoom(18);
|
|
2201
|
-
});
|
|
2202
|
-
}
|
|
2203
|
-
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
2204
|
-
if (!yandexMaps) {
|
|
2205
|
-
return null;
|
|
2206
|
-
}
|
|
2207
|
-
const zIndex = 'z-10';
|
|
2208
|
-
return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
1973
|
+
const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
|
|
1974
|
+
const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
|
|
1975
|
+
const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
|
|
1976
|
+
'border-transparent hover:bg-gray': !isToday,
|
|
1977
|
+
}, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
|
|
1978
|
+
|
|
1979
|
+
const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
|
|
1980
|
+
const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
|
|
1981
|
+
const handleDateClick = useCallback((date) => {
|
|
1982
|
+
onDateSelect(date);
|
|
1983
|
+
setValue(false);
|
|
1984
|
+
}, []);
|
|
1985
|
+
const { firstDayOfWeek, totalDays } = useMemo(() => ({
|
|
1986
|
+
firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
|
|
1987
|
+
totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
|
|
1988
|
+
}), [currentYear, currentMonth]);
|
|
1989
|
+
return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
|
|
1990
|
+
firstDayOfWeek,
|
|
1991
|
+
today,
|
|
1992
|
+
totalDays,
|
|
1993
|
+
currentYear,
|
|
1994
|
+
currentMonth,
|
|
1995
|
+
min,
|
|
1996
|
+
max,
|
|
1997
|
+
onDateClick: handleDateClick,
|
|
1998
|
+
}) })] }));
|
|
2209
1999
|
});
|
|
2210
|
-
const getCenterPoint = (points) => {
|
|
2211
|
-
const centerCoords = [
|
|
2212
|
-
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
2213
|
-
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
2214
|
-
];
|
|
2215
|
-
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
2216
|
-
};
|
|
2217
|
-
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
2218
|
-
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
2219
2000
|
|
|
2220
|
-
const
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2001
|
+
const months = [
|
|
2002
|
+
'Январь',
|
|
2003
|
+
'Февраль',
|
|
2004
|
+
'Март',
|
|
2005
|
+
'Апрель',
|
|
2006
|
+
'Май',
|
|
2007
|
+
'Июнь',
|
|
2008
|
+
'Июль',
|
|
2009
|
+
'Август',
|
|
2010
|
+
'Сентябрь',
|
|
2011
|
+
'Октябрь',
|
|
2012
|
+
'Ноябрь',
|
|
2013
|
+
'Декабрь',
|
|
2014
|
+
];
|
|
2015
|
+
|
|
2016
|
+
function normalizeWithMask(value, pattern) {
|
|
2017
|
+
const valueNumbers = value.replace(/\D/g, '');
|
|
2018
|
+
if (valueNumbers === '' || valueNumbers.length === pattern.length) {
|
|
2019
|
+
return value;
|
|
2228
2020
|
}
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
},
|
|
2237
|
-
credentials: 'include',
|
|
2238
|
-
body: body ? JSON.stringify(body) : null,
|
|
2239
|
-
});
|
|
2021
|
+
const patternInArr = [...pattern];
|
|
2022
|
+
const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
|
|
2023
|
+
const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
|
|
2024
|
+
const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
|
|
2025
|
+
const resultInArr = patternInArr.map(applyPlaceholder);
|
|
2026
|
+
const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
|
|
2027
|
+
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
2240
2028
|
}
|
|
2241
|
-
const
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
};
|
|
2245
|
-
|
|
2246
|
-
const fetchRegionOffices = async (regionKey) => {
|
|
2247
|
-
const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
|
|
2248
|
-
regionRfCd: {
|
|
2249
|
-
key: regionKey,
|
|
2250
|
-
},
|
|
2251
|
-
cashCardFlg: true,
|
|
2252
|
-
});
|
|
2253
|
-
return (response?.offices?.map((office) => ({
|
|
2254
|
-
...office,
|
|
2255
|
-
gpsLatitude: formatCoordinate(office.latitude ?? DEFAULT_CENTER_COORDS[0]),
|
|
2256
|
-
gpsLongitude: formatCoordinate(office.longitude ?? DEFAULT_CENTER_COORDS[1]),
|
|
2257
|
-
})) || []);
|
|
2258
|
-
};
|
|
2259
|
-
const formatCoordinate = (coordinate) => Number(coordinate.toString().replace(',', '.'));
|
|
2029
|
+
const isPlaceholder$1 = (_) => _ === '_';
|
|
2030
|
+
const isDigit$1 = (_) => /\d/.test(_);
|
|
2031
|
+
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2260
2032
|
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2263
|
-
const onToggle = useCallback(() => {
|
|
2264
|
-
setIsUnfolded((_) => !_);
|
|
2265
|
-
}, []);
|
|
2266
|
-
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2267
|
-
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2268
|
-
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2269
|
-
});
|
|
2033
|
+
const START_YEAR = 1940;
|
|
2034
|
+
const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
|
|
2270
2035
|
|
|
2271
|
-
|
|
2036
|
+
const ICON_PROPS$1 = {
|
|
2037
|
+
name: 'CalendarIcon',
|
|
2038
|
+
iconVersion: 'black',
|
|
2039
|
+
width: '24',
|
|
2040
|
+
height: '24',
|
|
2041
|
+
};
|
|
2042
|
+
const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
|
|
2272
2043
|
const ref = useRef(null);
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2044
|
+
const [inputValue, setInputValue] = useState(value || '');
|
|
2045
|
+
const handleChange = (ev) => {
|
|
2046
|
+
const val = ev.target?.value;
|
|
2047
|
+
if (typeof val === 'string' && val?.length < 11) {
|
|
2048
|
+
setInputValue(normalizeWithMask(val, '__.__.____'));
|
|
2277
2049
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
}, [callback, ...deps]);
|
|
2286
|
-
return ref;
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2290
|
-
const containerRef = useRef(null);
|
|
2291
|
-
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2292
|
-
if (containerRef.current) {
|
|
2293
|
-
containerRef.current.style.maxHeight = isUnfolded
|
|
2294
|
-
? `${childrenWrapperEl.scrollHeight}px`
|
|
2295
|
-
: '';
|
|
2050
|
+
};
|
|
2051
|
+
const onBlur = () => {
|
|
2052
|
+
if (checkIsValidDate(inputValue)) {
|
|
2053
|
+
const [day, month, year] = inputValue.split('.');
|
|
2054
|
+
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2055
|
+
setSelectedMonth(Number(month) - 1);
|
|
2056
|
+
setSelectedYear(Number(year));
|
|
2296
2057
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2058
|
+
else {
|
|
2059
|
+
setInputValue(value || '');
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
const onInputClick = () => {
|
|
2063
|
+
if (ref.current !== null) {
|
|
2064
|
+
ref.current.focus();
|
|
2065
|
+
}
|
|
2066
|
+
onClick?.();
|
|
2067
|
+
};
|
|
2068
|
+
useEffect(() => {
|
|
2069
|
+
setInputValue(value || '');
|
|
2070
|
+
}, [value]);
|
|
2071
|
+
return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
|
|
2299
2072
|
});
|
|
2300
|
-
|
|
2301
|
-
const
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2073
|
+
const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
|
|
2074
|
+
const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
|
|
2075
|
+
const checkIsValidDate = (date) => {
|
|
2076
|
+
const [day, month, year] = date.split('.');
|
|
2077
|
+
if (isValidYear(year)) {
|
|
2078
|
+
if (isValidMonth(month)) {
|
|
2079
|
+
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
2080
|
+
let maxDateOfMonth = 0;
|
|
2081
|
+
while (currentDate.getMonth() === Number(month) - 1) {
|
|
2082
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
2083
|
+
maxDateOfMonth++;
|
|
2084
|
+
}
|
|
2085
|
+
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
2086
|
+
return true;
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2305
2089
|
}
|
|
2306
|
-
return
|
|
2307
|
-
}
|
|
2308
|
-
const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
|
|
2309
|
-
const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
|
|
2310
|
-
const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
|
|
2090
|
+
return false;
|
|
2091
|
+
};
|
|
2311
2092
|
|
|
2312
|
-
const
|
|
2093
|
+
const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
|
|
2094
|
+
'hover:border-black active:border-black focus:border-black';
|
|
2095
|
+
const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
|
|
2313
2096
|
|
|
2314
|
-
const
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2097
|
+
const MONTHS_COUNT = 11;
|
|
2098
|
+
const MONTHS_OPTIONS = months.map((key) => ({ key }));
|
|
2099
|
+
const YEARS_OPTIONS = getYears()
|
|
2100
|
+
.reverse()
|
|
2101
|
+
.map((key) => ({ key: String(key) }));
|
|
2102
|
+
const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
|
|
2103
|
+
const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
|
|
2104
|
+
const ref = useOutsideClick(close);
|
|
2105
|
+
const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
|
|
2106
|
+
const handleNextMonth = useCallback(() => {
|
|
2107
|
+
if (selectedMonth + 1 <= MONTHS_COUNT) {
|
|
2108
|
+
onMonthSelect(selectedMonth + 1);
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
onMonthSelect(0);
|
|
2112
|
+
onYearSelect(selectedYear + 1);
|
|
2113
|
+
}
|
|
2114
|
+
}, [selectedMonth]);
|
|
2115
|
+
const handlePrevMonth = useCallback(() => {
|
|
2116
|
+
if (selectedMonth - 1 >= 0) {
|
|
2117
|
+
onMonthSelect(selectedMonth - 1);
|
|
2118
|
+
}
|
|
2119
|
+
else {
|
|
2120
|
+
onMonthSelect(11);
|
|
2121
|
+
onYearSelect(selectedYear - 1);
|
|
2122
|
+
}
|
|
2123
|
+
}, [selectedMonth]);
|
|
2124
|
+
const handleSelectMonth = useCallback(({ key }) => {
|
|
2125
|
+
onMonthSelect(months.indexOf(key));
|
|
2126
|
+
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
2127
|
+
handleChangeMonth({
|
|
2128
|
+
maxDateOfMonth,
|
|
2129
|
+
selectedYear,
|
|
2130
|
+
selectedMonth: months.indexOf(key),
|
|
2131
|
+
value,
|
|
2132
|
+
onChange,
|
|
2133
|
+
});
|
|
2134
|
+
}, [value]);
|
|
2135
|
+
const handleSelectYear = useCallback(({ key }) => {
|
|
2136
|
+
onYearSelect(Number(key));
|
|
2137
|
+
value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
|
|
2138
|
+
}, [value]);
|
|
2139
|
+
return {
|
|
2140
|
+
handleChangeVisibleCalendar,
|
|
2141
|
+
handleNextMonth,
|
|
2142
|
+
handlePrevMonth,
|
|
2143
|
+
handleSelectMonth,
|
|
2144
|
+
handleSelectYear,
|
|
2145
|
+
monthsOptions: MONTHS_OPTIONS,
|
|
2146
|
+
yearsOptions: YEARS_OPTIONS,
|
|
2147
|
+
ref,
|
|
2148
|
+
};
|
|
2329
2149
|
};
|
|
2330
|
-
const
|
|
2331
|
-
const
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
.
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
}),
|
|
2343
|
-
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
2344
|
-
].filter(Boolean);
|
|
2345
|
-
return rows;
|
|
2150
|
+
const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
|
|
2151
|
+
const date = new Date(selectedYear, selectedMonth, 1);
|
|
2152
|
+
let maxDateOfMonth = 0;
|
|
2153
|
+
while (date.getMonth() === selectedMonth) {
|
|
2154
|
+
maxDateOfMonth++;
|
|
2155
|
+
date.setDate(date.getDate() + 1);
|
|
2156
|
+
}
|
|
2157
|
+
return maxDateOfMonth;
|
|
2158
|
+
};
|
|
2159
|
+
const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
|
|
2160
|
+
value &&
|
|
2161
|
+
onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
|
|
2346
2162
|
};
|
|
2347
2163
|
|
|
2348
|
-
const
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
['workingFriday', 'Пт', 'Пятница'],
|
|
2354
|
-
['workingSaturday', 'Сб', 'Суббота'],
|
|
2355
|
-
['workingSunday', 'Вс', 'Воскресенье'],
|
|
2356
|
-
];
|
|
2357
|
-
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
2358
|
-
key,
|
|
2359
|
-
title,
|
|
2360
|
-
short,
|
|
2361
|
-
status: Boolean(workSchedule?.[key]),
|
|
2362
|
-
get workTime() {
|
|
2363
|
-
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
2364
|
-
},
|
|
2365
|
-
get lunchHour() {
|
|
2366
|
-
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
2367
|
-
},
|
|
2368
|
-
get hasLunch() {
|
|
2369
|
-
return /\d+/.test(this.lunchHour ?? '');
|
|
2370
|
-
},
|
|
2371
|
-
}));
|
|
2372
|
-
|
|
2373
|
-
const renderBusinessSchedule = (scheduleDescription) => {
|
|
2374
|
-
if (!scheduleDescription) {
|
|
2375
|
-
return null;
|
|
2376
|
-
}
|
|
2377
|
-
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
2378
|
-
return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
|
|
2164
|
+
const ICON_PROPS = {
|
|
2165
|
+
name: 'ArrowUpIcon',
|
|
2166
|
+
iconVersion: 'black',
|
|
2167
|
+
width: '24',
|
|
2168
|
+
height: '24',
|
|
2379
2169
|
};
|
|
2380
|
-
const
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
2385
|
-
return weekDayMap;
|
|
2386
|
-
}
|
|
2387
|
-
return weekDayMap.map((_) => ({
|
|
2388
|
-
..._,
|
|
2389
|
-
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
2390
|
-
}));
|
|
2170
|
+
const SELECT_PROPS = {
|
|
2171
|
+
className: 'min-w-32',
|
|
2172
|
+
iconVersion: 'black',
|
|
2173
|
+
isBorder: false,
|
|
2391
2174
|
};
|
|
2392
|
-
const
|
|
2175
|
+
const DatePicker = JSX(
|
|
2176
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2177
|
+
({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
|
|
2178
|
+
const [showCalendar, { setValue }] = useBool(false);
|
|
2179
|
+
const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
|
|
2180
|
+
const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
|
|
2181
|
+
const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
|
|
2182
|
+
onYearSelect: setSelectedYear,
|
|
2183
|
+
onMonthSelect: setSelectedMonth,
|
|
2184
|
+
onShowCalendar: setValue,
|
|
2185
|
+
selectedYear,
|
|
2186
|
+
selectedMonth,
|
|
2187
|
+
showCalendar,
|
|
2188
|
+
onChange,
|
|
2189
|
+
value,
|
|
2190
|
+
});
|
|
2191
|
+
const spaceAbove = useElementSpace(ref, 370);
|
|
2192
|
+
return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
|
|
2193
|
+
handleChangeVisibleCalendar,
|
|
2194
|
+
value,
|
|
2195
|
+
valid,
|
|
2196
|
+
onChange,
|
|
2197
|
+
disabled,
|
|
2198
|
+
setSelectedMonth,
|
|
2199
|
+
setSelectedYear,
|
|
2200
|
+
}), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
|
|
2201
|
+
'bottom-full': spaceAbove,
|
|
2202
|
+
}), children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate, setValue: setValue })] })) : null] })] }));
|
|
2203
|
+
});
|
|
2393
2204
|
|
|
2394
|
-
const
|
|
2205
|
+
const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
|
|
2395
2206
|
|
|
2396
|
-
const
|
|
2397
|
-
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
2398
|
-
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
2399
|
-
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
2400
|
-
red: { border: 'border-error/30', text: 'text-error' },
|
|
2401
|
-
};
|
|
2402
|
-
const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
|
|
2207
|
+
const BirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthday'), validatorObj.birthday, input?.required) })));
|
|
2403
2208
|
|
|
2404
|
-
const
|
|
2405
|
-
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
2406
|
-
const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
2407
|
-
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
2408
|
-
if (!currentWeekDay) {
|
|
2409
|
-
return null;
|
|
2410
|
-
}
|
|
2411
|
-
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
2412
|
-
return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
2413
|
-
};
|
|
2209
|
+
const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", isInteger: true, ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
2414
2210
|
|
|
2415
|
-
const
|
|
2416
|
-
if (!status) {
|
|
2417
|
-
return 'Не работает';
|
|
2418
|
-
}
|
|
2419
|
-
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
2420
|
-
};
|
|
2421
|
-
const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
|
|
2211
|
+
const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
|
|
2422
2212
|
|
|
2423
|
-
const
|
|
2424
|
-
|
|
2425
|
-
|
|
2213
|
+
const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
|
|
2214
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill: pathFill, ...options }, i) => {
|
|
2215
|
+
const resultOptions = { ...commonOptions, ...options };
|
|
2216
|
+
return (jsx("path", { d: d, fill: pathFill || 'currentColor', stroke: resultOptions.stroke, strokeLinecap: resultOptions.strokeLinecap, strokeLinejoin: resultOptions.strokeLinejoin, strokeWidth: resultOptions.strokeWidth, strokeMiterlimit: resultOptions.strokeMiterlimit }, i));
|
|
2217
|
+
}) }));
|
|
2218
|
+
});
|
|
2426
2219
|
|
|
2427
|
-
const
|
|
2428
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2429
|
-
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
2430
|
-
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
2431
|
-
if (!workSchedule) {
|
|
2432
|
-
return '';
|
|
2433
|
-
}
|
|
2434
|
-
if (!workSchedule.businessScheduleVisibleTag) {
|
|
2435
|
-
return renderMatchingTimeOfWork(timeOfWork);
|
|
2436
|
-
}
|
|
2437
|
-
if (workSchedule.businessScheduleVisibleTag &&
|
|
2438
|
-
workSchedule.businessScheduleDescription === null) {
|
|
2439
|
-
return renderIndividualTimeOfWork(timeOfWork);
|
|
2440
|
-
}
|
|
2441
|
-
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
2442
|
-
};
|
|
2443
|
-
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
2444
|
-
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
2445
|
-
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
2220
|
+
const defaultCheckStyle = 'appearance-none w-5 h-5 border-solid flex-none';
|
|
2446
2221
|
|
|
2447
|
-
const
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
workSchedule,
|
|
2460
|
-
exchangeRate,
|
|
2461
|
-
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
2462
|
-
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
2463
|
-
phone,
|
|
2464
|
-
fax,
|
|
2465
|
-
phoneBusiness,
|
|
2466
|
-
phoneNatural,
|
|
2467
|
-
phoneCallCentre,
|
|
2468
|
-
phoneCurrencyControl,
|
|
2469
|
-
workSchedule,
|
|
2470
|
-
exchangeRate,
|
|
2471
|
-
}) }));
|
|
2472
|
-
},
|
|
2473
|
-
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
2474
|
-
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
2475
|
-
};
|
|
2476
|
-
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
2477
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2478
|
-
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
2479
|
-
? 'Для физических лиц'
|
|
2480
|
-
: 'Для физических и юридических лиц';
|
|
2481
|
-
return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
2482
|
-
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
2483
|
-
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
2484
|
-
};
|
|
2485
|
-
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
2486
|
-
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
2487
|
-
const header = capitalizedFirstLetter$1(name);
|
|
2488
|
-
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
2489
|
-
return { header, body };
|
|
2490
|
-
};
|
|
2491
|
-
|
|
2492
|
-
const INITIAL_FILTRATION_STATE$1 = {
|
|
2493
|
-
workingSaturday: false,
|
|
2494
|
-
premiumService: false,
|
|
2495
|
-
privateBanking: false,
|
|
2496
|
-
remoteWorkplace: false,
|
|
2497
|
-
serviceDisabledPeople: false,
|
|
2498
|
-
sellingCoins: false,
|
|
2499
|
-
buyingCoins: false,
|
|
2500
|
-
bullionOperations: false,
|
|
2501
|
-
preciousMetalsOperations: false,
|
|
2502
|
-
transferringDataToBiometricSystem: false,
|
|
2503
|
-
};
|
|
2504
|
-
const FILTRATION_LABELS = {
|
|
2505
|
-
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
2506
|
-
workingSaturday: 'Открыты по субботам',
|
|
2507
|
-
terminalTypeAtms: 'Банкоматы',
|
|
2508
|
-
terminalTypeTerm: 'Терминалы',
|
|
2509
|
-
workAllTime: 'Круглосуточно',
|
|
2510
|
-
billAcceptorEnable: 'Прием наличных',
|
|
2511
|
-
premiumService: 'Премиальное обслуживание',
|
|
2512
|
-
privateBanking: 'Услуга Private banking',
|
|
2513
|
-
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
2514
|
-
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
2515
|
-
bullionOperations: 'Операции со слитками',
|
|
2516
|
-
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
2517
|
-
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
2518
|
-
locationDisabledPeople: 'Для маломобильных',
|
|
2519
|
-
designDisabledPeople: 'Для слабовидящих',
|
|
2520
|
-
remoteWorkplace: 'Удаленное рабочее место',
|
|
2521
|
-
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
2522
|
-
};
|
|
2523
|
-
const FILTRATION_PREDICATES$1 = {
|
|
2524
|
-
workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
2525
|
-
premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
|
|
2526
|
-
privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
|
|
2527
|
-
remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
|
|
2528
|
-
serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
2529
|
-
sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
|
|
2530
|
-
buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
|
|
2531
|
-
bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
|
|
2532
|
-
preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
2533
|
-
transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
2534
|
-
};
|
|
2535
|
-
|
|
2536
|
-
const filterItems$1 = (data, filtrationState) => {
|
|
2537
|
-
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
2538
|
-
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
2539
|
-
};
|
|
2540
|
-
|
|
2541
|
-
const defaultEmptyFunction$1 = () => void 0;
|
|
2542
|
-
const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
|
|
2543
|
-
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
2544
|
-
const _filteredItems = filterItems$1(data, filtrationState);
|
|
2545
|
-
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
2546
|
-
const _points = [
|
|
2547
|
-
..._filteredItems.map((_) => ({
|
|
2548
|
-
type: 'offices',
|
|
2549
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2550
|
-
content: getBalloon(_),
|
|
2551
|
-
})),
|
|
2552
|
-
..._filteredRemoteWorkplaces.map((_) => ({
|
|
2553
|
-
type: 'workplaces',
|
|
2554
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2555
|
-
content: getBalloonRemoteWorkplaces({
|
|
2556
|
-
address: _.address,
|
|
2557
|
-
workScheduleDescription: _.workScheduleDescription,
|
|
2558
|
-
}),
|
|
2559
|
-
})),
|
|
2560
|
-
].filter((_) => _.coords && _.coords.length === 2);
|
|
2561
|
-
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
2562
|
-
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
2563
|
-
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
2564
|
-
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
2565
|
-
};
|
|
2566
|
-
|
|
2567
|
-
const useLeadFormData = (typeField) => {
|
|
2568
|
-
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
2569
|
-
if (data && 'errorMessage' in data) {
|
|
2570
|
-
return { error };
|
|
2571
|
-
}
|
|
2572
|
-
return { data: data, error };
|
|
2573
|
-
};
|
|
2574
|
-
const fetchData = async (url) => {
|
|
2575
|
-
const result = await fetchJSON(url, { method: 'POST' });
|
|
2576
|
-
return result || [];
|
|
2577
|
-
};
|
|
2578
|
-
|
|
2579
|
-
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
2580
|
-
|
|
2581
|
-
const isClient = !isSSR();
|
|
2582
|
-
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
2583
|
-
|
|
2584
|
-
const AddressRetailField = JSX(({ field, input }) => {
|
|
2585
|
-
const [offices, setOffices] = useState([]);
|
|
2586
|
-
const { data } = useLeadFormData('REGION_RF');
|
|
2587
|
-
const regionValue = field('regionRetail')?.value || {};
|
|
2588
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2589
|
-
const fieldBranch = field('addressRetail');
|
|
2590
|
-
useEffect(() => {
|
|
2591
|
-
(async () => {
|
|
2592
|
-
const officesList = await fetchRegionOffices(regionValue?.key ?? '');
|
|
2593
|
-
setOffices(officesList);
|
|
2594
|
-
})();
|
|
2595
|
-
if (regionValue?.key) {
|
|
2596
|
-
field?.('addressRetail')?.onChange?.('');
|
|
2222
|
+
const CHECK_PATHS = [
|
|
2223
|
+
{
|
|
2224
|
+
d: 'M10.207.793a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 0 1 1.414-1.414L3.5 6.086 8.793.793a1 1 0 0 1 1.414 0Z',
|
|
2225
|
+
fillRule: 'evenodd',
|
|
2226
|
+
clipRule: 'evenodd',
|
|
2227
|
+
fill: 'white',
|
|
2228
|
+
},
|
|
2229
|
+
];
|
|
2230
|
+
const Checkbox = JSX(({ className, value, text, disabled, isRadio, onChange }) => {
|
|
2231
|
+
const handleChange = useCallback((e) => {
|
|
2232
|
+
if (disabled) {
|
|
2233
|
+
return;
|
|
2597
2234
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
});
|
|
2604
|
-
const isRegionSelected = Boolean(regionValue?.key);
|
|
2605
|
-
return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
|
|
2606
|
-
key: id?.toString() || '',
|
|
2607
|
-
text: address,
|
|
2608
|
-
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
|
|
2235
|
+
e.preventDefault();
|
|
2236
|
+
onChange && onChange(!value);
|
|
2237
|
+
}, [onChange, disabled, value]);
|
|
2238
|
+
const icon = isRadio ? (jsx("div", { className: "absolute left-1 w-3 h-3 rounded-full bg-primary-main" })) : (jsx(SVG, { paths: CHECK_PATHS, className: "absolute left-1 ml-px block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }));
|
|
2239
|
+
return (jsx("div", { className: className, children: jsxs("label", { className: style('flex items-center relative group/box', getCursorStyle(disabled)), onClick: handleChange, children: [jsx("div", { className: style(defaultCheckStyle, 'm-0', isRadio ? 'rounded-full border-2' : checkboxStyle(value), !disabled && value ? 'border-primary-main' : 'border-gray', disabled ? 'bg-main-disabled' : 'group-hover/box:border-primary-hover'), role: role(isRadio), "aria-checked": Boolean(value), "aria-disabled": Boolean(disabled), "aria-label": text }), value ? icon : null, renderText$3(text)] }) }));
|
|
2609
2240
|
});
|
|
2241
|
+
const renderText$3 = (text) => text ? (jsx("div", { className: "ml-s", children: jsx(Text, { size: "text-l", font: "font-light", children: text }) })) : null;
|
|
2242
|
+
const getCursorStyle = (disabled = false) => (disabled ? 'cursor-not-allowed' : 'cursor-pointer');
|
|
2243
|
+
const role = (isRadio = false) => (isRadio ? 'radio' : 'checkbox');
|
|
2244
|
+
const checkboxStyle = (value = false) => style('rounded border', { 'bg-primary-main': value });
|
|
2610
2245
|
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2613
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
2614
|
-
const handleFocus = useCallback((ev) => {
|
|
2615
|
-
setIsFocused(true);
|
|
2616
|
-
onFocus && onFocus(ev);
|
|
2617
|
-
}, []);
|
|
2618
|
-
const handleBlur = useCallback(() => {
|
|
2619
|
-
setIsFocused(false);
|
|
2620
|
-
onChange && onChange(normalize(value));
|
|
2621
|
-
onBlur && onBlur();
|
|
2622
|
-
}, [onChange, value]);
|
|
2623
|
-
return {
|
|
2624
|
-
value: (isFocused || !format ? value : format(value)),
|
|
2625
|
-
onFocus: handleFocus,
|
|
2626
|
-
onBlur: handleBlur,
|
|
2627
|
-
};
|
|
2628
|
-
};
|
|
2246
|
+
const FIELD_NAME$c = 'consentToReceiveMaterials';
|
|
2247
|
+
const ConsentToReceiveMaterialsField = JSX(({ field, input }) => (jsx(Checkbox, { text: "\u0421\u043E\u0433\u043B\u0430\u0441\u0435\u043D \u043D\u0430 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u043E\u043D\u043D\u044B\u0445 \u0438 \u0430\u043D\u0430\u043B\u0438\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B\u043E\u0432 \u043F\u043E \u044D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0439 \u043F\u043E\u0447\u0442\u0435", ...getValidation(field(FIELD_NAME$c), validatorObj[FIELD_NAME$c], input?.required) })));
|
|
2629
2248
|
|
|
2630
|
-
const
|
|
2249
|
+
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.desiredMeetingDate, input?.required) })));
|
|
2631
2250
|
|
|
2632
|
-
|
|
2633
|
-
const
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
}
|
|
2251
|
+
const EmailField = JSX(({ field, input }) => {
|
|
2252
|
+
const { required, ...rest } = input;
|
|
2253
|
+
return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
|
|
2254
|
+
});
|
|
2637
2255
|
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
const newValue = list.length ? list[rawValue] : rawValue;
|
|
2648
|
-
onChange && onChange(newValue || 0);
|
|
2649
|
-
}) }) })] }));
|
|
2650
|
-
}
|
|
2256
|
+
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
2257
|
+
const SERVICE_DIRECTIONS = [
|
|
2258
|
+
{ key: 'Физическое лицо' },
|
|
2259
|
+
{ key: 'Юридическое лицо / ИП' },
|
|
2260
|
+
];
|
|
2261
|
+
const FEEDBACK_METHOD = [
|
|
2262
|
+
{ key: 'phone', text: 'Телефонный звонок' },
|
|
2263
|
+
{ key: 'email', text: 'Электронное сообщение' },
|
|
2264
|
+
];
|
|
2651
2265
|
|
|
2652
|
-
const
|
|
2653
|
-
const DEFAULT_MIN = 1;
|
|
2654
|
-
const DEFAULT_MAX = 100;
|
|
2655
|
-
const InputRange = JSX((props) => {
|
|
2656
|
-
const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
|
|
2657
|
-
const normalizedProps = useNormalizedInput(props, {
|
|
2658
|
-
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
2659
|
-
format: toLocalNumberFormat(),
|
|
2660
|
-
});
|
|
2661
|
-
const handleChange = useCallback((ev) => {
|
|
2662
|
-
onChange && onChange(parseDecimal(ev.target?.value));
|
|
2663
|
-
}, [onChange]);
|
|
2664
|
-
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
2665
|
-
});
|
|
2666
|
-
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
2667
|
-
const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
|
|
2266
|
+
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
|
|
2668
2267
|
|
|
2669
|
-
const
|
|
2670
|
-
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
2671
|
-
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
2672
|
-
const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
|
|
2268
|
+
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
2673
2269
|
|
|
2674
2270
|
function copy(source, target) {
|
|
2675
2271
|
for (const [k, v] of source.entries()) {
|
|
@@ -2819,320 +2415,1278 @@
|
|
|
2819
2415
|
return useLocalStore();
|
|
2820
2416
|
};
|
|
2821
2417
|
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2418
|
+
const getOrganizationActivityType = (options, okved) => {
|
|
2419
|
+
if (!okved) {
|
|
2420
|
+
return null;
|
|
2421
|
+
}
|
|
2422
|
+
const getOptionByKey = getOptionOp(options);
|
|
2423
|
+
const okvedType = +okved?.split('.')[0];
|
|
2424
|
+
const secondOkvedType = +okved?.split('.')[1];
|
|
2425
|
+
switch (okvedType) {
|
|
2426
|
+
case 1:
|
|
2427
|
+
return getOptionByKey("AGRICULTURE" /* EOrganizationActivityTypes.AGRICULTURE */);
|
|
2428
|
+
case 35:
|
|
2429
|
+
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
2430
|
+
case 41:
|
|
2431
|
+
case 42:
|
|
2432
|
+
case 43:
|
|
2433
|
+
return getOptionByKey("CONSTRUCTION" /* EOrganizationActivityTypes.CONSTRUCTION */);
|
|
2434
|
+
case 46:
|
|
2435
|
+
case 47:
|
|
2436
|
+
return getOptionByKey("TRADE" /* EOrganizationActivityTypes.TRADE */);
|
|
2437
|
+
case 55:
|
|
2438
|
+
case 79:
|
|
2439
|
+
return getOptionByKey("TOURISM" /* EOrganizationActivityTypes.TOURISM */);
|
|
2440
|
+
case 62:
|
|
2441
|
+
return getOptionByKey("TECHNOLOGY" /* EOrganizationActivityTypes.TECHNOLOGY */);
|
|
2442
|
+
case 63:
|
|
2443
|
+
return getOptionByKey("CONSULTING_SERVICE" /* EOrganizationActivityTypes.CONSULTING_SERVICE */);
|
|
2444
|
+
case 64:
|
|
2445
|
+
return getOptionByKey("BANK" /* EOrganizationActivityTypes.BANK */);
|
|
2446
|
+
case 65:
|
|
2447
|
+
return getOptionByKey("INSURER" /* EOrganizationActivityTypes.INSURER */);
|
|
2448
|
+
case 66:
|
|
2449
|
+
return getOptionByKey("FINANCIAL_INSTITUTIONS" /* EOrganizationActivityTypes.FINANCIAL_INSTITUTIONS */);
|
|
2450
|
+
case 72:
|
|
2451
|
+
case 74:
|
|
2452
|
+
return getOptionByKey("SCIENCE" /* EOrganizationActivityTypes.SCIENCE */);
|
|
2453
|
+
case 80:
|
|
2454
|
+
return getOptionByKey("SECURITY" /* EOrganizationActivityTypes.SECURITY */);
|
|
2455
|
+
case 84: {
|
|
2456
|
+
if (secondOkvedType < 22) {
|
|
2457
|
+
return getOptionByKey("GOVERNANCE" /* EOrganizationActivityTypes.GOVERNANCE */);
|
|
2861
2458
|
}
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
window.addEventListener('resize', handleResize);
|
|
2865
|
-
return () => window.removeEventListener('resize', handleResize);
|
|
2866
|
-
}, [ref]);
|
|
2867
|
-
return spaceAbove;
|
|
2868
|
-
};
|
|
2869
|
-
|
|
2870
|
-
const DAY_COUNT = 6;
|
|
2871
|
-
const WEEK_COUNT = 7;
|
|
2872
|
-
const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
|
|
2873
|
-
const calendarCells = [];
|
|
2874
|
-
let dayCounter = 1;
|
|
2875
|
-
for (let i = 0; i < DAY_COUNT; i++) {
|
|
2876
|
-
const rowCells = [];
|
|
2877
|
-
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
2878
|
-
if (i === 0 && j < firstDayOfWeek) {
|
|
2879
|
-
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
2459
|
+
if (secondOkvedType === 22) {
|
|
2460
|
+
return getOptionByKey("ARMY" /* EOrganizationActivityTypes.ARMY */);
|
|
2880
2461
|
}
|
|
2881
|
-
|
|
2882
|
-
|
|
2462
|
+
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
2463
|
+
}
|
|
2464
|
+
case 85:
|
|
2465
|
+
return getOptionByKey("EDUCATION" /* EOrganizationActivityTypes.EDUCATION */);
|
|
2466
|
+
case 86:
|
|
2467
|
+
return getOptionByKey("HEALTHCARE" /* EOrganizationActivityTypes.HEALTHCARE */);
|
|
2468
|
+
case 87:
|
|
2469
|
+
return getOptionByKey("SOCIAL_SPHERE" /* EOrganizationActivityTypes.SOCIAL_SPHERE */);
|
|
2470
|
+
default: {
|
|
2471
|
+
if (okvedType >= 10 && okvedType <= 33) {
|
|
2472
|
+
return getOptionByKey("INDUSTRY" /* EOrganizationActivityTypes.INDUSTRY */);
|
|
2883
2473
|
}
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
dayCounter++;
|
|
2474
|
+
if (okvedType >= 5 && okvedType <= 9) {
|
|
2475
|
+
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
2476
|
+
}
|
|
2477
|
+
if (okvedType >= 49 && okvedType <= 53) {
|
|
2478
|
+
return getOptionByKey("TRANSPORT" /* EOrganizationActivityTypes.TRANSPORT */);
|
|
2890
2479
|
}
|
|
2480
|
+
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
2891
2481
|
}
|
|
2892
|
-
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
2893
2482
|
}
|
|
2894
|
-
return calendarCells;
|
|
2895
2483
|
};
|
|
2896
|
-
const
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2484
|
+
const getEmployeesNumberOption = (options, count) => {
|
|
2485
|
+
if (!count) {
|
|
2486
|
+
return null;
|
|
2487
|
+
}
|
|
2488
|
+
const [option] = [options?.find((_) => count <= Number(_.description))].map((_) => ({
|
|
2489
|
+
key: _?.key ?? '',
|
|
2490
|
+
text: _?.value ?? '',
|
|
2491
|
+
}));
|
|
2492
|
+
return option;
|
|
2493
|
+
};
|
|
2494
|
+
const getOrganizationKind = (options, okopf) => {
|
|
2495
|
+
const getOptionByKey = getOptionOp(options);
|
|
2496
|
+
if ([40001, 40002, 71610].includes(okopf)) {
|
|
2497
|
+
return getOptionByKey('FOREIGN');
|
|
2498
|
+
}
|
|
2499
|
+
return getOptionByKey('RUSSIAN');
|
|
2500
|
+
};
|
|
2501
|
+
const getOrganizationType = (options, okopf, inn) => {
|
|
2502
|
+
const getOptionByKey = getOptionOp(options);
|
|
2503
|
+
if (inn === '7725114488') {
|
|
2504
|
+
return getOptionByKey('RSHB');
|
|
2505
|
+
}
|
|
2506
|
+
if (okopf === 50102) {
|
|
2507
|
+
return getOptionByKey('SOLE_TRADER');
|
|
2508
|
+
}
|
|
2509
|
+
if (okopf >= 75000 && okopf <= 75505 && okopf !== 75500) {
|
|
2510
|
+
return getOptionByKey('BUDGETARY');
|
|
2511
|
+
}
|
|
2512
|
+
return getOptionByKey('COMMERCIAL');
|
|
2513
|
+
};
|
|
2514
|
+
const getOptionOp = (options) => (key) => options
|
|
2515
|
+
.map((_) => ({ key: _.key, text: _.value }))
|
|
2516
|
+
.find((_) => _.key === key) ?? null;
|
|
2901
2517
|
|
|
2902
|
-
const
|
|
2903
|
-
const
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2518
|
+
const ESIA_FIELD_NAME = 'esiaAccountTypeCd';
|
|
2519
|
+
const isEsiaAuthorize = (field, name) => Boolean(field(ESIA_FIELD_NAME)?.value?.key) && field(name).value;
|
|
2520
|
+
|
|
2521
|
+
const AddressField = JSX(({ field, input }) => {
|
|
2522
|
+
const fieldName = input?.name || 'addressRegistration';
|
|
2523
|
+
const fieldValue = field(fieldName).value;
|
|
2524
|
+
const onDaDataChange = useCallback((item) => {
|
|
2525
|
+
field?.(fieldName)?.onChange?.(getAddressFromDaDataItem(item));
|
|
2907
2526
|
}, []);
|
|
2908
|
-
const
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2527
|
+
const onChange = useCallback((value) => {
|
|
2528
|
+
field?.(fieldName)?.onChange?.({
|
|
2529
|
+
apartment: '',
|
|
2530
|
+
city: '',
|
|
2531
|
+
district: '',
|
|
2532
|
+
fullAddress: value,
|
|
2533
|
+
fiasCode: '',
|
|
2534
|
+
house: '',
|
|
2535
|
+
locality: '',
|
|
2536
|
+
okatoRegionCode: '',
|
|
2537
|
+
postcode: '',
|
|
2538
|
+
region: '',
|
|
2539
|
+
regionCode: '',
|
|
2540
|
+
street: '',
|
|
2541
|
+
qc: '',
|
|
2542
|
+
qcComplete: '',
|
|
2543
|
+
qcHouse: '',
|
|
2544
|
+
});
|
|
2545
|
+
}, []);
|
|
2546
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
|
|
2547
|
+
});
|
|
2548
|
+
const getAddressFromDaDataItem = (item) => ({
|
|
2549
|
+
apartment: item?.data?.flat,
|
|
2550
|
+
city: item?.data?.city,
|
|
2551
|
+
district: item?.data?.area_with_type,
|
|
2552
|
+
fullAddress: item?.unrestricted_value,
|
|
2553
|
+
fiasCode: item?.data?.fias_id,
|
|
2554
|
+
house: item?.data?.house,
|
|
2555
|
+
locality: item?.data?.settlement_with_type,
|
|
2556
|
+
okatoRegionCode: item?.data?.okato,
|
|
2557
|
+
postcode: item?.data?.postal_code,
|
|
2558
|
+
region: item?.data?.region,
|
|
2559
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
2560
|
+
street: item?.data?.street,
|
|
2561
|
+
qc: item?.data?.qc,
|
|
2562
|
+
qcComplete: item?.data?.qc_complete,
|
|
2563
|
+
qcHouse: item?.data?.qc_house,
|
|
2922
2564
|
});
|
|
2923
2565
|
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
'
|
|
2927
|
-
'
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
'Декабрь',
|
|
2937
|
-
];
|
|
2938
|
-
|
|
2939
|
-
function normalizeWithMask(value, pattern) {
|
|
2940
|
-
const valueNumbers = value.replace(/\D/g, '');
|
|
2941
|
-
if (valueNumbers === '' || valueNumbers.length === pattern.length) {
|
|
2942
|
-
return value;
|
|
2566
|
+
const updateOrganizationFields = (store, field, item) => {
|
|
2567
|
+
const { okved, okopf, inn } = getOrganizationRequisites(item);
|
|
2568
|
+
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
2569
|
+
field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
|
|
2570
|
+
const organizationData = {
|
|
2571
|
+
amountWorkers: getEmployeesNumberOption(store?.amountWorkers, item.data?.employee_count),
|
|
2572
|
+
employerActivities: getOrganizationActivityType(store?.employerActivities ?? [], okved),
|
|
2573
|
+
organization: getOrganizationType(store?.organization ?? [], okopf, inn),
|
|
2574
|
+
employerOrganization: getOrganizationKind(store?.employerOrganization ?? [], okopf),
|
|
2575
|
+
};
|
|
2576
|
+
for (const fieldName in organizationData) {
|
|
2577
|
+
organizationData[fieldName] && field?.(fieldName)?.onChange?.(organizationData[fieldName]);
|
|
2943
2578
|
}
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
2951
|
-
}
|
|
2952
|
-
const isPlaceholder$1 = (_) => _ === '_';
|
|
2953
|
-
const isDigit$1 = (_) => /\d/.test(_);
|
|
2954
|
-
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2579
|
+
};
|
|
2580
|
+
const getOrganizationRequisites = (item) => ({
|
|
2581
|
+
inn: item.data?.inn ?? '',
|
|
2582
|
+
okopf: Number(item.data?.opf?.code),
|
|
2583
|
+
okved: item.data?.okved ?? '',
|
|
2584
|
+
});
|
|
2955
2585
|
|
|
2956
|
-
const
|
|
2957
|
-
|
|
2586
|
+
const InnField = JSX(({ field, input }) => {
|
|
2587
|
+
const store = useRetailFormStore();
|
|
2588
|
+
const onDaDataChange = useCallback((item) => {
|
|
2589
|
+
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
2590
|
+
updateOrganizationFields(store, field, item);
|
|
2591
|
+
}, []);
|
|
2592
|
+
return (jsx(InputControl, { label: "\u0418\u041D\u041D", isInteger: true, maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
|
|
2593
|
+
});
|
|
2958
2594
|
|
|
2959
|
-
const
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2595
|
+
const CheckboxWithError = JSX(({ className, text, value, key, disabled, error, onChange }) => (jsxs("div", { className: style('shrink-0', className), children: [jsx(Checkbox, { text: text, value: value, disabled: disabled, onChange: onChange }, key), renderErrorText(error)] })));
|
|
2596
|
+
|
|
2597
|
+
const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
|
|
2598
|
+
|
|
2599
|
+
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
2600
|
+
const EMPTY_REGIONS$1 = [];
|
|
2601
|
+
async function getOutServiceRegions() {
|
|
2602
|
+
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
2603
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
const LocalitiesField = JSX(({ field, input }) => {
|
|
2607
|
+
const fieldRegion = field('region');
|
|
2608
|
+
const regionKey = fieldRegion?.value?.key;
|
|
2609
|
+
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
2610
|
+
const localities = regions
|
|
2611
|
+
?.find((_) => _.code === regionKey)
|
|
2612
|
+
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
2613
|
+
useEffect(() => {
|
|
2614
|
+
if (regionKey !== '') {
|
|
2615
|
+
field?.('localities')?.onChange?.('');
|
|
2616
|
+
}
|
|
2617
|
+
}, [regionKey]);
|
|
2618
|
+
return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
|
|
2619
|
+
});
|
|
2620
|
+
|
|
2621
|
+
const FIELD_NAME$b = 'middleName';
|
|
2622
|
+
const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$b), ...getValidation(field(FIELD_NAME$b), validatorObj.middleName, input?.required), ...input })));
|
|
2623
|
+
|
|
2624
|
+
const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
|
|
2625
|
+
|
|
2626
|
+
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
2627
|
+
|
|
2628
|
+
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
2629
|
+
|
|
2630
|
+
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
2631
|
+
const { required, ...rest } = input;
|
|
2632
|
+
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
2633
|
+
});
|
|
2634
|
+
|
|
2635
|
+
const isPlaceholder = (_) => _ === '_';
|
|
2636
|
+
const isDigit = (_) => /\d/.test(_);
|
|
2637
|
+
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
2638
|
+
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
2639
|
+
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
2640
|
+
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
2641
|
+
function normalizePhone(phone) {
|
|
2642
|
+
const phoneNumbers = phone.replace(/\D/g, '');
|
|
2643
|
+
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
2644
|
+
const result = phonePattern.map(applyPlaceholder);
|
|
2645
|
+
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
2646
|
+
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
2650
|
+
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
2651
|
+
const handleBlur = useCallback((v) => {
|
|
2652
|
+
if (v === '+7 (') {
|
|
2653
|
+
onChange && onChange('');
|
|
2654
|
+
}
|
|
2655
|
+
}, []);
|
|
2656
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
2657
|
+
});
|
|
2658
|
+
|
|
2659
|
+
const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
|
|
2660
|
+
|
|
2661
|
+
const PhoneField = JSX(({ field, input }) => {
|
|
2662
|
+
const fieldName = input?.name || 'phone';
|
|
2663
|
+
return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
|
|
2664
|
+
});
|
|
2665
|
+
|
|
2666
|
+
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
2667
|
+
|
|
2668
|
+
const ProductField = JSX(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
|
|
2669
|
+
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
2670
|
+
|
|
2671
|
+
const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
|
|
2672
|
+
const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
|
|
2673
|
+
|
|
2674
|
+
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
2675
|
+
const EMPTY_REGIONS = [];
|
|
2676
|
+
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
2677
|
+
function useRegions(url = REGIONS_URL) {
|
|
2678
|
+
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
2679
|
+
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
const RegionField = JSX(({ field, input, params }) => {
|
|
2683
|
+
const url = getRegionUrl(params?.typeForm);
|
|
2684
|
+
const regions = useRegions(url);
|
|
2685
|
+
return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
2686
|
+
});
|
|
2687
|
+
|
|
2688
|
+
const RegionPremiumField = JSX(({ field, input }) => {
|
|
2689
|
+
const branchByRegions = useBranchesByRegions(true);
|
|
2690
|
+
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
2691
|
+
key: region,
|
|
2692
|
+
text: region,
|
|
2693
|
+
})), [branchByRegions]);
|
|
2694
|
+
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
2695
|
+
});
|
|
2696
|
+
|
|
2697
|
+
const SecondaryPhoneField = JSX(({ field }) => {
|
|
2698
|
+
const fieldPhone = field('secondaryPhone');
|
|
2699
|
+
return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
|
|
2700
|
+
? fieldPhone
|
|
2701
|
+
: withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
|
|
2702
|
+
});
|
|
2703
|
+
|
|
2704
|
+
const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
|
|
2705
|
+
|
|
2706
|
+
const FIELD_NAME$a = 'surname';
|
|
2707
|
+
const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$a), ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
|
|
2708
|
+
|
|
2709
|
+
const MIN_CREDIT_TERM = 1;
|
|
2710
|
+
const MAX_CREDIT_TERM = 180;
|
|
2711
|
+
const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
|
|
2712
|
+
const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
|
|
2713
|
+
|
|
2714
|
+
const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
|
|
2715
|
+
|
|
2716
|
+
const orientationStyleMap = {
|
|
2717
|
+
horizontal: '@lg:flex-row',
|
|
2718
|
+
vertical: '',
|
|
2719
|
+
};
|
|
2720
|
+
const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
|
|
2721
|
+
|
|
2722
|
+
const VED_TYPES = [
|
|
2723
|
+
{ id: 'currencyControl', text: 'Валютный контроль' },
|
|
2724
|
+
{ id: 'documentOperations', text: 'Документарные операции' },
|
|
2725
|
+
{ id: 'conversionTransactions', text: 'Конверсионные операции' },
|
|
2726
|
+
{ id: 'otherIssues', text: 'Иные вопросы ВЭД' },
|
|
2727
|
+
];
|
|
2728
|
+
const VedField = JSX(({ field }) => {
|
|
2729
|
+
const { value, onChange } = field('vedTypes');
|
|
2730
|
+
useEffect(() => {
|
|
2731
|
+
if (value !== 'currencyControl') {
|
|
2732
|
+
field?.('inn')?.onChange?.('');
|
|
2733
|
+
field?.('region')?.onChange?.('');
|
|
2734
|
+
}
|
|
2735
|
+
}, [value]);
|
|
2736
|
+
return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
|
|
2737
|
+
});
|
|
2738
|
+
|
|
2739
|
+
function isRenderField({ input, field, }) {
|
|
2740
|
+
const { condition } = input;
|
|
2741
|
+
const { value } = field(condition?.name || '');
|
|
2742
|
+
return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
|
|
2743
|
+
}
|
|
2744
|
+
|
|
2745
|
+
const PRODUCT_REF = {
|
|
2746
|
+
$ref: '/wcms-resources/outservice-productlist.json',
|
|
2747
|
+
};
|
|
2748
|
+
const InputsMap = {
|
|
2749
|
+
fullName: (props) => jsx(FullNameField, { ...props }),
|
|
2750
|
+
addressBranch: (props) => jsx(AddressBranchField, { ...props }),
|
|
2751
|
+
desiredMeetingDate: (props) => jsx(DesiredMeetingDateField, { ...props }),
|
|
2752
|
+
product: (props) => jsx(ProductField, { ...props, source: PRODUCT_REF }),
|
|
2753
|
+
localities: (props) => jsx(LocalitiesField, { ...props }),
|
|
2754
|
+
isClient: (props) => jsx(IsClientField, { ...props }),
|
|
2755
|
+
partnerComments: (props) => jsx(PartnerCommentsField, { ...props }),
|
|
2756
|
+
collectionCount: (props) => jsx(CollectionCountField, { ...props }),
|
|
2757
|
+
acquiringType: (props) => jsx(AcquiringField, { ...props }),
|
|
2758
|
+
onlineCheckout: (props) => jsx(OnlineCheckoutField, { ...props }),
|
|
2759
|
+
posTerminal: (props) => jsx(PosTerminalField, { ...props }),
|
|
2760
|
+
serviceType: (props) => jsx(UltraPremiumField, { ...props }),
|
|
2761
|
+
term: (props) => jsx(TermField, { ...props }),
|
|
2762
|
+
amount: (props) => jsx(AmountField, { ...props }),
|
|
2763
|
+
annualRevenue: (props) => jsx(AnnualRevenueField, { ...props }),
|
|
2764
|
+
vedTypes: (props) => jsx(VedField, { ...props }),
|
|
2765
|
+
feedbackMethod: (props) => jsx(FeedbackMethodField, { ...props }),
|
|
2766
|
+
serviceDirection: (props) => jsx(ServiceDirectionField, { ...props }),
|
|
2767
|
+
bankEmpolee: (props) => jsx(BankEmpoleeField, { ...props }),
|
|
2768
|
+
secondaryPhone: (props) => jsx(SecondaryPhoneField, { ...props }),
|
|
2769
|
+
applicationDate: (props) => (jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...props })),
|
|
2770
|
+
region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
|
|
2771
|
+
consentToReceiveMaterials: (props) => (jsx(ConsentToReceiveMaterialsField, { ...props })),
|
|
2772
|
+
surname: (props) => jsx(SurnameField, { ...props }),
|
|
2773
|
+
name: (props) => jsx(NameField, { ...props }),
|
|
2774
|
+
middleName: (props) => jsx(MiddleNameField, { ...props }),
|
|
2775
|
+
birthday: (props) => jsx(BirthdayField, { ...props }),
|
|
2776
|
+
phone: (props) => jsx(PhoneField, { ...props }),
|
|
2777
|
+
email: (props) => jsx(EmailField, { ...props }),
|
|
2778
|
+
inn: (props) => jsx(InnField, { ...props }),
|
|
2779
|
+
comment: (props) => jsx(CommentField, { ...props }),
|
|
2780
|
+
};
|
|
2781
|
+
const getField = (field, params, externalInputs = {}) => (input, i) => {
|
|
2782
|
+
const resultInputsMap = {
|
|
2783
|
+
...InputsMap,
|
|
2784
|
+
...externalInputs,
|
|
2785
|
+
};
|
|
2786
|
+
return isRenderField({ input, field }) ? (jsx("div", { children: resultInputsMap[input?.name || '']?.({ field, input, params }) }, String(i))) : null;
|
|
2787
|
+
};
|
|
2788
|
+
|
|
2789
|
+
const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
|
|
2790
|
+
|
|
2791
|
+
const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
|
|
2792
|
+
|
|
2793
|
+
const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true, size = 'big' }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
|
|
2794
|
+
'backdrop-blur': blur,
|
|
2795
|
+
}), children: jsx("div", { className: style('inline-block ', 'animate-spin rounded-full', 'border-solid border-current', 'border-r-transparent', size === 'small' ? 'border-4 h-8 w-8' : 'border-8 h-28 w-28', color), role: "status" }) })));
|
|
2796
|
+
|
|
2797
|
+
function useButton() {
|
|
2798
|
+
return (props) => ({
|
|
2799
|
+
...props,
|
|
2800
|
+
onClick: handlerDecorator(handleClick(props)),
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2803
|
+
function handleClick({ disabled, onClick }) {
|
|
2804
|
+
return (ev) => {
|
|
2805
|
+
!disabled && onClick && onClick(ev);
|
|
2806
|
+
};
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
const buttonStyleMap = {
|
|
2810
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
2811
|
+
secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
|
|
2812
|
+
};
|
|
2813
|
+
const secondaryButtonStyleMap = {
|
|
2814
|
+
primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
2815
|
+
secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
2816
|
+
};
|
|
2817
|
+
const Button = JSX(({ children, ...props }) => {
|
|
2818
|
+
const button = useButton();
|
|
2819
|
+
const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
2820
|
+
return (jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
|
|
2821
|
+
'text-white bg-primary-active': active,
|
|
2822
|
+
'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
|
|
2823
|
+
'rounded-md': rounded,
|
|
2824
|
+
}, !active && !disabled && !isLoading
|
|
2825
|
+
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
2826
|
+
: '', className), type: type, role: role, onClick: onClick, children: [isLoading ? jsx(Loader, { blur: true, size: "small" }) : null, children] }));
|
|
2827
|
+
});
|
|
2828
|
+
|
|
2829
|
+
const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
|
|
2830
|
+
|
|
2831
|
+
const Dialog = JSX(({ className, head, children, onClose, onClick }) => (jsxs("div", { className: style('relative bg-white pt-0 p-lg', className), role: "dialog", onClick: onClick, children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: onClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] })));
|
|
2832
|
+
|
|
2833
|
+
const ResponseTypeDialog = JSX(({ responseType, typeForm, onClose }) => {
|
|
2834
|
+
const responseOK = responseType === 'OK';
|
|
2835
|
+
const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
|
|
2836
|
+
const responseOKDescription = typeForm === 'ANTIFRAUD'
|
|
2837
|
+
? `Сообщение отправлено. Для уточнения информации с Вами могут связаться работники Банка либо Вы
|
|
2838
|
+
можете самостоятельно позвонить по номеру контакт-центра +78001000100. Будьте внимательны, работники Банка
|
|
2839
|
+
не звонят с использованием мессенджеров.`
|
|
2840
|
+
: 'Совсем скоро мы с вами свяжемся';
|
|
2841
|
+
return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md space-x-m", children: [jsx(Img, { image: { icon: statusIcon, iconVersion: 'normal' }, width: "136", height: "136" }), jsx(Headline, { className: "w-full", title: responseOK ? 'Ваша заявка отправлена' : 'Не удалось отправить заявку', description: responseOK ? responseOKDescription : 'Пожалуйста, повторите позднее', headlineVersion: "XS", isEmbedded: true }), jsx(Button, { type: "button", onClick: onClose, children: "\u0425\u043E\u0440\u043E\u0448\u043E" })] }) }));
|
|
2842
|
+
});
|
|
2843
|
+
|
|
2844
|
+
const objectValidator = (validatorsMap) => (o) => (o &&
|
|
2845
|
+
Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
|
|
2846
|
+
[];
|
|
2847
|
+
|
|
2848
|
+
const getPartnerComments = (data) => {
|
|
2849
|
+
const { acquiringType, onlineCheckout = false, posTerminal = false, term, amount, annualRevenue, } = data;
|
|
2850
|
+
if (acquiringType) {
|
|
2851
|
+
return `Вид эквайринга=${acquiringType?.text || ''}${isAcquiringTrade(acquiringType?.key)
|
|
2852
|
+
? `/Онлайн касса=${onlineCheckout}/POS-терминал=${posTerminal}`
|
|
2853
|
+
: '/Онлайн касса=false/POS-терминал=false'}`;
|
|
2854
|
+
}
|
|
2855
|
+
else {
|
|
2856
|
+
return `Сумма=${amount}/Срок=${term}/Выручка=${annualRevenue}`;
|
|
2857
|
+
}
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2861
|
+
const getFormatData = (data) => {
|
|
2862
|
+
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
|
|
2863
|
+
const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
|
|
2864
|
+
const formatData = {
|
|
2865
|
+
...usedData,
|
|
2866
|
+
...getVedTypes(vedTypes),
|
|
2867
|
+
...getRegion(region),
|
|
2868
|
+
...(partnerComments ? { partnerComments } : {}),
|
|
2869
|
+
...(serviceType ? { typeForm: serviceType } : {}),
|
|
2870
|
+
};
|
|
2871
|
+
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
2872
|
+
};
|
|
2873
|
+
const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
|
|
2874
|
+
const getVedTypes = (vedTypes) => vedTypes
|
|
2875
|
+
? {
|
|
2876
|
+
vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
|
|
2877
|
+
}
|
|
2878
|
+
: {};
|
|
2879
|
+
|
|
2880
|
+
const initialFormState$1 = {
|
|
2881
|
+
typeForm: '',
|
|
2882
|
+
region: { key: '', text: '' },
|
|
2883
|
+
addressBranch: { key: '', text: '' },
|
|
2884
|
+
surname: '',
|
|
2885
|
+
name: '',
|
|
2886
|
+
phone: '',
|
|
2887
|
+
secondaryPhone: '',
|
|
2888
|
+
comment: '',
|
|
2889
|
+
product: '',
|
|
2890
|
+
partnerComments: '',
|
|
2891
|
+
annualRevenue: '',
|
|
2892
|
+
term: 12,
|
|
2893
|
+
amount: 100000,
|
|
2894
|
+
acquiringType: ACQUIRING_TYPES[0],
|
|
2895
|
+
serviceType: SERVICE_TYPES[0],
|
|
2896
|
+
feedbackMethod: FEEDBACK_METHOD[0],
|
|
2897
|
+
serviceDirection: SERVICE_DIRECTIONS[0],
|
|
2898
|
+
vedTypes: VED_TYPES[0],
|
|
2899
|
+
birthday: undefined,
|
|
2900
|
+
isClient: false,
|
|
2901
|
+
onlineCheckout: false,
|
|
2902
|
+
posTerminal: false,
|
|
2903
|
+
consentToReceiveMaterials: false,
|
|
2904
|
+
consentDataProcessing: false,
|
|
2905
|
+
addressRetail: { key: '', text: '' },
|
|
2906
|
+
};
|
|
2907
|
+
const getInitialFormState$3 = (inputs, typeForm = '') => {
|
|
2908
|
+
const formState = Object.fromEntries(inputs.map((_) => [
|
|
2909
|
+
_.name,
|
|
2910
|
+
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState$1[_.name || ''],
|
|
2911
|
+
]));
|
|
2912
|
+
return { ...formState, typeForm: { key: typeForm, text: '' } };
|
|
2913
|
+
};
|
|
2914
|
+
|
|
2915
|
+
const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
|
|
2916
|
+
|
|
2917
|
+
const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
2918
|
+
|
|
2919
|
+
const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
|
|
2920
|
+
const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
|
|
2921
|
+
|
|
2922
|
+
const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
|
|
2923
|
+
|
|
2924
|
+
const API = LeadServiceAPI();
|
|
2925
|
+
const ApplicationForm = JSX(
|
|
2926
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2927
|
+
({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
|
|
2928
|
+
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
2929
|
+
const initialFormState = getInitialFormState$3(inputs, typeForm);
|
|
2930
|
+
const [responseType, setResponseType] = useState('');
|
|
2931
|
+
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
2932
|
+
const handleSubmit = useCallback(async (formData, ev) => {
|
|
2933
|
+
const inputsFiltered = getFilteredInputs(inputs, formData);
|
|
2934
|
+
const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
|
|
2935
|
+
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
2936
|
+
return console.warn('validation fail');
|
|
2937
|
+
}
|
|
2938
|
+
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
2939
|
+
const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
|
|
2940
|
+
setResponseType(status);
|
|
2941
|
+
if (status) {
|
|
2942
|
+
responseTypeDialog.open({ typeForm, responseType: status });
|
|
2943
|
+
}
|
|
2944
|
+
if (status === 'OK' && data) {
|
|
2945
|
+
const aspects = useAspects();
|
|
2946
|
+
handleAspects({ aspectsAttributes: data, aspects, ev });
|
|
2947
|
+
}
|
|
2948
|
+
return status;
|
|
2949
|
+
}, [typeForm]);
|
|
2950
|
+
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
2951
|
+
const fieldName = getConsentDataProcessing(inputs)?.name;
|
|
2952
|
+
useEffect(() => {
|
|
2953
|
+
if (responseType === 'OK') {
|
|
2954
|
+
setResponseType('');
|
|
2955
|
+
reset();
|
|
2956
|
+
}
|
|
2957
|
+
}, [responseType]);
|
|
2958
|
+
return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm }))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
|
|
2959
|
+
});
|
|
2960
|
+
const getFilteredInputs = (inputs, data) => inputs.filter((input) => !input?.condition ||
|
|
2961
|
+
input?.condition.values.find((_) => {
|
|
2962
|
+
const dataValue = data?.[input?.condition?.name ?? ''];
|
|
2963
|
+
return _ === (dataValue?.key ?? dataValue);
|
|
2964
|
+
}));
|
|
2965
|
+
|
|
2966
|
+
const applicationFormData = [
|
|
2967
|
+
{
|
|
2968
|
+
columns: 2,
|
|
2969
|
+
inputs: [
|
|
2970
|
+
{ fieldType: 'common', name: 'surname', required: true, dadata: true },
|
|
2971
|
+
{ fieldType: 'common', name: 'name', required: true, dadata: true },
|
|
2972
|
+
{ fieldType: 'common', name: 'middleName', dadata: true },
|
|
2973
|
+
{ fieldType: 'common', name: 'limitedBirthday', required: true },
|
|
2974
|
+
{ fieldType: 'common', name: 'phone', required: true },
|
|
2975
|
+
{ fieldType: 'common', name: 'email', required: true, dadata: true },
|
|
2976
|
+
],
|
|
2977
|
+
},
|
|
2978
|
+
{
|
|
2979
|
+
inputs: [
|
|
2980
|
+
{ fieldType: 'common', name: 'processPersonalDataFlg', required: true },
|
|
2981
|
+
{ fieldType: 'common', name: 'consentProviderFlg', required: true },
|
|
2982
|
+
{ fieldType: 'common', name: 'consentOthersFlg', required: true },
|
|
2983
|
+
{ fieldType: 'common', name: 'consentInformFlg' },
|
|
2984
|
+
{ fieldType: 'common', name: 'consentPfrFlg' },
|
|
2985
|
+
],
|
|
2986
|
+
},
|
|
2987
|
+
];
|
|
2988
|
+
|
|
2989
|
+
const AddressFactField = JSX(({ field, input }) => {
|
|
2990
|
+
const fieldName = 'addressFact';
|
|
2991
|
+
const fieldValue = field(fieldName).value;
|
|
2992
|
+
const { value } = field('addressMatch');
|
|
2993
|
+
useEffect(() => {
|
|
2994
|
+
if (value) {
|
|
2995
|
+
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
2996
|
+
}
|
|
2997
|
+
}, [value, field('addressRegistration').value]);
|
|
2998
|
+
const onDaDataChange = useCallback((item) => {
|
|
2999
|
+
field?.(fieldName)?.onChange?.({
|
|
3000
|
+
apartment: item?.data?.flat,
|
|
3001
|
+
city: item?.data?.city,
|
|
3002
|
+
district: item?.data?.area_with_type,
|
|
3003
|
+
fullAddress: item?.value,
|
|
3004
|
+
fiasCode: item?.data?.fias_id,
|
|
3005
|
+
house: item?.data?.house,
|
|
3006
|
+
locality: item?.data?.settlement_with_type,
|
|
3007
|
+
okatoRegionCode: item?.data?.okato,
|
|
3008
|
+
postcode: item?.data?.postal_code,
|
|
3009
|
+
region: item?.data?.region,
|
|
3010
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
3011
|
+
street: item?.data?.house,
|
|
3012
|
+
qc: item?.data?.qc,
|
|
3013
|
+
qcComplete: item?.data?.qc_complete,
|
|
3014
|
+
qcHouse: item?.data?.qc_house,
|
|
3015
|
+
});
|
|
3016
|
+
}, []);
|
|
3017
|
+
const onChange = useCallback((val) => {
|
|
3018
|
+
field?.(fieldName)?.onChange?.({
|
|
3019
|
+
apartment: '',
|
|
3020
|
+
city: '',
|
|
3021
|
+
district: '',
|
|
3022
|
+
fullAddress: val,
|
|
3023
|
+
fiasCode: '',
|
|
3024
|
+
house: '',
|
|
3025
|
+
locality: '',
|
|
3026
|
+
okatoRegionCode: '',
|
|
3027
|
+
postcode: '',
|
|
3028
|
+
region: '',
|
|
3029
|
+
regionCode: '',
|
|
3030
|
+
street: '',
|
|
3031
|
+
qc: '',
|
|
3032
|
+
qcComplete: '',
|
|
3033
|
+
qcHouse: '',
|
|
3034
|
+
});
|
|
3035
|
+
}, []);
|
|
3036
|
+
return (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", disabled: value, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), value: fieldValue.fullAddress, onChange: onChange, ...input, onDaDataChange: onDaDataChange }));
|
|
3037
|
+
});
|
|
3038
|
+
|
|
3039
|
+
const AddressMatchField = JSX(({ field, input }) => {
|
|
3040
|
+
return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
|
|
3041
|
+
});
|
|
3042
|
+
|
|
3043
|
+
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
3044
|
+
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
3045
|
+
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
3046
|
+
if (isLoad || !points) {
|
|
3047
|
+
return;
|
|
3048
|
+
}
|
|
3049
|
+
map.geoObjects.removeAll();
|
|
3050
|
+
if (!points.length) {
|
|
3051
|
+
return;
|
|
3052
|
+
}
|
|
3053
|
+
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
3054
|
+
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
3055
|
+
if (points.length && points.every((_) => 'type' in _)) {
|
|
3056
|
+
const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
|
|
3057
|
+
const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
|
|
3058
|
+
const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
|
|
3059
|
+
officeClusterer.add(officesGeoObjects);
|
|
3060
|
+
remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
|
|
3061
|
+
map.geoObjects.add(remoteWorkplaceClusterer);
|
|
3062
|
+
map.geoObjects.add(officeClusterer);
|
|
3063
|
+
}
|
|
3064
|
+
else {
|
|
3065
|
+
const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
|
|
3066
|
+
officeClusterer.add(geoObjects);
|
|
3067
|
+
map.geoObjects.add(officeClusterer);
|
|
3068
|
+
}
|
|
3069
|
+
map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
|
|
3070
|
+
if (map.getZoom() > 10) {
|
|
3071
|
+
map.setZoom(10);
|
|
3072
|
+
}
|
|
3073
|
+
});
|
|
3074
|
+
}
|
|
3075
|
+
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
3076
|
+
return new yandexMaps.Clusterer({
|
|
3077
|
+
clusterIcons: [
|
|
3078
|
+
{
|
|
3079
|
+
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
3080
|
+
size: [78, 84],
|
|
3081
|
+
offset: [-35, -50],
|
|
3082
|
+
},
|
|
3083
|
+
],
|
|
3084
|
+
clusterIconContentLayout,
|
|
3085
|
+
clusterHideIconOnBalloonOpen: false,
|
|
3086
|
+
geoObjectHideIconOnBalloonOpen: false,
|
|
3087
|
+
});
|
|
3088
|
+
};
|
|
3089
|
+
const defineGeoObjects = (pointArr, type, yandexMaps) => {
|
|
3090
|
+
return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
|
|
3091
|
+
balloonContentHeader: content?.header,
|
|
3092
|
+
balloonContentBody: content?.body,
|
|
3093
|
+
balloonContentFooter: content?.footer,
|
|
3094
|
+
hintContent: content?.hint,
|
|
3095
|
+
}, {
|
|
3096
|
+
iconLayout: 'default#image',
|
|
3097
|
+
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
3098
|
+
iconImageSize: [78, 84],
|
|
3099
|
+
iconImageOffset: [-35, -50],
|
|
3100
|
+
}));
|
|
3101
|
+
};
|
|
3102
|
+
|
|
3103
|
+
const defaultStyle = {
|
|
3104
|
+
focus: 'focus:border-primary-text focus:border',
|
|
3105
|
+
hover: 'hover:bg-primary-hover',
|
|
3106
|
+
active: 'active:bg-primary-active',
|
|
3107
|
+
font: 'text-center font-sans',
|
|
3108
|
+
};
|
|
3109
|
+
|
|
3110
|
+
const styles$1 = {
|
|
3111
|
+
...defaultStyle,
|
|
3112
|
+
border: 'border border-transparent rounded-md',
|
|
3113
|
+
position: 'absolute flex items-center justify-center',
|
|
3114
|
+
};
|
|
3115
|
+
const renderUserGeolocation = (map, yandexMaps, className) => {
|
|
3116
|
+
const setUserGeoLocation = () => {
|
|
3117
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3118
|
+
// @ts-ignore
|
|
3119
|
+
yandexMaps.geolocation
|
|
3120
|
+
.get({
|
|
3121
|
+
provider: 'yandex',
|
|
3122
|
+
autoReverseGeocode: true,
|
|
3123
|
+
mapStateAutoApply: true,
|
|
3124
|
+
})
|
|
3125
|
+
.then(function (result) {
|
|
3126
|
+
map.current.geoObjects.add(result.geoObjects);
|
|
3127
|
+
});
|
|
3128
|
+
};
|
|
3129
|
+
return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
|
|
3130
|
+
};
|
|
3131
|
+
|
|
3132
|
+
const getNS = (_) => globalThis[_];
|
|
3133
|
+
const initializeExternalNS = (namespaceName, url) => {
|
|
3134
|
+
const script = document.getElementById(url);
|
|
3135
|
+
if (script) {
|
|
3136
|
+
const ns = getNS(namespaceName);
|
|
3137
|
+
if (ns) {
|
|
3138
|
+
return Promise.resolve(ns);
|
|
3139
|
+
}
|
|
3140
|
+
else {
|
|
3141
|
+
return new Promise((resolve) => {
|
|
3142
|
+
script.addEventListener('load', () => {
|
|
3143
|
+
resolve(getNS(namespaceName));
|
|
3144
|
+
});
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
3148
|
+
else {
|
|
3149
|
+
return new Promise((resolve, reject) => {
|
|
3150
|
+
const newScript = document.createElement('script');
|
|
3151
|
+
newScript.src = url;
|
|
3152
|
+
newScript.async = true;
|
|
3153
|
+
newScript.id = url;
|
|
3154
|
+
newScript.addEventListener('load', () => {
|
|
3155
|
+
resolve(getNS(namespaceName));
|
|
3156
|
+
});
|
|
3157
|
+
newScript.addEventListener('error', (error) => {
|
|
3158
|
+
reject(error);
|
|
3159
|
+
});
|
|
3160
|
+
document.head.appendChild(newScript);
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3163
|
+
};
|
|
3164
|
+
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
3165
|
+
const [externalNS, setExternalNS] = useState(undefined);
|
|
3166
|
+
useEffect(() => {
|
|
3167
|
+
let isMounted = true;
|
|
3168
|
+
initializeExternalNS(namespaceName, url)
|
|
3169
|
+
.then((ns) => {
|
|
3170
|
+
if (isMounted) {
|
|
3171
|
+
setExternalNS(ns);
|
|
3172
|
+
}
|
|
3173
|
+
})
|
|
3174
|
+
.catch((error) => {
|
|
3175
|
+
console.error(`Failed to initialize external namespace: ${error}`);
|
|
3176
|
+
});
|
|
3177
|
+
return () => {
|
|
3178
|
+
isMounted = false;
|
|
3179
|
+
if (unmountNS) {
|
|
3180
|
+
const script = document.getElementById(url);
|
|
3181
|
+
if (script) {
|
|
3182
|
+
document.head.removeChild(script);
|
|
3183
|
+
}
|
|
3184
|
+
setExternalNS(undefined);
|
|
3185
|
+
}
|
|
3186
|
+
};
|
|
3187
|
+
}, [namespaceName, url, unmountNS]);
|
|
3188
|
+
return externalNS;
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
const YMAPS_NAMESPACE = 'ymaps';
|
|
3192
|
+
const useYandexMaps = () => {
|
|
3193
|
+
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
3194
|
+
return useExternalNS(YMAPS_NAMESPACE, url, false);
|
|
3195
|
+
};
|
|
3196
|
+
|
|
3197
|
+
const styles = {
|
|
3198
|
+
...defaultStyle,
|
|
3199
|
+
border: 'border-b border-b-2 border-gray last:border-0',
|
|
3200
|
+
position: 'relative flex items-center justify-center',
|
|
3201
|
+
};
|
|
3202
|
+
// TODO: Добавить метод определения центральной точки
|
|
3203
|
+
const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
|
|
3204
|
+
const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
|
|
3205
|
+
const changeZoom = () => {
|
|
3206
|
+
const currentZoom = yandexMaps.current.getZoom();
|
|
3207
|
+
const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
|
|
3208
|
+
yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
|
|
3209
|
+
};
|
|
3210
|
+
return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
|
|
3211
|
+
});
|
|
3212
|
+
|
|
3213
|
+
const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
|
|
3214
|
+
// TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
|
|
3215
|
+
// Сейчас реализован поиск среди тестовых данных
|
|
3216
|
+
// TODO: Также выяснить что делать когда ничего не найдено
|
|
3217
|
+
// TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
|
|
3218
|
+
const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
|
|
3219
|
+
const map = useRef(null);
|
|
3220
|
+
const parentDiv = useRef(null);
|
|
3221
|
+
const yandexMaps = useYandexMaps();
|
|
3222
|
+
useEffect(() => {
|
|
3223
|
+
if (map.current) {
|
|
3224
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
3225
|
+
}
|
|
3226
|
+
else {
|
|
3227
|
+
yandexMaps?.ready(() => {
|
|
3228
|
+
// Ready function may be called few times, but must be called once
|
|
3229
|
+
if (map.current) {
|
|
3230
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
3231
|
+
return;
|
|
3232
|
+
}
|
|
3233
|
+
map.current = new yandexMaps.Map(parentDiv.current, {
|
|
3234
|
+
center: getCenterPoint(points),
|
|
3235
|
+
zoom,
|
|
3236
|
+
controls: [],
|
|
3237
|
+
suppressMapOpenBlock: true,
|
|
3238
|
+
});
|
|
3239
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
// zoom к выбранному отделению банка в рамках задачи по retail
|
|
3243
|
+
if (map.current && selectedAddress) {
|
|
3244
|
+
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
3245
|
+
const firstGeoObject = res.geoObjects.get(0);
|
|
3246
|
+
const coords = firstGeoObject.geometry.getCoordinates();
|
|
3247
|
+
map.current.setCenter(coords);
|
|
3248
|
+
map.current.setZoom(18);
|
|
3249
|
+
});
|
|
3250
|
+
}
|
|
3251
|
+
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
3252
|
+
if (!yandexMaps) {
|
|
3253
|
+
return null;
|
|
3254
|
+
}
|
|
3255
|
+
const zIndex = 'z-10';
|
|
3256
|
+
return (jsxs("div", { ref: parentDiv, className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
|
|
3257
|
+
});
|
|
3258
|
+
const getCenterPoint = (points) => {
|
|
3259
|
+
const centerCoords = [
|
|
3260
|
+
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
3261
|
+
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
3262
|
+
];
|
|
3263
|
+
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
3264
|
+
};
|
|
3265
|
+
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
3266
|
+
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
3267
|
+
|
|
3268
|
+
const fetchRetailJSON = async (url, method, body) => {
|
|
3269
|
+
try {
|
|
3270
|
+
const response = await doRequest(url, method, body);
|
|
3271
|
+
return response.json();
|
|
3272
|
+
}
|
|
3273
|
+
catch (err) {
|
|
3274
|
+
console.error(err);
|
|
3275
|
+
return null;
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3278
|
+
async function doRequest(url, method, body) {
|
|
3279
|
+
return globalThis?.fetch?.(`${API_BASE_URI}${url}`, {
|
|
3280
|
+
method,
|
|
3281
|
+
headers: {
|
|
3282
|
+
'Content-Type': 'application/json',
|
|
3283
|
+
...getAuthorizationHeaders(),
|
|
3284
|
+
},
|
|
3285
|
+
credentials: 'include',
|
|
3286
|
+
body: body ? JSON.stringify(body) : null,
|
|
3287
|
+
});
|
|
3288
|
+
}
|
|
3289
|
+
const getAuthorizationHeaders = () => {
|
|
3290
|
+
const token = sessionStorage.getItem('accessToken');
|
|
3291
|
+
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
3292
|
+
};
|
|
3293
|
+
|
|
3294
|
+
const fetchRegionOffices = async (regionKey) => {
|
|
3295
|
+
const response = await fetchRetailJSON('/public-data/regionOffices', 'POST', {
|
|
3296
|
+
regionRfCd: {
|
|
3297
|
+
key: regionKey,
|
|
3298
|
+
},
|
|
3299
|
+
cashCardFlg: true,
|
|
3300
|
+
});
|
|
3301
|
+
return (response?.offices?.map((office) => ({
|
|
3302
|
+
...office,
|
|
3303
|
+
gpsLatitude: formatCoordinate(office.latitude ?? DEFAULT_CENTER_COORDS[0]),
|
|
3304
|
+
gpsLongitude: formatCoordinate(office.longitude ?? DEFAULT_CENTER_COORDS[1]),
|
|
3305
|
+
})) || []);
|
|
3306
|
+
};
|
|
3307
|
+
const formatCoordinate = (coordinate) => Number(coordinate.toString().replace(',', '.'));
|
|
3308
|
+
|
|
3309
|
+
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
3310
|
+
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
3311
|
+
const onToggle = useCallback(() => {
|
|
3312
|
+
setIsUnfolded((_) => !_);
|
|
3313
|
+
}, []);
|
|
3314
|
+
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
3315
|
+
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
3316
|
+
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
3317
|
+
});
|
|
3318
|
+
|
|
3319
|
+
function useResizeObserver(callback, deps) {
|
|
3320
|
+
const ref = useRef(null);
|
|
3321
|
+
useEffect(() => {
|
|
3322
|
+
const element = ref?.current;
|
|
3323
|
+
if (!element) {
|
|
3324
|
+
return undefined;
|
|
3325
|
+
}
|
|
3326
|
+
const observer = new ResizeObserver((entries) => {
|
|
3327
|
+
callback(element, entries[0]);
|
|
3328
|
+
});
|
|
3329
|
+
observer.observe(element);
|
|
3330
|
+
return () => {
|
|
3331
|
+
observer.disconnect();
|
|
3332
|
+
};
|
|
3333
|
+
}, [callback, ...deps]);
|
|
3334
|
+
return ref;
|
|
3335
|
+
}
|
|
3336
|
+
|
|
3337
|
+
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
3338
|
+
const containerRef = useRef(null);
|
|
3339
|
+
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
3340
|
+
if (containerRef.current) {
|
|
3341
|
+
containerRef.current.style.maxHeight = isUnfolded
|
|
3342
|
+
? `${childrenWrapperEl.scrollHeight}px`
|
|
3343
|
+
: '';
|
|
3344
|
+
}
|
|
3345
|
+
}, [isUnfolded]);
|
|
3346
|
+
return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
|
|
3347
|
+
});
|
|
3348
|
+
|
|
3349
|
+
const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
|
|
3350
|
+
const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
|
|
3351
|
+
if ([textItems.length, children, subText].every((_) => !_)) {
|
|
3352
|
+
return null;
|
|
3353
|
+
}
|
|
3354
|
+
return renderCardCell({ textItems, subText, children, isPhone, ...props });
|
|
3355
|
+
});
|
|
3356
|
+
const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
|
|
3357
|
+
const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
|
|
3358
|
+
const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
|
|
3359
|
+
|
|
3360
|
+
const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
|
|
3361
|
+
|
|
3362
|
+
const getScheduleDescription = (workScheduleWeek) => {
|
|
3363
|
+
const rows = getDateDescription(workScheduleWeek);
|
|
3364
|
+
return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
|
|
3365
|
+
};
|
|
3366
|
+
const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
|
|
3367
|
+
if (!workTime) {
|
|
3368
|
+
return '';
|
|
3369
|
+
}
|
|
3370
|
+
return [
|
|
3371
|
+
`${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
|
|
3372
|
+
lunchHour ? `перерыв: ${lunchHour}` : '',
|
|
3373
|
+
daysOff ? `не работает: ${daysOff}` : '',
|
|
3374
|
+
]
|
|
3375
|
+
.filter(Boolean)
|
|
3376
|
+
.join('; ');
|
|
3377
|
+
};
|
|
3378
|
+
const getDateDescription = (workScheduleWeek) => {
|
|
3379
|
+
const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
3380
|
+
const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
3381
|
+
const daysOff = workScheduleWeek
|
|
3382
|
+
.filter((_) => !_.status)
|
|
3383
|
+
.map((_) => _.short?.toLowerCase())
|
|
3384
|
+
.join(', ');
|
|
3385
|
+
const rows = [
|
|
3386
|
+
buildScheduleText({
|
|
3387
|
+
workTime: workingWeekday?.workTime,
|
|
3388
|
+
lunchHour: workingWeekday?.lunchHour,
|
|
3389
|
+
daysOff: workingSaturday ? '' : daysOff,
|
|
3390
|
+
}),
|
|
3391
|
+
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
3392
|
+
].filter(Boolean);
|
|
3393
|
+
return rows;
|
|
3394
|
+
};
|
|
3395
|
+
|
|
3396
|
+
const WEEKDAY_MAP = [
|
|
3397
|
+
['workingMonday', 'Пн', 'Понедельник'],
|
|
3398
|
+
['workingTuesday', 'Вт', 'Вторник'],
|
|
3399
|
+
['workingWednesday', 'Ср', 'Среда'],
|
|
3400
|
+
['workingThursday', 'Чт', 'Четверг'],
|
|
3401
|
+
['workingFriday', 'Пт', 'Пятница'],
|
|
3402
|
+
['workingSaturday', 'Сб', 'Суббота'],
|
|
3403
|
+
['workingSunday', 'Вс', 'Воскресенье'],
|
|
3404
|
+
];
|
|
3405
|
+
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
3406
|
+
key,
|
|
3407
|
+
title,
|
|
3408
|
+
short,
|
|
3409
|
+
status: Boolean(workSchedule?.[key]),
|
|
3410
|
+
get workTime() {
|
|
3411
|
+
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
3412
|
+
},
|
|
3413
|
+
get lunchHour() {
|
|
3414
|
+
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
3415
|
+
},
|
|
3416
|
+
get hasLunch() {
|
|
3417
|
+
return /\d+/.test(this.lunchHour ?? '');
|
|
3418
|
+
},
|
|
3419
|
+
}));
|
|
3420
|
+
|
|
3421
|
+
const renderBusinessSchedule = (scheduleDescription) => {
|
|
3422
|
+
if (!scheduleDescription) {
|
|
3423
|
+
return null;
|
|
3424
|
+
}
|
|
3425
|
+
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
3426
|
+
return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
|
|
3427
|
+
};
|
|
3428
|
+
const getBusinessSchedule = (scheduleDescription) => {
|
|
3429
|
+
const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
|
|
3430
|
+
const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
|
|
3431
|
+
const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
|
|
3432
|
+
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
3433
|
+
return weekDayMap;
|
|
3434
|
+
}
|
|
3435
|
+
return weekDayMap.map((_) => ({
|
|
3436
|
+
..._,
|
|
3437
|
+
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
3438
|
+
}));
|
|
3439
|
+
};
|
|
3440
|
+
const renderAlternativeDay = ({ short, status }, i) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(i)));
|
|
3441
|
+
|
|
3442
|
+
const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
|
|
3443
|
+
|
|
3444
|
+
const colorStyle = {
|
|
3445
|
+
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
3446
|
+
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
3447
|
+
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
3448
|
+
red: { border: 'border-error/30', text: 'text-error' },
|
|
3449
|
+
};
|
|
3450
|
+
const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
|
|
3451
|
+
|
|
3452
|
+
const currentWeekDayIdx = new Date().getDay();
|
|
3453
|
+
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
3454
|
+
const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
3455
|
+
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
3456
|
+
if (!currentWeekDay) {
|
|
3457
|
+
return null;
|
|
3458
|
+
}
|
|
3459
|
+
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
3460
|
+
return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
|
|
3461
|
+
};
|
|
3462
|
+
|
|
3463
|
+
const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
|
|
3464
|
+
if (!status) {
|
|
3465
|
+
return 'Не работает';
|
|
3466
|
+
}
|
|
3467
|
+
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
3468
|
+
};
|
|
3469
|
+
const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
|
|
3470
|
+
|
|
3471
|
+
const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
3472
|
+
const labels = ['Подробнее', 'Скрыть'];
|
|
3473
|
+
const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
|
|
3474
|
+
|
|
3475
|
+
const renderWorkSchedule = (workSchedule) => {
|
|
3476
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
3477
|
+
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
3478
|
+
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
3479
|
+
if (!workSchedule) {
|
|
3480
|
+
return '';
|
|
3481
|
+
}
|
|
3482
|
+
if (!workSchedule.businessScheduleVisibleTag) {
|
|
3483
|
+
return renderMatchingTimeOfWork(timeOfWork);
|
|
3484
|
+
}
|
|
3485
|
+
if (workSchedule.businessScheduleVisibleTag &&
|
|
3486
|
+
workSchedule.businessScheduleDescription === null) {
|
|
3487
|
+
return renderIndividualTimeOfWork(timeOfWork);
|
|
3488
|
+
}
|
|
3489
|
+
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
3490
|
+
};
|
|
3491
|
+
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
3492
|
+
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
3493
|
+
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
3494
|
+
|
|
3495
|
+
const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
|
|
3496
|
+
if (!workSchedule) {
|
|
3497
|
+
return null;
|
|
3498
|
+
}
|
|
3499
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
3500
|
+
return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
|
|
3501
|
+
phone,
|
|
3502
|
+
fax,
|
|
3503
|
+
phoneBusiness,
|
|
3504
|
+
phoneNatural,
|
|
3505
|
+
phoneCallCentre,
|
|
3506
|
+
phoneCurrencyControl,
|
|
3507
|
+
workSchedule,
|
|
3508
|
+
exchangeRate,
|
|
3509
|
+
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
3510
|
+
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
3511
|
+
phone,
|
|
3512
|
+
fax,
|
|
3513
|
+
phoneBusiness,
|
|
3514
|
+
phoneNatural,
|
|
3515
|
+
phoneCallCentre,
|
|
3516
|
+
phoneCurrencyControl,
|
|
3517
|
+
workSchedule,
|
|
3518
|
+
exchangeRate,
|
|
3519
|
+
}) }));
|
|
3520
|
+
},
|
|
3521
|
+
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
3522
|
+
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
3523
|
+
};
|
|
3524
|
+
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
3525
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
3526
|
+
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
3527
|
+
? 'Для физических лиц'
|
|
3528
|
+
: 'Для физических и юридических лиц';
|
|
3529
|
+
return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness, isPhone: true }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural, isPhone: true }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), workSchedule?.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
|
|
3530
|
+
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
3531
|
+
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
3532
|
+
};
|
|
3533
|
+
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
3534
|
+
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
3535
|
+
const header = capitalizedFirstLetter$1(name);
|
|
3536
|
+
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
3537
|
+
return { header, body };
|
|
3538
|
+
};
|
|
3539
|
+
|
|
3540
|
+
const INITIAL_FILTRATION_STATE$1 = {
|
|
3541
|
+
workingSaturday: false,
|
|
3542
|
+
premiumService: false,
|
|
3543
|
+
privateBanking: false,
|
|
3544
|
+
remoteWorkplace: false,
|
|
3545
|
+
serviceDisabledPeople: false,
|
|
3546
|
+
sellingCoins: false,
|
|
3547
|
+
buyingCoins: false,
|
|
3548
|
+
bullionOperations: false,
|
|
3549
|
+
preciousMetalsOperations: false,
|
|
3550
|
+
transferringDataToBiometricSystem: false,
|
|
3551
|
+
};
|
|
3552
|
+
const FILTRATION_LABELS = {
|
|
3553
|
+
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
3554
|
+
workingSaturday: 'Открыты по субботам',
|
|
3555
|
+
terminalTypeAtms: 'Банкоматы',
|
|
3556
|
+
terminalTypeTerm: 'Терминалы',
|
|
3557
|
+
workAllTime: 'Круглосуточно',
|
|
3558
|
+
billAcceptorEnable: 'Прием наличных',
|
|
3559
|
+
premiumService: 'Премиальное обслуживание',
|
|
3560
|
+
privateBanking: 'Услуга Private banking',
|
|
3561
|
+
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
3562
|
+
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
3563
|
+
bullionOperations: 'Операции со слитками',
|
|
3564
|
+
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
3565
|
+
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
3566
|
+
locationDisabledPeople: 'Для маломобильных',
|
|
3567
|
+
designDisabledPeople: 'Для слабовидящих',
|
|
3568
|
+
remoteWorkplace: 'Удаленное рабочее место',
|
|
3569
|
+
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
2964
3570
|
};
|
|
2965
|
-
const
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
const [day, month, year] = inputValue.split('.');
|
|
2977
|
-
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2978
|
-
setSelectedMonth(Number(month) - 1);
|
|
2979
|
-
setSelectedYear(Number(year));
|
|
2980
|
-
}
|
|
2981
|
-
else {
|
|
2982
|
-
setInputValue(value || '');
|
|
2983
|
-
}
|
|
2984
|
-
};
|
|
2985
|
-
const onInputClick = () => {
|
|
2986
|
-
if (ref.current !== null) {
|
|
2987
|
-
ref.current.focus();
|
|
2988
|
-
}
|
|
2989
|
-
onClick?.();
|
|
2990
|
-
};
|
|
2991
|
-
useEffect(() => {
|
|
2992
|
-
setInputValue(value || '');
|
|
2993
|
-
}, [value]);
|
|
2994
|
-
return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
|
|
2995
|
-
});
|
|
2996
|
-
const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
|
|
2997
|
-
const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
|
|
2998
|
-
const checkIsValidDate = (date) => {
|
|
2999
|
-
const [day, month, year] = date.split('.');
|
|
3000
|
-
if (isValidYear(year)) {
|
|
3001
|
-
if (isValidMonth(month)) {
|
|
3002
|
-
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
3003
|
-
let maxDateOfMonth = 0;
|
|
3004
|
-
while (currentDate.getMonth() === Number(month) - 1) {
|
|
3005
|
-
currentDate.setDate(currentDate.getDate() + 1);
|
|
3006
|
-
maxDateOfMonth++;
|
|
3007
|
-
}
|
|
3008
|
-
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
3009
|
-
return true;
|
|
3010
|
-
}
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
return false;
|
|
3571
|
+
const FILTRATION_PREDICATES$1 = {
|
|
3572
|
+
workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
3573
|
+
premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
|
|
3574
|
+
privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
|
|
3575
|
+
remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
|
|
3576
|
+
serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
3577
|
+
sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
|
|
3578
|
+
buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
|
|
3579
|
+
bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
|
|
3580
|
+
preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
3581
|
+
transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
3014
3582
|
};
|
|
3015
3583
|
|
|
3016
|
-
const
|
|
3017
|
-
|
|
3018
|
-
|
|
3584
|
+
const filterItems$1 = (data, filtrationState) => {
|
|
3585
|
+
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
3586
|
+
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
3587
|
+
};
|
|
3019
3588
|
|
|
3020
|
-
const
|
|
3021
|
-
const
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
onYearSelect(selectedYear - 1);
|
|
3045
|
-
}
|
|
3046
|
-
}, [selectedMonth]);
|
|
3047
|
-
const handleSelectMonth = useCallback(({ key }) => {
|
|
3048
|
-
onMonthSelect(months.indexOf(key));
|
|
3049
|
-
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
3050
|
-
handleChangeMonth({
|
|
3051
|
-
maxDateOfMonth,
|
|
3052
|
-
selectedYear,
|
|
3053
|
-
selectedMonth: months.indexOf(key),
|
|
3054
|
-
value,
|
|
3055
|
-
onChange,
|
|
3056
|
-
});
|
|
3057
|
-
}, [value]);
|
|
3058
|
-
const handleSelectYear = useCallback(({ key }) => {
|
|
3059
|
-
onYearSelect(Number(key));
|
|
3060
|
-
value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
|
|
3061
|
-
}, [value]);
|
|
3062
|
-
return {
|
|
3063
|
-
handleChangeVisibleCalendar,
|
|
3064
|
-
handleNextMonth,
|
|
3065
|
-
handlePrevMonth,
|
|
3066
|
-
handleSelectMonth,
|
|
3067
|
-
handleSelectYear,
|
|
3068
|
-
monthsOptions: MONTHS_OPTIONS,
|
|
3069
|
-
yearsOptions: YEARS_OPTIONS,
|
|
3070
|
-
ref,
|
|
3071
|
-
};
|
|
3589
|
+
const defaultEmptyFunction$1 = () => void 0;
|
|
3590
|
+
const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, }) => {
|
|
3591
|
+
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
3592
|
+
const _filteredItems = filterItems$1(data, filtrationState);
|
|
3593
|
+
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
3594
|
+
const _points = [
|
|
3595
|
+
..._filteredItems.map((_) => ({
|
|
3596
|
+
type: 'offices',
|
|
3597
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3598
|
+
content: getBalloon(_),
|
|
3599
|
+
})),
|
|
3600
|
+
..._filteredRemoteWorkplaces.map((_) => ({
|
|
3601
|
+
type: 'workplaces',
|
|
3602
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3603
|
+
content: getBalloonRemoteWorkplaces({
|
|
3604
|
+
address: _.address,
|
|
3605
|
+
workScheduleDescription: _.workScheduleDescription,
|
|
3606
|
+
}),
|
|
3607
|
+
})),
|
|
3608
|
+
].filter((_) => _.coords && _.coords.length === 2);
|
|
3609
|
+
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
3610
|
+
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
3611
|
+
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
3612
|
+
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
3072
3613
|
};
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
date.setDate(date.getDate() + 1);
|
|
3614
|
+
|
|
3615
|
+
const useLeadFormData = (typeField) => {
|
|
3616
|
+
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
3617
|
+
if (data && 'errorMessage' in data) {
|
|
3618
|
+
return { error };
|
|
3079
3619
|
}
|
|
3080
|
-
return
|
|
3620
|
+
return { data: data, error };
|
|
3081
3621
|
};
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3084
|
-
|
|
3622
|
+
const fetchData = async (url) => {
|
|
3623
|
+
const result = await fetchJSON(url, { method: 'POST' });
|
|
3624
|
+
return result || [];
|
|
3085
3625
|
};
|
|
3086
3626
|
|
|
3087
|
-
const
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
}
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
onChange,
|
|
3112
|
-
value,
|
|
3627
|
+
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
3628
|
+
|
|
3629
|
+
const isClient = !isSSR();
|
|
3630
|
+
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
3631
|
+
|
|
3632
|
+
const AddressRetailField = JSX(({ field, input }) => {
|
|
3633
|
+
const [offices, setOffices] = useState([]);
|
|
3634
|
+
const { data } = useLeadFormData('REGION_RF');
|
|
3635
|
+
const regionValue = field('regionRetail')?.value || {};
|
|
3636
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3637
|
+
const fieldBranch = field('addressRetail');
|
|
3638
|
+
useEffect(() => {
|
|
3639
|
+
(async () => {
|
|
3640
|
+
const officesList = await fetchRegionOffices(regionValue?.key ?? '');
|
|
3641
|
+
setOffices(officesList);
|
|
3642
|
+
})();
|
|
3643
|
+
if (regionValue?.key) {
|
|
3644
|
+
field?.('addressRetail')?.onChange?.('');
|
|
3645
|
+
}
|
|
3646
|
+
}, [regionValue.key]);
|
|
3647
|
+
const { points } = useOfficesAtmsMapData({
|
|
3648
|
+
data: offices,
|
|
3649
|
+
filtrationState: {},
|
|
3650
|
+
getBalloon: getOfficePoint,
|
|
3113
3651
|
});
|
|
3114
|
-
const
|
|
3115
|
-
return (jsxs("div", {
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3652
|
+
const isRegionSelected = Boolean(regionValue?.key);
|
|
3653
|
+
return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: offices.map(({ id, address = '' }) => ({
|
|
3654
|
+
key: id?.toString() || '',
|
|
3655
|
+
text: address,
|
|
3656
|
+
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
|
|
3657
|
+
});
|
|
3658
|
+
|
|
3659
|
+
const SelectField = UniBlock(({ field, source, fieldName, input, placeholder = 'Выберите из списка',
|
|
3660
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3661
|
+
options, ...rest }) => {
|
|
3662
|
+
const leadOptions = source?.map((_) => ({
|
|
3663
|
+
key: _.key || '',
|
|
3664
|
+
text: _.value,
|
|
3665
|
+
})) || [];
|
|
3666
|
+
return (jsx(SelectControl, { placeholder: placeholder, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required), ...rest }));
|
|
3667
|
+
});
|
|
3668
|
+
|
|
3669
|
+
const AmountWorkersField = JSX(({ field, input }) => {
|
|
3670
|
+
const { data } = useLeadFormData('EMPLOYEES_NUMBER');
|
|
3671
|
+
const store = useRetailFormStore();
|
|
3672
|
+
useEffect(() => {
|
|
3673
|
+
if (data) {
|
|
3674
|
+
store.amountWorkers = data;
|
|
3675
|
+
}
|
|
3676
|
+
}, [data]);
|
|
3677
|
+
return (jsx(SelectField, { field: field, source: store.amountWorkers ?? [], label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
|
|
3126
3678
|
});
|
|
3127
3679
|
|
|
3128
|
-
const
|
|
3680
|
+
const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
|
|
3129
3681
|
|
|
3130
|
-
const
|
|
3682
|
+
const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", isInteger: true, ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
|
|
3131
3683
|
|
|
3132
|
-
const
|
|
3684
|
+
const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
|
|
3685
|
+
|
|
3686
|
+
const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
|
|
3133
3687
|
|
|
3134
|
-
const FIELD_NAME$
|
|
3135
|
-
const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
3688
|
+
const FIELD_NAME$9 = 'birthPlace';
|
|
3689
|
+
const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$9) })));
|
|
3136
3690
|
|
|
3137
3691
|
const getCardTypes = async (paymentSystemTypeCd, creditProgramId) => {
|
|
3138
3692
|
const data = await fetchRetailJSON('/dictionaryFiltered', 'POST', {
|
|
@@ -3188,10 +3742,6 @@
|
|
|
3188
3742
|
|
|
3189
3743
|
const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
|
|
3190
3744
|
|
|
3191
|
-
const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", isInteger: true, ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
3192
|
-
|
|
3193
|
-
const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
|
|
3194
|
-
|
|
3195
3745
|
const ConfirmationIncomeField = JSX(({ field, input }) => {
|
|
3196
3746
|
const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
|
|
3197
3747
|
return (jsx(SelectField, { field: field, source: confirmationIncome, label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0434\u043E\u0445\u043E\u0434\u0430", fieldName: "confirmationIncome", input: input }));
|
|
@@ -3223,9 +3773,6 @@
|
|
|
3223
3773
|
text: 'Согласие на запрос в ПФР',
|
|
3224
3774
|
docId: 3,
|
|
3225
3775
|
},
|
|
3226
|
-
consentToReceiveMaterials: {
|
|
3227
|
-
text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
|
|
3228
|
-
},
|
|
3229
3776
|
};
|
|
3230
3777
|
|
|
3231
3778
|
const feedbackById = async (id, convertToPng = false) => {
|
|
@@ -3233,42 +3780,6 @@
|
|
|
3233
3780
|
return response ? await response.blob() : new Blob();
|
|
3234
3781
|
};
|
|
3235
3782
|
|
|
3236
|
-
function useButton() {
|
|
3237
|
-
return (props) => ({
|
|
3238
|
-
...props,
|
|
3239
|
-
onClick: handlerDecorator(handleClick(props)),
|
|
3240
|
-
});
|
|
3241
|
-
}
|
|
3242
|
-
function handleClick({ disabled, onClick }) {
|
|
3243
|
-
return (ev) => {
|
|
3244
|
-
!disabled && onClick && onClick(ev);
|
|
3245
|
-
};
|
|
3246
|
-
}
|
|
3247
|
-
|
|
3248
|
-
const buttonStyleMap = {
|
|
3249
|
-
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
3250
|
-
secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
|
|
3251
|
-
};
|
|
3252
|
-
const secondaryButtonStyleMap = {
|
|
3253
|
-
primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
3254
|
-
secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
|
|
3255
|
-
};
|
|
3256
|
-
const Button = JSX(({ children, ...props }) => {
|
|
3257
|
-
const button = useButton();
|
|
3258
|
-
const { className, version = 'primary', active, disabled, isLoading, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
3259
|
-
return (jsxs("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs relative', {
|
|
3260
|
-
'text-white bg-primary-active': active,
|
|
3261
|
-
'bg-main-gray text-main-disabled cursor-not-allowed': disabled || isLoading,
|
|
3262
|
-
'rounded-md': rounded,
|
|
3263
|
-
}, !active && !disabled && !isLoading
|
|
3264
|
-
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
3265
|
-
: '', className), type: type, role: role, onClick: onClick, children: [isLoading ? jsx(Loader, { blur: true, size: "small" }) : null, children] }));
|
|
3266
|
-
});
|
|
3267
|
-
|
|
3268
|
-
const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
|
|
3269
|
-
|
|
3270
|
-
const Dialog = JSX(({ className, head, children, onClose, onClick }) => (jsxs("div", { className: style('relative bg-white pt-0 p-lg', className), role: "dialog", onClick: onClick, children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: onClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] })));
|
|
3271
|
-
|
|
3272
3783
|
// TODO Перенесено как есть из openDocument. Требует рефакторинга
|
|
3273
3784
|
const DocumentDialog = JSX(({ src, convertToPng, onClose, onDocumentRead }) => (jsxs(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", onClose: onClose, children: [convertToPng ? (jsx("img", { src: src })) : (jsx("iframe", { src: `${src}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })), jsx(Button, { className: "mx-auto mt-m", type: "button", onClick: () => {
|
|
3274
3785
|
onDocumentRead?.();
|
|
@@ -3351,12 +3862,6 @@
|
|
|
3351
3862
|
const renderMonthsInput = ({ min = 0, max = 0, availableMonths, ...rest }) => (jsx(InputRange, { items: [`От ${monthText(min)}`, `До ${monthText(max)}`], step: STEP_MONTHS, ...(availableMonths?.length ? { list: availableMonths } : { min, max }), ...rest }));
|
|
3352
3863
|
const monthText = (month) => `${month} ${Number(month) % 10 === 1 ? 'месяца' : 'месяцев'}`;
|
|
3353
3864
|
|
|
3354
|
-
const orientationStyleMap = {
|
|
3355
|
-
horizontal: '@lg:flex-row',
|
|
3356
|
-
vertical: '',
|
|
3357
|
-
};
|
|
3358
|
-
const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
|
|
3359
|
-
|
|
3360
3865
|
const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, onChange, ...rest }) => (jsxs("div", { className: "grid gap-s whitespace-nowrap", children: [title ? (jsx("div", { className: "hidden @5xl:block", role: "radiogroup", "aria-label": title, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (jsx("div", { className: "@5xl:hidden", role: "radiogroup", "aria-label": mobileTitle, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, jsx(RadioButtonGroup, { orientation: orientation, items: items, value: items[value ? 0 : 1].id, onChange: (_) => onChange && onChange(_ === items[0].id), ...rest })] }));
|
|
3361
3866
|
|
|
3362
3867
|
const renderPaymentType = (props) => renderBinaryRadioButtonGroup({
|
|
@@ -3598,12 +4103,12 @@
|
|
|
3598
4103
|
};
|
|
3599
4104
|
const swap = (_) => Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
|
|
3600
4105
|
|
|
3601
|
-
const FIELD_NAME$
|
|
4106
|
+
const FIELD_NAME$8 = 'calculator';
|
|
3602
4107
|
const CreditCalcField = JSX(({ field, params }) => {
|
|
3603
4108
|
const handleChange = useCallback((_) => {
|
|
3604
|
-
field(FIELD_NAME$
|
|
4109
|
+
field(FIELD_NAME$8).onChange?.(_);
|
|
3605
4110
|
}, []);
|
|
3606
|
-
return (jsx(CalculatorCredit, { ...params?.calcData, padding: "p-0", defaultParams: defaultValueAdapter(field(FIELD_NAME$
|
|
4111
|
+
return (jsx(CalculatorCredit, { ...params?.calcData, padding: "p-0", defaultParams: defaultValueAdapter(field(FIELD_NAME$8).value), onChange: handleChange }));
|
|
3607
4112
|
});
|
|
3608
4113
|
|
|
3609
4114
|
const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
|
|
@@ -3628,252 +4133,100 @@
|
|
|
3628
4133
|
|
|
3629
4134
|
const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", isInteger: true, maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
|
|
3630
4135
|
|
|
3631
|
-
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
|
|
3632
|
-
|
|
3633
4136
|
const DisablePeopleFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u0438\u043D\u0432\u0430\u043B\u0438\u0434\u043E\u043C", ...getValidation(field('disablePeopleFlg'), validatorObj.disablePeopleFlg, input?.required) })));
|
|
3634
4137
|
|
|
3635
|
-
const FIELD_NAME$
|
|
3636
|
-
const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$
|
|
4138
|
+
const FIELD_NAME$7 = 'dulIssueDateField';
|
|
4139
|
+
const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$7), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7) })));
|
|
3637
4140
|
|
|
3638
|
-
const FIELD_NAME$
|
|
4141
|
+
const FIELD_NAME$6 = 'dulIssuedBy';
|
|
3639
4142
|
const DulIssuedByField = JSX(({ field, input }) => {
|
|
3640
4143
|
const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
|
|
3641
4144
|
const onDaDataChange = useCallback((item) => {
|
|
3642
4145
|
changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
|
|
3643
4146
|
}, []);
|
|
3644
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4147
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
|
|
3645
4148
|
});
|
|
3646
4149
|
|
|
3647
|
-
const FIELD_NAME$
|
|
3648
|
-
const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4150
|
+
const FIELD_NAME$5 = 'dulNumber';
|
|
4151
|
+
const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
|
|
3649
4152
|
|
|
3650
|
-
const FIELD_NAME$
|
|
3651
|
-
const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4153
|
+
const FIELD_NAME$4 = 'dulSerie';
|
|
4154
|
+
const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", isInteger: true, maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
|
|
3652
4155
|
|
|
3653
|
-
const FIELD_NAME$
|
|
4156
|
+
const FIELD_NAME$3 = 'dulSubdivisionCode';
|
|
3654
4157
|
const DulSubdivisionCodeField = JSX(({ field, input }) => {
|
|
3655
4158
|
const onDaDataChange = useCallback((item) => {
|
|
3656
4159
|
field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
|
|
3657
4160
|
}, []);
|
|
3658
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$
|
|
4161
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", isInteger: true, maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$3), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
|
|
3659
4162
|
});
|
|
3660
4163
|
|
|
3661
4164
|
const EducationField = JSX(({ field, input }) => {
|
|
3662
4165
|
const { data: education } = useLeadFormData('EDUCATION_LEVEL');
|
|
3663
4166
|
return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
|
|
3664
4167
|
});
|
|
3665
|
-
|
|
3666
|
-
const
|
|
3667
|
-
const {
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
if (data) {
|
|
3676
|
-
store.employerActivities = data;
|
|
3677
|
-
}
|
|
3678
|
-
}, [data]);
|
|
3679
|
-
return (jsx(SelectField, { field: field, source: store.employerActivities ?? [], label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
|
|
3680
|
-
});
|
|
3681
|
-
|
|
3682
|
-
const EmployerOrganizationField = JSX(({ field, input }) => {
|
|
3683
|
-
const { data } = useLeadFormData('ORGANIZATION_KIND');
|
|
3684
|
-
const store = useRetailFormStore();
|
|
3685
|
-
useEffect(() => {
|
|
3686
|
-
if (data) {
|
|
3687
|
-
store.employerOrganization = data;
|
|
3688
|
-
}
|
|
3689
|
-
}, [data]);
|
|
3690
|
-
return (jsx(SelectField, { field: field, source: store.employerOrganization ?? [], label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
|
|
3691
|
-
});
|
|
3692
|
-
|
|
3693
|
-
const EmploymentField = JSX(({ field, input }) => {
|
|
3694
|
-
const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
|
|
3695
|
-
return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
|
|
3696
|
-
});
|
|
3697
|
-
|
|
3698
|
-
const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
|
|
3699
|
-
|
|
3700
|
-
const FIELD_NAME$4 = 'experience5Years';
|
|
3701
|
-
const MAX_YEARS = 5;
|
|
3702
|
-
const MIN_YEARS = 0;
|
|
3703
|
-
const Experience5YearsField = JSX(({ field, input }) => {
|
|
3704
|
-
const onChange = useCallback((value) => field(FIELD_NAME$4)?.onChange?.(String(clamp(Number(value), MIN_YEARS, MAX_YEARS))), []);
|
|
3705
|
-
return (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", ...getValidation(field(FIELD_NAME$4), validatorObj[FIELD_NAME$4], input?.required), ...input, onChange: onChange }));
|
|
3706
|
-
});
|
|
3707
|
-
|
|
3708
|
-
const FamilyMembersField = JSX(({ field }) => {
|
|
3709
|
-
const { value, onChange } = field('familyMembers');
|
|
3710
|
-
const familyStatusKey = field('familyStatus')?.value?.key;
|
|
3711
|
-
const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
|
|
3712
|
-
const childrenCount = Number(field('children')?.value);
|
|
3713
|
-
const dependentsCount = Number(field('dependents')?.value);
|
|
3714
|
-
const totalCount = adultsCount + childrenCount + dependentsCount;
|
|
3715
|
-
useEffect(() => {
|
|
3716
|
-
field?.('familyMembers')?.onChange?.(totalCount);
|
|
3717
|
-
}, [familyStatusKey, childrenCount, dependentsCount]);
|
|
3718
|
-
return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
|
|
3719
|
-
});
|
|
3720
|
-
|
|
3721
|
-
const FamilyStatusField = JSX(({ field, input }) => {
|
|
3722
|
-
const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
|
|
3723
|
-
return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
|
|
3724
|
-
});
|
|
3725
|
-
|
|
3726
|
-
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
3727
|
-
const SERVICE_DIRECTIONS = [
|
|
3728
|
-
{ key: 'Физическое лицо' },
|
|
3729
|
-
{ key: 'Юридическое лицо / ИП' },
|
|
3730
|
-
];
|
|
3731
|
-
const FEEDBACK_METHOD = [
|
|
3732
|
-
{ key: 'phone', text: 'Телефонный звонок' },
|
|
3733
|
-
{ key: 'email', text: 'Электронное сообщение' },
|
|
3734
|
-
];
|
|
3735
|
-
|
|
3736
|
-
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
|
|
3737
|
-
|
|
3738
|
-
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
3739
|
-
|
|
3740
|
-
const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
|
|
3741
|
-
|
|
3742
|
-
const HousingField = JSX(({ field, input }) => {
|
|
3743
|
-
const { data: housing } = useLeadFormData('HOUSE_TYPE');
|
|
3744
|
-
return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
|
|
3745
|
-
});
|
|
3746
|
-
|
|
3747
|
-
const getOrganizationActivityType = (options, okved) => {
|
|
3748
|
-
if (!okved) {
|
|
3749
|
-
return null;
|
|
3750
|
-
}
|
|
3751
|
-
const getOptionByKey = getOptionOp(options);
|
|
3752
|
-
const okvedType = +okved?.split('.')[0];
|
|
3753
|
-
const secondOkvedType = +okved?.split('.')[1];
|
|
3754
|
-
switch (okvedType) {
|
|
3755
|
-
case 1:
|
|
3756
|
-
return getOptionByKey("AGRICULTURE" /* EOrganizationActivityTypes.AGRICULTURE */);
|
|
3757
|
-
case 35:
|
|
3758
|
-
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
3759
|
-
case 41:
|
|
3760
|
-
case 42:
|
|
3761
|
-
case 43:
|
|
3762
|
-
return getOptionByKey("CONSTRUCTION" /* EOrganizationActivityTypes.CONSTRUCTION */);
|
|
3763
|
-
case 46:
|
|
3764
|
-
case 47:
|
|
3765
|
-
return getOptionByKey("TRADE" /* EOrganizationActivityTypes.TRADE */);
|
|
3766
|
-
case 55:
|
|
3767
|
-
case 79:
|
|
3768
|
-
return getOptionByKey("TOURISM" /* EOrganizationActivityTypes.TOURISM */);
|
|
3769
|
-
case 62:
|
|
3770
|
-
return getOptionByKey("TECHNOLOGY" /* EOrganizationActivityTypes.TECHNOLOGY */);
|
|
3771
|
-
case 63:
|
|
3772
|
-
return getOptionByKey("CONSULTING_SERVICE" /* EOrganizationActivityTypes.CONSULTING_SERVICE */);
|
|
3773
|
-
case 64:
|
|
3774
|
-
return getOptionByKey("BANK" /* EOrganizationActivityTypes.BANK */);
|
|
3775
|
-
case 65:
|
|
3776
|
-
return getOptionByKey("INSURER" /* EOrganizationActivityTypes.INSURER */);
|
|
3777
|
-
case 66:
|
|
3778
|
-
return getOptionByKey("FINANCIAL_INSTITUTIONS" /* EOrganizationActivityTypes.FINANCIAL_INSTITUTIONS */);
|
|
3779
|
-
case 72:
|
|
3780
|
-
case 74:
|
|
3781
|
-
return getOptionByKey("SCIENCE" /* EOrganizationActivityTypes.SCIENCE */);
|
|
3782
|
-
case 80:
|
|
3783
|
-
return getOptionByKey("SECURITY" /* EOrganizationActivityTypes.SECURITY */);
|
|
3784
|
-
case 84: {
|
|
3785
|
-
if (secondOkvedType < 22) {
|
|
3786
|
-
return getOptionByKey("GOVERNANCE" /* EOrganizationActivityTypes.GOVERNANCE */);
|
|
3787
|
-
}
|
|
3788
|
-
if (secondOkvedType === 22) {
|
|
3789
|
-
return getOptionByKey("ARMY" /* EOrganizationActivityTypes.ARMY */);
|
|
3790
|
-
}
|
|
3791
|
-
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
3792
|
-
}
|
|
3793
|
-
case 85:
|
|
3794
|
-
return getOptionByKey("EDUCATION" /* EOrganizationActivityTypes.EDUCATION */);
|
|
3795
|
-
case 86:
|
|
3796
|
-
return getOptionByKey("HEALTHCARE" /* EOrganizationActivityTypes.HEALTHCARE */);
|
|
3797
|
-
case 87:
|
|
3798
|
-
return getOptionByKey("SOCIAL_SPHERE" /* EOrganizationActivityTypes.SOCIAL_SPHERE */);
|
|
3799
|
-
default: {
|
|
3800
|
-
if (okvedType >= 10 && okvedType <= 33) {
|
|
3801
|
-
return getOptionByKey("INDUSTRY" /* EOrganizationActivityTypes.INDUSTRY */);
|
|
3802
|
-
}
|
|
3803
|
-
if (okvedType >= 5 && okvedType <= 9) {
|
|
3804
|
-
return getOptionByKey("FUEL_AND_ENERGY" /* EOrganizationActivityTypes.FUEL_AND_ENERGY */);
|
|
3805
|
-
}
|
|
3806
|
-
if (okvedType >= 49 && okvedType <= 53) {
|
|
3807
|
-
return getOptionByKey("TRANSPORT" /* EOrganizationActivityTypes.TRANSPORT */);
|
|
3808
|
-
}
|
|
3809
|
-
return getOptionByKey("OTHER_SECTORS" /* EOrganizationActivityTypes.OTHER_SECTORS */);
|
|
3810
|
-
}
|
|
3811
|
-
}
|
|
3812
|
-
};
|
|
3813
|
-
const getEmployeesNumberOption = (options, count) => {
|
|
3814
|
-
if (!count) {
|
|
3815
|
-
return null;
|
|
3816
|
-
}
|
|
3817
|
-
const [option] = [options?.find((_) => count <= Number(_.description))].map((_) => ({
|
|
3818
|
-
key: _?.key ?? '',
|
|
3819
|
-
text: _?.value ?? '',
|
|
3820
|
-
}));
|
|
3821
|
-
return option;
|
|
3822
|
-
};
|
|
3823
|
-
const getOrganizationKind = (options, okopf) => {
|
|
3824
|
-
const getOptionByKey = getOptionOp(options);
|
|
3825
|
-
if ([40001, 40002, 71610].includes(okopf)) {
|
|
3826
|
-
return getOptionByKey('FOREIGN');
|
|
3827
|
-
}
|
|
3828
|
-
return getOptionByKey('RUSSIAN');
|
|
3829
|
-
};
|
|
3830
|
-
const getOrganizationType = (options, okopf, inn) => {
|
|
3831
|
-
const getOptionByKey = getOptionOp(options);
|
|
3832
|
-
if (inn === '7725114488') {
|
|
3833
|
-
return getOptionByKey('RSHB');
|
|
3834
|
-
}
|
|
3835
|
-
if (okopf === 50102) {
|
|
3836
|
-
return getOptionByKey('SOLE_TRADER');
|
|
3837
|
-
}
|
|
3838
|
-
if (okopf >= 75000 && okopf <= 75505 && okopf !== 75500) {
|
|
3839
|
-
return getOptionByKey('BUDGETARY');
|
|
3840
|
-
}
|
|
3841
|
-
return getOptionByKey('COMMERCIAL');
|
|
3842
|
-
};
|
|
3843
|
-
const getOptionOp = (options) => (key) => options
|
|
3844
|
-
.map((_) => ({ key: _.key, text: _.value }))
|
|
3845
|
-
.find((_) => _.key === key) ?? null;
|
|
3846
|
-
|
|
3847
|
-
const updateOrganizationFields = (store, field, item) => {
|
|
3848
|
-
const { okved, okopf, inn } = getOrganizationRequisites(item);
|
|
3849
|
-
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
3850
|
-
field?.('organizationAddress')?.onChange?.(getAddressFromDaDataItem(item.data?.address));
|
|
3851
|
-
const organizationData = {
|
|
3852
|
-
amountWorkers: getEmployeesNumberOption(store?.amountWorkers, item.data?.employee_count),
|
|
3853
|
-
employerActivities: getOrganizationActivityType(store?.employerActivities ?? [], okved),
|
|
3854
|
-
organization: getOrganizationType(store?.organization ?? [], okopf, inn),
|
|
3855
|
-
employerOrganization: getOrganizationKind(store?.employerOrganization ?? [], okopf),
|
|
3856
|
-
};
|
|
3857
|
-
for (const fieldName in organizationData) {
|
|
3858
|
-
organizationData[fieldName] && field?.(fieldName)?.onChange?.(organizationData[fieldName]);
|
|
3859
|
-
}
|
|
3860
|
-
};
|
|
3861
|
-
const getOrganizationRequisites = (item) => ({
|
|
3862
|
-
inn: item.data?.inn ?? '',
|
|
3863
|
-
okopf: Number(item.data?.opf?.code),
|
|
3864
|
-
okved: item.data?.okved ?? '',
|
|
4168
|
+
|
|
4169
|
+
const EmployerActivitiesField = JSX(({ field, input }) => {
|
|
4170
|
+
const { data } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
|
|
4171
|
+
const store = useRetailFormStore();
|
|
4172
|
+
useEffect(() => {
|
|
4173
|
+
if (data) {
|
|
4174
|
+
store.employerActivities = data;
|
|
4175
|
+
}
|
|
4176
|
+
}, [data]);
|
|
4177
|
+
return (jsx(SelectField, { field: field, source: store.employerActivities ?? [], label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
|
|
3865
4178
|
});
|
|
3866
4179
|
|
|
3867
|
-
const
|
|
4180
|
+
const EmployerOrganizationField = JSX(({ field, input }) => {
|
|
4181
|
+
const { data } = useLeadFormData('ORGANIZATION_KIND');
|
|
3868
4182
|
const store = useRetailFormStore();
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
4183
|
+
useEffect(() => {
|
|
4184
|
+
if (data) {
|
|
4185
|
+
store.employerOrganization = data;
|
|
4186
|
+
}
|
|
4187
|
+
}, [data]);
|
|
4188
|
+
return (jsx(SelectField, { field: field, source: store.employerOrganization ?? [], label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
|
|
3874
4189
|
});
|
|
3875
4190
|
|
|
3876
|
-
const
|
|
4191
|
+
const EmploymentField = JSX(({ field, input }) => {
|
|
4192
|
+
const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
|
|
4193
|
+
return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
|
|
4194
|
+
});
|
|
4195
|
+
|
|
4196
|
+
const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
|
|
4197
|
+
|
|
4198
|
+
const FIELD_NAME$2 = 'experience5Years';
|
|
4199
|
+
const MAX_YEARS = 5;
|
|
4200
|
+
const MIN_YEARS = 0;
|
|
4201
|
+
const Experience5YearsField = JSX(({ field, input }) => {
|
|
4202
|
+
const onChange = useCallback((value) => field(FIELD_NAME$2)?.onChange?.(String(clamp(Number(value), MIN_YEARS, MAX_YEARS))), []);
|
|
4203
|
+
return (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", ...getValidation(field(FIELD_NAME$2), validatorObj[FIELD_NAME$2], input?.required), ...input, onChange: onChange }));
|
|
4204
|
+
});
|
|
4205
|
+
|
|
4206
|
+
const FamilyMembersField = JSX(({ field }) => {
|
|
4207
|
+
const { value, onChange } = field('familyMembers');
|
|
4208
|
+
const familyStatusKey = field('familyStatus')?.value?.key;
|
|
4209
|
+
const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
|
|
4210
|
+
const childrenCount = Number(field('children')?.value);
|
|
4211
|
+
const dependentsCount = Number(field('dependents')?.value);
|
|
4212
|
+
const totalCount = adultsCount + childrenCount + dependentsCount;
|
|
4213
|
+
useEffect(() => {
|
|
4214
|
+
field?.('familyMembers')?.onChange?.(totalCount);
|
|
4215
|
+
}, [familyStatusKey, childrenCount, dependentsCount]);
|
|
4216
|
+
return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
|
|
4217
|
+
});
|
|
4218
|
+
|
|
4219
|
+
const FamilyStatusField = JSX(({ field, input }) => {
|
|
4220
|
+
const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
|
|
4221
|
+
return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
|
|
4222
|
+
});
|
|
4223
|
+
|
|
4224
|
+
const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
|
|
4225
|
+
|
|
4226
|
+
const HousingField = JSX(({ field, input }) => {
|
|
4227
|
+
const { data: housing } = useLeadFormData('HOUSE_TYPE');
|
|
4228
|
+
return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
|
|
4229
|
+
});
|
|
3877
4230
|
|
|
3878
4231
|
const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", isInteger: true, maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
|
|
3879
4232
|
|
|
@@ -3885,30 +4238,8 @@
|
|
|
3885
4238
|
|
|
3886
4239
|
const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
|
|
3887
4240
|
|
|
3888
|
-
const FIELD_NAME$
|
|
3889
|
-
const LimitedBirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$
|
|
3890
|
-
|
|
3891
|
-
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3892
|
-
const EMPTY_REGIONS$1 = [];
|
|
3893
|
-
async function getOutServiceRegions() {
|
|
3894
|
-
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3895
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
3896
|
-
}
|
|
3897
|
-
|
|
3898
|
-
const LocalitiesField = JSX(({ field, input }) => {
|
|
3899
|
-
const fieldRegion = field('region');
|
|
3900
|
-
const regionKey = fieldRegion?.value?.key;
|
|
3901
|
-
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
3902
|
-
const localities = regions
|
|
3903
|
-
?.find((_) => _.code === regionKey)
|
|
3904
|
-
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
3905
|
-
useEffect(() => {
|
|
3906
|
-
if (regionKey !== '') {
|
|
3907
|
-
field?.('localities')?.onChange?.('');
|
|
3908
|
-
}
|
|
3909
|
-
}, [regionKey]);
|
|
3910
|
-
return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
|
|
3911
|
-
});
|
|
4241
|
+
const FIELD_NAME$1 = 'limitedBirthday';
|
|
4242
|
+
const LimitedBirthdayField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$1), validatorObj.limitedBirthday, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1) })));
|
|
3912
4243
|
|
|
3913
4244
|
const MandatoryPaymentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u043B\u0430\u0442\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('mandatoryPayments'), validatorObj.mandatoryPayments, input?.required), ...input })));
|
|
3914
4245
|
|
|
@@ -3918,15 +4249,6 @@
|
|
|
3918
4249
|
];
|
|
3919
4250
|
const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
|
|
3920
4251
|
|
|
3921
|
-
const FIELD_NAME$2 = 'middleName';
|
|
3922
|
-
const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), ...getValidation(field(FIELD_NAME$2), validatorObj.middleName, input?.required), ...input })));
|
|
3923
|
-
|
|
3924
|
-
const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
|
|
3925
|
-
|
|
3926
|
-
const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
|
|
3927
|
-
|
|
3928
|
-
const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
|
|
3929
|
-
|
|
3930
4252
|
const OrganizationField = JSX(({ field, input }) => {
|
|
3931
4253
|
const { data } = useLeadFormData('ORGANIZATION_TYPE');
|
|
3932
4254
|
const store = useRetailFormStore();
|
|
@@ -3953,15 +4275,10 @@
|
|
|
3953
4275
|
|
|
3954
4276
|
const MAX_PART = 100;
|
|
3955
4277
|
const MIN_PART = 0;
|
|
3956
|
-
const FIELD_NAME
|
|
4278
|
+
const FIELD_NAME = 'partInBusiness';
|
|
3957
4279
|
const PartInBusinessField = JSX(({ field, input }) => {
|
|
3958
|
-
const onChange = useCallback((value) => field(FIELD_NAME
|
|
3959
|
-
return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", isInteger: true, maxLength: 3, ...getValidation(field(FIELD_NAME
|
|
3960
|
-
});
|
|
3961
|
-
|
|
3962
|
-
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
3963
|
-
const { required, ...rest } = input;
|
|
3964
|
-
return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
|
|
4280
|
+
const onChange = useCallback((value) => field(FIELD_NAME)?.onChange?.(String(clamp(Number(value), MIN_PART, MAX_PART))), []);
|
|
4281
|
+
return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", isInteger: true, maxLength: 3, ...getValidation(field(FIELD_NAME), validatorObj.partInBusiness, input?.required), ...input, onChange: onChange }));
|
|
3965
4282
|
});
|
|
3966
4283
|
|
|
3967
4284
|
const getPaymentSystems = async (creditProgramId) => {
|
|
@@ -3992,73 +4309,11 @@
|
|
|
3992
4309
|
});
|
|
3993
4310
|
const formatPaymentSystems = (paymentSystems) => paymentSystems?.map((_) => ({ id: _.key, text: _.text })) ?? [];
|
|
3994
4311
|
|
|
3995
|
-
const isPlaceholder = (_) => _ === '_';
|
|
3996
|
-
const isDigit = (_) => /\d/.test(_);
|
|
3997
|
-
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
3998
|
-
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
3999
|
-
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
4000
|
-
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
4001
|
-
function normalizePhone(phone) {
|
|
4002
|
-
const phoneNumbers = phone.replace(/\D/g, '');
|
|
4003
|
-
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
4004
|
-
const result = phonePattern.map(applyPlaceholder);
|
|
4005
|
-
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
4006
|
-
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
4007
|
-
}
|
|
4008
|
-
|
|
4009
|
-
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
4010
|
-
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
4011
|
-
const handleBlur = useCallback((v) => {
|
|
4012
|
-
if (v === '+7 (') {
|
|
4013
|
-
onChange && onChange('');
|
|
4014
|
-
}
|
|
4015
|
-
}, []);
|
|
4016
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
4017
|
-
});
|
|
4018
|
-
|
|
4019
|
-
const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
|
|
4020
|
-
|
|
4021
|
-
const PhoneField = JSX(({ field, input }) => {
|
|
4022
|
-
const fieldName = input?.name || 'phone';
|
|
4023
|
-
return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
|
|
4024
|
-
});
|
|
4025
|
-
|
|
4026
4312
|
const PositionOrganizationField = JSX(({ field, input }) => {
|
|
4027
4313
|
const { data: positionOrganization } = useLeadFormData('POSITION');
|
|
4028
4314
|
return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
|
|
4029
4315
|
});
|
|
4030
4316
|
|
|
4031
|
-
const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
|
|
4032
|
-
|
|
4033
|
-
const ProductField = JSX(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
|
|
4034
|
-
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
4035
|
-
|
|
4036
|
-
const OUT_SERVICE_URL = `${API_BASE_URI}/outservice/outserviceregions`;
|
|
4037
|
-
const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
|
|
4038
|
-
|
|
4039
|
-
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
4040
|
-
const EMPTY_REGIONS = [];
|
|
4041
|
-
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
4042
|
-
function useRegions(url = REGIONS_URL) {
|
|
4043
|
-
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
4044
|
-
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
4045
|
-
}
|
|
4046
|
-
|
|
4047
|
-
const RegionField = JSX(({ field, input, params }) => {
|
|
4048
|
-
const url = getRegionUrl(params?.typeForm);
|
|
4049
|
-
const regions = useRegions(url);
|
|
4050
|
-
return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
4051
|
-
});
|
|
4052
|
-
|
|
4053
|
-
const RegionPremiumField = JSX(({ field, input }) => {
|
|
4054
|
-
const branchByRegions = useBranchesByRegions(true);
|
|
4055
|
-
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
4056
|
-
key: region,
|
|
4057
|
-
text: region,
|
|
4058
|
-
})), [branchByRegions]);
|
|
4059
|
-
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
|
|
4060
|
-
});
|
|
4061
|
-
|
|
4062
4317
|
const RegionRetailField = JSX(({ field, input }) => {
|
|
4063
4318
|
const { data: regions } = useLeadFormData('REGION_RF');
|
|
4064
4319
|
const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
|
|
@@ -4067,15 +4322,6 @@
|
|
|
4067
4322
|
|
|
4068
4323
|
const RetirementIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input })));
|
|
4069
4324
|
|
|
4070
|
-
const SecondaryPhoneField = JSX(({ field }) => {
|
|
4071
|
-
const fieldPhone = field('secondaryPhone');
|
|
4072
|
-
return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
|
|
4073
|
-
? fieldPhone
|
|
4074
|
-
: withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
|
|
4075
|
-
});
|
|
4076
|
-
|
|
4077
|
-
const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
|
|
4078
|
-
|
|
4079
4325
|
const GENDERS = ['male', 'female'];
|
|
4080
4326
|
const getGenderFromName = async (name) => {
|
|
4081
4327
|
const res = await fetchRetailJSON('/suggestions/suggest/fio', 'POST', {
|
|
@@ -4104,130 +4350,69 @@
|
|
|
4104
4350
|
})();
|
|
4105
4351
|
}
|
|
4106
4352
|
}, []);
|
|
4107
|
-
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) }));
|
|
4108
|
-
});
|
|
4109
|
-
|
|
4110
|
-
const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
|
|
4111
|
-
|
|
4112
|
-
const SnilsInput = JSX(({ children, onChange, maxLength, ...inputProps }) => {
|
|
4113
|
-
const handleChange = useCallback((v) => maxLength
|
|
4114
|
-
? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
|
|
4115
|
-
: onChange?.(normalizeWithMask(v, '___-___-___ __')), [onChange]);
|
|
4116
|
-
const handleBlur = useCallback((v) => {
|
|
4117
|
-
if (v === '___-___-___ __') {
|
|
4118
|
-
onChange && onChange('');
|
|
4119
|
-
}
|
|
4120
|
-
}, []);
|
|
4121
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
4122
|
-
});
|
|
4123
|
-
|
|
4124
|
-
const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __", ...rest }), renderErrorText(error)] })));
|
|
4125
|
-
|
|
4126
|
-
const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", maxLength: 14, ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
|
|
4127
|
-
|
|
4128
|
-
const
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
const
|
|
4133
|
-
|
|
4134
|
-
const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
|
|
4135
|
-
|
|
4136
|
-
const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
|
|
4137
|
-
|
|
4138
|
-
const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
|
|
4139
|
-
|
|
4140
|
-
const VED_TYPES = [
|
|
4141
|
-
{ id: 'currencyControl', text: 'Валютный контроль' },
|
|
4142
|
-
{ id: 'documentOperations', text: 'Документарные операции' },
|
|
4143
|
-
{ id: 'conversionTransactions', text: 'Конверсионные операции' },
|
|
4144
|
-
{ id: 'otherIssues', text: 'Иные вопросы ВЭД' },
|
|
4145
|
-
];
|
|
4146
|
-
const VedField = JSX(({ field }) => {
|
|
4147
|
-
const { value, onChange } = field('vedTypes');
|
|
4148
|
-
useEffect(() => {
|
|
4149
|
-
if (value !== 'currencyControl') {
|
|
4150
|
-
field?.('inn')?.onChange?.('');
|
|
4151
|
-
field?.('region')?.onChange?.('');
|
|
4152
|
-
}
|
|
4153
|
-
}, [value]);
|
|
4154
|
-
return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
|
|
4155
|
-
});
|
|
4156
|
-
|
|
4157
|
-
const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
|
|
4158
|
-
|
|
4159
|
-
function isRenderField({ input, field, }) {
|
|
4160
|
-
const { condition } = input;
|
|
4161
|
-
const { value } = field(condition?.name || '');
|
|
4162
|
-
return !condition || condition?.values?.find((_) => _ === (value?.key ?? value));
|
|
4163
|
-
}
|
|
4164
|
-
|
|
4165
|
-
const PRODUCT_REF = {
|
|
4166
|
-
$ref: '/wcms-resources/outservice-productlist.json',
|
|
4167
|
-
};
|
|
4168
|
-
const InputsMap = {
|
|
4169
|
-
fullName: (props) => jsx(FullNameField, { ...props }),
|
|
4170
|
-
addressBranch: (props) => jsx(AddressBranchField, { ...props }),
|
|
4171
|
-
desiredMeetingDate: (props) => jsx(DesiredMeetingDateField, { ...props }),
|
|
4172
|
-
product: (props) => jsx(ProductField, { ...props, source: PRODUCT_REF }),
|
|
4173
|
-
localities: (props) => jsx(LocalitiesField, { ...props }),
|
|
4174
|
-
isClient: (props) => jsx(IsClientField, { ...props }),
|
|
4175
|
-
partnerComments: (props) => jsx(PartnerCommentsField, { ...props }),
|
|
4176
|
-
collectionCount: (props) => jsx(CollectionCountField, { ...props }),
|
|
4177
|
-
acquiringType: (props) => jsx(AcquiringField, { ...props }),
|
|
4178
|
-
onlineCheckout: (props) => jsx(OnlineCheckoutField, { ...props }),
|
|
4179
|
-
posTerminal: (props) => jsx(PosTerminalField, { ...props }),
|
|
4180
|
-
serviceType: (props) => jsx(UltraPremiumField, { ...props }),
|
|
4181
|
-
term: (props) => jsx(TermField, { ...props }),
|
|
4182
|
-
amount: (props) => jsx(AmountField, { ...props }),
|
|
4183
|
-
annualRevenue: (props) => jsx(AnnualRevenueField, { ...props }),
|
|
4184
|
-
vedTypes: (props) => jsx(VedField, { ...props }),
|
|
4185
|
-
feedbackMethod: (props) => jsx(FeedbackMethodField, { ...props }),
|
|
4186
|
-
serviceDirection: (props) => jsx(ServiceDirectionField, { ...props }),
|
|
4187
|
-
bankEmpolee: (props) => jsx(BankEmpoleeField, { ...props }),
|
|
4188
|
-
secondaryPhone: (props) => jsx(SecondaryPhoneField, { ...props }),
|
|
4189
|
-
applicationDate: (props) => (jsx(InputControl, { label: "\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u044F \u0432 \u0411\u0430\u043D\u043A", ...props })),
|
|
4190
|
-
region: (props) => getPremium(props?.params?.typeForm) ? (jsx(RegionPremiumField, { ...props })) : (jsx(RegionField, { ...props })),
|
|
4191
|
-
consentToReceiveMaterials: (props) => jsx(ConsentField, { ...props }),
|
|
4192
|
-
surname: (props) => jsx(SurnameField, { ...props }),
|
|
4193
|
-
name: (props) => jsx(NameField, { ...props }),
|
|
4194
|
-
middleName: (props) => jsx(MiddleNameField, { ...props }),
|
|
4195
|
-
birthday: (props) => jsx(BirthdayField, { ...props }),
|
|
4196
|
-
phone: (props) => jsx(PhoneField, { ...props }),
|
|
4197
|
-
email: (props) => jsx(EmailField, { ...props }),
|
|
4198
|
-
inn: (props) => jsx(InnField, { ...props }),
|
|
4199
|
-
comment: (props) => jsx(CommentField, { ...props }),
|
|
4353
|
+
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) }));
|
|
4354
|
+
});
|
|
4355
|
+
|
|
4356
|
+
const ShareholderFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg, input?.required) })));
|
|
4357
|
+
|
|
4358
|
+
const SnilsInput = JSX(({ children, onChange, maxLength, ...inputProps }) => {
|
|
4359
|
+
const handleChange = useCallback((v) => maxLength
|
|
4360
|
+
? v.length <= maxLength && onChange?.(normalizeWithMask(v, '___-___-___ __'))
|
|
4361
|
+
: onChange?.(normalizeWithMask(v, '___-___-___ __')), [onChange]);
|
|
4362
|
+
const handleBlur = useCallback((v) => {
|
|
4363
|
+
if (v === '___-___-___ __') {
|
|
4364
|
+
onChange && onChange('');
|
|
4365
|
+
}
|
|
4366
|
+
}, []);
|
|
4367
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
4368
|
+
});
|
|
4369
|
+
|
|
4370
|
+
const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __", ...rest }), renderErrorText(error)] })));
|
|
4371
|
+
|
|
4372
|
+
const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", maxLength: 14, ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
|
|
4373
|
+
|
|
4374
|
+
const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
|
|
4375
|
+
|
|
4376
|
+
const WagesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", isInteger: true, ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input })));
|
|
4377
|
+
|
|
4378
|
+
const InputsApplicationLeadMap = {
|
|
4379
|
+
limitedBirthday: (props) => jsx(LimitedBirthdayField, { ...props }),
|
|
4200
4380
|
};
|
|
4201
|
-
const
|
|
4381
|
+
const InputsConsentsMap = {
|
|
4202
4382
|
processPersonalDataFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4203
4383
|
consentProviderFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4204
4384
|
consentOthersFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4205
4385
|
consentInformFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4206
4386
|
consentPfrFlg: (props) => jsx(ConsentField, { ...props }),
|
|
4387
|
+
};
|
|
4388
|
+
const InputsRetailMap = {
|
|
4389
|
+
organization: (props) => jsx(OrganizationField, { ...props }),
|
|
4390
|
+
organizationAddress: (props) => jsx(AddressField, { ...props }),
|
|
4207
4391
|
organizationPhone: (props) => jsx(PhoneField, { ...props }),
|
|
4208
|
-
legalForm: (props) => jsx(LegalFormField, { ...props }),
|
|
4209
4392
|
organizationName: (props) => jsx(OrganizationNameField, { ...props }),
|
|
4393
|
+
legalForm: (props) => jsx(LegalFormField, { ...props }),
|
|
4210
4394
|
generalSeniority: (props) => jsx(GeneralSeniorityField, { ...props }),
|
|
4211
4395
|
lastJobExperience: (props) => jsx(LastJobExperienceField, { ...props }),
|
|
4212
4396
|
experience5Years: (props) => jsx(Experience5YearsField, { ...props }),
|
|
4213
4397
|
jobsNumber: (props) => jsx(JobsNumberField, { ...props }),
|
|
4214
4398
|
beginDate: (props) => jsx(BeginDateField, { ...props }),
|
|
4215
4399
|
addressFact: (props) => jsx(AddressFactField, { ...props }),
|
|
4216
|
-
|
|
4400
|
+
addressRegistration: (props) => jsx(AddressField, { ...props }),
|
|
4401
|
+
addressRetail: (props) => jsx(AddressRetailField, { ...props }),
|
|
4402
|
+
addressMatch: (props) => jsx(AddressMatchField, { ...props }),
|
|
4217
4403
|
sex: (props) => jsx(SexField, { ...props }),
|
|
4218
4404
|
limitedBirthday: (props) => jsx(LimitedBirthdayField, { ...props }),
|
|
4219
4405
|
birthPlace: (props) => jsx(BirthPlaceField, { ...props }),
|
|
4220
4406
|
education: (props) => jsx(EducationField, { ...props }),
|
|
4221
4407
|
housing: (props) => jsx(HousingField, { ...props }),
|
|
4222
|
-
employment: (props) => jsx(EmploymentField, { ...props }),
|
|
4223
|
-
organization: (props) => jsx(OrganizationField, { ...props }),
|
|
4224
4408
|
amountWorkers: (props) => jsx(AmountWorkersField, { ...props }),
|
|
4409
|
+
employment: (props) => jsx(EmploymentField, { ...props }),
|
|
4225
4410
|
employerActivities: (props) => jsx(EmployerActivitiesField, { ...props }),
|
|
4226
4411
|
employerOrganization: (props) => jsx(EmployerOrganizationField, { ...props }),
|
|
4227
4412
|
positionOrganization: (props) => jsx(PositionOrganizationField, { ...props }),
|
|
4228
4413
|
familyStatus: (props) => jsx(FamilyStatusField, { ...props }),
|
|
4229
|
-
children: (props) => jsx(ChildrenField, { ...props }),
|
|
4230
4414
|
familyMembers: (props) => jsx(FamilyMembersField, { ...props }),
|
|
4415
|
+
children: (props) => jsx(ChildrenField, { ...props }),
|
|
4231
4416
|
dependents: (props) => jsx(DependentsField, { ...props }),
|
|
4232
4417
|
totalIncome: (props) => jsx(TotalIncomeField, { ...props }),
|
|
4233
4418
|
expenses: (props) => jsx(ExpensesField, { ...props }),
|
|
@@ -4239,8 +4424,6 @@
|
|
|
4239
4424
|
dulIssueDateField: (props) => jsx(DulIssueDateField, { ...props }),
|
|
4240
4425
|
dulSubdivisionCode: (props) => jsx(DulSubdivisionCodeField, { ...props }),
|
|
4241
4426
|
dulIssuedBy: (props) => jsx(DulIssuedByField, { ...props }),
|
|
4242
|
-
addressRegistration: (props) => jsx(AddressField, { ...props }),
|
|
4243
|
-
addressCourier: (props) => jsx(AddressField, { ...props }),
|
|
4244
4427
|
participantDateRegistration: (props) => (jsx(ParticipantDateRegistrationField, { ...props })),
|
|
4245
4428
|
retirementIncome: (props) => jsx(RetirementIncomeField, { ...props }),
|
|
4246
4429
|
otherIncome: (props) => jsx(OtherIncomeField, { ...props }),
|
|
@@ -4254,11 +4437,10 @@
|
|
|
4254
4437
|
bankEmployeeCode: (props) => jsx(BankEmpoleeCodeField, { ...props }),
|
|
4255
4438
|
partInBusiness: (props) => jsx(PartInBusinessField, { ...props }),
|
|
4256
4439
|
regionRetail: (props) => jsx(RegionRetailField, { ...props }),
|
|
4257
|
-
addressRetail: (props) => jsx(AddressRetailField, { ...props }),
|
|
4258
|
-
addressMatch: (props) => jsx(AddressMatchField, { ...props }),
|
|
4259
4440
|
calculator: (props) => jsx(CreditCalcField, { ...props }),
|
|
4260
4441
|
};
|
|
4261
4442
|
const InputRetailCardMap = {
|
|
4443
|
+
addressCourier: (props) => jsx(AddressField, { ...props }),
|
|
4262
4444
|
paymentSystem: (props) => jsx(PaymentSystemField, { ...props }),
|
|
4263
4445
|
currency: (props) => jsx(CurrencyField, { ...props }),
|
|
4264
4446
|
cardCategory: (props) => jsx(CardCategoryField, { ...props }),
|
|
@@ -4267,153 +4449,6 @@
|
|
|
4267
4449
|
methodObtain: (props) => jsx(MethodObtainField, { ...props }),
|
|
4268
4450
|
deliveryDate: (props) => jsx(DeliveryDateFiels, { ...props }),
|
|
4269
4451
|
};
|
|
4270
|
-
const getField = (field, params) => (input, i) => {
|
|
4271
|
-
const resultInputsMap = {
|
|
4272
|
-
...InputsMap,
|
|
4273
|
-
...InputsRetailMap,
|
|
4274
|
-
...InputRetailCardMap,
|
|
4275
|
-
};
|
|
4276
|
-
return isRenderField({ input, field }) ? (jsx("div", { children: resultInputsMap[input?.name || '']?.({ field, input, params }) }, String(i))) : null;
|
|
4277
|
-
};
|
|
4278
|
-
|
|
4279
|
-
const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
|
|
4280
|
-
|
|
4281
|
-
const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
|
|
4282
|
-
|
|
4283
|
-
const ResponseTypeDialog = JSX(({ responseType, typeForm, onClose }) => {
|
|
4284
|
-
const responseOK = responseType === 'OK';
|
|
4285
|
-
const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
|
|
4286
|
-
const responseOKDescription = typeForm === 'ANTIFRAUD'
|
|
4287
|
-
? `Сообщение отправлено. Для уточнения информации с Вами могут связаться работники Банка либо Вы
|
|
4288
|
-
можете самостоятельно позвонить по номеру контакт-центра +78001000100. Будьте внимательны, работники Банка
|
|
4289
|
-
не звонят с использованием мессенджеров.`
|
|
4290
|
-
: 'Совсем скоро мы с вами свяжемся';
|
|
4291
|
-
return (jsx(Dialog, { className: "my-6xl max-w-lg w-full min-h-fit mx-auto", onClose: onClose, children: jsxs("div", { className: "flex flex-col gap-lg items-center rounded-md space-x-m", children: [jsx(Img, { image: { icon: statusIcon, iconVersion: 'normal' }, width: "136", height: "136" }), jsx(Headline, { className: "w-full", title: responseOK ? 'Ваша заявка отправлена' : 'Не удалось отправить заявку', description: responseOK ? responseOKDescription : 'Пожалуйста, повторите позднее', headlineVersion: "XS", isEmbedded: true }), jsx(Button, { type: "button", onClick: onClose, children: "\u0425\u043E\u0440\u043E\u0448\u043E" })] }) }));
|
|
4292
|
-
});
|
|
4293
|
-
|
|
4294
|
-
const objectValidator = (validatorsMap) => (o) => (o &&
|
|
4295
|
-
Object.entries(validatorsMap).flatMap(([key, validator]) => validator(o[key]))) ||
|
|
4296
|
-
[];
|
|
4297
|
-
|
|
4298
|
-
const getPartnerComments = (data) => {
|
|
4299
|
-
const { acquiringType, onlineCheckout = false, posTerminal = false, term, amount, annualRevenue, } = data;
|
|
4300
|
-
if (acquiringType) {
|
|
4301
|
-
return `Вид эквайринга=${acquiringType?.text || ''}${isAcquiringTrade(acquiringType?.key)
|
|
4302
|
-
? `/Онлайн касса=${onlineCheckout}/POS-терминал=${posTerminal}`
|
|
4303
|
-
: '/Онлайн касса=false/POS-терминал=false'}`;
|
|
4304
|
-
}
|
|
4305
|
-
else {
|
|
4306
|
-
return `Сумма=${amount}/Срок=${term}/Выручка=${annualRevenue}`;
|
|
4307
|
-
}
|
|
4308
|
-
};
|
|
4309
|
-
|
|
4310
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4311
|
-
const getFormatData = (data) => {
|
|
4312
|
-
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, ...usedData } = data;
|
|
4313
|
-
const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
|
|
4314
|
-
const formatData = {
|
|
4315
|
-
...usedData,
|
|
4316
|
-
...getVedTypes(vedTypes),
|
|
4317
|
-
...getRegion(region),
|
|
4318
|
-
...(partnerComments ? { partnerComments } : {}),
|
|
4319
|
-
...(serviceType ? { typeForm: serviceType } : {}),
|
|
4320
|
-
};
|
|
4321
|
-
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
4322
|
-
};
|
|
4323
|
-
const getRegion = (region) => region?.key || region?.text ? { region: region?.text || region?.key } : {};
|
|
4324
|
-
const getVedTypes = (vedTypes) => vedTypes
|
|
4325
|
-
? {
|
|
4326
|
-
vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
|
|
4327
|
-
}
|
|
4328
|
-
: {};
|
|
4329
|
-
|
|
4330
|
-
const initialFormState$1 = {
|
|
4331
|
-
typeForm: '',
|
|
4332
|
-
region: { key: '', text: '' },
|
|
4333
|
-
addressBranch: { key: '', text: '' },
|
|
4334
|
-
surname: '',
|
|
4335
|
-
name: '',
|
|
4336
|
-
phone: '',
|
|
4337
|
-
secondaryPhone: '',
|
|
4338
|
-
comment: '',
|
|
4339
|
-
product: '',
|
|
4340
|
-
partnerComments: '',
|
|
4341
|
-
annualRevenue: '',
|
|
4342
|
-
term: 12,
|
|
4343
|
-
amount: 100000,
|
|
4344
|
-
acquiringType: ACQUIRING_TYPES[0],
|
|
4345
|
-
serviceType: SERVICE_TYPES[0],
|
|
4346
|
-
feedbackMethod: FEEDBACK_METHOD[0],
|
|
4347
|
-
serviceDirection: SERVICE_DIRECTIONS[0],
|
|
4348
|
-
vedTypes: VED_TYPES[0],
|
|
4349
|
-
birthday: undefined,
|
|
4350
|
-
isClient: false,
|
|
4351
|
-
onlineCheckout: false,
|
|
4352
|
-
posTerminal: false,
|
|
4353
|
-
consentToReceiveMaterials: false,
|
|
4354
|
-
consentDataProcessing: false,
|
|
4355
|
-
addressRetail: { key: '', text: '' },
|
|
4356
|
-
};
|
|
4357
|
-
const getInitialFormState$3 = (inputs, typeForm = '') => {
|
|
4358
|
-
const formState = Object.fromEntries(inputs.map((_) => [
|
|
4359
|
-
_.name,
|
|
4360
|
-
(_.fieldType === 'ved' && _?.defaultValue) || initialFormState$1[_.name || ''],
|
|
4361
|
-
]));
|
|
4362
|
-
return { ...formState, typeForm: { key: typeForm, text: '' } };
|
|
4363
|
-
};
|
|
4364
|
-
|
|
4365
|
-
const Footnote = JSX(({ text, link }) => (jsxs(Paragraph, { size: "text-l", font: "font-light", color: "text-secondary-text", children: [text ? jsx(Text, { children: text }) : null, link ? (jsx(LinkButton, { href: link.href, ariaLabel: "\u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043D\u043D\u044B\u0445", target: link.target || '', className: "!text-left text-primary-main", children: jsx(Text, { children: link.text }) })) : null] })));
|
|
4366
|
-
|
|
4367
|
-
const renderSubmitButton$1 = (button, className) => (jsx(Button, { className: style('w-full @xl:w-auto', className), type: "submit", children: button?.text ? button.text : 'Отправить заявку' }));
|
|
4368
|
-
|
|
4369
|
-
const agreementText = 'Нажимая кнопку, вы подтверждаете согласие с ';
|
|
4370
|
-
const renderAgreementSubmit = (consentDataProcessing, link, button) => (jsxs("div", { className: "flex col-span-2 gap-xs flex-col w-full items-baseline", children: [consentDataProcessing ? (jsxs("div", { children: [jsxs("div", { className: "flex gap-3 items-center", children: [jsx(Checkbox, { ...consentDataProcessing }), jsx(Footnote, { link: link })] }), renderErrorText(withValidator(consentDataProcessing, agreementValidator).error)] })) : (jsx(Footnote, { text: agreementText, link: link })), renderSubmitButton$1(button)] }));
|
|
4371
|
-
|
|
4372
|
-
const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex sm:justify-center gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "\u0442\u0435\u043B\u0435\u0444\u043E\u043D 8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "\u043F\u043E\u0447\u0442\u0430 ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
|
|
4373
|
-
|
|
4374
|
-
const API = LeadServiceAPI();
|
|
4375
|
-
const ApplicationForm = JSX(
|
|
4376
|
-
// eslint-disable-next-line max-lines-per-function
|
|
4377
|
-
({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
|
|
4378
|
-
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
4379
|
-
const initialFormState = getInitialFormState$3(inputs, typeForm);
|
|
4380
|
-
const [responseType, setResponseType] = useState('');
|
|
4381
|
-
const responseTypeDialog = useDialog(ResponseTypeDialog);
|
|
4382
|
-
const handleSubmit = useCallback(async (formData, ev) => {
|
|
4383
|
-
const inputsFiltered = getFilteredInputs(inputs, formData);
|
|
4384
|
-
const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
|
|
4385
|
-
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
4386
|
-
return console.warn('validation fail');
|
|
4387
|
-
}
|
|
4388
|
-
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
4389
|
-
const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
|
|
4390
|
-
setResponseType(status);
|
|
4391
|
-
if (status) {
|
|
4392
|
-
responseTypeDialog.open({ typeForm, responseType: status });
|
|
4393
|
-
}
|
|
4394
|
-
if (status === 'OK' && data) {
|
|
4395
|
-
const aspects = useAspects();
|
|
4396
|
-
handleAspects({ aspectsAttributes: data, aspects, ev });
|
|
4397
|
-
}
|
|
4398
|
-
return status;
|
|
4399
|
-
}, [typeForm]);
|
|
4400
|
-
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
4401
|
-
const fieldName = getConsentDataProcessing(inputs)?.name;
|
|
4402
|
-
useEffect(() => {
|
|
4403
|
-
if (responseType === 'OK') {
|
|
4404
|
-
setResponseType('');
|
|
4405
|
-
reset();
|
|
4406
|
-
}
|
|
4407
|
-
}, [responseType]);
|
|
4408
|
-
return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, { typeForm }))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
|
|
4409
|
-
});
|
|
4410
|
-
const getFilteredInputs = (inputs, data) => inputs
|
|
4411
|
-
.filter((_) => (_?.name === 'secondaryPhone' ? Boolean(data.secondaryPhone) : _))
|
|
4412
|
-
.filter((input) => !input?.condition ||
|
|
4413
|
-
input?.condition.values.find((_) => {
|
|
4414
|
-
const dataValue = data?.[input?.condition?.name ?? ''];
|
|
4415
|
-
return _ === (dataValue?.key ?? dataValue);
|
|
4416
|
-
}));
|
|
4417
4452
|
|
|
4418
4453
|
const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
|
|
4419
4454
|
const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
|
|
@@ -4428,42 +4463,19 @@
|
|
|
4428
4463
|
const hasValidationErrors = useMemo(() => inputs
|
|
4429
4464
|
?.filter((_) => _.required)
|
|
4430
4465
|
?.some((_) => Boolean(withValidator(field(_?.name), validatorObj[_?.name]).error)), [inputs]);
|
|
4431
|
-
return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, { typeForm })) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
|
|
4466
|
+
return (jsx("div", { className: "w-fit", children: jsx(Foldable, { isFoldButtonOnTop: true, unfoldedByDefault: true, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { isUnfolded: isUnfolded, className: "flex flex-col pl-2xl", children: inputs.map(getField(field, { typeForm }, InputsConsentsMap)) })), renderFoldButton: renderGeneralCheckbox(jsxs("div", { children: [jsx(Checkbox, { value: isChecked, onChange: handleGeneralToggle, text: CONSENT_ALL_DOCS_TEXT }, key), renderErrorText(hasValidationErrors ? CONSENT_REQUIRED : '')] })) }) }));
|
|
4432
4467
|
});
|
|
4433
4468
|
const renderGeneralCheckbox = (generalCheckBox) => (foldableData) => (jsxs("div", { className: "flex items-start", children: [generalCheckBox, jsx("button", { onClick: foldableData.onToggle, className: "px-m py-2xs", type: "button", children: jsx(Icon, { className: "text-primary-text", name: foldableData.isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" }) })] }));
|
|
4434
4469
|
|
|
4435
4470
|
const renderInputs$2 = ({ field, typeForm = '', inputs }) => {
|
|
4436
4471
|
const { consentInputs, restInputs } = splitInputs(inputs || []);
|
|
4437
|
-
return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm })));
|
|
4472
|
+
return consentInputs.length > 2 ? (jsxs("div", { children: [restInputs.map(getField(field, { typeForm }, { ...InputsApplicationLeadMap })), jsx(GroupedConsents, { inputs: consentInputs, field: field })] })) : ((inputs || [])?.map(getField(field, { typeForm }, { ...InputsApplicationLeadMap })));
|
|
4438
4473
|
};
|
|
4439
4474
|
const splitInputs = (inputs) => ({
|
|
4440
4475
|
consentInputs: inputs?.filter((_) => Object.keys(CONSENTS).includes(_.name || '')) || [],
|
|
4441
4476
|
restInputs: inputs?.filter((_) => !Object.keys(CONSENTS).includes(_.name || '')) || [],
|
|
4442
4477
|
});
|
|
4443
4478
|
|
|
4444
|
-
const applicationFormData = [
|
|
4445
|
-
{
|
|
4446
|
-
columns: 2,
|
|
4447
|
-
inputs: [
|
|
4448
|
-
{ fieldType: 'common', name: 'surname', required: true, dadata: true },
|
|
4449
|
-
{ fieldType: 'common', name: 'name', required: true, dadata: true },
|
|
4450
|
-
{ fieldType: 'common', name: 'middleName', dadata: true },
|
|
4451
|
-
{ fieldType: 'common', name: 'limitedBirthday', required: true },
|
|
4452
|
-
{ fieldType: 'common', name: 'phone', required: true },
|
|
4453
|
-
{ fieldType: 'common', name: 'email', required: true, dadata: true },
|
|
4454
|
-
],
|
|
4455
|
-
},
|
|
4456
|
-
{
|
|
4457
|
-
inputs: [
|
|
4458
|
-
{ fieldType: 'common', name: 'processPersonalDataFlg', required: true },
|
|
4459
|
-
{ fieldType: 'common', name: 'consentProviderFlg', required: true },
|
|
4460
|
-
{ fieldType: 'common', name: 'consentOthersFlg', required: true },
|
|
4461
|
-
{ fieldType: 'common', name: 'consentInformFlg' },
|
|
4462
|
-
{ fieldType: 'common', name: 'consentPfrFlg' },
|
|
4463
|
-
],
|
|
4464
|
-
},
|
|
4465
|
-
];
|
|
4466
|
-
|
|
4467
4479
|
const renderSubmitButton = (button, isSending) => (jsx(Button, { className: style('w-full @xl:w-auto'), type: "submit", isLoading: isSending, children: button?.text ? button.text : 'Отправить заявку' }));
|
|
4468
4480
|
|
|
4469
4481
|
const createDraftTask = async (body) => {
|
|
@@ -4852,7 +4864,7 @@
|
|
|
4852
4864
|
}, []);
|
|
4853
4865
|
|
|
4854
4866
|
const getFamilyStatusAndIncomeData = (formData) => {
|
|
4855
|
-
const { familyStatus,
|
|
4867
|
+
const { familyStatus, familyMembers, dependents, children, confirmationIncome, wages, mandatoryPayments, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, conscription, } = formData;
|
|
4856
4868
|
return {
|
|
4857
4869
|
maritalStatusCd: familyStatus,
|
|
4858
4870
|
totalDependents: familyMembers,
|
|
@@ -5287,12 +5299,10 @@
|
|
|
5287
5299
|
feedbackMethod: FEEDBACK_METHOD[0],
|
|
5288
5300
|
serviceDirection: SERVICE_DIRECTIONS[0],
|
|
5289
5301
|
vedTypes: VED_TYPES[0],
|
|
5290
|
-
birthday: undefined,
|
|
5291
5302
|
limitedBirthday: undefined,
|
|
5292
5303
|
isClient: false,
|
|
5293
5304
|
onlineCheckout: false,
|
|
5294
5305
|
posTerminal: false,
|
|
5295
|
-
consentToReceiveMaterials: false,
|
|
5296
5306
|
consentDataProcessing: false,
|
|
5297
5307
|
processPersonalDataFlg: false,
|
|
5298
5308
|
consentProviderFlg: false,
|
|
@@ -6956,32 +6966,32 @@
|
|
|
6956
6966
|
return statusesMap[status] || jsx(ReworkStatusContent$1, {});
|
|
6957
6967
|
};
|
|
6958
6968
|
|
|
6959
|
-
const calculateInputs
|
|
6969
|
+
const calculateInputs = (getValue) => (inputs, step) => inputs
|
|
6960
6970
|
.filter((_) => _)
|
|
6961
6971
|
.map((_) => {
|
|
6962
6972
|
if ([
|
|
6963
|
-
checkIsRetiree
|
|
6964
|
-
checkBusinessOwner
|
|
6965
|
-
checkConsentPfrFlg
|
|
6966
|
-
checkAddressFillFromESIA
|
|
6967
|
-
checkAddressFact
|
|
6968
|
-
checkCondition
|
|
6973
|
+
checkIsRetiree(step, getValue),
|
|
6974
|
+
checkBusinessOwner(_, getValue),
|
|
6975
|
+
checkConsentPfrFlg(_, getValue),
|
|
6976
|
+
checkAddressFillFromESIA(_, getValue),
|
|
6977
|
+
checkAddressFact(_, getValue),
|
|
6978
|
+
checkCondition(_, getValue),
|
|
6969
6979
|
].some(Boolean)) {
|
|
6970
6980
|
return { ..._, required: false };
|
|
6971
6981
|
}
|
|
6972
6982
|
return _;
|
|
6973
6983
|
});
|
|
6974
|
-
const checkIsRetiree
|
|
6975
|
-
const checkBusinessOwner
|
|
6976
|
-
const checkAddressFillFromESIA
|
|
6977
|
-
const checkAddressFact
|
|
6978
|
-
const checkCondition
|
|
6984
|
+
const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
|
|
6985
|
+
const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
|
|
6986
|
+
const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
|
|
6987
|
+
const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
|
|
6988
|
+
const checkCondition = ({ condition }, getValue) => condition?.name &&
|
|
6979
6989
|
condition?.values?.some((_) => {
|
|
6980
6990
|
const dataValue = getValue(condition?.name);
|
|
6981
6991
|
return _ !== (dataValue?.key ?? dataValue);
|
|
6982
6992
|
});
|
|
6983
|
-
const checkConsentPfrFlg
|
|
6984
|
-
const isSnilsRequired
|
|
6993
|
+
const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
|
|
6994
|
+
const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
|
|
6985
6995
|
|
|
6986
6996
|
const renderInfo$2 = (inputs = []) => {
|
|
6987
6997
|
const infoInputs = inputs.filter((_) => _.fieldType === 'info');
|
|
@@ -6990,11 +7000,11 @@
|
|
|
6990
7000
|
: null;
|
|
6991
7001
|
};
|
|
6992
7002
|
|
|
6993
|
-
const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params));
|
|
7003
|
+
const renderInputs$1 = ({ field, inputs, params }) => inputs.map(getField(field, params, { ...InputsRetailMap, ...InputRetailCardMap }));
|
|
6994
7004
|
|
|
6995
7005
|
const renderStep$1 = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
|
|
6996
|
-
const inputs = calculateInputs
|
|
6997
|
-
const filteredInputs = inputs.filter((_) => !checkCondition
|
|
7006
|
+
const inputs = calculateInputs(getValue$3(field))(origInputs, step);
|
|
7007
|
+
const filteredInputs = inputs.filter((_) => !checkCondition(_, getValue$3(field)));
|
|
6998
7008
|
return (jsxs("div", { className: style(inputColumnStyles(columns), 'grid gap-x-m'), children: [renderInfo$2(filteredInputs), renderTitle(title), renderInputs$1({ field, inputs, params })] }, `section-${i}`));
|
|
6999
7009
|
});
|
|
7000
7010
|
const getValue$3 = (field) => (name) => field(name)?.value;
|
|
@@ -7222,8 +7232,8 @@
|
|
|
7222
7232
|
},
|
|
7223
7233
|
{
|
|
7224
7234
|
familyStatus: { key: '', text: '' },
|
|
7225
|
-
dependents: undefined,
|
|
7226
7235
|
familyMembers: undefined,
|
|
7236
|
+
dependents: undefined,
|
|
7227
7237
|
confirmationIncome: { key: '', text: '' },
|
|
7228
7238
|
wages: undefined,
|
|
7229
7239
|
mandatoryPayments: undefined,
|
|
@@ -7287,7 +7297,7 @@
|
|
|
7287
7297
|
}
|
|
7288
7298
|
}, [isFinalStep, initialState]);
|
|
7289
7299
|
const handleSubmit = useCallback(async (formData) => {
|
|
7290
|
-
const feedbackValidator = objectValidator(getObjectValidator(calculateInputs
|
|
7300
|
+
const feedbackValidator = objectValidator(getObjectValidator(calculateInputs(getValue$2(formData))(inputs, step)));
|
|
7291
7301
|
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
7292
7302
|
return;
|
|
7293
7303
|
}
|
|
@@ -7886,33 +7896,6 @@
|
|
|
7886
7896
|
return statusesMap[status] || jsx(ReworkStatusContent, {});
|
|
7887
7897
|
};
|
|
7888
7898
|
|
|
7889
|
-
const calculateInputs = (getValue) => (inputs, step) => inputs
|
|
7890
|
-
.filter((_) => _)
|
|
7891
|
-
.map((_) => {
|
|
7892
|
-
if ([
|
|
7893
|
-
checkIsRetiree(step, getValue),
|
|
7894
|
-
checkBusinessOwner(_, getValue),
|
|
7895
|
-
checkConsentPfrFlg(_, getValue),
|
|
7896
|
-
checkAddressFillFromESIA(_, getValue),
|
|
7897
|
-
checkAddressFact(_, getValue),
|
|
7898
|
-
checkCondition(_, getValue),
|
|
7899
|
-
].some(Boolean)) {
|
|
7900
|
-
return { ..._, required: false };
|
|
7901
|
-
}
|
|
7902
|
-
return _;
|
|
7903
|
-
});
|
|
7904
|
-
const checkIsRetiree = (step, getValue) => step === 2 && getValue('employment')?.key === 'RETIREE';
|
|
7905
|
-
const checkBusinessOwner = ({ name }, getValue) => name === 'partInBusiness' && getValue('positionOrganization')?.key !== 'BUSINESS_OWNER';
|
|
7906
|
-
const checkAddressFillFromESIA = ({ name, filledByEsia }, getValue) => name?.startsWith('address') && getValue('esiaAccountTypeCd')?.key && filledByEsia;
|
|
7907
|
-
const checkAddressFact = ({ name }, getValue) => name === 'addressFact' && getValue('addressMatch');
|
|
7908
|
-
const checkCondition = ({ condition }, getValue) => condition?.name &&
|
|
7909
|
-
condition?.values?.some((_) => {
|
|
7910
|
-
const dataValue = getValue(condition?.name);
|
|
7911
|
-
return _ !== (dataValue?.key ?? dataValue);
|
|
7912
|
-
});
|
|
7913
|
-
const checkConsentPfrFlg = ({ name }, getValue) => name === 'snils' && isSnilsRequired(getValue);
|
|
7914
|
-
const isSnilsRequired = (getValue) => getValue('confirmationIncome')?.key !== 'PFR_CERTIFICATE';
|
|
7915
|
-
|
|
7916
7899
|
const renderInfo$1 = (inputs = []) => {
|
|
7917
7900
|
const infoInputs = inputs.filter((_) => _.fieldType === 'info');
|
|
7918
7901
|
return infoInputs.length
|
|
@@ -7920,7 +7903,7 @@
|
|
|
7920
7903
|
: null;
|
|
7921
7904
|
};
|
|
7922
7905
|
|
|
7923
|
-
const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params));
|
|
7906
|
+
const renderInputs = ({ field, inputs, params }) => inputs.map(getField(field, params, { ...InputsRetailMap }));
|
|
7924
7907
|
|
|
7925
7908
|
const renderStep = ({ sections, field, step, params }) => sections?.map(({ inputs: origInputs = [], columns, title }, i) => {
|
|
7926
7909
|
const inputs = calculateInputs(getValue$1(field))(origInputs, step);
|
|
@@ -10118,7 +10101,7 @@
|
|
|
10118
10101
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
10119
10102
|
});
|
|
10120
10103
|
|
|
10121
|
-
const packageVersion = "0.14.
|
|
10104
|
+
const packageVersion = "0.14.725";
|
|
10122
10105
|
|
|
10123
10106
|
exports.Blocks = Blocks;
|
|
10124
10107
|
exports.ContentPage = ContentPage;
|