@open-mercato/core 0.6.6-develop.6529.1.e1de4b3f27 → 0.6.6-develop.6531.1.87e9d31db6
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/.turbo/turbo-build.log +1 -1
- package/dist/modules/dictionaries/fields/dictionary.js +56 -41
- package/dist/modules/dictionaries/fields/dictionary.js.map +2 -2
- package/dist/modules/entities/backend/entities/system/[entityId]/page.meta.js +1 -0
- package/dist/modules/entities/backend/entities/system/[entityId]/page.meta.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js +49 -49
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/page.meta.js +1 -0
- package/dist/modules/entities/backend/entities/user/[entityId]/page.meta.js.map +2 -2
- package/dist/modules/sales/components/documents/AddressesSection.js +6 -2
- package/dist/modules/sales/components/documents/AddressesSection.js.map +2 -2
- package/dist/modules/sales/components/documents/SalesDocumentForm.js +44 -0
- package/dist/modules/sales/components/documents/SalesDocumentForm.js.map +2 -2
- package/dist/modules/sales/components/documents/ShipmentDialog.js +59 -38
- package/dist/modules/sales/components/documents/ShipmentDialog.js.map +2 -2
- package/package.json +7 -7
- package/src/modules/dictionaries/fields/dictionary.tsx +55 -32
- package/src/modules/dictionaries/i18n/de.json +2 -0
- package/src/modules/dictionaries/i18n/en.json +2 -0
- package/src/modules/dictionaries/i18n/es.json +2 -0
- package/src/modules/dictionaries/i18n/pl.json +2 -0
- package/src/modules/entities/backend/entities/system/[entityId]/page.meta.ts +1 -0
- package/src/modules/entities/backend/entities/user/[entityId]/page.meta.ts +1 -0
- package/src/modules/entities/backend/entities/user/[entityId]/page.tsx +51 -49
- package/src/modules/entities/i18n/de.json +34 -0
- package/src/modules/entities/i18n/en.json +34 -0
- package/src/modules/entities/i18n/es.json +34 -0
- package/src/modules/entities/i18n/pl.json +34 -0
- package/src/modules/sales/components/documents/AddressesSection.tsx +6 -2
- package/src/modules/sales/components/documents/SalesDocumentForm.tsx +46 -0
- package/src/modules/sales/components/documents/ShipmentDialog.tsx +65 -40
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"entities.customFields.editor.noFieldsets": "Aún no se han definido conjuntos de campos. Los conjuntos de campos permiten agrupar campos personalizados para distintas variantes de la misma entidad (p. ej. productos de Moda vs. Deporte).",
|
|
94
94
|
"entities.customFields.editor.noGroup": "Sin grupo",
|
|
95
95
|
"entities.customFields.editor.noOptionsDefined": "No se han definido opciones.",
|
|
96
|
+
"entities.customFields.editor.noParameterPlaceholder": "-",
|
|
96
97
|
"entities.customFields.editor.noValidationRules": "No se han definido reglas de validación.",
|
|
97
98
|
"entities.customFields.editor.optionLabelPlaceholder": "Etiqueta visible para los usuarios (opcional)",
|
|
98
99
|
"entities.customFields.editor.options": "Opciones",
|
|
@@ -118,6 +119,17 @@
|
|
|
118
119
|
"entities.customFields.editor.unassignedFields": "Campos sin asignar",
|
|
119
120
|
"entities.customFields.editor.unitsOptional": "Unidades (opcional)",
|
|
120
121
|
"entities.customFields.editor.unitsPlaceholder": "kg, cm, etc.",
|
|
122
|
+
"entities.customFields.editor.validation.date": "fecha",
|
|
123
|
+
"entities.customFields.editor.validation.eq": "igual",
|
|
124
|
+
"entities.customFields.editor.validation.float": "decimal",
|
|
125
|
+
"entities.customFields.editor.validation.gt": "mayor que",
|
|
126
|
+
"entities.customFields.editor.validation.gte": "mayor o igual",
|
|
127
|
+
"entities.customFields.editor.validation.integer": "entero",
|
|
128
|
+
"entities.customFields.editor.validation.lt": "menor que",
|
|
129
|
+
"entities.customFields.editor.validation.lte": "menor o igual",
|
|
130
|
+
"entities.customFields.editor.validation.ne": "distinto",
|
|
131
|
+
"entities.customFields.editor.validation.regex": "regex",
|
|
132
|
+
"entities.customFields.editor.validation.required": "obligatorio",
|
|
121
133
|
"entities.customFields.editor.validationRules": "Reglas de validación",
|
|
122
134
|
"entities.customFields.editor.value": "Valor",
|
|
123
135
|
"entities.customFields.editor.valueRequired": "El valor es obligatorio",
|
|
@@ -183,6 +195,28 @@
|
|
|
183
195
|
"entities.nav.systemEntities": "Entidades del sistema",
|
|
184
196
|
"entities.nav.userEntities": "Entidades de usuario",
|
|
185
197
|
"entities.nav.userEntities.create": "Crear entidad",
|
|
198
|
+
"entities.userEntities.edit.errors.deleteEntityFailed": "No se pudo eliminar la entidad",
|
|
199
|
+
"entities.userEntities.edit.errors.invalidEntityDescription": "Falta el ID de la entidad solicitada o no es válido.",
|
|
200
|
+
"entities.userEntities.edit.errors.invalidEntityId": "ID de entidad no válido",
|
|
201
|
+
"entities.userEntities.edit.errors.invalidEntityTitle": "Entidad no válida",
|
|
202
|
+
"entities.userEntities.edit.errors.loadDefinitionsFailed": "No se pudieron cargar las definiciones de la entidad",
|
|
203
|
+
"entities.userEntities.edit.errors.loadFailed": "No se pudo cargar",
|
|
204
|
+
"entities.userEntities.edit.errors.loadMetadataFailed": "No se pudieron cargar los metadatos de la entidad",
|
|
205
|
+
"entities.userEntities.edit.errors.reloadDefinitionsFailed": "No se pudieron recargar las definiciones de campos",
|
|
206
|
+
"entities.userEntities.edit.errors.restoreFieldFailed": "No se pudo restaurar el campo",
|
|
207
|
+
"entities.userEntities.edit.errors.saveEntityFailed": "No se pudo guardar la entidad",
|
|
208
|
+
"entities.userEntities.edit.errors.saveOrderFailed": "No se pudo guardar el orden",
|
|
209
|
+
"entities.userEntities.edit.errors.validationFailed": "La validación falló",
|
|
210
|
+
"entities.userEntities.edit.fieldsetTitle": "Editar conjunto: {{name}}",
|
|
211
|
+
"entities.userEntities.edit.flash.entityDeleted": "Entidad eliminada",
|
|
212
|
+
"entities.userEntities.edit.flash.orderSaved": "Orden guardado",
|
|
213
|
+
"entities.userEntities.edit.flash.restoredField": "{{key}} restaurado",
|
|
214
|
+
"entities.userEntities.edit.groups.definitions": "Definiciones de campos",
|
|
215
|
+
"entities.userEntities.edit.groups.settings": "Configuración de la entidad",
|
|
216
|
+
"entities.userEntities.edit.orderNotice": "Reordenado - se guardará al salir del campo",
|
|
217
|
+
"entities.userEntities.edit.pageTitle": "Editar definiciones",
|
|
218
|
+
"entities.userEntities.edit.showRecords": "Mostrar registros",
|
|
219
|
+
"entities.userEntities.edit.title": "Editar entidad: {{entityId}}",
|
|
186
220
|
"entities.userEntities.errors.entityIdExists": "El ID de la entidad ya existe",
|
|
187
221
|
"entities.userEntities.errors.entityIdRequired": "El ID de la entidad es obligatorio",
|
|
188
222
|
"entities.userEntities.errors.loadFailed": "No se pudieron cargar las entidades",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"entities.customFields.editor.noFieldsets": "Nie zdefiniowano jeszcze zestawów pól. Zestawy pól pozwalają grupować pola niestandardowe dla różnych wariantów tej samej encji (np. produkty Moda vs Sport).",
|
|
94
94
|
"entities.customFields.editor.noGroup": "Bez grupy",
|
|
95
95
|
"entities.customFields.editor.noOptionsDefined": "Nie zdefiniowano opcji.",
|
|
96
|
+
"entities.customFields.editor.noParameterPlaceholder": "-",
|
|
96
97
|
"entities.customFields.editor.noValidationRules": "Nie zdefiniowano reguł walidacji.",
|
|
97
98
|
"entities.customFields.editor.optionLabelPlaceholder": "Etykieta widoczna dla użytkowników (opcjonalnie)",
|
|
98
99
|
"entities.customFields.editor.options": "Opcje",
|
|
@@ -118,6 +119,17 @@
|
|
|
118
119
|
"entities.customFields.editor.unassignedFields": "Pola nieprzypisane",
|
|
119
120
|
"entities.customFields.editor.unitsOptional": "Jednostki (opcjonalnie)",
|
|
120
121
|
"entities.customFields.editor.unitsPlaceholder": "kg, cm itp.",
|
|
122
|
+
"entities.customFields.editor.validation.date": "data",
|
|
123
|
+
"entities.customFields.editor.validation.eq": "równe",
|
|
124
|
+
"entities.customFields.editor.validation.float": "liczba zmiennoprzecinkowa",
|
|
125
|
+
"entities.customFields.editor.validation.gt": "większe niż",
|
|
126
|
+
"entities.customFields.editor.validation.gte": "większe lub równe",
|
|
127
|
+
"entities.customFields.editor.validation.integer": "liczba całkowita",
|
|
128
|
+
"entities.customFields.editor.validation.lt": "mniejsze niż",
|
|
129
|
+
"entities.customFields.editor.validation.lte": "mniejsze lub równe",
|
|
130
|
+
"entities.customFields.editor.validation.ne": "różne",
|
|
131
|
+
"entities.customFields.editor.validation.regex": "regex",
|
|
132
|
+
"entities.customFields.editor.validation.required": "wymagane",
|
|
121
133
|
"entities.customFields.editor.validationRules": "Reguły walidacji",
|
|
122
134
|
"entities.customFields.editor.value": "Wartość",
|
|
123
135
|
"entities.customFields.editor.valueRequired": "Wartość jest wymagana",
|
|
@@ -183,6 +195,28 @@
|
|
|
183
195
|
"entities.nav.systemEntities": "Encje systemowe",
|
|
184
196
|
"entities.nav.userEntities": "Encje użytkownika",
|
|
185
197
|
"entities.nav.userEntities.create": "Utwórz encję",
|
|
198
|
+
"entities.userEntities.edit.errors.deleteEntityFailed": "Nie udało się usunąć encji",
|
|
199
|
+
"entities.userEntities.edit.errors.invalidEntityDescription": "Brakuje identyfikatora encji albo jest on nieprawidłowy.",
|
|
200
|
+
"entities.userEntities.edit.errors.invalidEntityId": "Nieprawidłowy identyfikator encji",
|
|
201
|
+
"entities.userEntities.edit.errors.invalidEntityTitle": "Nieprawidłowa encja",
|
|
202
|
+
"entities.userEntities.edit.errors.loadDefinitionsFailed": "Nie udało się wczytać definicji encji",
|
|
203
|
+
"entities.userEntities.edit.errors.loadFailed": "Nie udało się wczytać",
|
|
204
|
+
"entities.userEntities.edit.errors.loadMetadataFailed": "Nie udało się wczytać metadanych encji",
|
|
205
|
+
"entities.userEntities.edit.errors.reloadDefinitionsFailed": "Nie udało się ponownie wczytać definicji pól",
|
|
206
|
+
"entities.userEntities.edit.errors.restoreFieldFailed": "Nie udało się przywrócić pola",
|
|
207
|
+
"entities.userEntities.edit.errors.saveEntityFailed": "Nie udało się zapisać encji",
|
|
208
|
+
"entities.userEntities.edit.errors.saveOrderFailed": "Nie udało się zapisać kolejności",
|
|
209
|
+
"entities.userEntities.edit.errors.validationFailed": "Walidacja nie powiodła się",
|
|
210
|
+
"entities.userEntities.edit.fieldsetTitle": "Edytuj zestaw pól: {{name}}",
|
|
211
|
+
"entities.userEntities.edit.flash.entityDeleted": "Encja została usunięta",
|
|
212
|
+
"entities.userEntities.edit.flash.orderSaved": "Kolejność została zapisana",
|
|
213
|
+
"entities.userEntities.edit.flash.restoredField": "Przywrócono {{key}}",
|
|
214
|
+
"entities.userEntities.edit.groups.definitions": "Definicje pól",
|
|
215
|
+
"entities.userEntities.edit.groups.settings": "Ustawienia encji",
|
|
216
|
+
"entities.userEntities.edit.orderNotice": "Zmieniono kolejność - zapisze się po opuszczeniu pola",
|
|
217
|
+
"entities.userEntities.edit.pageTitle": "Edytuj definicje",
|
|
218
|
+
"entities.userEntities.edit.showRecords": "Pokaż rekordy",
|
|
219
|
+
"entities.userEntities.edit.title": "Edytuj encję: {{entityId}}",
|
|
186
220
|
"entities.userEntities.errors.entityIdExists": "Identyfikator encji już istnieje",
|
|
187
221
|
"entities.userEntities.errors.entityIdRequired": "Identyfikator encji jest wymagany",
|
|
188
222
|
"entities.userEntities.errors.loadFailed": "Nie udało się wczytać encji",
|
|
@@ -890,8 +890,12 @@ export function SalesDocumentAddressesSection({
|
|
|
890
890
|
if (res?.result?.id) billingId = res.result.id
|
|
891
891
|
}
|
|
892
892
|
|
|
893
|
-
|
|
894
|
-
|
|
893
|
+
if (shippingSnapshot || !shippingId) {
|
|
894
|
+
payload.shippingAddressSnapshot = shippingSnapshot ?? null
|
|
895
|
+
}
|
|
896
|
+
if (billingSnapshot || !billingId) {
|
|
897
|
+
payload.billingAddressSnapshot = billingSnapshot ?? null
|
|
898
|
+
}
|
|
895
899
|
payload.shippingAddressId = shippingSnapshot ? null : shippingId
|
|
896
900
|
payload.billingAddressId = billingSnapshot ? null : billingId
|
|
897
901
|
|
|
@@ -168,6 +168,7 @@ function CustomerQuickCreate({ t, onCreated }: CustomerQuickCreateProps) {
|
|
|
168
168
|
async (values: PersonFormValues) => {
|
|
169
169
|
setSaving(true)
|
|
170
170
|
try {
|
|
171
|
+
const addresses = Array.isArray(values.addresses) ? values.addresses : []
|
|
171
172
|
const payload = buildPersonPayload(values, organizationId)
|
|
172
173
|
const { result } = await createCrud<{ id?: string; entityId?: string }>('customers/people', payload, {
|
|
173
174
|
errorMessage: t('sales.documents.form.customer.quick.error', 'Failed to create customer.'),
|
|
@@ -177,6 +178,51 @@ function CustomerQuickCreate({ t, onCreated }: CustomerQuickCreateProps) {
|
|
|
177
178
|
(result && typeof result.id === 'string' && result.id) ||
|
|
178
179
|
null
|
|
179
180
|
if (!id) throw new Error('Missing customer id')
|
|
181
|
+
if (addresses.length) {
|
|
182
|
+
const normalize = (value?: string | null) => {
|
|
183
|
+
if (typeof value !== 'string') return undefined
|
|
184
|
+
const trimmed = value.trim()
|
|
185
|
+
return trimmed.length ? trimmed : undefined
|
|
186
|
+
}
|
|
187
|
+
for (const entry of addresses) {
|
|
188
|
+
const normalizedLine1 = normalize(entry.addressLine1)
|
|
189
|
+
if (!normalizedLine1) continue
|
|
190
|
+
const body: Record<string, unknown> = {
|
|
191
|
+
entityId: id,
|
|
192
|
+
...(organizationId ? { organizationId } : {}),
|
|
193
|
+
addressLine1: normalizedLine1,
|
|
194
|
+
isPrimary: entry.isPrimary ?? false,
|
|
195
|
+
}
|
|
196
|
+
const name = normalize(entry.name)
|
|
197
|
+
if (name !== undefined) body.name = name
|
|
198
|
+
const purpose = normalize(entry.purpose)
|
|
199
|
+
if (purpose !== undefined) body.purpose = purpose
|
|
200
|
+
const line2 = normalize(entry.addressLine2)
|
|
201
|
+
if (line2 !== undefined) body.addressLine2 = line2
|
|
202
|
+
const buildingNumber = normalize(entry.buildingNumber)
|
|
203
|
+
if (buildingNumber !== undefined) body.buildingNumber = buildingNumber
|
|
204
|
+
const flatNumber = normalize(entry.flatNumber)
|
|
205
|
+
if (flatNumber !== undefined) body.flatNumber = flatNumber
|
|
206
|
+
const city = normalize(entry.city)
|
|
207
|
+
if (city !== undefined) body.city = city
|
|
208
|
+
const region = normalize(entry.region)
|
|
209
|
+
if (region !== undefined) body.region = region
|
|
210
|
+
const postalCode = normalize(entry.postalCode)
|
|
211
|
+
if (postalCode !== undefined) body.postalCode = postalCode
|
|
212
|
+
const country = normalize(entry.country)
|
|
213
|
+
if (country !== undefined) body.country = country.toUpperCase()
|
|
214
|
+
if (typeof entry.latitude === 'number') body.latitude = entry.latitude
|
|
215
|
+
if (typeof entry.longitude === 'number') body.longitude = entry.longitude
|
|
216
|
+
try {
|
|
217
|
+
await createCrud('customers/addresses', body)
|
|
218
|
+
} catch (addressErr) {
|
|
219
|
+
const message =
|
|
220
|
+
(addressErr instanceof Error && addressErr.message ? addressErr.message : null) ||
|
|
221
|
+
t('customers.people.detail.addresses.error')
|
|
222
|
+
flash(message, 'error')
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
180
226
|
const displayName =
|
|
181
227
|
typeof values.displayName === 'string' && values.displayName.trim().length
|
|
182
228
|
? values.displayName.trim()
|
|
@@ -296,6 +296,13 @@ export function ShipmentDialog({
|
|
|
296
296
|
const [addressOptions, setAddressOptions] = React.useState<ShipmentAddressOption[]>([])
|
|
297
297
|
const [addressLoading, setAddressLoading] = React.useState(false)
|
|
298
298
|
const [addressError, setAddressError] = React.useState<string | null>(null)
|
|
299
|
+
const addressLoadPromiseRef = React.useRef<{
|
|
300
|
+
orderId: string
|
|
301
|
+
promise: Promise<ShipmentAddressOption[]>
|
|
302
|
+
} | null>(null)
|
|
303
|
+
const currentAddressOrderIdRef = React.useRef(orderId)
|
|
304
|
+
currentAddressOrderIdRef.current = orderId
|
|
305
|
+
const initializedDialogKeyRef = React.useRef<string | null>(null)
|
|
299
306
|
const [documentStatuses, setDocumentStatuses] = React.useState<StatusOption[]>([])
|
|
300
307
|
const [lineStatuses, setLineStatuses] = React.useState<StatusOption[]>([])
|
|
301
308
|
const [shipmentStatuses, setShipmentStatuses] = React.useState<StatusOption[]>([])
|
|
@@ -479,37 +486,52 @@ export function ShipmentDialog({
|
|
|
479
486
|
[],
|
|
480
487
|
)
|
|
481
488
|
|
|
482
|
-
const loadAddressOptions = React.useCallback(
|
|
489
|
+
const loadAddressOptions = React.useCallback((): Promise<ShipmentAddressOption[]> => {
|
|
490
|
+
const activeRequest = addressLoadPromiseRef.current
|
|
491
|
+
if (activeRequest?.orderId === orderId) return activeRequest.promise
|
|
492
|
+
|
|
483
493
|
setAddressLoading(true)
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
494
|
+
const request = (async () => {
|
|
495
|
+
try {
|
|
496
|
+
const params = new URLSearchParams({
|
|
497
|
+
page: '1',
|
|
498
|
+
pageSize: '100',
|
|
499
|
+
documentId: orderId,
|
|
500
|
+
documentKind: 'order',
|
|
501
|
+
})
|
|
502
|
+
const response = await apiCall<{ items?: Array<Record<string, unknown>> }>(
|
|
503
|
+
`/api/sales/document-addresses?${params.toString()}`,
|
|
504
|
+
undefined,
|
|
505
|
+
{ fallback: { items: [] } },
|
|
506
|
+
)
|
|
507
|
+
const items = Array.isArray(response.result?.items) ? response.result.items : []
|
|
508
|
+
const mapped = items
|
|
509
|
+
.map((item) => mapDocumentAddressOption(item))
|
|
510
|
+
.filter((entry): entry is ShipmentAddressOption => Boolean(entry))
|
|
511
|
+
const loadedOptions = dedupeAddressOptions([...baseAddressOptions, ...mapped])
|
|
512
|
+
if (currentAddressOrderIdRef.current !== orderId) return baseAddressOptions
|
|
513
|
+
mergeAddressOptions(loadedOptions)
|
|
514
|
+
setAddressError(null)
|
|
515
|
+
return loadedOptions
|
|
516
|
+
} catch (err) {
|
|
517
|
+
logger.error('sales.shipments.addresses.load', { err })
|
|
518
|
+
if (currentAddressOrderIdRef.current === orderId) {
|
|
519
|
+
setAddressError(
|
|
520
|
+
t('sales.documents.shipments.addressLoadError', 'Failed to load addresses.'),
|
|
521
|
+
)
|
|
522
|
+
}
|
|
523
|
+
return baseAddressOptions
|
|
524
|
+
}
|
|
525
|
+
})()
|
|
526
|
+
addressLoadPromiseRef.current = { orderId, promise: request }
|
|
527
|
+
void request.then(() => {
|
|
528
|
+
if (addressLoadPromiseRef.current?.promise === request) {
|
|
529
|
+
addressLoadPromiseRef.current = null
|
|
530
|
+
setAddressLoading(false)
|
|
531
|
+
}
|
|
532
|
+
})
|
|
533
|
+
return request
|
|
534
|
+
}, [baseAddressOptions, mapDocumentAddressOption, mergeAddressOptions, orderId, t])
|
|
513
535
|
|
|
514
536
|
const buildPriceSubtitle = React.useCallback(
|
|
515
537
|
(option: ShippingMethodOption): string | undefined => {
|
|
@@ -851,16 +873,20 @@ export function ShipmentDialog({
|
|
|
851
873
|
)
|
|
852
874
|
|
|
853
875
|
React.useEffect(() => {
|
|
854
|
-
if (!open)
|
|
876
|
+
if (!open) {
|
|
877
|
+
initializedDialogKeyRef.current = null
|
|
878
|
+
return
|
|
879
|
+
}
|
|
880
|
+
const dialogKey = `${orderId}:${mode}:${shipment?.id ?? 'new'}`
|
|
881
|
+
if (initializedDialogKeyRef.current === dialogKey) return
|
|
882
|
+
initializedDialogKeyRef.current = dialogKey
|
|
855
883
|
setFormResetKey((prev) => prev + 1)
|
|
856
884
|
if (!shippingMethods.length) {
|
|
857
885
|
void loadShippingMethods()
|
|
858
886
|
}
|
|
859
887
|
setAddressOptions(baseAddressOptions)
|
|
860
888
|
setAddressError(null)
|
|
861
|
-
|
|
862
|
-
void loadAddressOptions()
|
|
863
|
-
}
|
|
889
|
+
void loadAddressOptions()
|
|
864
890
|
if (!shipmentStatuses.length) {
|
|
865
891
|
void loadShipmentStatuses()
|
|
866
892
|
}
|
|
@@ -871,7 +897,6 @@ export function ShipmentDialog({
|
|
|
871
897
|
void loadLineStatuses()
|
|
872
898
|
}
|
|
873
899
|
}, [
|
|
874
|
-
addressOptions.length,
|
|
875
900
|
baseAddressOptions,
|
|
876
901
|
documentStatuses.length,
|
|
877
902
|
loadAddressOptions,
|
|
@@ -881,6 +906,8 @@ export function ShipmentDialog({
|
|
|
881
906
|
loadShippingMethods,
|
|
882
907
|
mode,
|
|
883
908
|
open,
|
|
909
|
+
orderId,
|
|
910
|
+
shipment?.id,
|
|
884
911
|
lineStatuses.length,
|
|
885
912
|
shipmentStatuses.length,
|
|
886
913
|
shippingMethods.length,
|
|
@@ -939,11 +966,9 @@ export function ShipmentDialog({
|
|
|
939
966
|
|
|
940
967
|
const fetchAddressItems = React.useCallback(
|
|
941
968
|
async (query?: string): Promise<LookupSelectItem[]> => {
|
|
942
|
-
|
|
943
|
-
await loadAddressOptions()
|
|
944
|
-
}
|
|
969
|
+
const options = addressOptions.length ? addressOptions : await loadAddressOptions()
|
|
945
970
|
const needle = query?.trim().toLowerCase() ?? ''
|
|
946
|
-
return
|
|
971
|
+
return options
|
|
947
972
|
.filter((option) => {
|
|
948
973
|
if (!needle) return true
|
|
949
974
|
return (
|
|
@@ -962,7 +987,7 @@ export function ShipmentDialog({
|
|
|
962
987
|
),
|
|
963
988
|
}))
|
|
964
989
|
},
|
|
965
|
-
[
|
|
990
|
+
[addressOptions, loadAddressOptions],
|
|
966
991
|
)
|
|
967
992
|
|
|
968
993
|
const validateItems = React.useCallback(
|