ordering-ui-external 14.1.40 → 14.1.42
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/_bundles/{7.ordering-ui.2a09e7e0162e34ea955c.js → 7.ordering-ui.0bcf027ad972ccbec19e.js} +1 -1
- package/_bundles/{ordering-ui.2a09e7e0162e34ea955c.js → ordering-ui.0bcf027ad972ccbec19e.js} +2 -2
- package/_modules/themes/callcenterOriginal/src/components/AddressForm/SpreadForm/index.js +322 -0
- package/_modules/themes/callcenterOriginal/src/components/AddressForm/SpreadForm/styles.js +25 -0
- package/_modules/themes/callcenterOriginal/src/components/AddressForm/index.js +57 -58
- package/_modules/themes/callcenterOriginal/src/components/AddressForm/styles.js +3 -1
- package/_modules/themes/callcenterOriginal/src/components/AddressList/index.js +50 -20
- package/_modules/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +18 -26
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
- package/package.json +1 -1
- package/src/themes/callcenterOriginal/src/components/AddressForm/SpreadForm/index.js +251 -0
- package/src/themes/callcenterOriginal/src/components/AddressForm/SpreadForm/styles.js +111 -0
- package/src/themes/callcenterOriginal/src/components/AddressForm/index.js +246 -230
- package/src/themes/callcenterOriginal/src/components/AddressForm/styles.js +2 -3
- package/src/themes/callcenterOriginal/src/components/AddressList/index.js +243 -214
- package/src/themes/callcenterOriginal/src/components/PhoneAutocomplete/index.js +1 -11
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +1 -1
- /package/_bundles/{0.ordering-ui.2a09e7e0162e34ea955c.js → 0.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{1.ordering-ui.2a09e7e0162e34ea955c.js → 1.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{2.ordering-ui.2a09e7e0162e34ea955c.js → 2.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{4.ordering-ui.2a09e7e0162e34ea955c.js → 4.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{5.ordering-ui.2a09e7e0162e34ea955c.js → 5.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{6.ordering-ui.2a09e7e0162e34ea955c.js → 6.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{7.ordering-ui.2a09e7e0162e34ea955c.js.LICENSE.txt → 7.ordering-ui.0bcf027ad972ccbec19e.js.LICENSE.txt} +0 -0
- /package/_bundles/{8.ordering-ui.2a09e7e0162e34ea955c.js → 8.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{9.ordering-ui.2a09e7e0162e34ea955c.js → 9.ordering-ui.0bcf027ad972ccbec19e.js} +0 -0
- /package/_bundles/{ordering-ui.2a09e7e0162e34ea955c.js.LICENSE.txt → ordering-ui.0bcf027ad972ccbec19e.js.LICENSE.txt} +0 -0
|
@@ -57,11 +57,15 @@ const AddressFormUI = (props) => {
|
|
|
57
57
|
userCustomerSetup,
|
|
58
58
|
businessesList,
|
|
59
59
|
getBusinessDeliveryZones,
|
|
60
|
-
isEnableContinueButton,
|
|
61
60
|
address,
|
|
62
61
|
notUseCustomerInfo,
|
|
63
62
|
addFormRestrictions,
|
|
64
|
-
|
|
63
|
+
showSpreadForm,
|
|
64
|
+
isAllowUnaddressOrderType,
|
|
65
|
+
addressSpreadForm,
|
|
66
|
+
setAddressSpreadForm,
|
|
67
|
+
editSpreadAddress,
|
|
68
|
+
setEditSpreadAddress
|
|
65
69
|
} = props
|
|
66
70
|
|
|
67
71
|
const [configState] = useConfig()
|
|
@@ -88,6 +92,7 @@ const AddressFormUI = (props) => {
|
|
|
88
92
|
: formState.changes?.location ?? null
|
|
89
93
|
)
|
|
90
94
|
|
|
95
|
+
const businessZones = businessesList?.businesses?.map(business => business?.zones)
|
|
91
96
|
const maxLimitLocation = configState?.configs?.meters_to_change_address?.value
|
|
92
97
|
const googleMapsApiKey = configState?.configs?.google_maps_api_key?.value
|
|
93
98
|
const isLocationRequired = configState.configs?.google_autocomplete_selection_required?.value === '1' ||
|
|
@@ -249,7 +254,7 @@ const AddressFormUI = (props) => {
|
|
|
249
254
|
})
|
|
250
255
|
}
|
|
251
256
|
|
|
252
|
-
const handleChangeAddress = async (address) => {
|
|
257
|
+
const handleChangeAddress = async (address, updateFstValue = false) => {
|
|
253
258
|
if (address?.location) {
|
|
254
259
|
const result = await getBusinessDeliveryZones(address?.location)
|
|
255
260
|
setLocationChange(address?.location)
|
|
@@ -258,10 +263,13 @@ const AddressFormUI = (props) => {
|
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
setSelectedFromAutocomplete(true)
|
|
261
|
-
updateChanges(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
266
|
+
updateChanges(updateFstValue
|
|
267
|
+
? address
|
|
268
|
+
: {
|
|
269
|
+
...address,
|
|
270
|
+
address: googleInputRef?.current?.value
|
|
271
|
+
}
|
|
272
|
+
)
|
|
265
273
|
}
|
|
266
274
|
|
|
267
275
|
const setMapErrors = (errKey) => {
|
|
@@ -348,6 +356,7 @@ const AddressFormUI = (props) => {
|
|
|
348
356
|
|
|
349
357
|
return () => {
|
|
350
358
|
setFirstLocationNoEdit({ value: null })
|
|
359
|
+
setAddressSpreadForm(null)
|
|
351
360
|
}
|
|
352
361
|
}, [])
|
|
353
362
|
|
|
@@ -379,237 +388,250 @@ const AddressFormUI = (props) => {
|
|
|
379
388
|
}
|
|
380
389
|
}, [address])
|
|
381
390
|
|
|
391
|
+
useEffect(() => {
|
|
392
|
+
if (addressSpreadForm) {
|
|
393
|
+
handleChangeAddress(addressSpreadForm, true)
|
|
394
|
+
}
|
|
395
|
+
}, [addressSpreadForm])
|
|
396
|
+
|
|
382
397
|
return (
|
|
383
398
|
<div className='address-form'>
|
|
384
|
-
{props.beforeElements?.map((BeforeElement, i) => (
|
|
385
|
-
<React.Fragment key={i}>
|
|
386
|
-
{BeforeElement}
|
|
387
|
-
</React.Fragment>))}
|
|
388
|
-
{props.beforeComponents?.map((BeforeComponent, i) => (
|
|
389
|
-
<BeforeComponent key={i} {...props} />))}
|
|
390
399
|
{(configState.loading || addressState.loading) && (
|
|
391
400
|
<WrapperSkeleton>
|
|
392
401
|
<Skeleton height={50} count={5} style={{ marginBottom: '10px' }} />
|
|
393
402
|
</WrapperSkeleton>
|
|
394
403
|
)}
|
|
395
404
|
|
|
396
|
-
{!
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
</AddressWrap>
|
|
461
|
-
|
|
462
|
-
{(addressState?.address?.location || formState?.changes?.location) && (
|
|
463
|
-
<WrapperMap notUseCustomerInfo={notUseCustomerInfo} addFormRestrictions={addFormRestrictions}>
|
|
464
|
-
|
|
465
|
-
{!showMap && (
|
|
466
|
-
<section>
|
|
467
|
-
<GeoAlt style={{ fontSize: 25, marginRight: 5 }} />
|
|
468
|
-
{(addressState?.address?.address || formState?.changes?.address) && (
|
|
469
|
-
<span>{addressState?.address?.address || formState?.changes?.address}{', '}</span>
|
|
470
|
-
)}
|
|
471
|
-
{(addressState?.address?.country || formState?.changes?.country) && (
|
|
472
|
-
<span>{addressState?.address?.country || formState?.changes?.country}{', '}</span>
|
|
473
|
-
)}
|
|
474
|
-
{(addressState?.address?.address_notes || formState?.changes?.address_notes) && (
|
|
475
|
-
<span>{addressState?.address?.address_notes || formState?.changes?.address_notes}{', '}</span>
|
|
476
|
-
)}
|
|
477
|
-
{(addressState?.address?.internal_number || formState?.changes?.internal_number) && (
|
|
478
|
-
<span>{addressState?.address?.internal_number || formState?.changes?.internal_number}{', '}</span>
|
|
479
|
-
)}
|
|
480
|
-
{(addressState?.address?.zipcode || formState?.changes?.zipcode) && (
|
|
481
|
-
<span>{addressState?.address?.zipcode || formState?.changes?.zipcode}{', '}</span>
|
|
482
|
-
)}
|
|
483
|
-
<a
|
|
484
|
-
style={{ textDecoration: 'underline', color: 'blue', cursor: 'pointer' }}
|
|
485
|
-
onClick={() => setShowMap(!showMap)}
|
|
405
|
+
{(!showSpreadForm || (showSpreadForm && addressSpreadForm?.address)) && (
|
|
406
|
+
<>
|
|
407
|
+
{!configState.loading && !addressState.loading && (
|
|
408
|
+
<FormControl
|
|
409
|
+
onSubmit={formMethods.handleSubmit(onSubmit)}
|
|
410
|
+
onKeyDown={(e) => checkKeyDown(e)}
|
|
411
|
+
autoComplete='off'
|
|
412
|
+
>
|
|
413
|
+
{inputNames.map(field => showField && showField(field.name) && (
|
|
414
|
+
field.name === 'address' ? (
|
|
415
|
+
<React.Fragment key={field.name}>
|
|
416
|
+
<>
|
|
417
|
+
{!showSpreadForm && (
|
|
418
|
+
<AddressWrap className='google-control'>
|
|
419
|
+
<WrapAddressInput>
|
|
420
|
+
{!selectedFromAutocomplete && address?.address && (!address?.location?.lat || !address?.location?.lng) && (
|
|
421
|
+
<AddressMarkContainer>
|
|
422
|
+
<p>
|
|
423
|
+
{t('PLEASE_SELECT_GOOGLE_MAPS_ADDRESS', 'Please select an address given by google maps.')}
|
|
424
|
+
</p>
|
|
425
|
+
</AddressMarkContainer>
|
|
426
|
+
)}
|
|
427
|
+
<GoogleAutocompleteInput
|
|
428
|
+
className='input-autocomplete'
|
|
429
|
+
apiKey={googleMapsApiKey}
|
|
430
|
+
placeholder={t('ADDRESS', 'Address')}
|
|
431
|
+
onChangeAddress={(e) => {
|
|
432
|
+
formMethods.setValue('address', e.address)
|
|
433
|
+
handleChangeAddress(e)
|
|
434
|
+
}}
|
|
435
|
+
onChange={(e) => {
|
|
436
|
+
handleChangeInput({ target: { name: 'address', value: e.target.value } })
|
|
437
|
+
setAddressValue(e.target.value)
|
|
438
|
+
}}
|
|
439
|
+
childRef={(ref) => {
|
|
440
|
+
googleInputRef.current = ref
|
|
441
|
+
}}
|
|
442
|
+
defaultValue={
|
|
443
|
+
formState?.result?.result
|
|
444
|
+
? formState?.result?.result?.address
|
|
445
|
+
: formState?.changes?.address ?? addressValue
|
|
446
|
+
}
|
|
447
|
+
autoComplete='new-field'
|
|
448
|
+
countryCode={configState?.configs?.country_autocomplete?.value || '*'}
|
|
449
|
+
/>
|
|
450
|
+
</WrapAddressInput>
|
|
451
|
+
<GoogleGpsButton
|
|
452
|
+
className='gps-button'
|
|
453
|
+
apiKey={googleMapsApiKey}
|
|
454
|
+
onAddress={(e) => {
|
|
455
|
+
formMethods.setValue('address', e.address)
|
|
456
|
+
handleChangeAddress(e)
|
|
457
|
+
}}
|
|
458
|
+
onError={setMapErrors}
|
|
459
|
+
IconButton={GeoAlt}
|
|
460
|
+
IconLoadingButton={CgSearchLoading}
|
|
461
|
+
/>
|
|
462
|
+
</AddressWrap>
|
|
463
|
+
)}
|
|
464
|
+
{(addressState?.address?.location || formState?.changes?.location) && (
|
|
465
|
+
<WrapperMap
|
|
466
|
+
showMap={showMap || !showSpreadForm}
|
|
467
|
+
notUseCustomerInfo={notUseCustomerInfo}
|
|
468
|
+
addFormRestrictions={addFormRestrictions}
|
|
486
469
|
>
|
|
487
|
-
{
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
470
|
+
{!showMap && (
|
|
471
|
+
<section>
|
|
472
|
+
<GeoAlt style={{ fontSize: 25, marginRight: 5 }} />
|
|
473
|
+
{(addressState?.address?.address || formState?.changes?.address) && (
|
|
474
|
+
<span>{addressState?.address?.address || formState?.changes?.address}{', '}</span>
|
|
475
|
+
)}
|
|
476
|
+
{(addressState?.address?.country || formState?.changes?.country) && (
|
|
477
|
+
<span>{addressState?.address?.country || formState?.changes?.country}{', '}</span>
|
|
478
|
+
)}
|
|
479
|
+
{(addressState?.address?.address_notes || formState?.changes?.address_notes) && (
|
|
480
|
+
<span>{addressState?.address?.address_notes || formState?.changes?.address_notes}{', '}</span>
|
|
481
|
+
)}
|
|
482
|
+
{(addressState?.address?.internal_number || formState?.changes?.internal_number) && (
|
|
483
|
+
<span>{addressState?.address?.internal_number || formState?.changes?.internal_number}{', '}</span>
|
|
484
|
+
)}
|
|
485
|
+
{(addressState?.address?.zipcode || formState?.changes?.zipcode) && (
|
|
486
|
+
<span>{addressState?.address?.zipcode || formState?.changes?.zipcode}{', '}</span>
|
|
487
|
+
)}
|
|
488
|
+
<br />
|
|
489
|
+
<a
|
|
490
|
+
style={{ textDecoration: 'underline', color: 'blue', cursor: 'pointer' }}
|
|
491
|
+
onClick={() => setShowMap(!showMap)}
|
|
492
|
+
>
|
|
493
|
+
{t('SHOW_MAP', 'Show Map')}
|
|
494
|
+
</a>
|
|
495
|
+
{showSpreadForm && (
|
|
496
|
+
<a
|
|
497
|
+
style={{ textDecoration: 'underline', color: 'blue', cursor: 'pointer', marginLeft: 20 }}
|
|
498
|
+
onClick={() => setEditSpreadAddress(!editSpreadAddress)}
|
|
499
|
+
>
|
|
500
|
+
{t('EDIT_ADDRESS', 'Edit Address')}
|
|
501
|
+
</a>
|
|
502
|
+
)}
|
|
503
|
+
</section>
|
|
504
|
+
)}
|
|
505
|
+
|
|
506
|
+
{locationChange && showMap && (
|
|
507
|
+
<GoogleMapsMap
|
|
508
|
+
useMapWithBusinessZones
|
|
509
|
+
deactiveAlerts
|
|
510
|
+
avoidFitBounds
|
|
511
|
+
apiKey={googleMapsApiKey}
|
|
512
|
+
location={locationChange}
|
|
513
|
+
locations={businessesList?.businesses}
|
|
514
|
+
mapControls={googleMapsControls}
|
|
515
|
+
handleChangeAddressMap={handleChangeAddress}
|
|
516
|
+
setErrors={setMapErrors}
|
|
517
|
+
maxLimitLocation={parseInt(maxLimitLocation, 10)}
|
|
518
|
+
businessZones={businessZones}
|
|
519
|
+
fallbackIcon={theme.images?.dummies?.businessLogo}
|
|
520
|
+
/>
|
|
521
|
+
)}
|
|
522
|
+
{showMap && !editSpreadAddress && (
|
|
523
|
+
<>
|
|
524
|
+
{showSpreadForm && (
|
|
525
|
+
<StreetViewText style={{ top: '0' }} onClick={() => setEditSpreadAddress(!editSpreadAddress)}>
|
|
526
|
+
{t('EDIT_ADDRESS', 'Edit Address')}
|
|
527
|
+
</StreetViewText>
|
|
528
|
+
)}
|
|
529
|
+
<StreetViewText onClick={() => openStreetView()}>
|
|
530
|
+
{t('OPEN_STREET_VIEW', 'Open Street view')}
|
|
531
|
+
</StreetViewText>
|
|
532
|
+
</>
|
|
533
|
+
)}
|
|
534
|
+
</WrapperMap>
|
|
535
|
+
)}
|
|
536
|
+
</>
|
|
537
|
+
|
|
538
|
+
</React.Fragment>
|
|
539
|
+
) : (
|
|
540
|
+
<React.Fragment key={field.name}>
|
|
541
|
+
{field.name !== 'address_notes' ? (
|
|
542
|
+
<Input
|
|
543
|
+
className={field.name}
|
|
544
|
+
placeholder={t(field.name.toUpperCase(), field.code)}
|
|
545
|
+
value={formState.changes?.[field.name] ?? addressState.address?.[field.name] ?? ''}
|
|
546
|
+
onChange={(e) => {
|
|
547
|
+
formMethods.setValue(field.name, e.target.value)
|
|
548
|
+
handleChangeInput({ target: { name: field.name, value: e.target.value } })
|
|
549
|
+
}}
|
|
550
|
+
autoComplete='new-field'
|
|
551
|
+
maxLength={30}
|
|
552
|
+
/>
|
|
553
|
+
) : (
|
|
554
|
+
<TextArea
|
|
555
|
+
rows={4}
|
|
556
|
+
placeholder={t('ADDRESS_NOTES', 'Address Notes')}
|
|
557
|
+
value={formState.changes?.address_notes ?? addressState.address.address_notes ?? ''}
|
|
558
|
+
onChange={(e) => {
|
|
559
|
+
formMethods.setValue('address_notes', e.target.value)
|
|
560
|
+
handleChangeInput({ target: { name: 'address_notes', value: e.target.value } })
|
|
561
|
+
}}
|
|
562
|
+
autoComplete='new-field'
|
|
563
|
+
maxLength={250}
|
|
505
564
|
/>
|
|
506
565
|
)}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
<React.Fragment key={field.name}>
|
|
517
|
-
{field.name !== 'address_notes' ? (
|
|
518
|
-
<Input
|
|
519
|
-
className={field.name}
|
|
520
|
-
placeholder={t(field.name.toUpperCase(), field.code)}
|
|
521
|
-
value={formState.changes?.[field.name] ?? addressState.address?.[field.name] ?? ''}
|
|
522
|
-
onChange={(e) => {
|
|
523
|
-
formMethods.setValue(field.name, e.target.value)
|
|
524
|
-
handleChangeInput({ target: { name: field.name, value: e.target.value } })
|
|
525
|
-
}}
|
|
526
|
-
autoComplete='new-field'
|
|
527
|
-
maxLength={30}
|
|
528
|
-
/>
|
|
529
|
-
) : (
|
|
530
|
-
<TextArea
|
|
531
|
-
rows={4}
|
|
532
|
-
placeholder={t('ADDRESS_NOTES', 'Address Notes')}
|
|
533
|
-
value={formState.changes?.address_notes ?? addressState.address.address_notes ?? ''}
|
|
534
|
-
onChange={(e) => {
|
|
535
|
-
formMethods.setValue('address_notes', e.target.value)
|
|
536
|
-
handleChangeInput({ target: { name: 'address_notes', value: e.target.value } })
|
|
537
|
-
}}
|
|
538
|
-
autoComplete='new-field'
|
|
539
|
-
maxLength={250}
|
|
540
|
-
/>
|
|
541
|
-
)}
|
|
542
|
-
</React.Fragment>
|
|
543
|
-
)
|
|
544
|
-
))}
|
|
545
|
-
|
|
546
|
-
{!formState.loading && formState.error && <p style={{ color: '#c10000' }}>{formState.error}</p>}
|
|
547
|
-
|
|
548
|
-
<AddressTagSection>
|
|
549
|
-
<Button className={addressTag === 'home' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('home')}>
|
|
550
|
-
<span><House /></span>
|
|
551
|
-
</Button>
|
|
552
|
-
<Button className={addressTag === 'office' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('office')}>
|
|
553
|
-
<span><Building /></span>
|
|
554
|
-
</Button>
|
|
555
|
-
<Button className={addressTag === 'favorite' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('favorite')}>
|
|
556
|
-
<span><Heart /></span>
|
|
557
|
-
</Button>
|
|
558
|
-
<Button className={addressTag === 'other' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('other')}>
|
|
559
|
-
<span><PlusLg /></span>
|
|
560
|
-
</Button>
|
|
561
|
-
</AddressTagSection>
|
|
562
|
-
{
|
|
563
|
-
props.afterMidElements?.map((MidElement, i) => (
|
|
564
|
-
<React.Fragment key={i}>
|
|
565
|
-
{MidElement}
|
|
566
|
-
</React.Fragment>))
|
|
567
|
-
}
|
|
568
|
-
{
|
|
569
|
-
props.afterMidComponents?.map((MidComponent, i) => (
|
|
570
|
-
<MidComponent key={i} {...props} />))
|
|
571
|
-
}
|
|
572
|
-
<FormActions>
|
|
573
|
-
{
|
|
574
|
-
!addFormRestrictions && Object.keys(formState?.changes).length === 0 && (
|
|
575
|
-
<Button
|
|
576
|
-
outline
|
|
577
|
-
type='button'
|
|
578
|
-
disabled={formState.loading}
|
|
579
|
-
onClick={() => onCancel()}
|
|
580
|
-
hoverColor='#CCC'
|
|
581
|
-
>
|
|
582
|
-
{t('CANCEL', 'Cancel')}
|
|
566
|
+
</React.Fragment>
|
|
567
|
+
)
|
|
568
|
+
))}
|
|
569
|
+
|
|
570
|
+
{!formState.loading && formState.error && <p style={{ color: '#c10000' }}>{formState.error}</p>}
|
|
571
|
+
|
|
572
|
+
<AddressTagSection>
|
|
573
|
+
<Button className={addressTag === 'home' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('home')}>
|
|
574
|
+
<span><House /></span>
|
|
583
575
|
</Button>
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
576
|
+
<Button className={addressTag === 'office' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('office')}>
|
|
577
|
+
<span><Building /></span>
|
|
578
|
+
</Button>
|
|
579
|
+
<Button className={addressTag === 'favorite' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('favorite')}>
|
|
580
|
+
<span><Heart /></span>
|
|
581
|
+
</Button>
|
|
582
|
+
<Button className={addressTag === 'other' ? 'active' : ''} bgtransparent type='button' onClick={() => handleAddressTag('other')}>
|
|
583
|
+
<span><PlusLg /></span>
|
|
584
|
+
</Button>
|
|
585
|
+
</AddressTagSection>
|
|
586
|
+
<FormActions>
|
|
587
|
+
{
|
|
588
|
+
!addFormRestrictions && Object.keys(formState?.changes).length === 0 && (
|
|
589
|
+
<Button
|
|
590
|
+
outline
|
|
591
|
+
type='button'
|
|
592
|
+
disabled={formState.loading}
|
|
593
|
+
onClick={() => onCancel()}
|
|
594
|
+
hoverColor='#CCC'
|
|
595
|
+
>
|
|
596
|
+
{t('CANCEL', 'Cancel')}
|
|
597
|
+
</Button>
|
|
598
|
+
)
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
{!(
|
|
602
|
+
!selectedFromAutocomplete &&
|
|
603
|
+
address?.address &&
|
|
604
|
+
(!address?.location?.lat || !address?.location?.lng)) &&
|
|
605
|
+
Object.keys(formState?.changes).length > 0 &&
|
|
606
|
+
(
|
|
607
|
+
<Button
|
|
608
|
+
id='submit-btn'
|
|
609
|
+
type='submit'
|
|
610
|
+
disabled={formState.loading}
|
|
611
|
+
color='primary'
|
|
612
|
+
>
|
|
613
|
+
{!formState.loading ? (
|
|
614
|
+
<>
|
|
615
|
+
{
|
|
616
|
+
isEditing || (!auth && orderState.options?.address?.address)
|
|
617
|
+
? t('SAVE_AND_CONTINUE', 'Save and continue')
|
|
618
|
+
: t('ADD_ADDRESS', 'Add address')
|
|
619
|
+
}
|
|
620
|
+
</>
|
|
621
|
+
) : (
|
|
622
|
+
t('LOADING', 'Loading')
|
|
623
|
+
)}
|
|
624
|
+
</Button>
|
|
603
625
|
)}
|
|
604
|
-
</
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
</
|
|
626
|
+
</FormActions>
|
|
627
|
+
{isAllowUnaddressOrderType && (
|
|
628
|
+
<WithoutAddressContainer>
|
|
629
|
+
<WithoutAddressText onClick={() => events.emit('go_to_page', { page: 'search' })}>{t('CONTINUE_WITHOUT_ADDRESS', 'Continue without address')}</WithoutAddressText>
|
|
630
|
+
</WithoutAddressContainer>
|
|
631
|
+
)}
|
|
632
|
+
</FormControl>
|
|
611
633
|
)}
|
|
612
|
-
|
|
634
|
+
</>
|
|
613
635
|
)}
|
|
614
636
|
|
|
615
637
|
<Alert
|
|
@@ -621,12 +643,6 @@ const AddressFormUI = (props) => {
|
|
|
621
643
|
onAccept={() => closeAlert()}
|
|
622
644
|
closeOnBackdrop={false}
|
|
623
645
|
/>
|
|
624
|
-
{props.afterComponents?.map((AfterComponent, i) => (
|
|
625
|
-
<AfterComponent key={i} {...props} />))}
|
|
626
|
-
{props.afterElements?.map((AfterElement, i) => (
|
|
627
|
-
<React.Fragment key={i}>
|
|
628
|
-
{AfterElement}
|
|
629
|
-
</React.Fragment>))}
|
|
630
646
|
</div>
|
|
631
647
|
)
|
|
632
648
|
}
|
|
@@ -199,12 +199,11 @@ export const AddressTagSection = styled.div`
|
|
|
199
199
|
|
|
200
200
|
export const WrapperMap = styled.div`
|
|
201
201
|
z-index: 100;
|
|
202
|
-
width:
|
|
202
|
+
width: 48%;
|
|
203
203
|
position: absolute;
|
|
204
204
|
bottom: 2%;
|
|
205
205
|
right: 0;
|
|
206
|
-
padding-
|
|
207
|
-
padding-top: 30px;
|
|
206
|
+
padding-top: ${props => props.showMap ? '30px' : 0};
|
|
208
207
|
height: ${({ notUseCustomerInfo }) =>
|
|
209
208
|
notUseCustomerInfo
|
|
210
209
|
? '370px'
|