@redneckz/wildless-cms-uni-blocks 0.14.665 → 0.14.667
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/api/RetailAPI/regionOffices.d.ts +16 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +1428 -1367
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
- package/bundle/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/bundle/components/CreditForm/utils.d.ts +7 -1
- package/bundle/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/{dist/ui-kit/FormField/Fields/RetailAddressField.d.ts → bundle/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
- package/bundle/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
- package/{lib/ui-kit/FormField/Fields/RetailRegionField.d.ts → bundle/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/bundle/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/bundle/ui-kit/FormField/SelectField.d.ts +2 -0
- package/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/dist/api/RetailAPI/regionOffices.d.ts +16 -0
- package/dist/api/RetailAPI/regionOffices.js +19 -0
- package/dist/api/RetailAPI/regionOffices.js.map +1 -0
- package/dist/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/dist/components/ApplicationForm/getInitialFormState.js +1 -0
- package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
- package/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/ContentPage/useContentPageData.js +1 -1
- package/dist/components/ContentPage/useContentPageData.js.map +1 -1
- package/dist/components/CreditCardForm/CreditCardForm.js +2 -0
- package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/dist/components/CreditCardForm/creditCardFormStepsData.js +2 -2
- package/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
- package/dist/components/CreditCardForm/formStateMap.js +4 -4
- package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/dist/components/CreditCardForm/getFourthStepData.js +8 -2
- package/dist/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/dist/components/CreditForm/creditFormStepsData.js +2 -2
- package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/dist/components/CreditForm/formStateMap.js +2 -2
- package/dist/components/CreditForm/formStateMap.js.map +1 -1
- package/dist/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/dist/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/dist/components/CreditForm/getFifthStepData.js +10 -0
- package/dist/components/CreditForm/getFifthStepData.js.map +1 -0
- package/dist/components/CreditForm/getThirdStepData.js +8 -2
- package/dist/components/CreditForm/getThirdStepData.js.map +1 -1
- package/dist/components/CreditForm/utils.d.ts +7 -1
- package/dist/components/CreditForm/utils.js +9 -3
- package/dist/components/CreditForm/utils.js.map +1 -1
- package/dist/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/dist/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/{lib/ui-kit/FormField/Fields/RetailAddressField.d.ts → dist/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
- package/dist/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
- package/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js +9 -0
- package/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/{RetailRegionField.d.ts → RegionRetailField.d.ts} +1 -1
- package/dist/ui-kit/FormField/Fields/RegionRetailField.js +14 -0
- package/dist/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
- package/dist/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/WagesField.js +18 -0
- package/dist/ui-kit/FormField/Fields/WagesField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/ui-kit/FormField/SelectField.d.ts +2 -0
- package/dist/ui-kit/FormField/SelectField.js +2 -2
- package/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/dist/ui-kit/FormField/getField.js +8 -8
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +3 -3
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/dist/ui-kit/YandexMap/YandexMap.js +4 -4
- package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/lib/api/RetailAPI/regionOffices.d.ts +16 -0
- package/lib/api/RetailAPI/regionOffices.js +16 -0
- package/lib/api/RetailAPI/regionOffices.js.map +1 -0
- package/lib/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/lib/components/ApplicationForm/getInitialFormState.js +1 -0
- package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
- package/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/ContentPage/useContentPageData.js +1 -1
- package/lib/components/ContentPage/useContentPageData.js.map +1 -1
- package/lib/components/CreditCardForm/CreditCardForm.js +3 -1
- package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/lib/components/CreditCardForm/creditCardFormStepsData.js +2 -2
- package/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
- package/lib/components/CreditCardForm/formStateMap.js +4 -4
- package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/lib/components/CreditCardForm/getFourthStepData.js +8 -2
- package/lib/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/lib/components/CreditForm/creditFormStepsData.js +2 -2
- package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/lib/components/CreditForm/formStateMap.js +2 -2
- package/lib/components/CreditForm/formStateMap.js.map +1 -1
- package/lib/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/lib/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/lib/components/CreditForm/getFifthStepData.js +7 -0
- package/lib/components/CreditForm/getFifthStepData.js.map +1 -0
- package/lib/components/CreditForm/getThirdStepData.js +8 -2
- package/lib/components/CreditForm/getThirdStepData.js.map +1 -1
- package/lib/components/CreditForm/utils.d.ts +7 -1
- package/lib/components/CreditForm/utils.js +9 -3
- package/lib/components/CreditForm/utils.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
- package/lib/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/lib/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/{bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts → lib/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
- package/lib/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
- package/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js +7 -0
- package/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
- package/{mobile/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts → lib/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/lib/ui-kit/FormField/Fields/RegionRetailField.js +12 -0
- package/lib/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/lib/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
- package/lib/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/WagesField.js +16 -0
- package/lib/ui-kit/FormField/Fields/WagesField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/lib/ui-kit/FormField/SelectField.d.ts +2 -0
- package/lib/ui-kit/FormField/SelectField.js +2 -2
- package/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/lib/ui-kit/FormField/getField.js +8 -8
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +3 -3
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/lib/ui-kit/YandexMap/YandexMap.js +2 -2
- package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/bundle/api/RetailAPI/regionOffices.d.ts +16 -0
- package/mobile/bundle/bundle.umd.js +1428 -1367
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
- package/mobile/bundle/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/mobile/bundle/components/CreditForm/utils.d.ts +7 -1
- package/mobile/bundle/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/{RetailAddressField.d.ts → AddressRetailField.d.ts} +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
- package/{bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts → mobile/bundle/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
- package/mobile/bundle/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/bundle/ui-kit/FormField/SelectField.d.ts +2 -0
- package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/regionOffices.d.ts +16 -0
- package/mobile/dist/api/RetailAPI/regionOffices.js +19 -0
- package/mobile/dist/api/RetailAPI/regionOffices.js.map +1 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ContentPage/useContentPageData.js +1 -1
- package/mobile/dist/components/ContentPage/useContentPageData.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/CreditCardForm.js +2 -0
- package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js +2 -2
- package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/formStateMap.js +4 -4
- package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/getFourthStepData.js +8 -2
- package/mobile/dist/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/mobile/dist/components/CreditForm/creditFormStepsData.js +2 -2
- package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/dist/components/CreditForm/formStateMap.js +2 -2
- package/mobile/dist/components/CreditForm/formStateMap.js.map +1 -1
- package/mobile/dist/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/mobile/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/mobile/dist/components/CreditForm/getFifthStepData.js +10 -0
- package/mobile/dist/components/CreditForm/getFifthStepData.js.map +1 -0
- package/mobile/dist/components/CreditForm/getThirdStepData.js +8 -2
- package/mobile/dist/components/CreditForm/getThirdStepData.js.map +1 -1
- package/mobile/dist/components/CreditForm/utils.d.ts +7 -1
- package/mobile/dist/components/CreditForm/utils.js +9 -3
- package/mobile/dist/components/CreditForm/utils.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
- package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js +9 -0
- package/mobile/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.js +14 -0
- package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
- package/mobile/dist/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/WagesField.js +18 -0
- package/mobile/dist/ui-kit/FormField/Fields/WagesField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/SelectField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/SelectField.js +2 -2
- package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +8 -8
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +3 -3
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js +4 -4
- package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/lib/api/RetailAPI/regionOffices.d.ts +16 -0
- package/mobile/lib/api/RetailAPI/regionOffices.js +16 -0
- package/mobile/lib/api/RetailAPI/regionOffices.js.map +1 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.d.ts +1 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ContentPage/useContentPageData.js +1 -1
- package/mobile/lib/components/ContentPage/useContentPageData.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/CreditCardForm.js +3 -1
- package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js +2 -2
- package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/formStateMap.js +4 -4
- package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/getFourthStepData.js +8 -2
- package/mobile/lib/components/CreditCardForm/getFourthStepData.js.map +1 -1
- package/mobile/lib/components/CreditForm/creditFormStepsData.js +2 -2
- package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/lib/components/CreditForm/formStateMap.js +2 -2
- package/mobile/lib/components/CreditForm/formStateMap.js.map +1 -1
- package/mobile/lib/components/CreditForm/getCreditFormTaskData.js +3 -1
- package/mobile/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getFifthStepData.d.ts +3 -0
- package/mobile/lib/components/CreditForm/getFifthStepData.js +7 -0
- package/mobile/lib/components/CreditForm/getFifthStepData.js.map +1 -0
- package/mobile/lib/components/CreditForm/getThirdStepData.js +8 -2
- package/mobile/lib/components/CreditForm/getThirdStepData.js.map +1 -1
- package/mobile/lib/components/CreditForm/utils.d.ts +7 -1
- package/mobile/lib/components/CreditForm/utils.js +9 -3
- package/mobile/lib/components/CreditForm/utils.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
- package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js +7 -0
- package/mobile/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.js +12 -0
- package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
- package/mobile/lib/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/WagesField.js +16 -0
- package/mobile/lib/ui-kit/FormField/Fields/WagesField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/SelectField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/SelectField.js +2 -2
- package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +8 -8
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +3 -3
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js +2 -2
- package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
- package/mobile/src/api/RetailAPI/regionOffices.ts +36 -0
- package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +2 -0
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +8 -2
- package/mobile/src/components/ContentPage/useContentPageData.ts +1 -1
- package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +4 -1
- package/mobile/src/components/CreditCardForm/creditCardFormStepsData.tsx +2 -2
- package/mobile/src/components/CreditCardForm/formStateMap.tsx +4 -4
- package/mobile/src/components/CreditCardForm/getFourthStepData.ts +14 -2
- package/mobile/src/components/CreditForm/creditFormStepsData.tsx +2 -2
- package/mobile/src/components/CreditForm/formStateMap.tsx +2 -2
- package/mobile/src/components/CreditForm/getCreditFormTaskData.ts +3 -1
- package/mobile/src/components/CreditForm/getFifthStepData.ts +10 -0
- package/mobile/src/components/CreditForm/getThirdStepData.ts +14 -2
- package/mobile/src/components/CreditForm/utils.ts +9 -3
- package/mobile/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +1 -1
- package/mobile/src/ui-kit/FormField/Fields/{RetailAddressField.tsx → AddressRetailField.tsx} +20 -23
- package/{src/ui-kit/FormField/Fields/OtherPayments.tsx → mobile/src/ui-kit/FormField/Fields/MandatoryPaymentsField.tsx} +2 -2
- package/{src/ui-kit/FormField/Fields/RetailRegionField.tsx → mobile/src/ui-kit/FormField/Fields/RegionRetailField.tsx} +6 -8
- package/mobile/src/ui-kit/FormField/Fields/RetirementIncomeField.tsx +25 -9
- package/mobile/src/ui-kit/FormField/Fields/WagesField.tsx +31 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +5 -1
- package/mobile/src/ui-kit/FormField/SelectField.tsx +13 -2
- package/mobile/src/ui-kit/FormField/getField.tsx +8 -8
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
- package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +2 -2
- package/package.json +1 -1
- package/src/api/RetailAPI/regionOffices.ts +36 -0
- package/src/components/ApplicationForm/getInitialFormState.tsx +2 -0
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +8 -2
- package/src/components/ContentPage/useContentPageData.ts +1 -1
- package/src/components/CreditCardForm/CreditCardForm.fixture.tsx +11 -0
- package/src/components/CreditCardForm/CreditCardForm.tsx +4 -1
- package/src/components/CreditCardForm/creditCardFormStepsData.tsx +2 -2
- package/src/components/CreditCardForm/formStateMap.tsx +4 -4
- package/src/components/CreditCardForm/getFourthStepData.ts +14 -2
- package/src/components/CreditForm/creditFormStepsData.tsx +2 -2
- package/src/components/CreditForm/formStateMap.tsx +2 -2
- package/src/components/CreditForm/getCreditFormTaskData.ts +3 -1
- package/src/components/CreditForm/getFifthStepData.ts +10 -0
- package/src/components/CreditForm/getThirdStepData.ts +14 -2
- package/src/components/CreditForm/utils.ts +9 -3
- package/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +1 -1
- package/src/ui-kit/FormField/Fields/{RetailAddressField.tsx → AddressRetailField.tsx} +20 -23
- package/{mobile/src/ui-kit/FormField/Fields/OtherPayments.tsx → src/ui-kit/FormField/Fields/MandatoryPaymentsField.tsx} +2 -2
- package/{mobile/src/ui-kit/FormField/Fields/RetailRegionField.tsx → src/ui-kit/FormField/Fields/RegionRetailField.tsx} +6 -8
- package/src/ui-kit/FormField/Fields/RetirementIncomeField.tsx +25 -9
- package/src/ui-kit/FormField/Fields/WagesField.tsx +31 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +5 -1
- package/src/ui-kit/FormField/SelectField.tsx +13 -2
- package/src/ui-kit/FormField/getField.tsx +8 -8
- package/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
- package/src/ui-kit/YandexMap/YandexMap.tsx +2 -2
- package/bundle/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
- package/bundle/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
- package/dist/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
- package/dist/ui-kit/FormField/Fields/MandatoryIncome.js +0 -9
- package/dist/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
- package/dist/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
- package/dist/ui-kit/FormField/Fields/OtherPayments.js +0 -9
- package/dist/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
- package/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/dist/ui-kit/FormField/Fields/RetailRegionField.js +0 -14
- package/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
- package/lib/ui-kit/FormField/Fields/MandatoryIncome.js +0 -7
- package/lib/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
- package/lib/ui-kit/FormField/Fields/OtherPayments.js +0 -7
- package/lib/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/RetailRegionField.js +0 -12
- package/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/mobile/bundle/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
- package/mobile/bundle/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/MandatoryIncome.js +0 -9
- package/mobile/dist/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/OtherPayments.js +0 -9
- package/mobile/dist/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js +0 -14
- package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/MandatoryIncome.js +0 -7
- package/mobile/lib/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/OtherPayments.js +0 -7
- package/mobile/lib/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js +0 -12
- package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
- package/mobile/src/ui-kit/FormField/Fields/MandatoryIncome.tsx +0 -15
- package/src/ui-kit/FormField/Fields/MandatoryIncome.tsx +0 -15
package/bundle/bundle.umd.js
CHANGED
|
@@ -1504,6 +1504,7 @@
|
|
|
1504
1504
|
feedbackMethod: defaultSelectValidator(),
|
|
1505
1505
|
serviceType: defaultSelectValidator(),
|
|
1506
1506
|
serviceDirection: defaultSelectValidator(),
|
|
1507
|
+
regionRetail: defaultSelectValidator('Выберите регион'),
|
|
1507
1508
|
meetingDay: defaultValidator(),
|
|
1508
1509
|
product: defaultValidator(),
|
|
1509
1510
|
localities: defaultValidator(),
|
|
@@ -1530,15 +1531,14 @@
|
|
|
1530
1531
|
participantDateRegistration: defaultValidator('Укажите дату регистрации'),
|
|
1531
1532
|
retirementIncome: defaultValidator(),
|
|
1532
1533
|
otherIncome: defaultValidator(),
|
|
1533
|
-
|
|
1534
|
-
|
|
1534
|
+
wages: defaultValidator(),
|
|
1535
|
+
mandatoryPayments: defaultValidator(),
|
|
1535
1536
|
disablePeopleFlg: defaultValidator(),
|
|
1536
1537
|
bankruptcyFlg: defaultValidator(),
|
|
1537
1538
|
shareholderFlg: defaultValidator(),
|
|
1538
1539
|
legalEntityName: defaultValidator(),
|
|
1539
1540
|
bankEmployeeCode: defaultValidator(),
|
|
1540
1541
|
partInBusiness: defaultValidator(),
|
|
1541
|
-
regionRetail: defaultSelectValidator('Выберите филиал банка'),
|
|
1542
1542
|
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
1543
1543
|
addressMatch: defaultValidator(),
|
|
1544
1544
|
codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
|
|
@@ -1796,1463 +1796,1485 @@
|
|
|
1796
1796
|
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) }));
|
|
1797
1797
|
});
|
|
1798
1798
|
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
const handleFocus = useCallback((ev) => {
|
|
1803
|
-
setIsFocused(true);
|
|
1804
|
-
onFocus && onFocus(ev);
|
|
1805
|
-
}, []);
|
|
1806
|
-
const handleBlur = useCallback(() => {
|
|
1807
|
-
setIsFocused(false);
|
|
1808
|
-
onChange && onChange(normalize(value));
|
|
1809
|
-
onBlur && onBlur();
|
|
1810
|
-
}, [onChange, value]);
|
|
1811
|
-
return {
|
|
1812
|
-
value: (isFocused || !format ? value : format(value)),
|
|
1813
|
-
onFocus: handleFocus,
|
|
1814
|
-
onBlur: handleBlur,
|
|
1815
|
-
};
|
|
1816
|
-
};
|
|
1817
|
-
|
|
1818
|
-
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
1819
|
-
|
|
1820
|
-
function parseDecimal(value) {
|
|
1821
|
-
const rawValue = (value || '').replace(/\D/g, '');
|
|
1822
|
-
const unsafeDecimal = parseInt(rawValue, 10);
|
|
1823
|
-
return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
|
|
1824
|
-
}
|
|
1799
|
+
const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
|
|
1800
|
+
'backdrop-blur': blur,
|
|
1801
|
+
}), children: jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
|
|
1825
1802
|
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1803
|
+
const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
|
|
1804
|
+
const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
|
|
1805
|
+
function renderClusterer({ yandexMaps, map, points, isLoad, }) {
|
|
1806
|
+
if (isLoad || !points) {
|
|
1807
|
+
return;
|
|
1808
|
+
}
|
|
1809
|
+
map.geoObjects.removeAll();
|
|
1810
|
+
if (!points.length) {
|
|
1811
|
+
return;
|
|
1812
|
+
}
|
|
1813
|
+
const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
|
|
1814
|
+
const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
|
|
1815
|
+
if (points.length && points.every((_) => 'type' in _)) {
|
|
1816
|
+
const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
|
|
1817
|
+
const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
|
|
1818
|
+
const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
|
|
1819
|
+
officeClusterer.add(officesGeoObjects);
|
|
1820
|
+
remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
|
|
1821
|
+
map.geoObjects.add(remoteWorkplaceClusterer);
|
|
1822
|
+
map.geoObjects.add(officeClusterer);
|
|
1823
|
+
}
|
|
1824
|
+
else {
|
|
1825
|
+
const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
|
|
1826
|
+
officeClusterer.add(geoObjects);
|
|
1827
|
+
map.geoObjects.add(officeClusterer);
|
|
1828
|
+
}
|
|
1829
|
+
map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
|
|
1830
|
+
if (map.getZoom() > 10) {
|
|
1831
|
+
map.setZoom(10);
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1838
1834
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1835
|
+
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
1836
|
+
return new yandexMaps.Clusterer({
|
|
1837
|
+
clusterIcons: [
|
|
1838
|
+
{
|
|
1839
|
+
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
1840
|
+
size: [78, 84],
|
|
1841
|
+
offset: [-35, -50],
|
|
1842
|
+
},
|
|
1843
|
+
],
|
|
1844
|
+
clusterIconContentLayout,
|
|
1845
|
+
clusterHideIconOnBalloonOpen: false,
|
|
1846
|
+
geoObjectHideIconOnBalloonOpen: false,
|
|
1848
1847
|
});
|
|
1849
|
-
const handleChange = useCallback((ev) => {
|
|
1850
|
-
onChange && onChange(parseDecimal(ev.target?.value));
|
|
1851
|
-
}, [onChange]);
|
|
1852
|
-
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)] }));
|
|
1853
|
-
});
|
|
1854
|
-
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
1855
|
-
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)))) }));
|
|
1856
|
-
|
|
1857
|
-
const MIN_CREDIT_AMOUNT = 1000;
|
|
1858
|
-
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
1859
|
-
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
1860
|
-
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') })));
|
|
1861
|
-
|
|
1862
|
-
const useLeadFormData = (typeField) => {
|
|
1863
|
-
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
1864
|
-
if (data && 'errorMessage' in data) {
|
|
1865
|
-
return { error };
|
|
1866
|
-
}
|
|
1867
|
-
return { data: data, error };
|
|
1868
1848
|
};
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
|
|
1849
|
+
const defineGeoObjects = (pointArr, type, yandexMaps) => {
|
|
1850
|
+
return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
|
|
1851
|
+
balloonContentHeader: content?.header,
|
|
1852
|
+
balloonContentBody: content?.body,
|
|
1853
|
+
balloonContentFooter: content?.footer,
|
|
1854
|
+
hintContent: content?.hint,
|
|
1855
|
+
}, {
|
|
1856
|
+
iconLayout: 'default#image',
|
|
1857
|
+
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
1858
|
+
iconImageSize: [78, 84],
|
|
1859
|
+
iconImageOffset: [-35, -50],
|
|
1860
|
+
}));
|
|
1872
1861
|
};
|
|
1873
1862
|
|
|
1874
|
-
const
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
[];
|
|
1881
|
-
return (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043F\u0438\u0441\u043A\u0430", label: label, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
|
|
1882
|
-
});
|
|
1883
|
-
|
|
1884
|
-
const AmountWorkersField = JSX(({ field, input }) => {
|
|
1885
|
-
const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
|
|
1886
|
-
return (jsx(SelectField, { field: field, source: 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 }));
|
|
1887
|
-
});
|
|
1888
|
-
|
|
1889
|
-
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) })));
|
|
1890
|
-
|
|
1891
|
-
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) })));
|
|
1892
|
-
|
|
1893
|
-
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", type: "number", ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
|
|
1894
|
-
|
|
1895
|
-
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') })));
|
|
1863
|
+
const defaultStyle = {
|
|
1864
|
+
focus: 'focus:border-primary-text focus:border',
|
|
1865
|
+
hover: 'hover:bg-primary-hover',
|
|
1866
|
+
active: 'active:bg-primary-active',
|
|
1867
|
+
font: 'text-center font-sans',
|
|
1868
|
+
};
|
|
1896
1869
|
|
|
1897
|
-
const
|
|
1870
|
+
const styles$1 = {
|
|
1871
|
+
...defaultStyle,
|
|
1872
|
+
border: 'border border-transparent rounded-md',
|
|
1873
|
+
position: 'absolute flex items-center justify-center',
|
|
1874
|
+
};
|
|
1875
|
+
const renderUserGeolocation = (map, yandexMaps, className) => {
|
|
1876
|
+
const setUserGeoLocation = () => {
|
|
1877
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1878
|
+
// @ts-ignore
|
|
1879
|
+
yandexMaps.geolocation
|
|
1880
|
+
.get({
|
|
1881
|
+
provider: 'yandex',
|
|
1882
|
+
autoReverseGeocode: true,
|
|
1883
|
+
mapStateAutoApply: true,
|
|
1884
|
+
})
|
|
1885
|
+
.then(function (result) {
|
|
1886
|
+
map.current.geoObjects.add(result.geoObjects);
|
|
1887
|
+
});
|
|
1888
|
+
};
|
|
1889
|
+
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" }) }));
|
|
1890
|
+
};
|
|
1898
1891
|
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1892
|
+
const getNS = (_) => globalThis[_];
|
|
1893
|
+
const initializeExternalNS = (namespaceName, url) => {
|
|
1894
|
+
const script = document.getElementById(url);
|
|
1895
|
+
if (script) {
|
|
1896
|
+
const ns = getNS(namespaceName);
|
|
1897
|
+
if (ns) {
|
|
1898
|
+
return Promise.resolve(ns);
|
|
1899
|
+
}
|
|
1900
|
+
else {
|
|
1901
|
+
return new Promise((resolve) => {
|
|
1902
|
+
script.addEventListener('load', () => {
|
|
1903
|
+
resolve(getNS(namespaceName));
|
|
1904
|
+
});
|
|
1905
|
+
});
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
else {
|
|
1909
|
+
return new Promise((resolve, reject) => {
|
|
1910
|
+
const newScript = document.createElement('script');
|
|
1911
|
+
newScript.src = url;
|
|
1912
|
+
newScript.async = true;
|
|
1913
|
+
newScript.id = url;
|
|
1914
|
+
newScript.addEventListener('load', () => {
|
|
1915
|
+
resolve(getNS(namespaceName));
|
|
1916
|
+
});
|
|
1917
|
+
newScript.addEventListener('error', (error) => {
|
|
1918
|
+
reject(error);
|
|
1919
|
+
});
|
|
1920
|
+
document.head.appendChild(newScript);
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
1925
|
+
const [externalNS, setExternalNS] = useState(undefined);
|
|
1901
1926
|
useEffect(() => {
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1927
|
+
let isMounted = true;
|
|
1928
|
+
initializeExternalNS(namespaceName, url)
|
|
1929
|
+
.then((ns) => {
|
|
1930
|
+
if (isMounted) {
|
|
1931
|
+
setExternalNS(ns);
|
|
1932
|
+
}
|
|
1933
|
+
})
|
|
1934
|
+
.catch((error) => {
|
|
1935
|
+
console.error(`Failed to initialize external namespace: ${error}`);
|
|
1936
|
+
});
|
|
1937
|
+
return () => {
|
|
1938
|
+
isMounted = false;
|
|
1939
|
+
if (unmountNS) {
|
|
1940
|
+
const script = document.getElementById(url);
|
|
1941
|
+
if (script) {
|
|
1942
|
+
document.head.removeChild(script);
|
|
1943
|
+
}
|
|
1944
|
+
setExternalNS(undefined);
|
|
1907
1945
|
}
|
|
1908
1946
|
};
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1947
|
+
}, [namespaceName, url, unmountNS]);
|
|
1948
|
+
return externalNS;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
const YMAPS_NAMESPACE = 'ymaps';
|
|
1952
|
+
const useYandexMaps = () => {
|
|
1953
|
+
const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
|
|
1954
|
+
return useExternalNS(YMAPS_NAMESPACE, url, false);
|
|
1914
1955
|
};
|
|
1915
1956
|
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
let dayCounter = 1;
|
|
1921
|
-
for (let i = 0; i < DAY_COUNT; i++) {
|
|
1922
|
-
const rowCells = [];
|
|
1923
|
-
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
1924
|
-
if (i === 0 && j < firstDayOfWeek) {
|
|
1925
|
-
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1926
|
-
}
|
|
1927
|
-
else if (dayCounter > totalDays) {
|
|
1928
|
-
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
1929
|
-
}
|
|
1930
|
-
else {
|
|
1931
|
-
const currentDate = new Date(currentYear, currentMonth, dayCounter);
|
|
1932
|
-
const isToday = checkIsToday(currentDate, today);
|
|
1933
|
-
const isDisabled = checkIsDisabled(currentDate, min, max);
|
|
1934
|
-
rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
|
|
1935
|
-
dayCounter++;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
1939
|
-
}
|
|
1940
|
-
return calendarCells;
|
|
1957
|
+
const styles = {
|
|
1958
|
+
...defaultStyle,
|
|
1959
|
+
border: 'border-b border-b-2 border-gray last:border-0',
|
|
1960
|
+
position: 'relative flex items-center justify-center',
|
|
1941
1961
|
};
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
onDateSelect(date);
|
|
1952
|
-
setValue(false);
|
|
1953
|
-
}, []);
|
|
1954
|
-
const { firstDayOfWeek, totalDays } = useMemo(() => ({
|
|
1955
|
-
firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
|
|
1956
|
-
totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
|
|
1957
|
-
}), [currentYear, currentMonth]);
|
|
1958
|
-
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({
|
|
1959
|
-
firstDayOfWeek,
|
|
1960
|
-
today,
|
|
1961
|
-
totalDays,
|
|
1962
|
-
currentYear,
|
|
1963
|
-
currentMonth,
|
|
1964
|
-
min,
|
|
1965
|
-
max,
|
|
1966
|
-
onDateClick: handleDateClick,
|
|
1967
|
-
}) })] }));
|
|
1962
|
+
// TODO: Добавить метод определения центральной точки
|
|
1963
|
+
const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
|
|
1964
|
+
const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
|
|
1965
|
+
const changeZoom = () => {
|
|
1966
|
+
const currentZoom = yandexMaps.current.getZoom();
|
|
1967
|
+
const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
|
|
1968
|
+
yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
|
|
1969
|
+
};
|
|
1970
|
+
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" }) }));
|
|
1968
1971
|
});
|
|
1969
1972
|
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
'Ноябрь',
|
|
1982
|
-
'Декабрь',
|
|
1983
|
-
];
|
|
1984
|
-
|
|
1985
|
-
function normalizeWithMask(value, pattern) {
|
|
1986
|
-
const valueNumbers = value.replace(/\D/g, '');
|
|
1987
|
-
if (valueNumbers === '' || value?.length === pattern.length) {
|
|
1988
|
-
return value;
|
|
1989
|
-
}
|
|
1990
|
-
const patternInArr = [...pattern];
|
|
1991
|
-
const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
|
|
1992
|
-
const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
|
|
1993
|
-
const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
|
|
1994
|
-
const resultInArr = patternInArr.map(applyPlaceholder);
|
|
1995
|
-
const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
|
|
1996
|
-
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
1997
|
-
}
|
|
1998
|
-
const isPlaceholder$1 = (_) => _ === '_';
|
|
1999
|
-
const isDigit$1 = (_) => /\d/.test(_);
|
|
2000
|
-
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2001
|
-
|
|
2002
|
-
const START_YEAR = 1940;
|
|
2003
|
-
const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
|
|
2004
|
-
|
|
2005
|
-
const ICON_PROPS$1 = {
|
|
2006
|
-
name: 'CalendarIcon',
|
|
2007
|
-
iconVersion: 'black',
|
|
2008
|
-
width: '24',
|
|
2009
|
-
height: '24',
|
|
2010
|
-
};
|
|
2011
|
-
const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
|
|
2012
|
-
const ref = useRef(null);
|
|
2013
|
-
const [inputValue, setInputValue] = useState(value || '');
|
|
2014
|
-
const handleChange = (ev) => {
|
|
2015
|
-
const val = ev.target?.value;
|
|
2016
|
-
if (typeof val === 'string' && val?.length < 11) {
|
|
2017
|
-
setInputValue(normalizeWithMask(val, '__.__.____'));
|
|
2018
|
-
}
|
|
2019
|
-
};
|
|
2020
|
-
const onBlur = () => {
|
|
2021
|
-
if (checkIsValidDate(inputValue)) {
|
|
2022
|
-
const [day, month, year] = inputValue.split('.');
|
|
2023
|
-
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2024
|
-
setSelectedMonth(Number(month) - 1);
|
|
2025
|
-
setSelectedYear(Number(year));
|
|
1973
|
+
const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
|
|
1974
|
+
// TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
|
|
1975
|
+
// Сейчас реализован поиск среди тестовых данных
|
|
1976
|
+
// TODO: Также выяснить что делать когда ничего не найдено
|
|
1977
|
+
// TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
|
|
1978
|
+
const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
|
|
1979
|
+
const map = useRef(null);
|
|
1980
|
+
const yandexMaps = useYandexMaps();
|
|
1981
|
+
useEffect(() => {
|
|
1982
|
+
if (map.current) {
|
|
1983
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad, selectedAddress });
|
|
2026
1984
|
}
|
|
2027
1985
|
else {
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
1986
|
+
yandexMaps?.ready(() => {
|
|
1987
|
+
// Ready function may be called few times, but must be called once
|
|
1988
|
+
if (map.current) {
|
|
1989
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
map.current = new yandexMaps.Map('map', {
|
|
1993
|
+
center: getCenterPoint(points),
|
|
1994
|
+
zoom,
|
|
1995
|
+
controls: [],
|
|
1996
|
+
suppressMapOpenBlock: true,
|
|
1997
|
+
});
|
|
1998
|
+
renderClusterer({ yandexMaps, map: map.current, points, isLoad });
|
|
1999
|
+
});
|
|
2034
2000
|
}
|
|
2035
|
-
|
|
2036
|
-
};
|
|
2001
|
+
}, [yandexMaps, points, zoom, isLoad, selectedAddress]);
|
|
2037
2002
|
useEffect(() => {
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
const [day, month, year] = date.split('.');
|
|
2046
|
-
if (isValidYear(year)) {
|
|
2047
|
-
if (isValidMonth(month)) {
|
|
2048
|
-
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
2049
|
-
let maxDateOfMonth = 0;
|
|
2050
|
-
while (currentDate.getMonth() === Number(month) - 1) {
|
|
2051
|
-
currentDate.setDate(currentDate.getDate() + 1);
|
|
2052
|
-
maxDateOfMonth++;
|
|
2053
|
-
}
|
|
2054
|
-
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
2055
|
-
return true;
|
|
2056
|
-
}
|
|
2003
|
+
if (map.current && selectedAddress) {
|
|
2004
|
+
yandexMaps?.geocode(selectedAddress).then((res) => {
|
|
2005
|
+
const firstGeoObject = res.geoObjects.get(0);
|
|
2006
|
+
const coords = firstGeoObject.geometry.getCoordinates();
|
|
2007
|
+
map.current.setCenter(coords);
|
|
2008
|
+
map.current.setZoom(18);
|
|
2009
|
+
});
|
|
2057
2010
|
}
|
|
2011
|
+
}, [selectedAddress]);
|
|
2012
|
+
if (!yandexMaps) {
|
|
2013
|
+
return null;
|
|
2058
2014
|
}
|
|
2059
|
-
|
|
2015
|
+
const zIndex = 'z-10';
|
|
2016
|
+
return (jsxs("div", { id: "map", 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))] }));
|
|
2017
|
+
});
|
|
2018
|
+
const getCenterPoint = (points) => {
|
|
2019
|
+
const centerCoords = [
|
|
2020
|
+
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
2021
|
+
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
2022
|
+
];
|
|
2023
|
+
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
2060
2024
|
};
|
|
2025
|
+
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
2026
|
+
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
2061
2027
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2028
|
+
async function doRequest(url, method, body) {
|
|
2029
|
+
const response = await fetch(`${API_BASE_URI}${url}`, {
|
|
2030
|
+
method,
|
|
2031
|
+
headers: {
|
|
2032
|
+
'Content-Type': 'application/json',
|
|
2033
|
+
...getAuthorizationHeaders(),
|
|
2034
|
+
},
|
|
2035
|
+
credentials: 'include',
|
|
2036
|
+
body: body ? JSON.stringify(body) : null,
|
|
2037
|
+
});
|
|
2038
|
+
// TODO: add error handling
|
|
2039
|
+
return isJSON(response) ? response.json() : response;
|
|
2040
|
+
}
|
|
2041
|
+
// TODO: Need delete isJSON
|
|
2042
|
+
const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
|
|
2043
|
+
const getAuthorizationHeaders = () => {
|
|
2044
|
+
const token = sessionStorage.getItem('accessToken');
|
|
2045
|
+
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
2046
|
+
};
|
|
2065
2047
|
|
|
2066
|
-
const
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2048
|
+
const regionOffices = async (regionKey) => {
|
|
2049
|
+
const response = await doRequest('/public-data/regionOffices', 'POST', {
|
|
2050
|
+
regionRfCd: {
|
|
2051
|
+
key: regionKey,
|
|
2052
|
+
},
|
|
2053
|
+
cashCardFlg: true,
|
|
2054
|
+
});
|
|
2055
|
+
return await response.json().then((_) => _?.offices?.map((office) => ({
|
|
2056
|
+
...office,
|
|
2057
|
+
gpsLatitude: (office.latitude ?? DEFAULT_CENTER_COORDS[0]).toString().replace(',', '.'),
|
|
2058
|
+
gpsLongitude: (office.longitude ?? DEFAULT_CENTER_COORDS[1]).toString().replace(',', '.'),
|
|
2059
|
+
})));
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
2063
|
+
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
2064
|
+
const onToggle = useCallback(() => {
|
|
2065
|
+
setIsUnfolded((_) => !_);
|
|
2066
|
+
}, []);
|
|
2067
|
+
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2068
|
+
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2069
|
+
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2070
|
+
});
|
|
2071
|
+
|
|
2072
|
+
function useResizeObserver(callback, deps) {
|
|
2073
|
+
const ref = useRef(null);
|
|
2074
|
+
useEffect(() => {
|
|
2075
|
+
const element = ref?.current;
|
|
2076
|
+
if (!element) {
|
|
2077
|
+
return undefined;
|
|
2091
2078
|
}
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
onMonthSelect(months.indexOf(key));
|
|
2095
|
-
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
2096
|
-
handleChangeMonth({
|
|
2097
|
-
maxDateOfMonth,
|
|
2098
|
-
selectedYear,
|
|
2099
|
-
selectedMonth: months.indexOf(key),
|
|
2100
|
-
value,
|
|
2101
|
-
onChange,
|
|
2079
|
+
const observer = new ResizeObserver((entries) => {
|
|
2080
|
+
callback(element, entries[0]);
|
|
2102
2081
|
});
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
}, [
|
|
2108
|
-
return
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2082
|
+
observer.observe(element);
|
|
2083
|
+
return () => {
|
|
2084
|
+
observer.disconnect();
|
|
2085
|
+
};
|
|
2086
|
+
}, [callback, ...deps]);
|
|
2087
|
+
return ref;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2091
|
+
const containerRef = useRef(null);
|
|
2092
|
+
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2093
|
+
if (containerRef.current) {
|
|
2094
|
+
containerRef.current.style.maxHeight = isUnfolded
|
|
2095
|
+
? `${childrenWrapperEl.scrollHeight}px`
|
|
2096
|
+
: '';
|
|
2097
|
+
}
|
|
2098
|
+
}, [isUnfolded]);
|
|
2099
|
+
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 }) }));
|
|
2100
|
+
});
|
|
2101
|
+
|
|
2102
|
+
const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
|
|
2103
|
+
const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
|
|
2104
|
+
if ([textItems.length, children, subText].every((_) => !_)) {
|
|
2105
|
+
return null;
|
|
2106
|
+
}
|
|
2107
|
+
return renderCardCell({ textItems, subText, children, isPhone, ...props });
|
|
2108
|
+
});
|
|
2109
|
+
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] }));
|
|
2110
|
+
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))));
|
|
2111
|
+
const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
|
|
2112
|
+
|
|
2113
|
+
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 })));
|
|
2114
|
+
|
|
2115
|
+
const getScheduleDescription = (workScheduleWeek) => {
|
|
2116
|
+
const rows = getDateDescription(workScheduleWeek);
|
|
2117
|
+
return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
|
|
2118
2118
|
};
|
|
2119
|
-
const
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
while (date.getMonth() === selectedMonth) {
|
|
2123
|
-
maxDateOfMonth++;
|
|
2124
|
-
date.setDate(date.getDate() + 1);
|
|
2119
|
+
const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
|
|
2120
|
+
if (!workTime) {
|
|
2121
|
+
return '';
|
|
2125
2122
|
}
|
|
2126
|
-
return
|
|
2123
|
+
return [
|
|
2124
|
+
`${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
|
|
2125
|
+
lunchHour ? `перерыв: ${lunchHour}` : '',
|
|
2126
|
+
daysOff ? `не работает: ${daysOff}` : '',
|
|
2127
|
+
]
|
|
2128
|
+
.filter(Boolean)
|
|
2129
|
+
.join('; ');
|
|
2127
2130
|
};
|
|
2128
|
-
const
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
+
const getDateDescription = (workScheduleWeek) => {
|
|
2132
|
+
const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
2133
|
+
const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
|
|
2134
|
+
const daysOff = workScheduleWeek
|
|
2135
|
+
.filter((_) => !_.status)
|
|
2136
|
+
.map((_) => _.short?.toLowerCase())
|
|
2137
|
+
.join(', ');
|
|
2138
|
+
const rows = [
|
|
2139
|
+
buildScheduleText({
|
|
2140
|
+
workTime: workingWeekday?.workTime,
|
|
2141
|
+
lunchHour: workingWeekday?.lunchHour,
|
|
2142
|
+
daysOff: workingSaturday ? '' : daysOff,
|
|
2143
|
+
}),
|
|
2144
|
+
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
2145
|
+
].filter(Boolean);
|
|
2146
|
+
return rows;
|
|
2131
2147
|
};
|
|
2132
2148
|
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2149
|
+
const WEEKDAY_MAP = [
|
|
2150
|
+
['workingMonday', 'Пн', 'Понедельник'],
|
|
2151
|
+
['workingTuesday', 'Вт', 'Вторник'],
|
|
2152
|
+
['workingWednesday', 'Ср', 'Среда'],
|
|
2153
|
+
['workingThursday', 'Чт', 'Четверг'],
|
|
2154
|
+
['workingFriday', 'Пт', 'Пятница'],
|
|
2155
|
+
['workingSaturday', 'Сб', 'Суббота'],
|
|
2156
|
+
['workingSunday', 'Вс', 'Воскресенье'],
|
|
2157
|
+
];
|
|
2158
|
+
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
2159
|
+
key,
|
|
2160
|
+
title,
|
|
2161
|
+
short,
|
|
2162
|
+
status: Boolean(workSchedule?.[key]),
|
|
2163
|
+
get workTime() {
|
|
2164
|
+
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
2165
|
+
},
|
|
2166
|
+
get lunchHour() {
|
|
2167
|
+
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
2168
|
+
},
|
|
2169
|
+
get hasLunch() {
|
|
2170
|
+
return /\d+/.test(this.lunchHour ?? '');
|
|
2171
|
+
},
|
|
2172
|
+
}));
|
|
2173
|
+
|
|
2174
|
+
const renderBusinessSchedule = (scheduleDescription) => {
|
|
2175
|
+
if (!scheduleDescription) {
|
|
2176
|
+
return null;
|
|
2177
|
+
}
|
|
2178
|
+
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
2179
|
+
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 }) })] }));
|
|
2138
2180
|
};
|
|
2139
|
-
const
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2181
|
+
const getBusinessSchedule = (scheduleDescription) => {
|
|
2182
|
+
const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
|
|
2183
|
+
const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
|
|
2184
|
+
const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
|
|
2185
|
+
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
2186
|
+
return weekDayMap;
|
|
2187
|
+
}
|
|
2188
|
+
return weekDayMap.map((_) => ({
|
|
2189
|
+
..._,
|
|
2190
|
+
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
2191
|
+
}));
|
|
2143
2192
|
};
|
|
2144
|
-
const
|
|
2145
|
-
// eslint-disable-next-line max-lines-per-function
|
|
2146
|
-
({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
|
|
2147
|
-
const [showCalendar, { setValue }] = useBool(false);
|
|
2148
|
-
const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
|
|
2149
|
-
const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
|
|
2150
|
-
const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
|
|
2151
|
-
onYearSelect: setSelectedYear,
|
|
2152
|
-
onMonthSelect: setSelectedMonth,
|
|
2153
|
-
onShowCalendar: setValue,
|
|
2154
|
-
selectedYear,
|
|
2155
|
-
selectedMonth,
|
|
2156
|
-
showCalendar,
|
|
2157
|
-
onChange,
|
|
2158
|
-
value,
|
|
2159
|
-
});
|
|
2160
|
-
const spaceAbove = useElementSpace(ref, 370);
|
|
2161
|
-
return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
|
|
2162
|
-
handleChangeVisibleCalendar,
|
|
2163
|
-
value,
|
|
2164
|
-
valid,
|
|
2165
|
-
onChange,
|
|
2166
|
-
disabled,
|
|
2167
|
-
setSelectedMonth,
|
|
2168
|
-
setSelectedYear,
|
|
2169
|
-
}), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
|
|
2170
|
-
'bottom-full': spaceAbove,
|
|
2171
|
-
}), 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] })] }));
|
|
2172
|
-
});
|
|
2193
|
+
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)));
|
|
2173
2194
|
|
|
2174
|
-
const
|
|
2195
|
+
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)));
|
|
2175
2196
|
|
|
2176
|
-
const
|
|
2197
|
+
const colorStyle = {
|
|
2198
|
+
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
2199
|
+
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
2200
|
+
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
2201
|
+
red: { border: 'border-error/30', text: 'text-error' },
|
|
2202
|
+
};
|
|
2203
|
+
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 })] })));
|
|
2177
2204
|
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$8), validatorObj.birthday, input?.required), error: isRetailForm && value && !birthdayValidate(value) ? AGE_ERROR_MESSAGE : '', disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) }));
|
|
2185
|
-
});
|
|
2186
|
-
const birthdayValidate = (date) => {
|
|
2187
|
-
const today = new Date();
|
|
2188
|
-
const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
|
|
2189
|
-
const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
|
|
2190
|
-
if (!date || date > minDate || date < maxDate) {
|
|
2191
|
-
return false;
|
|
2205
|
+
const currentWeekDayIdx = new Date().getDay();
|
|
2206
|
+
//TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
|
|
2207
|
+
const renderCurrentDaySchedule = (workScheduleWeek) => {
|
|
2208
|
+
const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
|
|
2209
|
+
if (!currentWeekDay) {
|
|
2210
|
+
return null;
|
|
2192
2211
|
}
|
|
2193
|
-
|
|
2212
|
+
const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
|
|
2213
|
+
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" }));
|
|
2194
2214
|
};
|
|
2195
2215
|
|
|
2196
|
-
const
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
});
|
|
2203
|
-
|
|
2204
|
-
const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
|
|
2205
|
-
|
|
2206
|
-
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 })));
|
|
2207
|
-
|
|
2208
|
-
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", type: "number", ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
2216
|
+
const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
|
|
2217
|
+
if (!status) {
|
|
2218
|
+
return 'Не работает';
|
|
2219
|
+
}
|
|
2220
|
+
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
2221
|
+
};
|
|
2222
|
+
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)));
|
|
2209
2223
|
|
|
2210
|
-
const
|
|
2224
|
+
const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
2225
|
+
const labels = ['Подробнее', 'Скрыть'];
|
|
2226
|
+
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" })] }));
|
|
2211
2227
|
|
|
2212
|
-
const
|
|
2213
|
-
const
|
|
2214
|
-
|
|
2215
|
-
|
|
2228
|
+
const renderWorkSchedule = (workSchedule) => {
|
|
2229
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2230
|
+
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
2231
|
+
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
2232
|
+
if (!workSchedule) {
|
|
2233
|
+
return '';
|
|
2234
|
+
}
|
|
2235
|
+
if (!workSchedule.businessScheduleVisibleTag) {
|
|
2236
|
+
return renderMatchingTimeOfWork(timeOfWork);
|
|
2237
|
+
}
|
|
2238
|
+
if (workSchedule.businessScheduleVisibleTag &&
|
|
2239
|
+
workSchedule.businessScheduleDescription === null) {
|
|
2240
|
+
return renderIndividualTimeOfWork(timeOfWork);
|
|
2241
|
+
}
|
|
2242
|
+
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
2243
|
+
};
|
|
2244
|
+
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
2245
|
+
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
2246
|
+
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
2216
2247
|
|
|
2217
|
-
const
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
},
|
|
2246
|
-
};
|
|
2247
|
-
|
|
2248
|
-
async function doRequest(url, method, body) {
|
|
2249
|
-
const response = await fetch(`${API_BASE_URI}${url}`, {
|
|
2250
|
-
method,
|
|
2251
|
-
headers: {
|
|
2252
|
-
'Content-Type': 'application/json',
|
|
2253
|
-
...getAuthorizationHeaders(),
|
|
2254
|
-
},
|
|
2255
|
-
credentials: 'include',
|
|
2256
|
-
body: body ? JSON.stringify(body) : null,
|
|
2257
|
-
});
|
|
2258
|
-
// TODO: add error handling
|
|
2259
|
-
return isJSON(response) ? response.json() : response;
|
|
2260
|
-
}
|
|
2261
|
-
// TODO: Need delete isJSON
|
|
2262
|
-
const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
|
|
2263
|
-
const getAuthorizationHeaders = () => {
|
|
2264
|
-
const token = sessionStorage.getItem('accessToken');
|
|
2265
|
-
return token ? { Authorization: `Bearer ${token}` } : null;
|
|
2248
|
+
const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
|
|
2249
|
+
if (!workSchedule) {
|
|
2250
|
+
return null;
|
|
2251
|
+
}
|
|
2252
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2253
|
+
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({
|
|
2254
|
+
phone,
|
|
2255
|
+
fax,
|
|
2256
|
+
phoneBusiness,
|
|
2257
|
+
phoneNatural,
|
|
2258
|
+
phoneCallCentre,
|
|
2259
|
+
phoneCurrencyControl,
|
|
2260
|
+
workSchedule,
|
|
2261
|
+
exchangeRate,
|
|
2262
|
+
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
2263
|
+
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
2264
|
+
phone,
|
|
2265
|
+
fax,
|
|
2266
|
+
phoneBusiness,
|
|
2267
|
+
phoneNatural,
|
|
2268
|
+
phoneCallCentre,
|
|
2269
|
+
phoneCurrencyControl,
|
|
2270
|
+
workSchedule,
|
|
2271
|
+
exchangeRate,
|
|
2272
|
+
}) }));
|
|
2273
|
+
},
|
|
2274
|
+
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
2275
|
+
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
2266
2276
|
};
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2277
|
+
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
2278
|
+
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2279
|
+
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
2280
|
+
? 'Для физических лиц'
|
|
2281
|
+
: 'Для физических и юридических лиц';
|
|
2282
|
+
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
|
|
2283
|
+
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
2284
|
+
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
2271
2285
|
};
|
|
2272
|
-
|
|
2273
|
-
const
|
|
2274
|
-
const
|
|
2275
|
-
|
|
2286
|
+
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
2287
|
+
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
2288
|
+
const header = capitalizedFirstLetter$1(name);
|
|
2289
|
+
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
2290
|
+
return { header, body };
|
|
2276
2291
|
};
|
|
2277
2292
|
|
|
2278
|
-
const
|
|
2293
|
+
const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
|
|
2279
2294
|
|
|
2280
|
-
const
|
|
2281
|
-
|
|
2282
|
-
const handleClose = useCallback(() => {
|
|
2283
|
-
close();
|
|
2284
|
-
onClose && onClose();
|
|
2285
|
-
}, [onClose]);
|
|
2286
|
-
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
2287
|
-
});
|
|
2295
|
+
const isClient = !isSSR();
|
|
2296
|
+
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
2288
2297
|
|
|
2289
|
-
const
|
|
2290
|
-
|
|
2291
|
-
|
|
2298
|
+
const INITIAL_FILTRATION_STATE$1 = {
|
|
2299
|
+
workingSaturday: false,
|
|
2300
|
+
premiumService: false,
|
|
2301
|
+
privateBanking: false,
|
|
2302
|
+
remoteWorkplace: false,
|
|
2303
|
+
serviceDisabledPeople: false,
|
|
2304
|
+
sellingCoins: false,
|
|
2305
|
+
buyingCoins: false,
|
|
2306
|
+
bullionOperations: false,
|
|
2307
|
+
preciousMetalsOperations: false,
|
|
2308
|
+
transferringDataToBiometricSystem: false,
|
|
2292
2309
|
};
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2310
|
+
const FILTRATION_LABELS = {
|
|
2311
|
+
safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
|
|
2312
|
+
workingSaturday: 'Открыты по субботам',
|
|
2313
|
+
terminalTypeAtms: 'Банкоматы',
|
|
2314
|
+
terminalTypeTerm: 'Терминалы',
|
|
2315
|
+
workAllTime: 'Круглосуточно',
|
|
2316
|
+
billAcceptorEnable: 'Прием наличных',
|
|
2317
|
+
premiumService: 'Премиальное обслуживание',
|
|
2318
|
+
privateBanking: 'Услуга Private banking',
|
|
2319
|
+
sellingCoins: 'Продажа монет из драгоценных металлов',
|
|
2320
|
+
buyingCoins: 'Покупка монет из драгоценных металлов',
|
|
2321
|
+
bullionOperations: 'Операции со слитками',
|
|
2322
|
+
preciousMetalsOperations: 'Операции с драгоценными металлами',
|
|
2323
|
+
transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
|
|
2324
|
+
locationDisabledPeople: 'Для маломобильных',
|
|
2325
|
+
designDisabledPeople: 'Для слабовидящих',
|
|
2326
|
+
remoteWorkplace: 'Удаленное рабочее место',
|
|
2327
|
+
serviceDisabledPeople: 'Для маломобильных граждан',
|
|
2328
|
+
};
|
|
2329
|
+
const FILTRATION_PREDICATES$1 = {
|
|
2330
|
+
workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
|
|
2331
|
+
premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
|
|
2332
|
+
privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
|
|
2333
|
+
remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
|
|
2334
|
+
serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
|
|
2335
|
+
sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
|
|
2336
|
+
buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
|
|
2337
|
+
bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
|
|
2338
|
+
preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
|
|
2339
|
+
transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
|
|
2314
2340
|
};
|
|
2315
|
-
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)))) })] })));
|
|
2316
2341
|
|
|
2317
|
-
|
|
2342
|
+
function useButton() {
|
|
2343
|
+
return (props) => ({
|
|
2344
|
+
...props,
|
|
2345
|
+
onClick: handlerDecorator(handleClick(props)),
|
|
2346
|
+
});
|
|
2347
|
+
}
|
|
2348
|
+
function handleClick({ disabled, onClick }) {
|
|
2349
|
+
return (ev) => {
|
|
2350
|
+
!disabled && onClick && onClick(ev);
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2318
2353
|
|
|
2319
|
-
const
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2354
|
+
const buttonStyleMap = {
|
|
2355
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
2356
|
+
secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
|
|
2357
|
+
};
|
|
2358
|
+
const secondaryButtonStyleMap = {
|
|
2359
|
+
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'),
|
|
2360
|
+
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'),
|
|
2361
|
+
};
|
|
2362
|
+
const Button = JSX(({ children, ...props }) => {
|
|
2363
|
+
const button = useButton();
|
|
2364
|
+
const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
2365
|
+
return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
|
|
2366
|
+
'text-white bg-primary-active': active,
|
|
2367
|
+
'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
|
|
2368
|
+
'rounded-md': rounded,
|
|
2369
|
+
}, !active && !disabled
|
|
2370
|
+
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
2371
|
+
: '', className), type: type, role: role, onClick: onClick, children: children }));
|
|
2323
2372
|
});
|
|
2324
2373
|
|
|
2325
|
-
const
|
|
2326
|
-
|
|
2327
|
-
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", type: "number", maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
|
|
2374
|
+
const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
|
|
2328
2375
|
|
|
2329
|
-
const
|
|
2376
|
+
const renderButtonsGroup = (data, activeButton, onButtonClick) => {
|
|
2377
|
+
const allButtonVersion = getVersion(activeButton === 'all');
|
|
2378
|
+
const businessButtonVersion = getVersion(activeButton === 'business');
|
|
2379
|
+
const handleClick = (e, key, branches) => {
|
|
2380
|
+
const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
|
|
2381
|
+
onButtonClick(key);
|
|
2382
|
+
return filteredBranches;
|
|
2383
|
+
};
|
|
2384
|
+
const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
|
|
2385
|
+
branch.workSchedule.businessScheduleVisibleTag &&
|
|
2386
|
+
!branch.workSchedule.businessScheduleDescription);
|
|
2387
|
+
return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
|
|
2388
|
+
};
|
|
2330
2389
|
|
|
2331
|
-
const
|
|
2390
|
+
const renderDescriptionBlock$1 = ({ __html, list, richVersion }) => __html || list?.length ? (jsxs("div", { className: "mb-2xl border-b sm:border border-main-divider sm:rounded-md", children: [__html ? (jsx("div", { className: "mb-2xl", children: jsx(RichText, { __html: __html, richVersion: richVersion }) })) : null, list?.length ? (jsx("div", { className: "flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl", children: list.map((item, i) => (jsxs("div", { className: "flex gap-xs items-center", children: [item?.image ? jsx(Img, { image: item.image }) : null, item?.text ? (jsx(Text, { size: "text-m", font: "font-light", children: item.text })) : null] }, String(i)))) })) : null] })) : null;
|
|
2332
2391
|
|
|
2333
|
-
const
|
|
2334
|
-
const
|
|
2392
|
+
const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
|
|
2393
|
+
const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
|
|
2394
|
+
const visibleFiltersNum = onlyOffice ? 5 : 6;
|
|
2395
|
+
const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
|
|
2396
|
+
const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
|
|
2397
|
+
? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
|
|
2398
|
+
: [filtersCheckbox, []];
|
|
2399
|
+
return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
|
|
2400
|
+
};
|
|
2401
|
+
const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
|
|
2402
|
+
const labels = ['Больше фильтров', 'Меньше фильтров'];
|
|
2403
|
+
const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
2404
|
+
return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
|
|
2405
|
+
};
|
|
2406
|
+
const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
|
|
2335
2407
|
|
|
2336
|
-
const
|
|
2337
|
-
const DulIssuedByField = JSX(({ field, input }) => {
|
|
2338
|
-
const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
|
|
2339
|
-
const onDaDataChange = useCallback((item) => {
|
|
2340
|
-
changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
|
|
2341
|
-
}, []);
|
|
2342
|
-
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
|
|
2343
|
-
});
|
|
2408
|
+
const renderHeading = (title, lengthItems) => (jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }));
|
|
2344
2409
|
|
|
2345
|
-
const
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2410
|
+
const defaultEmptyFunction$1 = () => void 0;
|
|
2411
|
+
const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
|
|
2412
|
+
const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
|
|
2413
|
+
const onlyOffice = title?.includes('Офис');
|
|
2414
|
+
const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
|
|
2415
|
+
const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
|
|
2416
|
+
data,
|
|
2417
|
+
remoteWorkplaces,
|
|
2418
|
+
filtrationState,
|
|
2419
|
+
getBalloon,
|
|
2420
|
+
getBalloonRemoteWorkplaces,
|
|
2421
|
+
});
|
|
2422
|
+
const [activeButton, setActiveButton] = useState('all');
|
|
2423
|
+
const filterOptions = {
|
|
2424
|
+
filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
|
|
2425
|
+
field: { field, reset },
|
|
2426
|
+
onlyOffice,
|
|
2427
|
+
labels: FILTRATION_LABELS,
|
|
2428
|
+
};
|
|
2429
|
+
return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
|
|
2362
2430
|
});
|
|
2431
|
+
const filterItems$1 = (data, filtrationState) => {
|
|
2432
|
+
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
2433
|
+
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
2434
|
+
};
|
|
2435
|
+
const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
|
|
2363
2436
|
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2437
|
+
const defaultEmptyFunction = () => void 0;
|
|
2438
|
+
const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
|
|
2439
|
+
const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
|
|
2440
|
+
const _filteredItems = filterItems$1(data, filtrationState);
|
|
2441
|
+
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
2442
|
+
const _points = [
|
|
2443
|
+
..._filteredItems.map((_) => ({
|
|
2444
|
+
type: 'offices',
|
|
2445
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2446
|
+
content: getBalloon(_),
|
|
2447
|
+
})),
|
|
2448
|
+
..._filteredRemoteWorkplaces.map((_) => ({
|
|
2449
|
+
type: 'workplaces',
|
|
2450
|
+
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
2451
|
+
content: getBalloonRemoteWorkplaces({
|
|
2452
|
+
address: _.address,
|
|
2453
|
+
workScheduleDescription: _.workScheduleDescription,
|
|
2454
|
+
}),
|
|
2455
|
+
})),
|
|
2456
|
+
].filter((_) => _.coords && _.coords.length === 2);
|
|
2457
|
+
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
2458
|
+
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
2459
|
+
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
2460
|
+
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
2461
|
+
};
|
|
2368
2462
|
|
|
2369
|
-
const
|
|
2370
|
-
const { data
|
|
2371
|
-
|
|
2372
|
-
|
|
2463
|
+
const useLeadFormData = (typeField) => {
|
|
2464
|
+
const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
2465
|
+
if (data && 'errorMessage' in data) {
|
|
2466
|
+
return { error };
|
|
2467
|
+
}
|
|
2468
|
+
return { data: data, error };
|
|
2469
|
+
};
|
|
2470
|
+
const fetchData = async (url) => {
|
|
2471
|
+
const result = await fetchJSON(url, { method: 'POST' });
|
|
2472
|
+
return result || [];
|
|
2473
|
+
};
|
|
2373
2474
|
|
|
2374
|
-
const
|
|
2375
|
-
const
|
|
2376
|
-
|
|
2475
|
+
const AddressRetailField = JSX(({ field, input }) => {
|
|
2476
|
+
const [offices, setOffices] = useState([]);
|
|
2477
|
+
const { data } = useLeadFormData('REGION_RF');
|
|
2478
|
+
const regionValue = field('regionRetail')?.value || {};
|
|
2479
|
+
const fieldBranch = field('addressRetail');
|
|
2480
|
+
useEffect(() => {
|
|
2481
|
+
(async () => {
|
|
2482
|
+
const officesList = await regionOffices(regionValue?.key ?? '');
|
|
2483
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
2484
|
+
setOffices(officesList || []);
|
|
2485
|
+
})();
|
|
2486
|
+
if (regionValue?.key) {
|
|
2487
|
+
field?.('addressRetail')?.onChange?.('');
|
|
2488
|
+
}
|
|
2489
|
+
}, [regionValue.key]);
|
|
2490
|
+
const { points } = useOfficesAtmsMapData({
|
|
2491
|
+
data: offices,
|
|
2492
|
+
filtrationState: {},
|
|
2493
|
+
getBalloon: getOfficePoint,
|
|
2494
|
+
});
|
|
2495
|
+
const isRegionSelected = Boolean(regionValue?.key);
|
|
2496
|
+
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 = '' }) => ({
|
|
2497
|
+
key: id?.toString() || '',
|
|
2498
|
+
text: address,
|
|
2499
|
+
})), ...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 }) }) })] }));
|
|
2377
2500
|
});
|
|
2378
2501
|
|
|
2379
|
-
const
|
|
2380
|
-
const {
|
|
2381
|
-
|
|
2382
|
-
|
|
2502
|
+
const useNormalizedInput = (props, { normalize, format }) => {
|
|
2503
|
+
const { value, onFocus, onBlur, onChange } = props;
|
|
2504
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
2505
|
+
const handleFocus = useCallback((ev) => {
|
|
2506
|
+
setIsFocused(true);
|
|
2507
|
+
onFocus && onFocus(ev);
|
|
2508
|
+
}, []);
|
|
2509
|
+
const handleBlur = useCallback(() => {
|
|
2510
|
+
setIsFocused(false);
|
|
2511
|
+
onChange && onChange(normalize(value));
|
|
2512
|
+
onBlur && onBlur();
|
|
2513
|
+
}, [onChange, value]);
|
|
2514
|
+
return {
|
|
2515
|
+
value: (isFocused || !format ? value : format(value)),
|
|
2516
|
+
onFocus: handleFocus,
|
|
2517
|
+
onBlur: handleBlur,
|
|
2518
|
+
};
|
|
2519
|
+
};
|
|
2383
2520
|
|
|
2384
|
-
const
|
|
2521
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
2385
2522
|
|
|
2386
|
-
|
|
2523
|
+
function parseDecimal(value) {
|
|
2524
|
+
const rawValue = (value || '').replace(/\D/g, '');
|
|
2525
|
+
const unsafeDecimal = parseInt(rawValue, 10);
|
|
2526
|
+
return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
|
|
2527
|
+
}
|
|
2387
2528
|
|
|
2388
|
-
|
|
2389
|
-
const
|
|
2390
|
-
const
|
|
2391
|
-
const
|
|
2392
|
-
const
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2529
|
+
function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
|
|
2530
|
+
const rangeValue = list.length ? list.indexOf(value) : value;
|
|
2531
|
+
const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
|
|
2532
|
+
const percentage = (rangeValueShift * 100) / (max - min);
|
|
2533
|
+
const inputStyle = {
|
|
2534
|
+
backgroundSize: `${percentage.toFixed(2)}% 100%`,
|
|
2535
|
+
};
|
|
2536
|
+
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) => {
|
|
2537
|
+
const rawValue = parseDecimal(ev.target?.value);
|
|
2538
|
+
const newValue = list.length ? list[rawValue] : rawValue;
|
|
2539
|
+
onChange && onChange(newValue || 0);
|
|
2540
|
+
}) }) })] }));
|
|
2541
|
+
}
|
|
2400
2542
|
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2403
|
-
|
|
2543
|
+
const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
|
|
2544
|
+
const DEFAULT_MIN = 1;
|
|
2545
|
+
const DEFAULT_MAX = 100;
|
|
2546
|
+
const InputRange = JSX((props) => {
|
|
2547
|
+
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;
|
|
2548
|
+
const normalizedProps = useNormalizedInput(props, {
|
|
2549
|
+
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
2550
|
+
format: toLocalNumberFormat(),
|
|
2551
|
+
});
|
|
2552
|
+
const handleChange = useCallback((ev) => {
|
|
2553
|
+
onChange && onChange(parseDecimal(ev.target?.value));
|
|
2554
|
+
}, [onChange]);
|
|
2555
|
+
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)] }));
|
|
2404
2556
|
});
|
|
2557
|
+
const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
|
|
2558
|
+
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)))) }));
|
|
2405
2559
|
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
const SERVICE_DIRECTIONS = [
|
|
2411
|
-
{ key: 'Физическое лицо' },
|
|
2412
|
-
{ key: 'Юридическое лицо / ИП' },
|
|
2413
|
-
];
|
|
2414
|
-
const FEEDBACK_METHOD = [
|
|
2415
|
-
{ key: 'phone', text: 'Телефонный звонок' },
|
|
2416
|
-
{ key: 'email', text: 'Электронное сообщение' },
|
|
2417
|
-
];
|
|
2418
|
-
|
|
2419
|
-
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) })));
|
|
2420
|
-
|
|
2421
|
-
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
2422
|
-
|
|
2423
|
-
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 })));
|
|
2560
|
+
const MIN_CREDIT_AMOUNT = 1000;
|
|
2561
|
+
const MAX_CREDIT_AMOUNT = 1000000000;
|
|
2562
|
+
const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
|
|
2563
|
+
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') })));
|
|
2424
2564
|
|
|
2425
|
-
const
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2565
|
+
const SelectField = UniBlock(({ field, source, label, fieldName, input, placeholder = 'Выберите из списка', isSearch = false, }) => {
|
|
2566
|
+
const leadOptions = (source &&
|
|
2567
|
+
source?.map((_) => ({
|
|
2568
|
+
key: _.key || '',
|
|
2569
|
+
text: _.value,
|
|
2570
|
+
}))) ||
|
|
2571
|
+
[];
|
|
2572
|
+
return (jsx(SelectControl, { placeholder: placeholder, label: label, options: leadOptions, isSearch: isSearch, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
|
|
2428
2573
|
});
|
|
2429
2574
|
|
|
2430
|
-
const
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2433
|
-
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
2434
|
-
}, []);
|
|
2435
|
-
return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
|
|
2575
|
+
const AmountWorkersField = JSX(({ field, input }) => {
|
|
2576
|
+
const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
|
|
2577
|
+
return (jsx(SelectField, { field: field, source: 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 }));
|
|
2436
2578
|
});
|
|
2437
2579
|
|
|
2438
|
-
const
|
|
2439
|
-
|
|
2440
|
-
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", type: "number", maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
|
|
2580
|
+
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) })));
|
|
2441
2581
|
|
|
2442
|
-
const
|
|
2582
|
+
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) })));
|
|
2443
2583
|
|
|
2444
|
-
const
|
|
2445
|
-
return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...input, ...getValidation(field('legalEntityName'), validatorObj.legalEntityName, input?.required) }));
|
|
2446
|
-
});
|
|
2584
|
+
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", type: "number", ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
|
|
2447
2585
|
|
|
2448
|
-
const
|
|
2586
|
+
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') })));
|
|
2449
2587
|
|
|
2450
|
-
const
|
|
2451
|
-
const EMPTY_REGIONS = [];
|
|
2452
|
-
async function getOutServiceRegions() {
|
|
2453
|
-
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
2454
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
2455
|
-
}
|
|
2588
|
+
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) })));
|
|
2456
2589
|
|
|
2457
|
-
const
|
|
2458
|
-
const
|
|
2459
|
-
const regionKey = fieldRegion?.value?.key;
|
|
2460
|
-
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
2461
|
-
const localities = regions
|
|
2462
|
-
?.find((_) => _.code === regionKey)
|
|
2463
|
-
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
2590
|
+
const useElementSpace = (ref, heightEl) => {
|
|
2591
|
+
const [spaceAbove, setSpaceAbove] = useState(false);
|
|
2464
2592
|
useEffect(() => {
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
|
|
2479
|
-
|
|
2480
|
-
const FIELD_NAME$1 = 'middleName';
|
|
2481
|
-
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$1), ...getValidation(field(FIELD_NAME$1), validatorObj.middleName, input?.required), ...input })));
|
|
2482
|
-
|
|
2483
|
-
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 })));
|
|
2484
|
-
|
|
2485
|
-
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] })));
|
|
2486
|
-
|
|
2487
|
-
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);
|
|
2593
|
+
const handleResize = () => {
|
|
2594
|
+
if (ref?.current) {
|
|
2595
|
+
const { top } = ref.current.getBoundingClientRect();
|
|
2596
|
+
const hasSpaceAbove = top > heightEl;
|
|
2597
|
+
setSpaceAbove(hasSpaceAbove);
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
handleResize();
|
|
2601
|
+
window.addEventListener('resize', handleResize);
|
|
2602
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
2603
|
+
}, [ref]);
|
|
2604
|
+
return spaceAbove;
|
|
2605
|
+
};
|
|
2488
2606
|
|
|
2489
|
-
const
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2607
|
+
const DAY_COUNT = 6;
|
|
2608
|
+
const WEEK_COUNT = 7;
|
|
2609
|
+
const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
|
|
2610
|
+
const calendarCells = [];
|
|
2611
|
+
let dayCounter = 1;
|
|
2612
|
+
for (let i = 0; i < DAY_COUNT; i++) {
|
|
2613
|
+
const rowCells = [];
|
|
2614
|
+
for (let j = 0; j < WEEK_COUNT; j++) {
|
|
2615
|
+
if (i === 0 && j < firstDayOfWeek) {
|
|
2616
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
2617
|
+
}
|
|
2618
|
+
else if (dayCounter > totalDays) {
|
|
2619
|
+
rowCells.push(jsx("td", {}, `empty-${j}`));
|
|
2620
|
+
}
|
|
2621
|
+
else {
|
|
2622
|
+
const currentDate = new Date(currentYear, currentMonth, dayCounter);
|
|
2623
|
+
const isToday = checkIsToday(currentDate, today);
|
|
2624
|
+
const isDisabled = checkIsDisabled(currentDate, min, max);
|
|
2625
|
+
rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
|
|
2626
|
+
dayCounter++;
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
|
|
2630
|
+
}
|
|
2631
|
+
return calendarCells;
|
|
2632
|
+
};
|
|
2633
|
+
const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
|
|
2634
|
+
const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
|
|
2635
|
+
const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
|
|
2636
|
+
'border-transparent hover:bg-gray': !isToday,
|
|
2637
|
+
}, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
|
|
2493
2638
|
|
|
2494
|
-
const
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2639
|
+
const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
|
|
2640
|
+
const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
|
|
2641
|
+
const handleDateClick = useCallback((date) => {
|
|
2642
|
+
onDateSelect(date);
|
|
2643
|
+
setValue(false);
|
|
2498
2644
|
}, []);
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
};
|
|
2514
|
-
const handleChange = (value) => partInBusinessField?.onChange &&
|
|
2515
|
-
partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
|
|
2516
|
-
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 %", type: "number", maxLength: 3, ...partInBusinessField, ...input, onChange: handleChange, value: isBusinessOwner ? partInBusinessField?.value : '', disabled: !isBusinessOwner }));
|
|
2517
|
-
});
|
|
2518
|
-
|
|
2519
|
-
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
2520
|
-
const { required, ...rest } = input;
|
|
2521
|
-
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 }));
|
|
2645
|
+
const { firstDayOfWeek, totalDays } = useMemo(() => ({
|
|
2646
|
+
firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
|
|
2647
|
+
totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
|
|
2648
|
+
}), [currentYear, currentMonth]);
|
|
2649
|
+
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({
|
|
2650
|
+
firstDayOfWeek,
|
|
2651
|
+
today,
|
|
2652
|
+
totalDays,
|
|
2653
|
+
currentYear,
|
|
2654
|
+
currentMonth,
|
|
2655
|
+
min,
|
|
2656
|
+
max,
|
|
2657
|
+
onDateClick: handleDateClick,
|
|
2658
|
+
}) })] }));
|
|
2522
2659
|
});
|
|
2523
2660
|
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2526
|
-
|
|
2661
|
+
const months = [
|
|
2662
|
+
'Январь',
|
|
2663
|
+
'Февраль',
|
|
2664
|
+
'Март',
|
|
2665
|
+
'Апрель',
|
|
2666
|
+
'Май',
|
|
2667
|
+
'Июнь',
|
|
2668
|
+
'Июль',
|
|
2669
|
+
'Август',
|
|
2670
|
+
'Сентябрь',
|
|
2671
|
+
'Октябрь',
|
|
2672
|
+
'Ноябрь',
|
|
2673
|
+
'Декабрь',
|
|
2527
2674
|
];
|
|
2528
|
-
const PaymentSystemField = JSX(({ field, input }) => {
|
|
2529
|
-
const { value, onChange } = field('paymentSystem');
|
|
2530
|
-
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
|
|
2531
|
-
});
|
|
2532
|
-
|
|
2533
|
-
const isPlaceholder = (_) => _ === '_';
|
|
2534
|
-
const isDigit = (_) => /\d/.test(_);
|
|
2535
|
-
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
2536
|
-
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
2537
|
-
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
2538
|
-
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
2539
|
-
function normalizePhone(phone) {
|
|
2540
|
-
const phoneNumbers = phone.replace(/\D/g, '');
|
|
2541
|
-
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
2542
|
-
const result = phonePattern.map(applyPlaceholder);
|
|
2543
|
-
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
2544
|
-
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
2545
|
-
}
|
|
2546
|
-
|
|
2547
|
-
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
2548
|
-
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
2549
|
-
const handleBlur = useCallback((v) => {
|
|
2550
|
-
if (v === '+7 (') {
|
|
2551
|
-
onChange && onChange('');
|
|
2552
|
-
}
|
|
2553
|
-
}, []);
|
|
2554
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
2555
|
-
});
|
|
2556
|
-
|
|
2557
|
-
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)] })));
|
|
2558
|
-
|
|
2559
|
-
const PhoneField = JSX(({ field, input }) => {
|
|
2560
|
-
const fieldName = input?.name || 'phone';
|
|
2561
|
-
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 }));
|
|
2562
|
-
});
|
|
2563
|
-
|
|
2564
|
-
const PositionOrganizationField = JSX(({ field, input }) => {
|
|
2565
|
-
const { data: positionOrganization } = useLeadFormData('POSITION');
|
|
2566
|
-
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 }));
|
|
2567
|
-
});
|
|
2568
|
-
|
|
2569
|
-
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);
|
|
2570
|
-
|
|
2571
|
-
const ProductField = UniBlock(({ 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) })));
|
|
2572
|
-
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
2573
2675
|
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2676
|
+
function normalizeWithMask(value, pattern) {
|
|
2677
|
+
const valueNumbers = value.replace(/\D/g, '');
|
|
2678
|
+
if (valueNumbers === '' || value?.length === pattern.length) {
|
|
2679
|
+
return value;
|
|
2680
|
+
}
|
|
2681
|
+
const patternInArr = [...pattern];
|
|
2682
|
+
const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
|
|
2683
|
+
const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
|
|
2684
|
+
const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
|
|
2685
|
+
const resultInArr = patternInArr.map(applyPlaceholder);
|
|
2686
|
+
const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
|
|
2687
|
+
return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
|
|
2578
2688
|
}
|
|
2689
|
+
const isPlaceholder$1 = (_) => _ === '_';
|
|
2690
|
+
const isDigit$1 = (_) => /\d/.test(_);
|
|
2691
|
+
const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
|
|
2579
2692
|
|
|
2580
|
-
const
|
|
2581
|
-
|
|
2582
|
-
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) }));
|
|
2583
|
-
});
|
|
2584
|
-
|
|
2585
|
-
const RegionPremiumField = JSX(({ field, input }) => {
|
|
2586
|
-
const branchByRegions = useBranchesByRegions(true);
|
|
2587
|
-
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
2588
|
-
key: region,
|
|
2589
|
-
text: region,
|
|
2590
|
-
})), [branchByRegions]);
|
|
2591
|
-
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) }));
|
|
2592
|
-
});
|
|
2593
|
-
|
|
2594
|
-
const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
|
|
2595
|
-
const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
|
|
2596
|
-
const onToggle = useCallback(() => {
|
|
2597
|
-
setIsUnfolded((_) => !_);
|
|
2598
|
-
}, []);
|
|
2599
|
-
const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
|
|
2600
|
-
const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
|
|
2601
|
-
return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
|
|
2602
|
-
});
|
|
2693
|
+
const START_YEAR = 1940;
|
|
2694
|
+
const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
|
|
2603
2695
|
|
|
2604
|
-
|
|
2696
|
+
const ICON_PROPS$1 = {
|
|
2697
|
+
name: 'CalendarIcon',
|
|
2698
|
+
iconVersion: 'black',
|
|
2699
|
+
width: '24',
|
|
2700
|
+
height: '24',
|
|
2701
|
+
};
|
|
2702
|
+
const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
|
|
2605
2703
|
const ref = useRef(null);
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2704
|
+
const [inputValue, setInputValue] = useState(value || '');
|
|
2705
|
+
const handleChange = (ev) => {
|
|
2706
|
+
const val = ev.target?.value;
|
|
2707
|
+
if (typeof val === 'string' && val?.length < 11) {
|
|
2708
|
+
setInputValue(normalizeWithMask(val, '__.__.____'));
|
|
2610
2709
|
}
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
}, [callback, ...deps]);
|
|
2619
|
-
return ref;
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
|
|
2623
|
-
const containerRef = useRef(null);
|
|
2624
|
-
const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
|
|
2625
|
-
if (containerRef.current) {
|
|
2626
|
-
containerRef.current.style.maxHeight = isUnfolded
|
|
2627
|
-
? `${childrenWrapperEl.scrollHeight}px`
|
|
2628
|
-
: '';
|
|
2710
|
+
};
|
|
2711
|
+
const onBlur = () => {
|
|
2712
|
+
if (checkIsValidDate(inputValue)) {
|
|
2713
|
+
const [day, month, year] = inputValue.split('.');
|
|
2714
|
+
onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
|
|
2715
|
+
setSelectedMonth(Number(month) - 1);
|
|
2716
|
+
setSelectedYear(Number(year));
|
|
2629
2717
|
}
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2718
|
+
else {
|
|
2719
|
+
setInputValue(value || '');
|
|
2720
|
+
}
|
|
2721
|
+
};
|
|
2722
|
+
const onInputClick = () => {
|
|
2723
|
+
if (ref.current !== null) {
|
|
2724
|
+
ref.current.focus();
|
|
2725
|
+
}
|
|
2726
|
+
onClick?.();
|
|
2727
|
+
};
|
|
2728
|
+
useEffect(() => {
|
|
2729
|
+
setInputValue(value || '');
|
|
2730
|
+
}, [value]);
|
|
2731
|
+
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 })] }));
|
|
2640
2732
|
});
|
|
2641
|
-
const
|
|
2642
|
-
const
|
|
2643
|
-
const
|
|
2733
|
+
const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
|
|
2734
|
+
const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
|
|
2735
|
+
const checkIsValidDate = (date) => {
|
|
2736
|
+
const [day, month, year] = date.split('.');
|
|
2737
|
+
if (isValidYear(year)) {
|
|
2738
|
+
if (isValidMonth(month)) {
|
|
2739
|
+
const currentDate = new Date(Number(year), Number(month) - 1, 1);
|
|
2740
|
+
let maxDateOfMonth = 0;
|
|
2741
|
+
while (currentDate.getMonth() === Number(month) - 1) {
|
|
2742
|
+
currentDate.setDate(currentDate.getDate() + 1);
|
|
2743
|
+
maxDateOfMonth++;
|
|
2744
|
+
}
|
|
2745
|
+
if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
|
|
2746
|
+
return true;
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
return false;
|
|
2751
|
+
};
|
|
2644
2752
|
|
|
2645
|
-
const
|
|
2753
|
+
const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
|
|
2754
|
+
'hover:border-black active:border-black focus:border-black';
|
|
2755
|
+
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') }));
|
|
2646
2756
|
|
|
2647
|
-
const
|
|
2648
|
-
|
|
2649
|
-
|
|
2757
|
+
const MONTHS_COUNT = 11;
|
|
2758
|
+
const MONTHS_OPTIONS = months.map((key) => ({ key }));
|
|
2759
|
+
const YEARS_OPTIONS = getYears()
|
|
2760
|
+
.reverse()
|
|
2761
|
+
.map((key) => ({ key: String(key) }));
|
|
2762
|
+
const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
|
|
2763
|
+
const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
|
|
2764
|
+
const ref = useOutsideClick(close);
|
|
2765
|
+
const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
|
|
2766
|
+
const handleNextMonth = useCallback(() => {
|
|
2767
|
+
if (selectedMonth + 1 <= MONTHS_COUNT) {
|
|
2768
|
+
onMonthSelect(selectedMonth + 1);
|
|
2769
|
+
}
|
|
2770
|
+
else {
|
|
2771
|
+
onMonthSelect(0);
|
|
2772
|
+
onYearSelect(selectedYear + 1);
|
|
2773
|
+
}
|
|
2774
|
+
}, [selectedMonth]);
|
|
2775
|
+
const handlePrevMonth = useCallback(() => {
|
|
2776
|
+
if (selectedMonth - 1 >= 0) {
|
|
2777
|
+
onMonthSelect(selectedMonth - 1);
|
|
2778
|
+
}
|
|
2779
|
+
else {
|
|
2780
|
+
onMonthSelect(11);
|
|
2781
|
+
onYearSelect(selectedYear - 1);
|
|
2782
|
+
}
|
|
2783
|
+
}, [selectedMonth]);
|
|
2784
|
+
const handleSelectMonth = useCallback(({ key }) => {
|
|
2785
|
+
onMonthSelect(months.indexOf(key));
|
|
2786
|
+
const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
|
|
2787
|
+
handleChangeMonth({
|
|
2788
|
+
maxDateOfMonth,
|
|
2789
|
+
selectedYear,
|
|
2790
|
+
selectedMonth: months.indexOf(key),
|
|
2791
|
+
value,
|
|
2792
|
+
onChange,
|
|
2793
|
+
});
|
|
2794
|
+
}, [value]);
|
|
2795
|
+
const handleSelectYear = useCallback(({ key }) => {
|
|
2796
|
+
onYearSelect(Number(key));
|
|
2797
|
+
value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
|
|
2798
|
+
}, [value]);
|
|
2799
|
+
return {
|
|
2800
|
+
handleChangeVisibleCalendar,
|
|
2801
|
+
handleNextMonth,
|
|
2802
|
+
handlePrevMonth,
|
|
2803
|
+
handleSelectMonth,
|
|
2804
|
+
handleSelectYear,
|
|
2805
|
+
monthsOptions: MONTHS_OPTIONS,
|
|
2806
|
+
yearsOptions: YEARS_OPTIONS,
|
|
2807
|
+
ref,
|
|
2808
|
+
};
|
|
2650
2809
|
};
|
|
2651
|
-
const
|
|
2652
|
-
|
|
2653
|
-
|
|
2810
|
+
const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
|
|
2811
|
+
const date = new Date(selectedYear, selectedMonth, 1);
|
|
2812
|
+
let maxDateOfMonth = 0;
|
|
2813
|
+
while (date.getMonth() === selectedMonth) {
|
|
2814
|
+
maxDateOfMonth++;
|
|
2815
|
+
date.setDate(date.getDate() + 1);
|
|
2654
2816
|
}
|
|
2655
|
-
return
|
|
2656
|
-
`${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
|
|
2657
|
-
lunchHour ? `перерыв: ${lunchHour}` : '',
|
|
2658
|
-
daysOff ? `не работает: ${daysOff}` : '',
|
|
2659
|
-
]
|
|
2660
|
-
.filter(Boolean)
|
|
2661
|
-
.join('; ');
|
|
2817
|
+
return maxDateOfMonth;
|
|
2662
2818
|
};
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
const daysOff = workScheduleWeek
|
|
2667
|
-
.filter((_) => !_.status)
|
|
2668
|
-
.map((_) => _.short?.toLowerCase())
|
|
2669
|
-
.join(', ');
|
|
2670
|
-
const rows = [
|
|
2671
|
-
buildScheduleText({
|
|
2672
|
-
workTime: workingWeekday?.workTime,
|
|
2673
|
-
lunchHour: workingWeekday?.lunchHour,
|
|
2674
|
-
daysOff: workingSaturday ? '' : daysOff,
|
|
2675
|
-
}),
|
|
2676
|
-
buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
|
|
2677
|
-
].filter(Boolean);
|
|
2678
|
-
return rows;
|
|
2819
|
+
const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
|
|
2820
|
+
value &&
|
|
2821
|
+
onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
|
|
2679
2822
|
};
|
|
2680
2823
|
|
|
2681
|
-
const
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
['workingFriday', 'Пт', 'Пятница'],
|
|
2687
|
-
['workingSaturday', 'Сб', 'Суббота'],
|
|
2688
|
-
['workingSunday', 'Вс', 'Воскресенье'],
|
|
2689
|
-
];
|
|
2690
|
-
const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
|
|
2691
|
-
key,
|
|
2692
|
-
title,
|
|
2693
|
-
short,
|
|
2694
|
-
status: Boolean(workSchedule?.[key]),
|
|
2695
|
-
get workTime() {
|
|
2696
|
-
return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
|
|
2697
|
-
},
|
|
2698
|
-
get lunchHour() {
|
|
2699
|
-
return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
|
|
2700
|
-
},
|
|
2701
|
-
get hasLunch() {
|
|
2702
|
-
return /\d+/.test(this.lunchHour ?? '');
|
|
2703
|
-
},
|
|
2704
|
-
}));
|
|
2705
|
-
|
|
2706
|
-
const renderBusinessSchedule = (scheduleDescription) => {
|
|
2707
|
-
if (!scheduleDescription) {
|
|
2708
|
-
return null;
|
|
2709
|
-
}
|
|
2710
|
-
const businessSchedule = getBusinessSchedule(scheduleDescription);
|
|
2711
|
-
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 }) })] }));
|
|
2824
|
+
const ICON_PROPS = {
|
|
2825
|
+
name: 'ArrowUpIcon',
|
|
2826
|
+
iconVersion: 'black',
|
|
2827
|
+
width: '24',
|
|
2828
|
+
height: '24',
|
|
2712
2829
|
};
|
|
2713
|
-
const
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
if (!lastPartScheduleDescription?.includes('выходной')) {
|
|
2718
|
-
return weekDayMap;
|
|
2719
|
-
}
|
|
2720
|
-
return weekDayMap.map((_) => ({
|
|
2721
|
-
..._,
|
|
2722
|
-
status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
|
|
2723
|
-
}));
|
|
2830
|
+
const SELECT_PROPS = {
|
|
2831
|
+
className: 'min-w-32',
|
|
2832
|
+
iconVersion: 'black',
|
|
2833
|
+
isBorder: false,
|
|
2724
2834
|
};
|
|
2725
|
-
const
|
|
2835
|
+
const DatePicker = JSX(
|
|
2836
|
+
// eslint-disable-next-line max-lines-per-function
|
|
2837
|
+
({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
|
|
2838
|
+
const [showCalendar, { setValue }] = useBool(false);
|
|
2839
|
+
const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
|
|
2840
|
+
const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
|
|
2841
|
+
const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
|
|
2842
|
+
onYearSelect: setSelectedYear,
|
|
2843
|
+
onMonthSelect: setSelectedMonth,
|
|
2844
|
+
onShowCalendar: setValue,
|
|
2845
|
+
selectedYear,
|
|
2846
|
+
selectedMonth,
|
|
2847
|
+
showCalendar,
|
|
2848
|
+
onChange,
|
|
2849
|
+
value,
|
|
2850
|
+
});
|
|
2851
|
+
const spaceAbove = useElementSpace(ref, 370);
|
|
2852
|
+
return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
|
|
2853
|
+
handleChangeVisibleCalendar,
|
|
2854
|
+
value,
|
|
2855
|
+
valid,
|
|
2856
|
+
onChange,
|
|
2857
|
+
disabled,
|
|
2858
|
+
setSelectedMonth,
|
|
2859
|
+
setSelectedYear,
|
|
2860
|
+
}), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
|
|
2861
|
+
'bottom-full': spaceAbove,
|
|
2862
|
+
}), 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] })] }));
|
|
2863
|
+
});
|
|
2726
2864
|
|
|
2727
|
-
const
|
|
2865
|
+
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)] })));
|
|
2728
2866
|
|
|
2729
|
-
const
|
|
2730
|
-
yellow: { border: 'border-yellow-light', text: 'text-yellow' },
|
|
2731
|
-
green: { border: 'border-green-more-light', text: 'text-green-dark' },
|
|
2732
|
-
gray: { border: 'border-gray', text: 'text-secondary-text' },
|
|
2733
|
-
red: { border: 'border-error/30', text: 'text-error' },
|
|
2734
|
-
};
|
|
2735
|
-
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 })] })));
|
|
2867
|
+
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 })));
|
|
2736
2868
|
|
|
2737
|
-
const
|
|
2738
|
-
|
|
2739
|
-
const
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2869
|
+
const MIN_AGE = 23;
|
|
2870
|
+
const MAX_AGE = 75;
|
|
2871
|
+
const AGE_ERROR_MESSAGE = 'Допустимый возраст заёмщика - от 23 до 75 лет';
|
|
2872
|
+
const FIELD_NAME$8 = 'birthday';
|
|
2873
|
+
const BirthdayField = JSX(({ field, input, isRetailForm = false }) => {
|
|
2874
|
+
const { value } = field(FIELD_NAME$8);
|
|
2875
|
+
return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$8), validatorObj.birthday, input?.required), error: isRetailForm && value && !birthdayValidate(value) ? AGE_ERROR_MESSAGE : '', disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) }));
|
|
2876
|
+
});
|
|
2877
|
+
const birthdayValidate = (date) => {
|
|
2878
|
+
const today = new Date();
|
|
2879
|
+
const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
|
|
2880
|
+
const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
|
|
2881
|
+
if (!date || date > minDate || date < maxDate) {
|
|
2882
|
+
return false;
|
|
2743
2883
|
}
|
|
2744
|
-
|
|
2745
|
-
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" }));
|
|
2884
|
+
return true;
|
|
2746
2885
|
};
|
|
2747
2886
|
|
|
2748
|
-
const
|
|
2749
|
-
|
|
2750
|
-
return 'Не работает';
|
|
2751
|
-
}
|
|
2752
|
-
return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
|
|
2753
|
-
};
|
|
2754
|
-
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)));
|
|
2887
|
+
const FIELD_NAME$7 = 'birthPlace';
|
|
2888
|
+
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$7) })));
|
|
2755
2889
|
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2758
|
-
|
|
2890
|
+
const CardCategoryField = JSX(({ field, input }) => {
|
|
2891
|
+
const { data: cardCategory } = useLeadFormData('CARD_TYPE');
|
|
2892
|
+
return (jsx(SelectField, { field: field, source: cardCategory, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
|
|
2893
|
+
});
|
|
2759
2894
|
|
|
2760
|
-
const
|
|
2761
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2762
|
-
const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
|
|
2763
|
-
const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
|
|
2764
|
-
if (!workSchedule) {
|
|
2765
|
-
return null;
|
|
2766
|
-
}
|
|
2767
|
-
if (!workSchedule.businessScheduleVisibleTag) {
|
|
2768
|
-
return renderMatchingTimeOfWork(timeOfWork);
|
|
2769
|
-
}
|
|
2770
|
-
if (workSchedule.businessScheduleVisibleTag &&
|
|
2771
|
-
workSchedule.businessScheduleDescription === null) {
|
|
2772
|
-
return renderIndividualTimeOfWork(timeOfWork);
|
|
2773
|
-
}
|
|
2774
|
-
return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
|
|
2775
|
-
};
|
|
2776
|
-
const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
|
|
2777
|
-
const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
|
|
2778
|
-
const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
|
|
2895
|
+
const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
|
|
2779
2896
|
|
|
2780
|
-
const
|
|
2781
|
-
if (!workSchedule) {
|
|
2782
|
-
return null;
|
|
2783
|
-
}
|
|
2784
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2785
|
-
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({
|
|
2786
|
-
phone,
|
|
2787
|
-
fax,
|
|
2788
|
-
phoneBusiness,
|
|
2789
|
-
phoneNatural,
|
|
2790
|
-
phoneCallCentre,
|
|
2791
|
-
phoneCurrencyControl,
|
|
2792
|
-
workSchedule,
|
|
2793
|
-
exchangeRate,
|
|
2794
|
-
}) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
|
|
2795
|
-
return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
|
|
2796
|
-
phone,
|
|
2797
|
-
fax,
|
|
2798
|
-
phoneBusiness,
|
|
2799
|
-
phoneNatural,
|
|
2800
|
-
phoneCallCentre,
|
|
2801
|
-
phoneCurrencyControl,
|
|
2802
|
-
workSchedule,
|
|
2803
|
-
exchangeRate,
|
|
2804
|
-
}) }));
|
|
2805
|
-
},
|
|
2806
|
-
//** TODO: remove styles with refactoring DefaultFoldButton*/
|
|
2807
|
-
renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
|
|
2808
|
-
};
|
|
2809
|
-
const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
|
|
2810
|
-
const workScheduleWeek = getWorkScheduleWeek(workSchedule);
|
|
2811
|
-
const labelSchedule = workSchedule?.businessScheduleVisibleTag
|
|
2812
|
-
? 'Для физических лиц'
|
|
2813
|
-
: 'Для физических и юридических лиц';
|
|
2814
|
-
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
|
|
2815
|
-
? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
|
|
2816
|
-
: null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
|
|
2817
|
-
};
|
|
2818
|
-
const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
|
|
2819
|
-
const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
|
|
2820
|
-
const header = capitalizedFirstLetter$1(name);
|
|
2821
|
-
const body = `${address} ${renderWorkSchedule(workSchedule)}`;
|
|
2822
|
-
return { header, body };
|
|
2823
|
-
};
|
|
2897
|
+
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 })));
|
|
2824
2898
|
|
|
2825
|
-
const
|
|
2899
|
+
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", type: "number", ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
|
|
2826
2900
|
|
|
2827
|
-
const
|
|
2828
|
-
const ClientOnly = JSX(({ children }) => (isClient ? children : null));
|
|
2901
|
+
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 })));
|
|
2829
2902
|
|
|
2830
|
-
const
|
|
2831
|
-
|
|
2832
|
-
|
|
2903
|
+
const ConfirmationIncomeField = JSX(({ field, input }) => {
|
|
2904
|
+
const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
|
|
2905
|
+
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 }));
|
|
2906
|
+
});
|
|
2833
2907
|
|
|
2834
|
-
const
|
|
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
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
}
|
|
2864
|
-
});
|
|
2865
|
-
}
|
|
2866
|
-
const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
|
|
2867
|
-
return new yandexMaps.Clusterer({
|
|
2868
|
-
clusterIcons: [
|
|
2869
|
-
{
|
|
2870
|
-
href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2871
|
-
size: [78, 84],
|
|
2872
|
-
offset: [-35, -50],
|
|
2873
|
-
},
|
|
2874
|
-
],
|
|
2875
|
-
clusterIconContentLayout,
|
|
2876
|
-
clusterHideIconOnBalloonOpen: false,
|
|
2877
|
-
geoObjectHideIconOnBalloonOpen: false,
|
|
2878
|
-
});
|
|
2908
|
+
const ConscriptionField = JSX(({ field, input }) => {
|
|
2909
|
+
const { data: conscription } = useLeadFormData('MILITARY_STATUS');
|
|
2910
|
+
return (jsx(SelectField, { field: field, source: conscription, label: "\u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u043E\u0435\u043D\u043D\u043E\u043E\u0431\u044F\u0437\u0430\u043D\u043D\u043E\u0433\u043E", fieldName: "conscription", input: input }));
|
|
2911
|
+
});
|
|
2912
|
+
|
|
2913
|
+
const CONSENTS = {
|
|
2914
|
+
processPersonalDataFlg: {
|
|
2915
|
+
text: 'Согласие на обработку персональных данных',
|
|
2916
|
+
docId: 4,
|
|
2917
|
+
},
|
|
2918
|
+
consentInformFlg: {
|
|
2919
|
+
text: 'Согласие на информирование о продуктах и услугах Банка',
|
|
2920
|
+
docId: 14,
|
|
2921
|
+
},
|
|
2922
|
+
consentProviderFlg: {
|
|
2923
|
+
text: 'Согласие об использовании простой электронной подписи',
|
|
2924
|
+
docId: 5,
|
|
2925
|
+
},
|
|
2926
|
+
consentOthersFlg: {
|
|
2927
|
+
text: 'Прочие согласия',
|
|
2928
|
+
docId: 1,
|
|
2929
|
+
},
|
|
2930
|
+
consentPfrFlg: {
|
|
2931
|
+
text: 'Согласие на запрос в ПФР',
|
|
2932
|
+
docId: 3,
|
|
2933
|
+
},
|
|
2934
|
+
consentToReceiveMaterials: {
|
|
2935
|
+
text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
|
|
2936
|
+
},
|
|
2879
2937
|
};
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
balloonContentFooter: content?.footer,
|
|
2885
|
-
hintContent: content?.hint,
|
|
2886
|
-
}, {
|
|
2887
|
-
iconLayout: 'default#image',
|
|
2888
|
-
iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
|
|
2889
|
-
iconImageSize: [78, 84],
|
|
2890
|
-
iconImageOffset: [-35, -50],
|
|
2891
|
-
}));
|
|
2938
|
+
|
|
2939
|
+
const feedbackById = async (id, convertToPng = false) => {
|
|
2940
|
+
const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
|
|
2941
|
+
return await response.blob();
|
|
2892
2942
|
};
|
|
2893
2943
|
|
|
2894
|
-
const
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
active: 'active:bg-primary-active',
|
|
2898
|
-
font: 'text-center font-sans',
|
|
2944
|
+
const getDocument = async (id, convertToPng = false) => {
|
|
2945
|
+
const response = await feedbackById(id, convertToPng);
|
|
2946
|
+
return URL.createObjectURL(response);
|
|
2899
2947
|
};
|
|
2900
2948
|
|
|
2901
|
-
const
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2949
|
+
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" }) })));
|
|
2950
|
+
|
|
2951
|
+
const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
|
|
2952
|
+
const { close } = useDialogManager();
|
|
2953
|
+
const handleClose = useCallback(() => {
|
|
2954
|
+
close();
|
|
2955
|
+
onClose && onClose();
|
|
2956
|
+
}, [onClose]);
|
|
2957
|
+
return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
2958
|
+
});
|
|
2959
|
+
|
|
2960
|
+
const openDocument = async (open, id, convertToPng = false) => {
|
|
2961
|
+
const document = await getDocument(id, convertToPng);
|
|
2962
|
+
open(jsx(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", children: convertToPng ? (jsx("img", { src: document })) : (jsx("iframe", { src: `${document}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })) }));
|
|
2905
2963
|
};
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2964
|
+
|
|
2965
|
+
const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
|
|
2966
|
+
const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
|
|
2967
|
+
const { open } = useDialogManager();
|
|
2968
|
+
const isMobile = useMobileMode();
|
|
2969
|
+
return (jsxs("div", { className: className, children: [jsxs("div", { className: "flex flex-wrap gap-x-m", children: [jsx(Checkbox, { ...props }), docId ? (jsx(LinkButton, { className: "text-primary-main", onClick: () => openDocument(open, docId, isMobile), children: jsx(Text, { children: OPEN_DOC_BUTTON_TEXT }) })) : null] }), renderErrorText(error)] }));
|
|
2970
|
+
});
|
|
2971
|
+
|
|
2972
|
+
const ConsentField = JSX(({ field, input }) => input && input.name ? (jsx(CheckboxWithDoc, { text: CONSENTS[input.name]?.text, docId: CONSENTS[input.name]?.docId, ...getValidation(field(input.name), validatorObj[input.name], input?.required) })) : null);
|
|
2973
|
+
|
|
2974
|
+
const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
|
|
2975
|
+
вкладчиком с долей участия более 20% уставного капитала руководителем,
|
|
2976
|
+
которого Вы являетесь, кредит в АО «Россельхозбанк»`;
|
|
2977
|
+
const CreditInRshbCdField = JSX(({ field, input }) => {
|
|
2978
|
+
const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
|
|
2979
|
+
return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
|
|
2980
|
+
});
|
|
2981
|
+
|
|
2982
|
+
const orientationStyleMap = {
|
|
2983
|
+
horizontal: '@lg:flex-row',
|
|
2984
|
+
vertical: '',
|
|
2921
2985
|
};
|
|
2986
|
+
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)))) })] })));
|
|
2922
2987
|
|
|
2923
|
-
const
|
|
2924
|
-
const initializeExternalNS = (namespaceName, url) => {
|
|
2925
|
-
const script = document.getElementById(url);
|
|
2926
|
-
if (script) {
|
|
2927
|
-
const ns = getNS(namespaceName);
|
|
2928
|
-
if (ns) {
|
|
2929
|
-
return Promise.resolve(ns);
|
|
2930
|
-
}
|
|
2931
|
-
else {
|
|
2932
|
-
return new Promise((resolve) => {
|
|
2933
|
-
script.addEventListener('load', () => {
|
|
2934
|
-
resolve(getNS(namespaceName));
|
|
2935
|
-
});
|
|
2936
|
-
});
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
else {
|
|
2940
|
-
return new Promise((resolve, reject) => {
|
|
2941
|
-
const newScript = document.createElement('script');
|
|
2942
|
-
newScript.src = url;
|
|
2943
|
-
newScript.async = true;
|
|
2944
|
-
newScript.id = url;
|
|
2945
|
-
newScript.addEventListener('load', () => {
|
|
2946
|
-
resolve(getNS(namespaceName));
|
|
2947
|
-
});
|
|
2948
|
-
newScript.addEventListener('error', (error) => {
|
|
2949
|
-
reject(error);
|
|
2950
|
-
});
|
|
2951
|
-
document.head.appendChild(newScript);
|
|
2952
|
-
});
|
|
2953
|
-
}
|
|
2954
|
-
};
|
|
2955
|
-
function useExternalNS(namespaceName, url, unmountNS = true) {
|
|
2956
|
-
const [externalNS, setExternalNS] = useState(undefined);
|
|
2957
|
-
useEffect(() => {
|
|
2958
|
-
let isMounted = true;
|
|
2959
|
-
initializeExternalNS(namespaceName, url)
|
|
2960
|
-
.then((ns) => {
|
|
2961
|
-
if (isMounted) {
|
|
2962
|
-
setExternalNS(ns);
|
|
2963
|
-
}
|
|
2964
|
-
})
|
|
2965
|
-
.catch((error) => {
|
|
2966
|
-
console.error(`Failed to initialize external namespace: ${error}`);
|
|
2967
|
-
});
|
|
2968
|
-
return () => {
|
|
2969
|
-
isMounted = false;
|
|
2970
|
-
if (unmountNS) {
|
|
2971
|
-
const script = document.getElementById(url);
|
|
2972
|
-
if (script) {
|
|
2973
|
-
document.head.removeChild(script);
|
|
2974
|
-
}
|
|
2975
|
-
setExternalNS(undefined);
|
|
2976
|
-
}
|
|
2977
|
-
};
|
|
2978
|
-
}, [namespaceName, url, unmountNS]);
|
|
2979
|
-
return externalNS;
|
|
2980
|
-
}
|
|
2988
|
+
const RadioButtonGroupControl = JSX(({ className, label, onChange, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(RadioButtonGroup, { label: getRequiredLabel({ label, errors: rest?.errors }), onChange: (_) => onChange && onChange(_), ...rest }), renderErrorText(error)] })));
|
|
2981
2989
|
|
|
2982
|
-
const
|
|
2983
|
-
const
|
|
2984
|
-
const
|
|
2985
|
-
return
|
|
2986
|
-
};
|
|
2990
|
+
const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
|
|
2991
|
+
const CurrencyField = JSX(({ field, input }) => {
|
|
2992
|
+
const { value, onChange } = field('currency');
|
|
2993
|
+
return (jsx(RadioButtonGroupControl, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", orientation: "horizontal", items: CURRENCY_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('currency'), validatorObj.currency, input?.required) }));
|
|
2994
|
+
});
|
|
2987
2995
|
|
|
2988
|
-
const
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
};
|
|
2993
|
-
|
|
2994
|
-
const
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
2996
|
+
const DeliveryDateFiels = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...getValidation(field('deliveryDate'), validatorObj.deliveryDate, input?.required) })));
|
|
2997
|
+
|
|
2998
|
+
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", type: "number", maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
|
|
2999
|
+
|
|
3000
|
+
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) })));
|
|
3001
|
+
|
|
3002
|
+
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) })));
|
|
3003
|
+
|
|
3004
|
+
const FIELD_NAME$6 = 'dulIssueDateField';
|
|
3005
|
+
const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6) })));
|
|
3006
|
+
|
|
3007
|
+
const FIELD_NAME$5 = 'dulIssuedBy';
|
|
3008
|
+
const DulIssuedByField = JSX(({ field, input }) => {
|
|
3009
|
+
const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
|
|
3010
|
+
const onDaDataChange = useCallback((item) => {
|
|
3011
|
+
changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
|
|
3012
|
+
}, []);
|
|
3013
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
|
|
3002
3014
|
});
|
|
3003
3015
|
|
|
3004
|
-
const
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3016
|
+
const FIELD_NAME$4 = 'dulNumber';
|
|
3017
|
+
const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
|
|
3018
|
+
|
|
3019
|
+
const FIELD_NAME$3 = 'dulSerie';
|
|
3020
|
+
const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
|
|
3021
|
+
|
|
3022
|
+
const FIELD_NAME$2 = 'dulSubdivisionCode';
|
|
3023
|
+
const DulSubdivisionCodeField = JSX(({ field, input }) => {
|
|
3024
|
+
const onDaDataChange = useCallback((item) => {
|
|
3025
|
+
field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
|
|
3026
|
+
}, []);
|
|
3027
|
+
return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", type: "number", maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$2), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
|
|
3028
|
+
});
|
|
3029
|
+
|
|
3030
|
+
const EducationField = JSX(({ field, input }) => {
|
|
3031
|
+
const { data: education } = useLeadFormData('EDUCATION_LEVEL');
|
|
3032
|
+
return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
|
|
3033
|
+
});
|
|
3034
|
+
|
|
3035
|
+
const EmailField = JSX(({ field, input }) => {
|
|
3036
|
+
const { required, ...rest } = input;
|
|
3037
|
+
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 }));
|
|
3038
|
+
});
|
|
3039
|
+
|
|
3040
|
+
const EmployerActivitiesField = JSX(({ field, input }) => {
|
|
3041
|
+
const { data: employerActivities } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
|
|
3042
|
+
return (jsx(SelectField, { field: field, source: 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 }));
|
|
3043
|
+
});
|
|
3044
|
+
|
|
3045
|
+
const EmployerOrganizationField = JSX(({ field, input }) => {
|
|
3046
|
+
const { data: employerOrganization } = useLeadFormData('ORGANIZATION_KIND');
|
|
3047
|
+
return (jsx(SelectField, { field: field, source: 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 }));
|
|
3048
|
+
});
|
|
3049
|
+
|
|
3050
|
+
const EmploymentField = JSX(({ field, input }) => {
|
|
3051
|
+
const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
|
|
3052
|
+
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 }));
|
|
3053
|
+
});
|
|
3054
|
+
|
|
3055
|
+
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", type: "number", ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
|
|
3056
|
+
|
|
3057
|
+
const Experience5YearsField = JSX(({ field, input }) => (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", maxLength: 2, ...getValidation(field('experience5Years'), validatorObj.experience5Years, input?.required), ...input })));
|
|
3058
|
+
|
|
3059
|
+
const FamilyMembersField = JSX(({ field }) => {
|
|
3060
|
+
const { value, onChange } = field('familyMembers');
|
|
3061
|
+
const familyStatusKey = field('familyStatus')?.value?.key;
|
|
3062
|
+
const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
|
|
3063
|
+
const childrenCount = Number(field('children')?.value);
|
|
3064
|
+
const dependentsCount = Number(field('dependents')?.value);
|
|
3065
|
+
const totalCount = adultsCount + childrenCount + dependentsCount;
|
|
3012
3066
|
useEffect(() => {
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3067
|
+
field?.('familyMembers')?.onChange?.(totalCount);
|
|
3068
|
+
}, [familyStatusKey, childrenCount, dependentsCount]);
|
|
3069
|
+
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?.(_) }));
|
|
3070
|
+
});
|
|
3071
|
+
|
|
3072
|
+
const FamilyStatusField = JSX(({ field, input }) => {
|
|
3073
|
+
const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
|
|
3074
|
+
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 }));
|
|
3075
|
+
});
|
|
3076
|
+
|
|
3077
|
+
const SERVICE_TYPES = [
|
|
3078
|
+
{ key: 'ULTRASERVICE', text: 'Ультра' },
|
|
3079
|
+
{ key: 'PREMIUMSERVICE', text: 'Премиум' },
|
|
3080
|
+
];
|
|
3081
|
+
const SERVICE_DIRECTIONS = [
|
|
3082
|
+
{ key: 'Физическое лицо' },
|
|
3083
|
+
{ key: 'Юридическое лицо / ИП' },
|
|
3084
|
+
];
|
|
3085
|
+
const FEEDBACK_METHOD = [
|
|
3086
|
+
{ key: 'phone', text: 'Телефонный звонок' },
|
|
3087
|
+
{ key: 'email', text: 'Электронное сообщение' },
|
|
3088
|
+
];
|
|
3089
|
+
|
|
3090
|
+
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) })));
|
|
3091
|
+
|
|
3092
|
+
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
|
|
3093
|
+
|
|
3094
|
+
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 })));
|
|
3095
|
+
|
|
3096
|
+
const HousingField = JSX(({ field, input }) => {
|
|
3097
|
+
const { data: housing } = useLeadFormData('HOUSE_TYPE');
|
|
3098
|
+
return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
|
|
3099
|
+
});
|
|
3100
|
+
|
|
3101
|
+
const InnField = JSX(({ field, input }) => {
|
|
3102
|
+
const onDaDataChange = useCallback((item) => {
|
|
3103
|
+
field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
|
|
3104
|
+
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
3105
|
+
}, []);
|
|
3106
|
+
return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
|
|
3107
|
+
});
|
|
3108
|
+
|
|
3109
|
+
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"' })));
|
|
3110
|
+
|
|
3111
|
+
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", type: "number", maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
|
|
3112
|
+
|
|
3113
|
+
const LastJobExperienceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436 \u043D\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u043C \u0440\u0430\u0431\u043E\u0447\u0435\u043C \u043C\u0435\u0441\u0442\u0435", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('lastJobExperience'), validatorObj.lastJobExperience, input?.required), ...input })));
|
|
3114
|
+
|
|
3115
|
+
const LegalEntityNameField = JSX(({ field, input }) => {
|
|
3116
|
+
return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...input, ...getValidation(field('legalEntityName'), validatorObj.legalEntityName, input?.required) }));
|
|
3117
|
+
});
|
|
3118
|
+
|
|
3119
|
+
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 })));
|
|
3120
|
+
|
|
3121
|
+
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3122
|
+
const EMPTY_REGIONS = [];
|
|
3123
|
+
async function getOutServiceRegions() {
|
|
3124
|
+
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3125
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
const LocalitiesField = JSX(({ field, input }) => {
|
|
3129
|
+
const fieldRegion = field('region');
|
|
3130
|
+
const regionKey = fieldRegion?.value?.key;
|
|
3131
|
+
const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
|
|
3132
|
+
const localities = regions
|
|
3133
|
+
?.find((_) => _.code === regionKey)
|
|
3134
|
+
?.localities?.map((_) => ({ key: _, text: _ }));
|
|
3033
3135
|
useEffect(() => {
|
|
3034
|
-
if (
|
|
3035
|
-
|
|
3036
|
-
const firstGeoObject = res.geoObjects.get(0);
|
|
3037
|
-
const coords = firstGeoObject.geometry.getCoordinates();
|
|
3038
|
-
map.current.setCenter(coords);
|
|
3039
|
-
map.current.setZoom(18);
|
|
3040
|
-
});
|
|
3136
|
+
if (regionKey !== '') {
|
|
3137
|
+
field?.('localities')?.onChange?.('');
|
|
3041
3138
|
}
|
|
3042
|
-
}, [
|
|
3043
|
-
|
|
3044
|
-
return null;
|
|
3045
|
-
}
|
|
3046
|
-
const zIndex = 'z-10';
|
|
3047
|
-
return (jsxs("div", { id: "map", 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))] }));
|
|
3139
|
+
}, [regionKey]);
|
|
3140
|
+
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 }));
|
|
3048
3141
|
});
|
|
3049
|
-
const getCenterPoint = (points) => {
|
|
3050
|
-
const centerCoords = [
|
|
3051
|
-
getArraySumAndAverage(mapByIndex(points, 0)),
|
|
3052
|
-
getArraySumAndAverage(mapByIndex(points, 1)),
|
|
3053
|
-
];
|
|
3054
|
-
return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
|
|
3055
|
-
};
|
|
3056
|
-
const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
|
|
3057
|
-
const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
|
|
3058
3142
|
|
|
3059
|
-
const
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
};
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
};
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3143
|
+
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", type: "number", ...getValidation(field('mandatoryPayments'), validatorObj.mandatoryPayments, input?.required), ...input })));
|
|
3144
|
+
|
|
3145
|
+
const METHODS_OF_OBTAIN = [
|
|
3146
|
+
{ id: 'office', text: 'В отделении Банка' },
|
|
3147
|
+
{ id: 'courier', text: 'Курьерская доставка' },
|
|
3148
|
+
];
|
|
3149
|
+
const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
|
|
3150
|
+
|
|
3151
|
+
const FIELD_NAME$1 = 'middleName';
|
|
3152
|
+
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$1), ...getValidation(field(FIELD_NAME$1), validatorObj.middleName, input?.required), ...input })));
|
|
3153
|
+
|
|
3154
|
+
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 })));
|
|
3155
|
+
|
|
3156
|
+
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] })));
|
|
3157
|
+
|
|
3158
|
+
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);
|
|
3159
|
+
|
|
3160
|
+
const OrganizationField = JSX(({ field, input }) => {
|
|
3161
|
+
const { data: organization } = useLeadFormData('ORGANIZATION_TYPE');
|
|
3162
|
+
return (jsx(SelectField, { field: field, source: organization, label: "\u0422\u0438\u043F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "organization", input: input }));
|
|
3163
|
+
});
|
|
3164
|
+
|
|
3165
|
+
const OrganizationNameField = JSX(({ field, input }) => {
|
|
3166
|
+
const onDaDataChange = useCallback((item) => {
|
|
3167
|
+
field?.('inn')?.onChange?.(item.data?.inn);
|
|
3168
|
+
field?.('legalForm')?.onChange?.(item.data?.opf?.short);
|
|
3169
|
+
}, []);
|
|
3170
|
+
return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...input, ...getValidation(field('organizationName'), validatorObj.organizationName, input?.required), onDaDataChange: onDaDataChange }));
|
|
3171
|
+
});
|
|
3172
|
+
|
|
3173
|
+
const OtherIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\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", type: "number", ...getValidation(field('otherIncome'), validatorObj.otherIncome, input?.required), ...input })));
|
|
3174
|
+
|
|
3175
|
+
const ParticipantDateRegistrationField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043F\u043E \u043C\u0435\u0441\u0442\u0443 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430", ...getValidation(field('participantDateRegistration'), validatorObj.participantDateRegistration, input?.required) })));
|
|
3176
|
+
|
|
3177
|
+
const MAX_PART = 100;
|
|
3178
|
+
const PartInBusinessField = JSX(({ field, input }) => {
|
|
3179
|
+
const isBusinessOwner = field('positionOrganization')?.value?.key === 'BUSINESS_OWNER';
|
|
3180
|
+
const partInBusinessField = {
|
|
3181
|
+
...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
|
|
3182
|
+
};
|
|
3183
|
+
const handleChange = (value) => partInBusinessField?.onChange &&
|
|
3184
|
+
partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
|
|
3185
|
+
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 %", type: "number", maxLength: 3, ...partInBusinessField, ...input, onChange: handleChange, value: isBusinessOwner ? partInBusinessField?.value : '', disabled: !isBusinessOwner }));
|
|
3186
|
+
});
|
|
3187
|
+
|
|
3188
|
+
const PartnerCommentsField = JSX(({ field, input }) => {
|
|
3189
|
+
const { required, ...rest } = input;
|
|
3190
|
+
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 }));
|
|
3191
|
+
});
|
|
3192
|
+
|
|
3193
|
+
const PAYMENT_SYSTEM_TYPES = [
|
|
3194
|
+
{ id: 'mir', text: 'Карта МИР' },
|
|
3195
|
+
{ id: 'union_pay', text: 'UnionPay' },
|
|
3196
|
+
];
|
|
3197
|
+
const PaymentSystemField = JSX(({ field, input }) => {
|
|
3198
|
+
const { value, onChange } = field('paymentSystem');
|
|
3199
|
+
return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
|
|
3200
|
+
});
|
|
3102
3201
|
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
function
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3202
|
+
const isPlaceholder = (_) => _ === '_';
|
|
3203
|
+
const isDigit = (_) => /\d/.test(_);
|
|
3204
|
+
const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
|
|
3205
|
+
const phonePattern = [...'+7 (___) ___-__-__'];
|
|
3206
|
+
const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
|
|
3207
|
+
const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
|
|
3208
|
+
function normalizePhone(phone) {
|
|
3209
|
+
const phoneNumbers = phone.replace(/\D/g, '');
|
|
3210
|
+
const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
|
|
3211
|
+
const result = phonePattern.map(applyPlaceholder);
|
|
3212
|
+
const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
|
|
3213
|
+
return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
|
|
3113
3214
|
}
|
|
3114
3215
|
|
|
3115
|
-
const
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
const Button = JSX(({ children, ...props }) => {
|
|
3124
|
-
const button = useButton();
|
|
3125
|
-
const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
|
|
3126
|
-
return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
|
|
3127
|
-
'text-white bg-primary-active': active,
|
|
3128
|
-
'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
|
|
3129
|
-
'rounded-md': rounded,
|
|
3130
|
-
}, !active && !disabled
|
|
3131
|
-
? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
|
|
3132
|
-
: '', className), type: type, role: role, onClick: onClick, children: children }));
|
|
3216
|
+
const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
|
|
3217
|
+
const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
|
|
3218
|
+
const handleBlur = useCallback((v) => {
|
|
3219
|
+
if (v === '+7 (') {
|
|
3220
|
+
onChange && onChange('');
|
|
3221
|
+
}
|
|
3222
|
+
}, []);
|
|
3223
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
3133
3224
|
});
|
|
3134
3225
|
|
|
3135
|
-
const
|
|
3226
|
+
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)] })));
|
|
3136
3227
|
|
|
3137
|
-
const
|
|
3138
|
-
const
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
|
|
3142
|
-
onButtonClick(key);
|
|
3143
|
-
return filteredBranches;
|
|
3144
|
-
};
|
|
3145
|
-
const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
|
|
3146
|
-
branch.workSchedule.businessScheduleVisibleTag &&
|
|
3147
|
-
!branch.workSchedule.businessScheduleDescription);
|
|
3148
|
-
return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
|
|
3149
|
-
};
|
|
3228
|
+
const PhoneField = JSX(({ field, input }) => {
|
|
3229
|
+
const fieldName = input?.name || 'phone';
|
|
3230
|
+
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 }));
|
|
3231
|
+
});
|
|
3150
3232
|
|
|
3151
|
-
const
|
|
3233
|
+
const PositionOrganizationField = JSX(({ field, input }) => {
|
|
3234
|
+
const { data: positionOrganization } = useLeadFormData('POSITION');
|
|
3235
|
+
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 }));
|
|
3236
|
+
});
|
|
3152
3237
|
|
|
3153
|
-
const
|
|
3154
|
-
const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
|
|
3155
|
-
const visibleFiltersNum = onlyOffice ? 5 : 6;
|
|
3156
|
-
const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
|
|
3157
|
-
const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
|
|
3158
|
-
? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
|
|
3159
|
-
: [filtersCheckbox, []];
|
|
3160
|
-
return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
|
|
3161
|
-
};
|
|
3162
|
-
const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
|
|
3163
|
-
const labels = ['Больше фильтров', 'Меньше фильтров'];
|
|
3164
|
-
const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
|
|
3165
|
-
return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
|
|
3166
|
-
};
|
|
3167
|
-
const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
|
|
3238
|
+
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);
|
|
3168
3239
|
|
|
3169
|
-
const
|
|
3240
|
+
const ProductField = UniBlock(({ 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) })));
|
|
3241
|
+
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
3170
3242
|
|
|
3171
|
-
const
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
|
|
3177
|
-
data,
|
|
3178
|
-
remoteWorkplaces,
|
|
3179
|
-
filtrationState,
|
|
3180
|
-
getBalloon,
|
|
3181
|
-
getBalloonRemoteWorkplaces,
|
|
3182
|
-
});
|
|
3183
|
-
const [activeButton, setActiveButton] = useState('all');
|
|
3184
|
-
const filterOptions = {
|
|
3185
|
-
filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
|
|
3186
|
-
field: { field, reset },
|
|
3187
|
-
onlyOffice,
|
|
3188
|
-
labels: FILTRATION_LABELS,
|
|
3189
|
-
};
|
|
3190
|
-
return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
|
|
3191
|
-
});
|
|
3192
|
-
const filterItems$1 = (data, filtrationState) => {
|
|
3193
|
-
const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
|
|
3194
|
-
return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
|
|
3195
|
-
};
|
|
3196
|
-
const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
|
|
3243
|
+
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
3244
|
+
function useRegions(url = REGIONS_URL) {
|
|
3245
|
+
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
3246
|
+
return Array.isArray(data) ? data : [];
|
|
3247
|
+
}
|
|
3197
3248
|
|
|
3198
|
-
const
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
|
|
3203
|
-
const _points = [
|
|
3204
|
-
..._filteredItems.map((_) => ({
|
|
3205
|
-
type: 'offices',
|
|
3206
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3207
|
-
content: getBalloon(_),
|
|
3208
|
-
})),
|
|
3209
|
-
..._filteredRemoteWorkplaces.map((_) => ({
|
|
3210
|
-
type: 'workplaces',
|
|
3211
|
-
coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
|
|
3212
|
-
content: getBalloonRemoteWorkplaces({
|
|
3213
|
-
address: _.address,
|
|
3214
|
-
workScheduleDescription: _.workScheduleDescription,
|
|
3215
|
-
}),
|
|
3216
|
-
})),
|
|
3217
|
-
].filter((_) => _.coords && _.coords.length === 2);
|
|
3218
|
-
const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
|
|
3219
|
-
return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
|
|
3220
|
-
}, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
|
|
3221
|
-
return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
|
|
3222
|
-
};
|
|
3249
|
+
const RegionField = JSX(({ field, input, url }) => {
|
|
3250
|
+
const regions = useRegions(url);
|
|
3251
|
+
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) }));
|
|
3252
|
+
});
|
|
3223
3253
|
|
|
3224
|
-
const
|
|
3225
|
-
const
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
const regionText = fieldRegion?.value?.text;
|
|
3232
|
-
const addressBranchRetail = useBranchesByRegions()?.find((_) => _?.region === regionText)?.branches;
|
|
3233
|
-
useEffect(() => {
|
|
3234
|
-
if (fieldRegion?.value?.key !== '') {
|
|
3235
|
-
field?.('addressRetail')?.onChange?.('');
|
|
3236
|
-
}
|
|
3237
|
-
}, [fieldRegion?.value]);
|
|
3238
|
-
const { points } = useOfficesAtmsMapData({
|
|
3239
|
-
data: selectedRegion?.branches || [],
|
|
3240
|
-
filtrationState: {},
|
|
3241
|
-
getBalloon: getOfficePoint,
|
|
3242
|
-
});
|
|
3243
|
-
const isRegionSelected = Boolean(fieldRegion?.value?.key);
|
|
3244
|
-
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: (addressBranchRetail || []).map(({ address = '' }) => ({
|
|
3245
|
-
key: address,
|
|
3246
|
-
text: address,
|
|
3247
|
-
})), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
|
|
3254
|
+
const RegionPremiumField = JSX(({ field, input }) => {
|
|
3255
|
+
const branchByRegions = useBranchesByRegions(true);
|
|
3256
|
+
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
3257
|
+
key: region,
|
|
3258
|
+
text: region,
|
|
3259
|
+
})), [branchByRegions]);
|
|
3260
|
+
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) }));
|
|
3248
3261
|
});
|
|
3249
3262
|
|
|
3250
|
-
const
|
|
3251
|
-
const regions =
|
|
3252
|
-
|
|
3263
|
+
const RegionRetailField = JSX(({ field, input }) => {
|
|
3264
|
+
const { data: regions } = useLeadFormData('REGION_RF');
|
|
3265
|
+
const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
|
|
3266
|
+
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", isSearch: true, options: formatRegions, ...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required) }));
|
|
3253
3267
|
});
|
|
3254
3268
|
|
|
3255
|
-
const RetirementIncomeField = JSX(({ field, input }) =>
|
|
3269
|
+
const RetirementIncomeField = JSX(({ field, input }) => {
|
|
3270
|
+
const currentWages = field('wages')?.value;
|
|
3271
|
+
const onChange = useCallback((_) => {
|
|
3272
|
+
const incomesSum = Number(_) + Number(currentWages || 0);
|
|
3273
|
+
field('retirementIncome')?.onChange?.(_);
|
|
3274
|
+
field('incomeAverage')?.onChange?.(String(incomesSum));
|
|
3275
|
+
}, [currentWages]);
|
|
3276
|
+
return (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", type: "number", ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input, onChange: onChange }));
|
|
3277
|
+
});
|
|
3256
3278
|
|
|
3257
3279
|
const SecondaryPhoneField = JSX(({ field }) => {
|
|
3258
3280
|
const fieldPhone = field('secondaryPhone');
|
|
@@ -3317,6 +3339,16 @@
|
|
|
3317
3339
|
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(_) }) }));
|
|
3318
3340
|
});
|
|
3319
3341
|
|
|
3342
|
+
const WagesField = JSX(({ field, input }) => {
|
|
3343
|
+
const currentRetirementIncome = field('retirementIncome')?.value;
|
|
3344
|
+
const onChange = useCallback((_) => {
|
|
3345
|
+
const incomesSum = Number(_) + Number(currentRetirementIncome || 0);
|
|
3346
|
+
field('wages')?.onChange?.(_);
|
|
3347
|
+
field('incomeAverage')?.onChange?.(String(incomesSum));
|
|
3348
|
+
}, [currentRetirementIncome]);
|
|
3349
|
+
return (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", type: "number", ...getValidation(field('wages'), validatorObj.wages, input?.required), ...input, onChange: onChange }));
|
|
3350
|
+
});
|
|
3351
|
+
|
|
3320
3352
|
function isRenderField({ input, field, }) {
|
|
3321
3353
|
const { condition } = input;
|
|
3322
3354
|
const { value } = field(condition?.name || '');
|
|
@@ -3404,8 +3436,8 @@
|
|
|
3404
3436
|
participantDateRegistration: jsx(ParticipantDateRegistrationField, { field: field, input: input }),
|
|
3405
3437
|
retirementIncome: jsx(RetirementIncomeField, { field: field, input: input }),
|
|
3406
3438
|
otherIncome: jsx(OtherIncomeField, { field: field, input: input }),
|
|
3407
|
-
|
|
3408
|
-
|
|
3439
|
+
wages: jsx(WagesField, { field: field, input: input }),
|
|
3440
|
+
mandatoryPayments: jsx(MandatoryPaymentsField, { field: field, input: input }),
|
|
3409
3441
|
disablePeopleFlg: jsx(DisablePeopleFlgField, { field: field, input: input }),
|
|
3410
3442
|
bankruptcyFlg: jsx(BankruptcyFlgField, { field: field, input: input }),
|
|
3411
3443
|
shareholderFlg: jsx(ShareholderFlgField, { field: field, input: input }),
|
|
@@ -3413,8 +3445,8 @@
|
|
|
3413
3445
|
creditInRshbCd: jsx(CreditInRshbCdField, { field: field, input: input }),
|
|
3414
3446
|
bankEmployeeCode: jsx(BankEmpoleeCodeField, { field: field, input: input }),
|
|
3415
3447
|
partInBusiness: jsx(PartInBusinessField, { field: field, input: input }),
|
|
3416
|
-
regionRetail: jsx(
|
|
3417
|
-
addressRetail: jsx(
|
|
3448
|
+
regionRetail: jsx(RegionRetailField, { field: field, input: input }),
|
|
3449
|
+
addressRetail: jsx(AddressRetailField, { field: field, input: input }),
|
|
3418
3450
|
addressMatch: jsx(AddressMatchField, { field: field, input: input }),
|
|
3419
3451
|
paymentSystem: jsx(PaymentSystemField, { field: field, input: input }),
|
|
3420
3452
|
currency: jsx(CurrencyField, { field: field, input: input }),
|
|
@@ -3515,6 +3547,7 @@
|
|
|
3515
3547
|
posTerminal: false,
|
|
3516
3548
|
consentToReceiveMaterials: false,
|
|
3517
3549
|
consentDataProcessing: false,
|
|
3550
|
+
addressRetail: { key: '', text: '' },
|
|
3518
3551
|
};
|
|
3519
3552
|
const getInitialFormState$3 = (inputs, typeForm = '') => {
|
|
3520
3553
|
const formState = Object.fromEntries(inputs.map((_) => [
|
|
@@ -3652,6 +3685,7 @@
|
|
|
3652
3685
|
paymentSystem: '',
|
|
3653
3686
|
cardCategory: { key: '', text: '' },
|
|
3654
3687
|
codeWord: '',
|
|
3688
|
+
addressRetail: { key: '', text: '' },
|
|
3655
3689
|
};
|
|
3656
3690
|
const getInitialFormState$2 = (inputs, savedForm, typeForm = '') => {
|
|
3657
3691
|
if (savedForm) {
|
|
@@ -4049,8 +4083,14 @@
|
|
|
4049
4083
|
organizationAddress: 'WORK',
|
|
4050
4084
|
};
|
|
4051
4085
|
const fieldsNamesToIncomeKeysMap = {
|
|
4052
|
-
|
|
4053
|
-
|
|
4086
|
+
incomeAverage: 'INCOME_AVERAGE',
|
|
4087
|
+
mandatoryPayments: 'MANDATORY_PAYMENTS',
|
|
4088
|
+
additionalIncome: 'ADDITIONAL_INCOME',
|
|
4089
|
+
otherIncome: 'OTHER_INCOME',
|
|
4090
|
+
otherPayments: 'OTHER_PAYMENTS',
|
|
4091
|
+
rentalIncome: 'RENTAL_INCOME',
|
|
4092
|
+
wages: 'WAGES',
|
|
4093
|
+
retirementIncome: 'RETIREMENT_INCOME',
|
|
4054
4094
|
};
|
|
4055
4095
|
const getParticipantContacts = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
|
|
4056
4096
|
if (key in fieldsNamesToContactKeysMap) {
|
|
@@ -4091,7 +4131,7 @@
|
|
|
4091
4131
|
incomeTypeCd: {
|
|
4092
4132
|
key: fieldsNamesToIncomeKeysMap[key],
|
|
4093
4133
|
},
|
|
4094
|
-
value,
|
|
4134
|
+
value: Number(value || 0),
|
|
4095
4135
|
},
|
|
4096
4136
|
];
|
|
4097
4137
|
}
|
|
@@ -5987,6 +6027,40 @@
|
|
|
5987
6027
|
const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
|
|
5988
6028
|
const renderBlocksColumn = ({ column, i }) => column ? (jsx("div", { className: "flex flex-col gap-xl grow basis-0", children: column.map(({ title = '', description, additionalDescription, button }, key) => (jsxs("div", { children: [jsx(Headline, { title: title, description: description, headlineVersion: "XS", align: "text-left", isEmbedded: true }), additionalDescription ? (jsx("div", { className: "mt-xs opacity-80", children: jsx(Paragraph, { size: "text-m", font: "font-light", children: additionalDescription }) })) : null, jsx("div", { className: style({ 'mt-xl': Boolean(button?.text) }), children: renderButtonsSection([button]) })] }, String(key)))) }, `col-${String(i)}`)) : null;
|
|
5989
6029
|
|
|
6030
|
+
const PORTAL_NATURAL_URL = '/';
|
|
6031
|
+
const UPDATING_INTERVAL = 60000 * 4;
|
|
6032
|
+
const updateRefreshToken = () => {
|
|
6033
|
+
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
6034
|
+
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
6035
|
+
const taskId = globalThis.localStorage.getItem('taskId');
|
|
6036
|
+
if (!accessToken || !refreshToken || !taskId) {
|
|
6037
|
+
globalThis.location.href = PORTAL_NATURAL_URL;
|
|
6038
|
+
return () => null;
|
|
6039
|
+
}
|
|
6040
|
+
const updateTokenRequest = async () => {
|
|
6041
|
+
const res = await doRequest('/auth/refresh', 'POST', {
|
|
6042
|
+
// eslint-disable-next-line camelcase
|
|
6043
|
+
refresh_token: refreshToken,
|
|
6044
|
+
// eslint-disable-next-line camelcase
|
|
6045
|
+
access_token: accessToken,
|
|
6046
|
+
});
|
|
6047
|
+
if (res instanceof Response) {
|
|
6048
|
+
handleStatus(res.status);
|
|
6049
|
+
return;
|
|
6050
|
+
}
|
|
6051
|
+
globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
|
|
6052
|
+
globalThis.sessionStorage.setItem('accessToken', res.access_token);
|
|
6053
|
+
};
|
|
6054
|
+
updateTokenRequest();
|
|
6055
|
+
const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
|
|
6056
|
+
return () => clearInterval(timer);
|
|
6057
|
+
};
|
|
6058
|
+
const handleStatus = (status) => {
|
|
6059
|
+
if (status == 401) {
|
|
6060
|
+
globalThis.location.href = PORTAL_NATURAL_URL;
|
|
6061
|
+
}
|
|
6062
|
+
};
|
|
6063
|
+
|
|
5990
6064
|
const ProgressBar = JSX(({ step = 10, description, showPercentage = true }) => (jsxs("div", { children: [jsx("div", { className: "h-4 w-full bg-gray relative", children: jsx("div", { className: "h-4 bg-green", style: { width: `${step}%` } }) }), jsxs("div", { className: "relative", children: [showPercentage ? jsxs("div", { className: "absolute left-2/4 text-green", children: [step, "%"] }) : null, description ? jsx("div", { className: "text-right mr-4 text-gray", children: description }) : null] })] })));
|
|
5991
6065
|
|
|
5992
6066
|
const CreditCardFormProgress = JSX(({ step = 1, totalSteps = 6, stepsTitles = [] }) => {
|
|
@@ -6173,8 +6247,8 @@
|
|
|
6173
6247
|
dependents: undefined,
|
|
6174
6248
|
familyMembers: undefined,
|
|
6175
6249
|
confirmationIncome: { key: '', text: '' },
|
|
6176
|
-
|
|
6177
|
-
|
|
6250
|
+
wages: undefined,
|
|
6251
|
+
mandatoryPayments: undefined,
|
|
6178
6252
|
snils: '',
|
|
6179
6253
|
armyIdFlg: false,
|
|
6180
6254
|
},
|
|
@@ -6188,8 +6262,8 @@
|
|
|
6188
6262
|
{
|
|
6189
6263
|
regionRetail: '',
|
|
6190
6264
|
addressRetail: {
|
|
6191
|
-
|
|
6192
|
-
|
|
6265
|
+
key: '',
|
|
6266
|
+
text: '',
|
|
6193
6267
|
},
|
|
6194
6268
|
bankEmployeeCode: undefined,
|
|
6195
6269
|
addressCourier: {
|
|
@@ -6269,7 +6343,7 @@
|
|
|
6269
6343
|
return (jsxs("div", { className: "flex justify-between gap-m", children: [jsx(Button, { onClick: onPrevStep, className: style('w-full @xl:w-auto'), type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { className: "w-full @xl:w-auto", type: "submit", children: "\u0414\u0430\u043B\u0435\u0435" })] }));
|
|
6270
6344
|
});
|
|
6271
6345
|
|
|
6272
|
-
const getFifthStepData = (formData) => {
|
|
6346
|
+
const getFifthStepData$1 = (formData) => {
|
|
6273
6347
|
const { bankruptcyFlg, shareholderFlg, legalEntityName, creditInRshbCd } = formData;
|
|
6274
6348
|
return {
|
|
6275
6349
|
bankruptcyFlg,
|
|
@@ -6290,14 +6364,20 @@
|
|
|
6290
6364
|
};
|
|
6291
6365
|
|
|
6292
6366
|
const getFourthStepData$1 = (formData) => {
|
|
6293
|
-
const { familyStatus, dependents, familyMembers,
|
|
6367
|
+
const { familyStatus, dependents, familyMembers, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, } = formData;
|
|
6294
6368
|
return {
|
|
6295
6369
|
maritalStatusCd: familyStatus,
|
|
6296
6370
|
totalDependents: familyMembers,
|
|
6297
6371
|
otherDependents: dependents,
|
|
6298
6372
|
participantIncomes: getParticipantIncomes({
|
|
6299
|
-
|
|
6373
|
+
wages,
|
|
6374
|
+
mandatoryPayments,
|
|
6375
|
+
incomeAverage,
|
|
6376
|
+
additionalIncome,
|
|
6377
|
+
otherIncome,
|
|
6300
6378
|
otherPayments,
|
|
6379
|
+
rentalIncome,
|
|
6380
|
+
retirementIncome,
|
|
6301
6381
|
}),
|
|
6302
6382
|
snils: snils?.replaceAll(' ', ''),
|
|
6303
6383
|
armyIdFlg,
|
|
@@ -6411,7 +6491,7 @@
|
|
|
6411
6491
|
case 3:
|
|
6412
6492
|
return getFourthStepData$1(formData);
|
|
6413
6493
|
case 4:
|
|
6414
|
-
return getFifthStepData(formData);
|
|
6494
|
+
return getFifthStepData$1(formData);
|
|
6415
6495
|
case 5:
|
|
6416
6496
|
return getSixthStepData(formData);
|
|
6417
6497
|
default:
|
|
@@ -6688,11 +6768,11 @@
|
|
|
6688
6768
|
},
|
|
6689
6769
|
{
|
|
6690
6770
|
columns: 1,
|
|
6691
|
-
inputs: [{ fieldType: 'common', name: '
|
|
6771
|
+
inputs: [{ fieldType: 'common', name: 'wages', required: true }],
|
|
6692
6772
|
},
|
|
6693
6773
|
{
|
|
6694
6774
|
columns: 1,
|
|
6695
|
-
inputs: [{ fieldType: 'common', name: '
|
|
6775
|
+
inputs: [{ fieldType: 'common', name: 'mandatoryPayments', required: true }],
|
|
6696
6776
|
},
|
|
6697
6777
|
{
|
|
6698
6778
|
columns: 1,
|
|
@@ -6830,6 +6910,7 @@
|
|
|
6830
6910
|
];
|
|
6831
6911
|
const CreditCardForm = JSX(({ className, ...rest }) => {
|
|
6832
6912
|
const [step, setStep] = useState(0);
|
|
6913
|
+
useEffect(updateRefreshToken, []);
|
|
6833
6914
|
const handleNextStep = useCallback(() => {
|
|
6834
6915
|
setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
|
|
6835
6916
|
}, []);
|
|
@@ -6842,40 +6923,6 @@
|
|
|
6842
6923
|
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
|
|
6843
6924
|
});
|
|
6844
6925
|
|
|
6845
|
-
const PORTAL_NATURAL_URL = '/';
|
|
6846
|
-
const UPDATING_INTERVAL = 60000 * 4;
|
|
6847
|
-
const updateRefreshToken = () => {
|
|
6848
|
-
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
6849
|
-
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
6850
|
-
const taskId = globalThis.localStorage.getItem('taskId');
|
|
6851
|
-
if (!accessToken || !refreshToken || !taskId) {
|
|
6852
|
-
globalThis.location.href = PORTAL_NATURAL_URL;
|
|
6853
|
-
return () => null;
|
|
6854
|
-
}
|
|
6855
|
-
const updateTokenRequest = async () => {
|
|
6856
|
-
const res = await doRequest('/auth/refresh', 'POST', {
|
|
6857
|
-
// eslint-disable-next-line camelcase
|
|
6858
|
-
refresh_token: refreshToken,
|
|
6859
|
-
// eslint-disable-next-line camelcase
|
|
6860
|
-
access_token: accessToken,
|
|
6861
|
-
});
|
|
6862
|
-
if (res instanceof Response) {
|
|
6863
|
-
handleStatus(res.status);
|
|
6864
|
-
return;
|
|
6865
|
-
}
|
|
6866
|
-
globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
|
|
6867
|
-
globalThis.sessionStorage.setItem('accessToken', res.access_token);
|
|
6868
|
-
};
|
|
6869
|
-
updateTokenRequest();
|
|
6870
|
-
const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
|
|
6871
|
-
return () => clearInterval(timer);
|
|
6872
|
-
};
|
|
6873
|
-
const handleStatus = (status) => {
|
|
6874
|
-
if (status == 401) {
|
|
6875
|
-
globalThis.location.href = PORTAL_NATURAL_URL;
|
|
6876
|
-
}
|
|
6877
|
-
};
|
|
6878
|
-
|
|
6879
6926
|
const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
|
|
6880
6927
|
const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
|
|
6881
6928
|
return (jsx("div", { className: "py-lg px-5xl bg-white col-span-12", children: jsxs("div", { children: [jsxs("span", { className: "font-bold mr-s", children: ["\u0428\u0430\u0433 ", step, " \u0438\u0437 ", totalSteps, "."] }), stepsTitles[step] || null, jsx(ProgressBar, { step: progress, showPercentage: false })] }) }));
|
|
@@ -7067,8 +7114,8 @@
|
|
|
7067
7114
|
dependents: undefined,
|
|
7068
7115
|
familyMembers: undefined,
|
|
7069
7116
|
confirmationIncome: { key: '', text: '' },
|
|
7070
|
-
|
|
7071
|
-
|
|
7117
|
+
wages: undefined,
|
|
7118
|
+
mandatoryPayments: undefined,
|
|
7072
7119
|
snils: '',
|
|
7073
7120
|
armyIdFlg: false,
|
|
7074
7121
|
},
|
|
@@ -7153,6 +7200,13 @@
|
|
|
7153
7200
|
return (jsxs("div", { className: 'flex justify-between', children: [jsx(Button, { onClick: onPrevStep, className: style('w-full @xl:w-auto'), type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { className: style('w-full @xl:w-auto'), type: "submit", children: "\u0414\u0430\u043B\u0435\u0435" })] }));
|
|
7154
7201
|
});
|
|
7155
7202
|
|
|
7203
|
+
const getFifthStepData = (formData) => {
|
|
7204
|
+
const { addressRetail } = formData;
|
|
7205
|
+
return {
|
|
7206
|
+
office: addressRetail?.key ? { id: addressRetail.key } : undefined,
|
|
7207
|
+
};
|
|
7208
|
+
};
|
|
7209
|
+
|
|
7156
7210
|
const getFirstStepData = (formData) => {
|
|
7157
7211
|
const { name, surname, middleName, birthday = '', phone = '', email, sex, birthPlace, dulIssueDateField = '', dulIssuedBy, dulNumber, dulSerie, dulSubdivisionCode, education, participantDateRegistration = '', housing, addressRegistration, addressFact, } = formData;
|
|
7158
7212
|
return {
|
|
@@ -7217,15 +7271,21 @@
|
|
|
7217
7271
|
};
|
|
7218
7272
|
|
|
7219
7273
|
const getThirdStepData = (formData) => {
|
|
7220
|
-
const { familyStatus, dependents, familyMembers, confirmationIncome,
|
|
7274
|
+
const { familyStatus, dependents, familyMembers, confirmationIncome, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, } = formData;
|
|
7221
7275
|
return {
|
|
7222
7276
|
maritalStatusCd: familyStatus,
|
|
7223
7277
|
totalDependents: familyMembers,
|
|
7224
7278
|
incomeCertificateCd: confirmationIncome,
|
|
7225
7279
|
otherDependents: dependents,
|
|
7226
7280
|
participantIncomes: getParticipantIncomes({
|
|
7227
|
-
|
|
7281
|
+
wages,
|
|
7282
|
+
mandatoryPayments,
|
|
7283
|
+
incomeAverage,
|
|
7284
|
+
additionalIncome,
|
|
7285
|
+
otherIncome,
|
|
7228
7286
|
otherPayments,
|
|
7287
|
+
rentalIncome,
|
|
7288
|
+
retirementIncome,
|
|
7229
7289
|
}),
|
|
7230
7290
|
snils: snils?.replaceAll(' ', ''),
|
|
7231
7291
|
armyIdFlg,
|
|
@@ -7252,7 +7312,7 @@
|
|
|
7252
7312
|
taskSource: globalThis.location.origin,
|
|
7253
7313
|
id: taskId,
|
|
7254
7314
|
office: {
|
|
7255
|
-
id: '
|
|
7315
|
+
id: '',
|
|
7256
7316
|
},
|
|
7257
7317
|
authorizedAgentId: formData?.bankEmployeeCode,
|
|
7258
7318
|
participants: [
|
|
@@ -7269,6 +7329,7 @@
|
|
|
7269
7329
|
},
|
|
7270
7330
|
],
|
|
7271
7331
|
...getZeroStepData(formData),
|
|
7332
|
+
...getFifthStepData(formData),
|
|
7272
7333
|
esiaAccountTypeCd: {
|
|
7273
7334
|
key: formData?.esiaAccountTypeCd?.key,
|
|
7274
7335
|
},
|
|
@@ -7547,11 +7608,11 @@
|
|
|
7547
7608
|
},
|
|
7548
7609
|
{
|
|
7549
7610
|
columns: 1,
|
|
7550
|
-
inputs: [{ fieldType: 'common', name: '
|
|
7611
|
+
inputs: [{ fieldType: 'common', name: 'wages', required: true }],
|
|
7551
7612
|
},
|
|
7552
7613
|
{
|
|
7553
7614
|
columns: 1,
|
|
7554
|
-
inputs: [{ fieldType: 'common', name: '
|
|
7615
|
+
inputs: [{ fieldType: 'common', name: 'mandatoryPayments', required: true }],
|
|
7555
7616
|
},
|
|
7556
7617
|
{
|
|
7557
7618
|
columns: 1,
|
|
@@ -9917,7 +9978,7 @@
|
|
|
9917
9978
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9918
9979
|
});
|
|
9919
9980
|
|
|
9920
|
-
const packageVersion = "0.14.
|
|
9981
|
+
const packageVersion = "0.14.666";
|
|
9921
9982
|
|
|
9922
9983
|
exports.Blocks = Blocks;
|
|
9923
9984
|
exports.ContentPage = ContentPage;
|