@acorex-platform/module-location-management-client 0.0.32 → 0.0.37

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.
Files changed (41) hide show
  1. package/fesm2022/acorex-platform-module-location-management-client-assign-existing-location-to-party.command-DECKrIBR.mjs.map +1 -1
  2. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-geographic-region.mjs +782 -0
  3. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-geographic-region.mjs.map +1 -0
  4. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location-assignment.mjs +400 -0
  5. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location-assignment.mjs.map +1 -0
  6. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location-role.mjs +156 -0
  7. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location-role.mjs.map +1 -0
  8. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location-type.mjs +288 -0
  9. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location-type.mjs.map +1 -0
  10. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location.mjs +1356 -0
  11. package/fesm2022/acorex-platform-module-location-management-client-contracts-entities-location.mjs.map +1 -0
  12. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-acorex-platform-module-location-management-client-contracts-entity-catalog-B1rJccHr.mjs +70 -0
  13. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-acorex-platform-module-location-management-client-contracts-entity-catalog-B1rJccHr.mjs.map +1 -0
  14. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-geographic-region.entity-CUhM4K8a.mjs +735 -0
  15. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-geographic-region.entity-CUhM4K8a.mjs.map +1 -0
  16. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-assignment.entity-Cw46YCj9.mjs +198 -0
  17. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-assignment.entity-Cw46YCj9.mjs.map +1 -0
  18. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-assignment.utils-CfwbSQiM.mjs +160 -0
  19. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-assignment.utils-CfwbSQiM.mjs.map +1 -0
  20. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-role.entity-CEtJEhCf.mjs +109 -0
  21. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-role.entity-CEtJEhCf.mjs.map +1 -0
  22. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-type.entity-BXuQ_A7h.mjs +241 -0
  23. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location-type.entity-BXuQ_A7h.mjs.map +1 -0
  24. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location.entity-CmnVKTG-.mjs +1154 -0
  25. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog-location.entity-CmnVKTG-.mjs.map +1 -0
  26. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog.mjs +2 -0
  27. package/fesm2022/acorex-platform-module-location-management-client-contracts-entity-catalog.mjs.map +1 -0
  28. package/fesm2022/acorex-platform-module-location-management-client-contracts.mjs.map +1 -1
  29. package/fesm2022/acorex-platform-module-location-management-client-create-location-with-assignment.command-Cl6KfruM.mjs.map +1 -1
  30. package/fesm2022/acorex-platform-module-location-management-client-local-entities.mjs +33 -0
  31. package/fesm2022/acorex-platform-module-location-management-client-local-entities.mjs.map +1 -0
  32. package/fesm2022/acorex-platform-module-location-management-client.mjs +1 -1
  33. package/fesm2022/acorex-platform-module-location-management-client.mjs.map +1 -1
  34. package/package.json +29 -1
  35. package/types/acorex-platform-module-location-management-client-contracts-entities-geographic-region.d.ts +5 -0
  36. package/types/acorex-platform-module-location-management-client-contracts-entities-location-assignment.d.ts +5 -0
  37. package/types/acorex-platform-module-location-management-client-contracts-entities-location-role.d.ts +5 -0
  38. package/types/acorex-platform-module-location-management-client-contracts-entities-location-type.d.ts +5 -0
  39. package/types/acorex-platform-module-location-management-client-contracts-entities-location.d.ts +5 -0
  40. package/types/acorex-platform-module-location-management-client-contracts-entity-catalog.d.ts +10 -0
  41. package/types/acorex-platform-module-location-management-client-local-entities.d.ts +12 -0
@@ -0,0 +1,1356 @@
1
+ import { AXPSystemActionType, resolveMultiLanguageString, formatAddressData, AXPWidgetsList, AXPWidgetsCatalog, AXPRegionalSetting } from '@acorex-platform/framework-shared/core';
2
+ import { entityMasterCreateAction, entityMasterBulkDeleteAction, entityMasterDeleteAction, entityMasterViewAction, AXPEntityCommandScope, entityDetailsEditAction, entityOverrideDetailsViewAction, createAllQueryView, entityMasterCrudActions, entityMasterRecordActions } from '@acorex-platform/framework-shared/entity';
3
+
4
+ const config = {
5
+ i18n: 'location-management',
6
+ };
7
+ const RootConfig = {
8
+ config,
9
+ module: {
10
+ name: 'LocationManagement',
11
+ title: '@location-management:module.title',
12
+ icon: 'fa-light fa-map-marker-alt',
13
+ },
14
+ entities: {
15
+ location: {
16
+ name: 'Location',
17
+ title: '@location-management:locations.entities.location.title',
18
+ titlePlural: '@location-management:locations.entities.location.plural',
19
+ icon: 'fa-light fa-map-marker-alt',
20
+ },
21
+ locationType: {
22
+ name: 'LocationType',
23
+ title: '@location-management:location-types.entities.location-type.title',
24
+ titlePlural: '@location-management:location-types.entities.location-type.plural',
25
+ icon: 'fa-light fa-tags',
26
+ },
27
+ locationRole: {
28
+ name: 'LocationRole',
29
+ title: '@location-management:location-roles.entities.location-role.title',
30
+ titlePlural: '@location-management:location-roles.entities.location-role.plural',
31
+ icon: 'fa-light fa-map-pin',
32
+ },
33
+ geographicRegion: {
34
+ name: 'GeographicRegion',
35
+ title: '@location-management:geographic-regions.entities.geographic-region.title',
36
+ titlePlural: '@location-management:geographic-regions.entities.geographic-region.plural',
37
+ icon: 'fa-light fa-globe',
38
+ },
39
+ locationAssignment: {
40
+ name: 'LocationAssignment',
41
+ title: `@${config.i18n}:location-assignments.entities.location-assignment.title`,
42
+ titlePlural: `@${config.i18n}:location-assignments.entities.location-assignment.plural`,
43
+ icon: 'fa-light fa-building-user',
44
+ },
45
+ },
46
+ };
47
+
48
+ //#region ---- Command keys ----
49
+ const ASSIGN_EXISTING_LOCATION = `${RootConfig.module.name}.${RootConfig.entities.locationAssignment.name}:AssignExistingLocation`;
50
+ const CREATE_WITH_NEW_LOCATION = `${RootConfig.module.name}.${RootConfig.entities.locationAssignment.name}:CreateWithNewLocation`;
51
+ //#endregion
52
+ //#region ---- Location assignment related-entity actions ----
53
+ const assigneeProcessOptions = () => ({
54
+ process: {
55
+ redirect: false,
56
+ canCreateNewOne: true,
57
+ data: {
58
+ 'ownerRef.type': '{{ host.entity() }}',
59
+ 'ownerRef.id': '{{ host.eval("id") }}',
60
+ 'ownerRef.title': '{{ host.eval("party.title") }}',
61
+ },
62
+ },
63
+ });
64
+ /** Read-only assignments list on Location detail (no create/update/delete). */
65
+ function locationAssignmentReadOnlyRelatedActions() {
66
+ return [
67
+ { ...entityMasterCreateAction(), hidden: true },
68
+ { ...entityMasterBulkDeleteAction(), hidden: true },
69
+ { ...entityMasterDeleteAction(), hidden: true },
70
+ { ...entityMasterViewAction(), hidden: true },
71
+ ];
72
+ }
73
+ function locationAssignmentPartyCreateAction() {
74
+ const assigneeOptions = assigneeProcessOptions();
75
+ return {
76
+ name: 'Create',
77
+ title: '@general:actions.create.title',
78
+ command: { name: 'Entity:Create' },
79
+ icon: 'fa-light fa-plus',
80
+ priority: 'primary',
81
+ type: AXPSystemActionType.Create,
82
+ scope: AXPEntityCommandScope.TypeLevel,
83
+ items: [
84
+ {
85
+ name: 'AssignExistingLocation',
86
+ title: '@location-management:location-assignments.actions.assign-existing-location.title',
87
+ command: { name: ASSIGN_EXISTING_LOCATION, options: assigneeOptions },
88
+ icon: 'fa-light fa-map-marker-alt',
89
+ priority: 'primary',
90
+ type: AXPSystemActionType.Create,
91
+ scope: AXPEntityCommandScope.TypeLevel,
92
+ },
93
+ {
94
+ name: 'CreateWithNewLocation',
95
+ title: '@location-management:location-assignments.actions.create-with-new-location.title',
96
+ command: { name: CREATE_WITH_NEW_LOCATION, options: assigneeOptions },
97
+ icon: 'fa-light fa-location-plus',
98
+ priority: 'primary',
99
+ type: AXPSystemActionType.Create,
100
+ scope: AXPEntityCommandScope.TypeLevel,
101
+ },
102
+ ],
103
+ };
104
+ }
105
+ /**
106
+ * Actions for LocationAssignment when shown from Party/Customer/Supplier.
107
+ * Create menu: assign existing location or create new location with assignee prefilled.
108
+ */
109
+ function locationAssignmentDetailsCrudActionsForPartyContext(_partyIdContextPath = 'id') {
110
+ return [
111
+ { ...entityMasterCreateAction(), hidden: true },
112
+ locationAssignmentPartyCreateAction(),
113
+ entityDetailsEditAction(),
114
+ entityOverrideDetailsViewAction(),
115
+ ];
116
+ }
117
+ //#endregion
118
+
119
+ //#region ---- Imports ----
120
+ //#endregion
121
+ //#region ---- Constants ----
122
+ /** Canonical assignee type for party-scoped location assignment links. */
123
+ const LOCATION_ASSIGNMENT_PARTY_TYPE = 'BusinessCore.Party';
124
+ //#endregion
125
+ //#region ---- Display helpers ----
126
+ /** Resolves assignee display title from host/process data (plain string or multi-language object). */
127
+ function resolveLocationAssignmentDisplayTitle(locale, ...candidates) {
128
+ for (const candidate of candidates) {
129
+ if (candidate == null || candidate === '') {
130
+ continue;
131
+ }
132
+ const resolved = resolveMultiLanguageString(candidate, locale).trim();
133
+ if (resolved) {
134
+ return resolved;
135
+ }
136
+ }
137
+ return '';
138
+ }
139
+ /** Builds a location snapshot for nested LocationAssignment display fields. */
140
+ function buildLocationAssignmentLocationSnapshot(locationRow, locationId) {
141
+ const fullAddress = locationRow['fullAddress']?.trim() || formatAddressData(locationRow)?.trim() || undefined;
142
+ const toRegionRef = (value) => {
143
+ if (value == null) {
144
+ return undefined;
145
+ }
146
+ if (typeof value === 'object') {
147
+ const record = value;
148
+ const title = record['title'];
149
+ if (title == null) {
150
+ return undefined;
151
+ }
152
+ if (typeof title === 'string') {
153
+ return { title };
154
+ }
155
+ if (typeof title === 'object') {
156
+ return {
157
+ title: resolveMultiLanguageString(title, 'en-US'),
158
+ };
159
+ }
160
+ return undefined;
161
+ }
162
+ return { title: String(value) };
163
+ };
164
+ return {
165
+ id: locationId,
166
+ title: locationRow['title'],
167
+ fullAddress,
168
+ street1: locationRow['street1'],
169
+ street2: locationRow['street2'],
170
+ postalCode: locationRow['postalCode'],
171
+ city: toRegionRef(locationRow['city']),
172
+ state: toRegionRef(locationRow['state']),
173
+ country: toRegionRef(locationRow['country']),
174
+ };
175
+ }
176
+ /** Builds a person snapshot for nested LocationAssignment site-contact fields. */
177
+ function buildLocationAssignmentPersonSnapshot(personRow, personId) {
178
+ const fullName = personRow['fullName'] ??
179
+ [personRow['firstName'], personRow['lastName']].filter(Boolean).join(' ').trim();
180
+ return {
181
+ id: personId,
182
+ fullName: fullName || undefined,
183
+ phones: personRow['phones'],
184
+ emails: personRow['emails'],
185
+ };
186
+ }
187
+ //#endregion
188
+ //#region ---- Filter helpers ----
189
+ /** Filters LocationAssignment rows for a location detail context. */
190
+ function locationAssignmentLocationConditions(locationIdContextPath = 'id') {
191
+ return [
192
+ {
193
+ name: 'locationId',
194
+ operator: { type: 'equal' },
195
+ value: `{{context.eval("${locationIdContextPath}")}}`,
196
+ },
197
+ ];
198
+ }
199
+ /** Filters LocationAssignment rows for the current details-view host entity. */
200
+ function locationAssignmentPartyConditions(hostIdContextPath = 'id') {
201
+ return [
202
+ {
203
+ name: 'ownerRef.type',
204
+ operator: { type: 'equal' },
205
+ value: '{{ host.entity() }}',
206
+ },
207
+ {
208
+ name: 'ownerRef.id',
209
+ operator: { type: 'equal' },
210
+ value: `{{ host.eval("${hostIdContextPath}") }}`,
211
+ },
212
+ ];
213
+ }
214
+ //#endregion
215
+ //#region ---- Form layout helpers ----
216
+ /** Assignee lookup omitted when injected from party/customer/supplier context. */
217
+ const LOCATION_ASSIGNMENT_REF_PROPERTY_NAMES = ['ownerRef.id', 'ownerRef.type'];
218
+ /** Location lookup omitted when injected from location detail context. */
219
+ const LOCATION_ASSIGNMENT_LOCATION_PROPERTY_NAMES = ['locationId'];
220
+ function omitLocationAssignmentRefFromEditLayouts(layouts) {
221
+ return layouts.filter((layout) => !LOCATION_ASSIGNMENT_REF_PROPERTY_NAMES.includes(layout.name));
222
+ }
223
+ function omitLocationAssignmentLocationFromEditLayouts(layouts) {
224
+ return layouts.filter((layout) => !LOCATION_ASSIGNMENT_LOCATION_PROPERTY_NAMES.includes(layout.name));
225
+ }
226
+ //#endregion
227
+ //#region ---- Property factories ----
228
+ /** Polymorphic assignee lookup (AssessmentCase subjectRef pattern). */
229
+ function createLocationAssignmentOwnerRefLookupProperty(groupId, options = {}) {
230
+ const readonly = options.readonly ?? false;
231
+ return {
232
+ name: 'ownerRef.id',
233
+ title: '@location-management:location-assignments.entities.location-assignment.fields.assignee.title',
234
+ groupId,
235
+ options: readonly
236
+ ? { sort: { enabled: false }, filter: { advance: { enabled: false }, inline: { enabled: false } } }
237
+ : { sort: { enabled: true }, filter: { advance: { enabled: true }, inline: { enabled: true } } },
238
+ schema: {
239
+ dataType: 'string',
240
+ readonly,
241
+ interface: {
242
+ type: AXPWidgetsList.Editors.LookupBox,
243
+ options: {
244
+ readonly,
245
+ entity: "{{ context.eval('ownerRef.type') }}",
246
+ textField: 'title',
247
+ valueField: 'id',
248
+ expose: [
249
+ { source: 'id', target: 'ownerRef.id' },
250
+ { source: 'title', target: 'ownerRef.title' },
251
+ ],
252
+ triggers: [{ event: "{{ events.context('ownerRef.type') }}", action: '{{ widget.refresh() }}' }],
253
+ },
254
+ },
255
+ },
256
+ validations: [{ rule: 'required' }],
257
+ };
258
+ }
259
+ /** Hidden assignee type field; defaults to BusinessCore.Party. */
260
+ function createLocationAssignmentOwnerRefTypeProperty(groupId) {
261
+ return {
262
+ name: 'ownerRef.type',
263
+ title: '@location-management:location-assignments.entities.location-assignment.fields.assignee-type.title',
264
+ groupId,
265
+ schema: {
266
+ dataType: 'string',
267
+ visible: false,
268
+ defaultValue: LOCATION_ASSIGNMENT_PARTY_TYPE,
269
+ interface: { type: AXPWidgetsList.Editors.TextBox },
270
+ },
271
+ };
272
+ }
273
+ //#endregion
274
+
275
+ async function locationFactory() {
276
+ const entityDef = {
277
+ module: RootConfig.module.name,
278
+ name: RootConfig.entities.location.name,
279
+ icon: 'fa-solid fa-location-dot',
280
+ title: RootConfig.entities.location.title,
281
+ formats: {
282
+ individual: RootConfig.entities.location.title,
283
+ plural: RootConfig.entities.location.titlePlural,
284
+ searchResult: {
285
+ title: '{{ title }}',
286
+ description: '{{ fullAddress }}',
287
+ },
288
+ },
289
+ plugins: [
290
+ { name: 'archive' },
291
+ {
292
+ name: 'computed-property',
293
+ options: {
294
+ fields: [
295
+ {
296
+ name: 'fullAddress',
297
+ title: '@general:terms.geography.address',
298
+ value: '{{ address.format({ street1: context.eval("street1"), street2: context.eval("street2"), country: context.eval("country"), state: context.eval("state"), city: context.eval("city"), postalCode: context.eval("postalCode") }) }}',
299
+ group: {
300
+ id: 'address',
301
+ title: '@location-management:locations.entities.location.groups.address-details',
302
+ },
303
+ visible: false,
304
+ recompute: { middleware: true },
305
+ showAs: { type: AXPWidgetsCatalog.text },
306
+ },
307
+ ],
308
+ },
309
+ },
310
+ ],
311
+ groups: [
312
+ {
313
+ id: 'basic-info',
314
+ title: '@general:terms.interface.basic-info',
315
+ },
316
+ {
317
+ id: 'address',
318
+ title: '@location-management:locations.entities.location.groups.address-details',
319
+ },
320
+ {
321
+ id: 'geographic',
322
+ title: '@general:terms.interface.geographic-details',
323
+ },
324
+ {
325
+ id: 'additional',
326
+ title: '@general:terms.interface.additional-info',
327
+ },
328
+ ],
329
+ properties: [
330
+ {
331
+ name: 'code',
332
+ title: '@location-management:locations.entities.location.fields.code',
333
+ groupId: 'basic-info',
334
+ options: {
335
+ sort: {
336
+ enabled: true,
337
+ },
338
+ filter: {
339
+ advance: {
340
+ enabled: true,
341
+ },
342
+ inline: {
343
+ enabled: true,
344
+ },
345
+ },
346
+ },
347
+ schema: {
348
+ dataType: 'string',
349
+ interface: {
350
+ type: AXPWidgetsCatalog.text,
351
+ options: {
352
+ placeholder: 'Optional location code',
353
+ },
354
+ },
355
+ },
356
+ },
357
+ {
358
+ name: 'title',
359
+ title: '@general:terms.common.title',
360
+ groupId: 'basic-info',
361
+ options: {
362
+ sort: {
363
+ enabled: true,
364
+ },
365
+ filter: {
366
+ advance: {
367
+ enabled: true,
368
+ },
369
+ inline: {
370
+ enabled: true,
371
+ },
372
+ },
373
+ },
374
+ schema: {
375
+ dataType: 'string',
376
+ interface: {
377
+ type: AXPWidgetsCatalog.text,
378
+ options: {
379
+ placeholder: 'Enter location name',
380
+ },
381
+ },
382
+ },
383
+ validations: [
384
+ {
385
+ rule: 'required',
386
+ },
387
+ ],
388
+ },
389
+ {
390
+ name: 'locationTypeId',
391
+ title: '@location-management:locations.entities.location.fields.location-type',
392
+ groupId: 'basic-info',
393
+ options: {
394
+ sort: {
395
+ enabled: true,
396
+ },
397
+ filter: {
398
+ advance: {
399
+ enabled: true,
400
+ },
401
+ inline: {
402
+ enabled: true,
403
+ },
404
+ },
405
+ },
406
+ schema: {
407
+ dataType: 'object',
408
+ interface: {
409
+ type: AXPWidgetsCatalog.lookup,
410
+ options: {
411
+ entity: `${RootConfig.module.name}.${RootConfig.entities.locationType.name}`,
412
+ look: 'select',
413
+ expose: [
414
+ { source: 'id', target: 'locationType.id' },
415
+ { source: 'title', target: 'locationType.title' },
416
+ ],
417
+ },
418
+ },
419
+ },
420
+ validations: [
421
+ {
422
+ rule: 'required',
423
+ },
424
+ ],
425
+ },
426
+ {
427
+ name: 'street1',
428
+ title: '@location-management:locations.entities.location.fields.street1',
429
+ groupId: 'address',
430
+ options: {
431
+ sort: {
432
+ enabled: true,
433
+ },
434
+ filter: {
435
+ advance: {
436
+ enabled: true,
437
+ },
438
+ inline: {
439
+ enabled: true,
440
+ },
441
+ },
442
+ },
443
+ schema: {
444
+ dataType: 'string',
445
+ interface: {
446
+ type: AXPWidgetsCatalog.text,
447
+ options: {
448
+ placeholder: 'Enter street address',
449
+ },
450
+ },
451
+ },
452
+ validations: [
453
+ {
454
+ rule: 'required',
455
+ },
456
+ ],
457
+ },
458
+ {
459
+ name: 'street2',
460
+ title: '@location-management:locations.entities.location.fields.street2',
461
+ groupId: 'address',
462
+ options: {
463
+ filter: {
464
+ advance: {
465
+ enabled: true,
466
+ },
467
+ },
468
+ },
469
+ schema: {
470
+ dataType: 'string',
471
+ interface: {
472
+ type: AXPWidgetsCatalog.text,
473
+ options: {
474
+ placeholder: 'Apartment, suite, etc.',
475
+ },
476
+ },
477
+ },
478
+ },
479
+ {
480
+ name: 'countryId',
481
+ title: '@location-management:locations.entities.location.fields.country',
482
+ groupId: 'address',
483
+ options: {
484
+ sort: {
485
+ enabled: true,
486
+ },
487
+ filter: {
488
+ advance: {
489
+ enabled: true,
490
+ },
491
+ inline: {
492
+ enabled: true,
493
+ },
494
+ },
495
+ },
496
+ schema: {
497
+ dataType: 'object',
498
+ interface: {
499
+ type: AXPWidgetsCatalog.lookup,
500
+ options: {
501
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
502
+ look: 'select',
503
+ allowCreate: 'quick',
504
+ create: {
505
+ enable: true,
506
+ },
507
+ expose: [
508
+ { source: 'id', target: 'country.id' },
509
+ { source: 'title', target: 'country.title' },
510
+ ],
511
+ filter: {
512
+ logic: 'and',
513
+ filters: [
514
+ { field: 'type.code', operator: { type: 'equal' }, value: 'country' },
515
+ ],
516
+ },
517
+ },
518
+ },
519
+ },
520
+ },
521
+ {
522
+ name: 'stateId',
523
+ title: '@location-management:locations.entities.location.fields.state',
524
+ groupId: 'address',
525
+ options: {
526
+ filter: {
527
+ advance: {
528
+ enabled: true,
529
+ },
530
+ inline: {
531
+ enabled: true,
532
+ },
533
+ },
534
+ },
535
+ schema: {
536
+ dataType: 'object',
537
+ interface: {
538
+ type: AXPWidgetsCatalog.lookup,
539
+ options: {
540
+ look: 'select',
541
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
542
+ allowCreate: 'quick',
543
+ disabled: '{{ !context.eval("countryId") }}',
544
+ create: {
545
+ enable: true,
546
+ context: {
547
+ parentId: '{{ context.eval("countryId") }}',
548
+ type: { code: 'state' },
549
+ },
550
+ },
551
+ expose: [
552
+ { source: 'id', target: 'state.id' },
553
+ { source: 'title', target: 'state.title' },
554
+ ],
555
+ filter: {
556
+ logic: 'and',
557
+ filters: [
558
+ {
559
+ field: 'parentId',
560
+ operator: {
561
+ type: 'equal',
562
+ },
563
+ value: '{{ context.eval("countryId") }}',
564
+ },
565
+ {
566
+ field: 'type.code',
567
+ operator: {
568
+ type: 'equal',
569
+ },
570
+ value: 'state',
571
+ },
572
+ ],
573
+ },
574
+ },
575
+ triggers: [
576
+ {
577
+ event: "{{ events.context('countryId') }}",
578
+ action: `{{ widget.setValue(null); context.set('state.title', null); context.set('cityId', null); context.set('city.id', null); context.set('city.title', null); widget.refresh(); }}`,
579
+ },
580
+ ],
581
+ },
582
+ },
583
+ },
584
+ {
585
+ name: 'cityId',
586
+ title: '@location-management:locations.entities.location.fields.city',
587
+ groupId: 'address',
588
+ options: {
589
+ filter: {
590
+ advance: {
591
+ enabled: true,
592
+ },
593
+ inline: {
594
+ enabled: true,
595
+ },
596
+ },
597
+ },
598
+ schema: {
599
+ dataType: 'object',
600
+ interface: {
601
+ type: AXPWidgetsCatalog.lookup,
602
+ options: {
603
+ look: 'select',
604
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
605
+ allowCreate: 'quick',
606
+ disabled: '{{ !context.eval("stateId") }}',
607
+ create: {
608
+ enable: true,
609
+ context: {
610
+ parentId: '{{ context.eval("stateId") }}',
611
+ type: { code: 'city' },
612
+ },
613
+ },
614
+ expose: [
615
+ { source: 'id', target: 'city.id' },
616
+ { source: 'title', target: 'city.title' },
617
+ ],
618
+ filter: {
619
+ logic: 'and',
620
+ filters: [
621
+ {
622
+ field: 'parentId',
623
+ operator: {
624
+ type: 'equal',
625
+ },
626
+ value: '{{ context.eval("stateId") }}',
627
+ },
628
+ {
629
+ field: 'type.code',
630
+ operator: {
631
+ type: 'equal',
632
+ },
633
+ value: 'city',
634
+ },
635
+ ],
636
+ },
637
+ },
638
+ triggers: [
639
+ {
640
+ event: "{{ events.context('stateId') }}",
641
+ action: `{{ widget.setValue(null); context.set('city.title', null); widget.refresh(); }}`,
642
+ },
643
+ {
644
+ event: "{{ events.context('countryId') }}",
645
+ action: `{{ widget.setValue(null); context.set('city.title', null); widget.refresh(); }}`,
646
+ },
647
+ ],
648
+ },
649
+ },
650
+ },
651
+ {
652
+ name: 'postalCode',
653
+ title: '@location-management:locations.entities.location.fields.postal-code',
654
+ groupId: 'address',
655
+ options: {
656
+ filter: {
657
+ advance: {
658
+ enabled: true,
659
+ },
660
+ inline: {
661
+ enabled: true,
662
+ },
663
+ },
664
+ },
665
+ schema: {
666
+ dataType: 'string',
667
+ interface: {
668
+ type: AXPWidgetsCatalog.text,
669
+ options: {
670
+ placeholder: 'Postal/ZIP code',
671
+ },
672
+ },
673
+ },
674
+ validations: [
675
+ {
676
+ rule: 'required',
677
+ },
678
+ ],
679
+ },
680
+ {
681
+ name: 'hasCoordinates',
682
+ title: '@location-management:locations.entities.location.fields.coordinates',
683
+ groupId: 'geographic',
684
+ schema: {
685
+ dataType: 'boolean',
686
+ defaultValue: false,
687
+ interface: {
688
+ type: AXPWidgetsCatalog.toggle,
689
+ },
690
+ },
691
+ },
692
+ {
693
+ name: 'coordinates',
694
+ title: '@location-management:locations.entities.location.fields.coordinates',
695
+ groupId: 'geographic',
696
+ schema: {
697
+ dataType: 'string',
698
+ visible: '{{ context.eval("hasCoordinates") == true || !!context.eval("coordinates") }}',
699
+ interface: {
700
+ type: AXPWidgetsCatalog.map,
701
+ options: {
702
+ hasDraw: true,
703
+ maxPolygon: 0,
704
+ fitToDraw: true,
705
+ },
706
+ triggers: [
707
+ {
708
+ event: "{{ events.context('hasCoordinates') }}",
709
+ action: `{{ widget.clear() }}`,
710
+ },
711
+ ],
712
+ },
713
+ },
714
+ },
715
+ {
716
+ name: 'timezone',
717
+ title: '@location-management:locations.entities.location.fields.timezone',
718
+ groupId: 'geographic',
719
+ options: {
720
+ filter: {
721
+ advance: {
722
+ enabled: true,
723
+ },
724
+ },
725
+ },
726
+ schema: {
727
+ dataType: 'string',
728
+ defaultValue: `{{ settings.get('${AXPRegionalSetting.TimeZone}') }}`,
729
+ interface: {
730
+ type: AXPWidgetsCatalog.lookup,
731
+ options: {
732
+ entity: 'LocaleManagement.Timezones',
733
+ look: 'select',
734
+ allowSearch: true,
735
+ valueField: 'code',
736
+ textField: 'title',
737
+ placeholder: 'e.g., America/New_York',
738
+ filter: {
739
+ logic: 'and',
740
+ filters: [{ field: 'isActive', operator: { type: 'equal' }, value: true }],
741
+ },
742
+ },
743
+ },
744
+ },
745
+ },
746
+ {
747
+ name: 'parentLocationId',
748
+ title: '@location-management:locations.entities.location.fields.parent-location',
749
+ groupId: 'basic-info',
750
+ options: {
751
+ filter: {
752
+ advance: {
753
+ enabled: true,
754
+ },
755
+ inline: {
756
+ enabled: true,
757
+ },
758
+ },
759
+ },
760
+ schema: {
761
+ dataType: 'object',
762
+ interface: {
763
+ type: AXPWidgetsCatalog.lookup,
764
+ options: {
765
+ entity: `${RootConfig.module.name}.${RootConfig.entities.location.name}`,
766
+ expose: [
767
+ { source: 'id', target: 'parentLocation.id' },
768
+ { source: 'title', target: 'parentLocation.title' },
769
+ ],
770
+ },
771
+ },
772
+ },
773
+ },
774
+ {
775
+ name: 'description',
776
+ title: '@general:terms.common.description',
777
+ groupId: 'basic-info',
778
+ options: {
779
+ filter: {
780
+ advance: {
781
+ enabled: true,
782
+ },
783
+ },
784
+ },
785
+ schema: {
786
+ dataType: 'string',
787
+ interface: {
788
+ type: AXPWidgetsCatalog.largeText,
789
+ options: {
790
+ rows: 3,
791
+ },
792
+ },
793
+ },
794
+ },
795
+ ],
796
+ columns: [
797
+ { name: 'code' },
798
+ { name: 'title' },
799
+ { name: 'locationTypeId', options: { dataPath: 'locationType.title' } },
800
+ { name: 'street1' },
801
+ { name: 'postalCode' },
802
+ { name: 'cityId', options: { dataPath: 'city.title' } },
803
+ { name: 'stateId', options: { dataPath: 'state.title' } },
804
+ { name: 'countryId', options: { dataPath: 'country.title' } },
805
+ ],
806
+ relatedEntities: [
807
+ {
808
+ entity: `${RootConfig.module.name}.${RootConfig.entities.locationAssignment.name}`,
809
+ title: '@location-management:locations.entities.location.related-entities.assignments.title',
810
+ icon: RootConfig.entities.locationAssignment.icon,
811
+ columns: [
812
+ { name: 'ownerRef.id', options: { dataPath: 'ownerRef.title' } },
813
+ { name: 'roleId', options: { dataPath: 'role.title' } },
814
+ { name: 'personId', options: { dataPath: 'person.fullName' } },
815
+ { name: 'person.phones' },
816
+ { name: 'notes' },
817
+ ],
818
+ conditions: locationAssignmentLocationConditions('id'),
819
+ actions: [...locationAssignmentReadOnlyRelatedActions()],
820
+ layout: { type: 'page-list', position: 'after', order: 1 },
821
+ },
822
+ ],
823
+ interfaces: {
824
+ master: {
825
+ create: {
826
+ sections: [
827
+ {
828
+ id: 'basic-info',
829
+ },
830
+ {
831
+ id: 'address',
832
+ },
833
+ {
834
+ id: 'geographic',
835
+ },
836
+ {
837
+ id: 'additional',
838
+ },
839
+ ],
840
+ properties: [
841
+ {
842
+ name: 'code',
843
+ },
844
+ {
845
+ name: 'title',
846
+ },
847
+ {
848
+ name: 'locationTypeId',
849
+ layout: {
850
+ positions: {
851
+ sm: {
852
+ colSpan: 12,
853
+ },
854
+ md: {
855
+ colSpan: 6,
856
+ },
857
+ },
858
+ },
859
+ },
860
+ {
861
+ name: 'street1',
862
+ layout: {
863
+ positions: {
864
+ sm: {
865
+ colSpan: 12,
866
+ },
867
+ },
868
+ },
869
+ },
870
+ {
871
+ name: 'street2',
872
+ layout: {
873
+ positions: {
874
+ sm: {
875
+ colSpan: 12,
876
+ },
877
+ },
878
+ },
879
+ },
880
+ {
881
+ name: 'countryId',
882
+ layout: {
883
+ positions: {
884
+ sm: {
885
+ colSpan: 12,
886
+ },
887
+ md: {
888
+ colSpan: 4,
889
+ },
890
+ },
891
+ },
892
+ },
893
+ {
894
+ name: 'stateId',
895
+ layout: {
896
+ positions: {
897
+ sm: {
898
+ colSpan: 12,
899
+ },
900
+ md: {
901
+ colSpan: 4,
902
+ },
903
+ },
904
+ },
905
+ },
906
+ {
907
+ name: 'cityId',
908
+ layout: {
909
+ positions: {
910
+ sm: {
911
+ colSpan: 12,
912
+ },
913
+ md: {
914
+ colSpan: 4,
915
+ },
916
+ },
917
+ },
918
+ },
919
+ {
920
+ name: 'postalCode',
921
+ layout: {
922
+ positions: {
923
+ sm: {
924
+ colSpan: 12,
925
+ },
926
+ md: {
927
+ colSpan: 4,
928
+ },
929
+ },
930
+ },
931
+ },
932
+ {
933
+ name: 'hasCoordinates',
934
+ layout: {
935
+ positions: {
936
+ sm: {
937
+ colSpan: 6,
938
+ },
939
+ },
940
+ },
941
+ },
942
+ {
943
+ name: 'coordinates',
944
+ layout: {
945
+ label: {
946
+ visible: false,
947
+ },
948
+ positions: {
949
+ sm: {
950
+ colSpan: 12,
951
+ },
952
+ },
953
+ },
954
+ },
955
+ {
956
+ name: 'timezone',
957
+ layout: {
958
+ positions: {
959
+ sm: {
960
+ colSpan: 12,
961
+ colStart: 1,
962
+ },
963
+ md: {
964
+ colSpan: 4,
965
+ colStart: 1,
966
+ },
967
+ },
968
+ },
969
+ },
970
+ {
971
+ name: 'parentLocationId',
972
+ layout: {
973
+ positions: {
974
+ sm: {
975
+ colSpan: 12,
976
+ },
977
+ md: {
978
+ colSpan: 6,
979
+ },
980
+ },
981
+ },
982
+ },
983
+ {
984
+ name: 'description',
985
+ },
986
+ ],
987
+ },
988
+ update: {
989
+ sections: [
990
+ {
991
+ id: 'basic-info',
992
+ },
993
+ {
994
+ id: 'address',
995
+ },
996
+ {
997
+ id: 'geographic',
998
+ },
999
+ {
1000
+ id: 'additional',
1001
+ },
1002
+ {
1003
+ id: 'settings',
1004
+ },
1005
+ ],
1006
+ properties: [
1007
+ {
1008
+ name: 'code',
1009
+ },
1010
+ {
1011
+ name: 'title',
1012
+ },
1013
+ {
1014
+ name: 'locationTypeId',
1015
+ layout: {
1016
+ positions: {
1017
+ sm: {
1018
+ colSpan: 12,
1019
+ },
1020
+ md: {
1021
+ colSpan: 6,
1022
+ },
1023
+ },
1024
+ },
1025
+ },
1026
+ {
1027
+ name: 'description',
1028
+ },
1029
+ {
1030
+ name: 'parentLocationId',
1031
+ layout: {
1032
+ positions: {
1033
+ sm: {
1034
+ colSpan: 12,
1035
+ },
1036
+ md: {
1037
+ colSpan: 6,
1038
+ },
1039
+ },
1040
+ },
1041
+ },
1042
+ {
1043
+ name: 'street1',
1044
+ layout: {
1045
+ positions: {
1046
+ sm: {
1047
+ colSpan: 12,
1048
+ },
1049
+ },
1050
+ },
1051
+ },
1052
+ {
1053
+ name: 'street2',
1054
+ layout: {
1055
+ positions: {
1056
+ sm: {
1057
+ colSpan: 12,
1058
+ },
1059
+ },
1060
+ },
1061
+ },
1062
+ {
1063
+ name: 'cityId',
1064
+ layout: {
1065
+ positions: {
1066
+ sm: {
1067
+ colSpan: 12,
1068
+ },
1069
+ md: {
1070
+ colSpan: 4,
1071
+ },
1072
+ },
1073
+ },
1074
+ },
1075
+ {
1076
+ name: 'stateId',
1077
+ layout: {
1078
+ positions: {
1079
+ sm: {
1080
+ colSpan: 12,
1081
+ },
1082
+ md: {
1083
+ colSpan: 4,
1084
+ },
1085
+ },
1086
+ },
1087
+ },
1088
+ {
1089
+ name: 'countryId',
1090
+ layout: {
1091
+ positions: {
1092
+ sm: {
1093
+ colSpan: 12,
1094
+ },
1095
+ md: {
1096
+ colSpan: 4,
1097
+ },
1098
+ },
1099
+ },
1100
+ },
1101
+ {
1102
+ name: 'postalCode',
1103
+ layout: {
1104
+ positions: {
1105
+ sm: {
1106
+ colSpan: 12,
1107
+ },
1108
+ md: {
1109
+ colSpan: 4,
1110
+ },
1111
+ },
1112
+ },
1113
+ },
1114
+ {
1115
+ name: 'hasCoordinates',
1116
+ layout: {
1117
+ positions: {
1118
+ sm: {
1119
+ colSpan: 6,
1120
+ },
1121
+ },
1122
+ },
1123
+ },
1124
+ {
1125
+ name: 'coordinates',
1126
+ layout: {
1127
+ label: {
1128
+ visible: false,
1129
+ },
1130
+ positions: {
1131
+ sm: {
1132
+ colSpan: 12,
1133
+ },
1134
+ },
1135
+ },
1136
+ },
1137
+ {
1138
+ name: 'timezone',
1139
+ layout: {
1140
+ positions: {
1141
+ sm: {
1142
+ colSpan: 12,
1143
+ colStart: 1,
1144
+ },
1145
+ md: {
1146
+ colSpan: 4,
1147
+ colStart: 1,
1148
+ },
1149
+ },
1150
+ },
1151
+ },
1152
+ ],
1153
+ },
1154
+ single: {
1155
+ title: '{{title}}',
1156
+ description: '{{ fullAddress }}',
1157
+ sections: [
1158
+ {
1159
+ id: 'basic-info',
1160
+ layout: {
1161
+ positions: {
1162
+ lg: {
1163
+ colSpan: 12,
1164
+ },
1165
+ },
1166
+ },
1167
+ },
1168
+ {
1169
+ id: 'address',
1170
+ layout: {
1171
+ positions: {
1172
+ lg: {
1173
+ colSpan: 12,
1174
+ },
1175
+ },
1176
+ },
1177
+ },
1178
+ {
1179
+ id: 'geographic',
1180
+ layout: {
1181
+ positions: {
1182
+ lg: {
1183
+ colSpan: 12,
1184
+ },
1185
+ },
1186
+ },
1187
+ },
1188
+ {
1189
+ id: 'additional',
1190
+ layout: {
1191
+ positions: {
1192
+ lg: {
1193
+ colSpan: 12,
1194
+ },
1195
+ },
1196
+ },
1197
+ },
1198
+ ],
1199
+ properties: [
1200
+ {
1201
+ name: 'code',
1202
+ },
1203
+ {
1204
+ name: 'title',
1205
+ },
1206
+ {
1207
+ name: 'locationTypeId',
1208
+ layout: {
1209
+ positions: {
1210
+ lg: {
1211
+ colSpan: 6,
1212
+ order: 3,
1213
+ },
1214
+ },
1215
+ },
1216
+ },
1217
+ {
1218
+ name: 'description',
1219
+ },
1220
+ {
1221
+ name: 'parentLocationId',
1222
+ layout: {
1223
+ positions: {
1224
+ lg: {
1225
+ colSpan: 6,
1226
+ order: 11,
1227
+ },
1228
+ },
1229
+ },
1230
+ },
1231
+ {
1232
+ name: 'street1',
1233
+ layout: {
1234
+ positions: {
1235
+ lg: {
1236
+ colSpan: 12,
1237
+ order: 4,
1238
+ },
1239
+ },
1240
+ },
1241
+ },
1242
+ {
1243
+ name: 'street2',
1244
+ layout: {
1245
+ positions: {
1246
+ lg: {
1247
+ colSpan: 12,
1248
+ order: 5,
1249
+ },
1250
+ },
1251
+ },
1252
+ },
1253
+ {
1254
+ name: 'cityId',
1255
+ layout: {
1256
+ positions: {
1257
+ lg: {
1258
+ colSpan: 4,
1259
+ order: 6,
1260
+ },
1261
+ },
1262
+ },
1263
+ },
1264
+ {
1265
+ name: 'stateId',
1266
+ layout: {
1267
+ positions: {
1268
+ lg: {
1269
+ colSpan: 4,
1270
+ order: 7,
1271
+ },
1272
+ },
1273
+ },
1274
+ },
1275
+ {
1276
+ name: 'countryId',
1277
+ layout: {
1278
+ positions: {
1279
+ lg: {
1280
+ colSpan: 4,
1281
+ order: 8,
1282
+ },
1283
+ },
1284
+ },
1285
+ },
1286
+ {
1287
+ name: 'postalCode',
1288
+ layout: {
1289
+ positions: {
1290
+ lg: {
1291
+ colSpan: 4,
1292
+ order: 9,
1293
+ },
1294
+ },
1295
+ },
1296
+ },
1297
+ {
1298
+ name: 'hasCoordinates',
1299
+ layout: {
1300
+ positions: {
1301
+ lg: {
1302
+ colSpan: 6,
1303
+ order: 10,
1304
+ },
1305
+ },
1306
+ },
1307
+ },
1308
+ {
1309
+ name: 'coordinates',
1310
+ layout: {
1311
+ label: {
1312
+ visible: false,
1313
+ },
1314
+ positions: {
1315
+ lg: {
1316
+ colSpan: 12,
1317
+ order: 11,
1318
+ },
1319
+ },
1320
+ },
1321
+ },
1322
+ {
1323
+ name: 'timezone',
1324
+ layout: {
1325
+ positions: {
1326
+ lg: {
1327
+ colSpan: 4,
1328
+ colStart: 1,
1329
+ order: 12,
1330
+ },
1331
+ },
1332
+ },
1333
+ },
1334
+ ],
1335
+ actions: [...entityMasterRecordActions()],
1336
+ },
1337
+ list: {
1338
+ actions: [...entityMasterCrudActions()],
1339
+ views: [
1340
+ createAllQueryView({
1341
+ sorts: [{ name: 'title', dir: 'asc' }],
1342
+ }),
1343
+ ],
1344
+ },
1345
+ },
1346
+ },
1347
+ };
1348
+ return entityDef;
1349
+ }
1350
+
1351
+ /**
1352
+ * Generated bundle index. Do not edit.
1353
+ */
1354
+
1355
+ export { locationFactory };
1356
+ //# sourceMappingURL=acorex-platform-module-location-management-client-contracts-entities-location.mjs.map