@acorex-platform/module-location-management-client 0.0.15 → 0.0.18

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 (60) hide show
  1. package/fesm2022/acorex-platform-module-location-management-client-assign-existing-location-to-party.command-DmpN-yas.mjs +164 -0
  2. package/fesm2022/acorex-platform-module-location-management-client-assign-existing-location-to-party.command-DmpN-yas.mjs.map +1 -0
  3. package/fesm2022/acorex-platform-module-location-management-client-contracts.mjs +2694 -0
  4. package/fesm2022/acorex-platform-module-location-management-client-contracts.mjs.map +1 -0
  5. package/fesm2022/acorex-platform-module-location-management-client-create-location-with-assignment.command-D6VXtZRf.mjs +201 -0
  6. package/fesm2022/acorex-platform-module-location-management-client-create-location-with-assignment.command-D6VXtZRf.mjs.map +1 -0
  7. package/fesm2022/acorex-platform-module-location-management-client.mjs +1955 -0
  8. package/fesm2022/acorex-platform-module-location-management-client.mjs.map +1 -0
  9. package/package.json +21 -5
  10. package/types/acorex-platform-module-location-management-client-contracts.d.ts +274 -0
  11. package/types/acorex-platform-module-location-management-client.d.ts +53 -0
  12. package/contracts/datasource.keys.d.ts +0 -6
  13. package/contracts/datasource.keys.js +0 -8
  14. package/contracts/entities/geographic-region/geographic-region.entity.d.ts +0 -2
  15. package/contracts/entities/geographic-region/geographic-region.entity.js +0 -725
  16. package/contracts/entities/geographic-region/geographic-region.types.d.ts +0 -27
  17. package/contracts/entities/geographic-region/geographic-region.types.js +0 -1
  18. package/contracts/entities/geographic-region/index.d.ts +0 -2
  19. package/contracts/entities/geographic-region/index.js +0 -2
  20. package/contracts/entities/index.d.ts +0 -5
  21. package/contracts/entities/index.js +0 -5
  22. package/contracts/entities/location/index.d.ts +0 -2
  23. package/contracts/entities/location/index.js +0 -2
  24. package/contracts/entities/location/location.entity.d.ts +0 -2
  25. package/contracts/entities/location/location.entity.js +0 -1075
  26. package/contracts/entities/location/location.types.d.ts +0 -30
  27. package/contracts/entities/location/location.types.js +0 -1
  28. package/contracts/entities/location-assignment/index.d.ts +0 -2
  29. package/contracts/entities/location-assignment/index.js +0 -2
  30. package/contracts/entities/location-assignment/location-assignment.entity.d.ts +0 -2
  31. package/contracts/entities/location-assignment/location-assignment.entity.js +0 -194
  32. package/contracts/entities/location-assignment/location-assignment.types.d.ts +0 -35
  33. package/contracts/entities/location-assignment/location-assignment.types.js +0 -2
  34. package/contracts/entities/location-role/index.d.ts +0 -2
  35. package/contracts/entities/location-role/index.js +0 -2
  36. package/contracts/entities/location-role/location-role.entity.d.ts +0 -2
  37. package/contracts/entities/location-role/location-role.entity.js +0 -143
  38. package/contracts/entities/location-role/location-role.types.d.ts +0 -6
  39. package/contracts/entities/location-role/location-role.types.js +0 -1
  40. package/contracts/entities/location-type/index.d.ts +0 -2
  41. package/contracts/entities/location-type/index.js +0 -2
  42. package/contracts/entities/location-type/location-type.entity.d.ts +0 -2
  43. package/contracts/entities/location-type/location-type.entity.js +0 -237
  44. package/contracts/entities/location-type/location-type.types.d.ts +0 -8
  45. package/contracts/entities/location-type/location-type.types.js +0 -1
  46. package/contracts/features.keys.d.ts +0 -1
  47. package/contracts/features.keys.js +0 -2
  48. package/contracts/index.d.ts +0 -8
  49. package/contracts/index.js +0 -10
  50. package/contracts/location-assignment.actions.d.ts +0 -8
  51. package/contracts/location-assignment.actions.js +0 -73
  52. package/contracts/location-assignment.utils.d.ts +0 -53
  53. package/contracts/location-assignment.utils.js +0 -145
  54. package/contracts/menu.keys.d.ts +0 -8
  55. package/contracts/menu.keys.js +0 -8
  56. package/contracts/package.json +0 -5
  57. package/contracts/permission.keys.d.ts +0 -33
  58. package/contracts/permission.keys.js +0 -42
  59. package/contracts/root-config.d.ts +0 -42
  60. package/contracts/root-config.js +0 -43
@@ -0,0 +1,2694 @@
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
+ import { AXPLocaleManagementDataSourceKeys } from '@acorex-platform/module-locale-management-contracts';
4
+
5
+ //#region ---- Datasource keys ----
6
+ /** Location Management datasource registry names. */
7
+ const AXMLocationManagementDataSourceKeys = {
8
+ Countries: 'countries',
9
+ Provinces: 'provinces',
10
+ Cities: 'cities',
11
+ };
12
+ //#endregion
13
+
14
+ // Management feature removed - module name is used directly as feature key
15
+ const AXMLocationManagementFeatureKeys = {};
16
+
17
+ const config = {
18
+ i18n: 'location-management',
19
+ };
20
+ const RootConfig = {
21
+ config,
22
+ module: {
23
+ name: 'LocationManagement',
24
+ title: '@location-management:module.title',
25
+ icon: 'fa-light fa-map-marker-alt',
26
+ },
27
+ entities: {
28
+ location: {
29
+ name: 'Location',
30
+ title: '@location-management:locations.entities.location.title',
31
+ titlePlural: '@location-management:locations.entities.location.plural',
32
+ icon: 'fa-light fa-map-marker-alt',
33
+ },
34
+ locationType: {
35
+ name: 'LocationType',
36
+ title: '@location-management:location-types.entities.location-type.title',
37
+ titlePlural: '@location-management:location-types.entities.location-type.plural',
38
+ icon: 'fa-light fa-tags',
39
+ },
40
+ locationRole: {
41
+ name: 'LocationRole',
42
+ title: '@location-management:location-roles.entities.location-role.title',
43
+ titlePlural: '@location-management:location-roles.entities.location-role.plural',
44
+ icon: 'fa-light fa-map-pin',
45
+ },
46
+ geographicRegion: {
47
+ name: 'GeographicRegion',
48
+ title: '@location-management:geographic-regions.entities.geographic-region.title',
49
+ titlePlural: '@location-management:geographic-regions.entities.geographic-region.plural',
50
+ icon: 'fa-light fa-globe',
51
+ },
52
+ locationAssignment: {
53
+ name: 'LocationAssignment',
54
+ title: `@${config.i18n}:location-assignments.entities.location-assignment.title`,
55
+ titlePlural: `@${config.i18n}:location-assignments.entities.location-assignment.plural`,
56
+ icon: 'fa-light fa-building-user',
57
+ },
58
+ },
59
+ };
60
+
61
+ //#region ---- Command keys ----
62
+ const ASSIGN_EXISTING_LOCATION = `${RootConfig.module.name}.${RootConfig.entities.locationAssignment.name}:AssignExistingLocation`;
63
+ const CREATE_WITH_NEW_LOCATION = `${RootConfig.module.name}.${RootConfig.entities.locationAssignment.name}:CreateWithNewLocation`;
64
+ //#endregion
65
+ //#region ---- Location assignment related-entity actions ----
66
+ const assigneeProcessOptions = () => ({
67
+ process: {
68
+ redirect: false,
69
+ canCreateNewOne: true,
70
+ data: {
71
+ 'ownerRef.type': '{{ host.entity() }}',
72
+ 'ownerRef.id': '{{ host.eval("id") }}',
73
+ 'ownerRef.title': '{{ host.eval("party.title") }}',
74
+ },
75
+ },
76
+ });
77
+ /** Read-only assignments list on Location detail (no create/update/delete). */
78
+ function locationAssignmentReadOnlyRelatedActions() {
79
+ return [
80
+ { ...entityMasterCreateAction(), hidden: true },
81
+ { ...entityMasterBulkDeleteAction(), hidden: true },
82
+ { ...entityMasterDeleteAction(), hidden: true },
83
+ { ...entityMasterViewAction(), hidden: true },
84
+ ];
85
+ }
86
+ function locationAssignmentPartyCreateAction() {
87
+ const assigneeOptions = assigneeProcessOptions();
88
+ return {
89
+ name: 'Create',
90
+ title: '@general:actions.create.title',
91
+ command: { name: 'Entity:Create' },
92
+ icon: 'fa-light fa-plus',
93
+ priority: 'primary',
94
+ type: AXPSystemActionType.Create,
95
+ scope: AXPEntityCommandScope.TypeLevel,
96
+ items: [
97
+ {
98
+ name: 'AssignExistingLocation',
99
+ title: '@location-management:location-assignments.actions.assign-existing-location.title',
100
+ command: { name: ASSIGN_EXISTING_LOCATION, options: assigneeOptions },
101
+ icon: 'fa-light fa-map-marker-alt',
102
+ priority: 'primary',
103
+ type: AXPSystemActionType.Create,
104
+ scope: AXPEntityCommandScope.TypeLevel,
105
+ },
106
+ {
107
+ name: 'CreateWithNewLocation',
108
+ title: '@location-management:location-assignments.actions.create-with-new-location.title',
109
+ command: { name: CREATE_WITH_NEW_LOCATION, options: assigneeOptions },
110
+ icon: 'fa-light fa-location-plus',
111
+ priority: 'primary',
112
+ type: AXPSystemActionType.Create,
113
+ scope: AXPEntityCommandScope.TypeLevel,
114
+ },
115
+ ],
116
+ };
117
+ }
118
+ /**
119
+ * Actions for LocationAssignment when shown from Party/Customer/Supplier.
120
+ * Create menu: assign existing location or create new location with assignee prefilled.
121
+ */
122
+ function locationAssignmentDetailsCrudActionsForPartyContext(_partyIdContextPath = 'id') {
123
+ return [
124
+ { ...entityMasterCreateAction(), hidden: true },
125
+ locationAssignmentPartyCreateAction(),
126
+ entityDetailsEditAction(),
127
+ entityOverrideDetailsViewAction(),
128
+ ];
129
+ }
130
+ //#endregion
131
+
132
+ //#region ---- Imports ----
133
+ //#endregion
134
+ //#region ---- Constants ----
135
+ /** Canonical assignee type for party-scoped location assignment links. */
136
+ const LOCATION_ASSIGNMENT_PARTY_TYPE = 'BusinessCore.Party';
137
+ //#endregion
138
+ //#region ---- Display helpers ----
139
+ /** Resolves assignee display title from host/process data (plain string or multi-language object). */
140
+ function resolveLocationAssignmentDisplayTitle(locale, ...candidates) {
141
+ for (const candidate of candidates) {
142
+ if (candidate == null || candidate === '') {
143
+ continue;
144
+ }
145
+ const resolved = resolveMultiLanguageString(candidate, locale).trim();
146
+ if (resolved) {
147
+ return resolved;
148
+ }
149
+ }
150
+ return '';
151
+ }
152
+ /** Builds a location snapshot for nested LocationAssignment display fields. */
153
+ function buildLocationAssignmentLocationSnapshot(locationRow, locationId) {
154
+ const fullAddress = locationRow['fullAddress']?.trim() || formatAddressData(locationRow)?.trim() || undefined;
155
+ const toRegionRef = (value) => {
156
+ if (value == null) {
157
+ return undefined;
158
+ }
159
+ if (typeof value === 'object') {
160
+ const record = value;
161
+ const title = record['title'];
162
+ return title != null ? { title: String(title) } : undefined;
163
+ }
164
+ return { title: String(value) };
165
+ };
166
+ return {
167
+ id: locationId,
168
+ title: locationRow['title'],
169
+ fullAddress,
170
+ street1: locationRow['street1'],
171
+ street2: locationRow['street2'],
172
+ postalCode: locationRow['postalCode'],
173
+ city: toRegionRef(locationRow['city']),
174
+ state: toRegionRef(locationRow['state']),
175
+ country: toRegionRef(locationRow['country']),
176
+ };
177
+ }
178
+ /** Builds a person snapshot for nested LocationAssignment site-contact fields. */
179
+ function buildLocationAssignmentPersonSnapshot(personRow, personId) {
180
+ const fullName = personRow['fullName'] ??
181
+ [personRow['firstName'], personRow['lastName']].filter(Boolean).join(' ').trim();
182
+ return {
183
+ id: personId,
184
+ fullName: fullName || undefined,
185
+ phones: personRow['phones'],
186
+ emails: personRow['emails'],
187
+ };
188
+ }
189
+ //#endregion
190
+ //#region ---- Filter helpers ----
191
+ /** Filters LocationAssignment rows for a location detail context. */
192
+ function locationAssignmentLocationConditions(locationIdContextPath = 'id') {
193
+ return [
194
+ {
195
+ name: 'locationId',
196
+ operator: { type: 'equal' },
197
+ value: `{{context.eval("${locationIdContextPath}")}}`,
198
+ },
199
+ ];
200
+ }
201
+ /** Filters LocationAssignment rows for the current details-view host entity. */
202
+ function locationAssignmentPartyConditions(hostIdContextPath = 'id') {
203
+ return [
204
+ {
205
+ name: 'ownerRef.type',
206
+ operator: { type: 'equal' },
207
+ value: '{{ host.entity() }}',
208
+ },
209
+ {
210
+ name: 'ownerRef.id',
211
+ operator: { type: 'equal' },
212
+ value: `{{ host.eval("${hostIdContextPath}") }}`,
213
+ },
214
+ ];
215
+ }
216
+ //#endregion
217
+ //#region ---- Form layout helpers ----
218
+ /** Assignee lookup omitted when injected from party/customer/supplier context. */
219
+ const LOCATION_ASSIGNMENT_REF_PROPERTY_NAMES = ['ownerRef.id', 'ownerRef.type'];
220
+ /** Location lookup omitted when injected from location detail context. */
221
+ const LOCATION_ASSIGNMENT_LOCATION_PROPERTY_NAMES = ['locationId'];
222
+ function omitLocationAssignmentRefFromEditLayouts(layouts) {
223
+ return layouts.filter((layout) => !LOCATION_ASSIGNMENT_REF_PROPERTY_NAMES.includes(layout.name));
224
+ }
225
+ function omitLocationAssignmentLocationFromEditLayouts(layouts) {
226
+ return layouts.filter((layout) => !LOCATION_ASSIGNMENT_LOCATION_PROPERTY_NAMES.includes(layout.name));
227
+ }
228
+ //#endregion
229
+ //#region ---- Property factories ----
230
+ /** Polymorphic assignee lookup (AssessmentCase subjectRef pattern). */
231
+ function createLocationAssignmentOwnerRefLookupProperty(groupId, options = {}) {
232
+ const readonly = options.readonly ?? false;
233
+ return {
234
+ name: 'ownerRef.id',
235
+ title: '@location-management:location-assignments.entities.location-assignment.fields.assignee.title',
236
+ groupId,
237
+ options: readonly
238
+ ? { sort: { enabled: false }, filter: { advance: { enabled: false }, inline: { enabled: false } } }
239
+ : { sort: { enabled: true }, filter: { advance: { enabled: true }, inline: { enabled: true } } },
240
+ schema: {
241
+ dataType: 'string',
242
+ readonly,
243
+ interface: {
244
+ type: AXPWidgetsList.Editors.LookupBox,
245
+ options: {
246
+ readonly,
247
+ entity: "{{ context.eval('ownerRef.type') }}",
248
+ textField: 'title',
249
+ valueField: 'id',
250
+ expose: [
251
+ { source: 'id', target: 'ownerRef.id' },
252
+ { source: 'title', target: 'ownerRef.title' },
253
+ ],
254
+ triggers: [{ event: "{{ events.context('ownerRef.type') }}", action: '{{ widget.refresh() }}' }],
255
+ },
256
+ },
257
+ },
258
+ validations: [{ rule: 'required' }],
259
+ };
260
+ }
261
+ /** Hidden assignee type field; defaults to BusinessCore.Party. */
262
+ function createLocationAssignmentOwnerRefTypeProperty(groupId) {
263
+ return {
264
+ name: 'ownerRef.type',
265
+ title: '@location-management:location-assignments.entities.location-assignment.fields.assignee-type.title',
266
+ groupId,
267
+ schema: {
268
+ dataType: 'string',
269
+ visible: false,
270
+ defaultValue: LOCATION_ASSIGNMENT_PARTY_TYPE,
271
+ interface: { type: AXPWidgetsList.Editors.TextBox },
272
+ },
273
+ };
274
+ }
275
+ //#endregion
276
+
277
+ const AXPLocationManagementMenuKeys = {
278
+ Root: 'location-management:menu',
279
+ Locations: 'location-management:menu:locations',
280
+ Divider1: 'location-management:menu:divider-1',
281
+ LocationTypes: 'location-management:menu:location-types',
282
+ LocationRoles: 'location-management:menu:location-roles',
283
+ GeographicRegions: 'location-management:menu:geographic-regions',
284
+ };
285
+
286
+ const moduleKey = RootConfig.module.name;
287
+ const entitiesKey = RootConfig.entities;
288
+ const manageKey = AXPSystemActionType.Manage;
289
+ const viewKey = AXPSystemActionType.View;
290
+ const updateKey = AXPSystemActionType.Update;
291
+ const deleteKey = AXPSystemActionType.Delete;
292
+ const createKey = AXPSystemActionType.Create;
293
+ const AXMLocationManagementPermissionsKeys = {
294
+ LocationManagement: {
295
+ Management: `${moduleKey}:${manageKey}`,
296
+ Locations: {
297
+ Management: `${moduleKey}:${entitiesKey.location.name}:${manageKey}`,
298
+ View: `${moduleKey}:${entitiesKey.location.name}:${viewKey}`,
299
+ Edit: `${moduleKey}:${entitiesKey.location.name}:${updateKey}`,
300
+ Delete: `${moduleKey}:${entitiesKey.location.name}:${deleteKey}`,
301
+ Create: `${moduleKey}:${entitiesKey.location.name}:${createKey}`,
302
+ },
303
+ LocationTypes: {
304
+ Management: `${moduleKey}:${entitiesKey.locationType.name}:${manageKey}`,
305
+ View: `${moduleKey}:${entitiesKey.locationType.name}:${viewKey}`,
306
+ Edit: `${moduleKey}:${entitiesKey.locationType.name}:${updateKey}`,
307
+ Delete: `${moduleKey}:${entitiesKey.locationType.name}:${deleteKey}`,
308
+ Create: `${moduleKey}:${entitiesKey.locationType.name}:${createKey}`,
309
+ },
310
+ LocationRoles: {
311
+ Management: `${moduleKey}:${entitiesKey.locationRole.name}:${manageKey}`,
312
+ View: `${moduleKey}:${entitiesKey.locationRole.name}:${viewKey}`,
313
+ Edit: `${moduleKey}:${entitiesKey.locationRole.name}:${updateKey}`,
314
+ Delete: `${moduleKey}:${entitiesKey.locationRole.name}:${deleteKey}`,
315
+ Create: `${moduleKey}:${entitiesKey.locationRole.name}:${createKey}`,
316
+ },
317
+ GeographicRegions: {
318
+ Management: `${moduleKey}:${entitiesKey.geographicRegion.name}:${manageKey}`,
319
+ View: `${moduleKey}:${entitiesKey.geographicRegion.name}:${viewKey}`,
320
+ Edit: `${moduleKey}:${entitiesKey.geographicRegion.name}:${updateKey}`,
321
+ Delete: `${moduleKey}:${entitiesKey.geographicRegion.name}:${deleteKey}`,
322
+ Create: `${moduleKey}:${entitiesKey.geographicRegion.name}:${createKey}`,
323
+ },
324
+ },
325
+ };
326
+
327
+ async function geographicRegionFactory() {
328
+ const entityDef = {
329
+ module: RootConfig.module.name,
330
+ name: RootConfig.entities.geographicRegion.name,
331
+ parentKey: 'parentId',
332
+ title: RootConfig.entities.geographicRegion.title,
333
+ icon: RootConfig.entities.geographicRegion.icon,
334
+ formats: {
335
+ individual: RootConfig.entities.geographicRegion.title,
336
+ plural: RootConfig.entities.geographicRegion.titlePlural,
337
+ searchResult: {
338
+ title: '{{ name }}',
339
+ description: '{{ context.eval("type") + (context.eval("parentId") ? " (Child)" : "") }}',
340
+ },
341
+ },
342
+ plugins: [{ name: 'archive' }],
343
+ groups: [
344
+ {
345
+ id: 'basic-info',
346
+ title: '@general:terms.interface.basic-info',
347
+ },
348
+ {
349
+ id: 'geographic-data',
350
+ title: '@general:terms.interface.geographic-details',
351
+ },
352
+ {
353
+ id: 'additional-info',
354
+ title: '@general:terms.interface.additional-info',
355
+ },
356
+ {
357
+ id: 'settings',
358
+ title: '@general:terms.interface.settings',
359
+ },
360
+ ],
361
+ properties: [
362
+ {
363
+ name: 'title',
364
+ title: '@general:terms.common.title',
365
+ groupId: 'basic-info',
366
+ options: {
367
+ sort: {
368
+ enabled: true,
369
+ },
370
+ filter: {
371
+ advance: {
372
+ enabled: true,
373
+ },
374
+ inline: {
375
+ enabled: true,
376
+ },
377
+ },
378
+ },
379
+ schema: {
380
+ dataType: 'string',
381
+ interface: {
382
+ type: AXPWidgetsCatalog.text,
383
+ options: {
384
+ placeholder: 'Enter region title',
385
+ },
386
+ },
387
+ },
388
+ validations: [
389
+ {
390
+ rule: 'required',
391
+ },
392
+ ],
393
+ },
394
+ {
395
+ name: 'code',
396
+ title: '@general:terms.common.code',
397
+ groupId: 'basic-info',
398
+ options: {
399
+ sort: {
400
+ enabled: true,
401
+ },
402
+ filter: {
403
+ advance: {
404
+ enabled: true,
405
+ },
406
+ inline: {
407
+ enabled: true,
408
+ },
409
+ },
410
+ },
411
+ schema: {
412
+ dataType: 'string',
413
+ interface: {
414
+ type: AXPWidgetsCatalog.text,
415
+ options: {
416
+ placeholder: 'Region code (e.g., CA, US)',
417
+ },
418
+ },
419
+ },
420
+ },
421
+ {
422
+ name: 'type',
423
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.type',
424
+ groupId: 'basic-info',
425
+ options: {
426
+ sort: {
427
+ enabled: true,
428
+ },
429
+ filter: {
430
+ advance: {
431
+ enabled: true,
432
+ },
433
+ inline: {
434
+ enabled: true,
435
+ },
436
+ },
437
+ },
438
+ schema: {
439
+ dataType: 'string',
440
+ interface: {
441
+ type: AXPWidgetsCatalog.select,
442
+ options: {
443
+ valueField: 'code',
444
+ textField: 'title',
445
+ dataSource: [
446
+ { code: 'country', title: 'Country' },
447
+ { code: 'state', title: 'State/Province' },
448
+ { code: 'city', title: 'City' },
449
+ { code: 'district', title: 'District' },
450
+ { code: 'subdistrict', title: 'Subdistrict' },
451
+ { code: 'territory', title: 'Territory' },
452
+ ],
453
+ },
454
+ },
455
+ },
456
+ validations: [
457
+ {
458
+ rule: 'required',
459
+ },
460
+ ],
461
+ },
462
+ {
463
+ name: 'parentId',
464
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.parent-region',
465
+ groupId: 'basic-info',
466
+ options: {
467
+ filter: {
468
+ advance: {
469
+ enabled: true,
470
+ },
471
+ inline: {
472
+ enabled: true,
473
+ },
474
+ },
475
+ },
476
+ schema: {
477
+ dataType: 'object',
478
+ interface: {
479
+ type: AXPWidgetsCatalog.lookup,
480
+ options: {
481
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
482
+ expose: [
483
+ { source: 'id', target: 'parentRegion.id' },
484
+ { source: 'name', target: 'parentRegion.name' },
485
+ { source: 'type', target: 'parentRegion.type' },
486
+ ],
487
+ },
488
+ },
489
+ },
490
+ },
491
+ {
492
+ name: 'coordinates',
493
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.coordinates',
494
+ groupId: 'geographic-data',
495
+ options: {
496
+ filter: {
497
+ advance: {
498
+ enabled: false,
499
+ },
500
+ },
501
+ },
502
+ schema: {
503
+ dataType: 'string',
504
+ interface: {
505
+ type: AXPWidgetsCatalog.map,
506
+ options: {
507
+ hasDraw: true,
508
+ maxPolygon: 0,
509
+ fitToDraw: true,
510
+ },
511
+ },
512
+ },
513
+ },
514
+ {
515
+ name: 'timezone',
516
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.timezone',
517
+ groupId: 'geographic-data',
518
+ options: {
519
+ filter: {
520
+ advance: {
521
+ enabled: true,
522
+ },
523
+ },
524
+ },
525
+ schema: {
526
+ dataType: 'string',
527
+ defaultValue: `{{ settings.get('${AXPRegionalSetting.TimeZone}') }}`,
528
+ interface: {
529
+ type: AXPWidgetsCatalog.select,
530
+ options: {
531
+ allowSearch: true,
532
+ valueField: 'code',
533
+ placeholder: 'e.g., America/New_York',
534
+ dataSource: AXPLocaleManagementDataSourceKeys.Timezones,
535
+ },
536
+ },
537
+ },
538
+ },
539
+ {
540
+ name: 'population',
541
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.population',
542
+ groupId: 'additional-info',
543
+ options: {
544
+ filter: {
545
+ advance: {
546
+ enabled: true,
547
+ },
548
+ },
549
+ },
550
+ schema: {
551
+ dataType: 'number',
552
+ interface: {
553
+ type: AXPWidgetsCatalog.number,
554
+ options: {
555
+ minValue: 0,
556
+ },
557
+ },
558
+ },
559
+ },
560
+ {
561
+ name: 'area',
562
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.area',
563
+ groupId: 'additional-info',
564
+ options: {
565
+ filter: {
566
+ advance: {
567
+ enabled: true,
568
+ },
569
+ },
570
+ },
571
+ schema: {
572
+ dataType: 'number',
573
+ interface: {
574
+ type: AXPWidgetsCatalog.number,
575
+ options: {
576
+ minValue: 0,
577
+ placeholder: 'Area in square kilometers',
578
+ },
579
+ },
580
+ },
581
+ },
582
+ {
583
+ name: 'currencyId',
584
+ title: '@location-management:geographic-regions.entities.geographic-region.fields.currency',
585
+ groupId: 'additional-info',
586
+ options: {
587
+ sort: { enabled: false },
588
+ filter: {
589
+ advance: {
590
+ enabled: true,
591
+ },
592
+ inline: { enabled: false },
593
+ },
594
+ },
595
+ schema: {
596
+ dataType: 'string',
597
+ interface: {
598
+ type: AXPWidgetsCatalog.lookup,
599
+ options: {
600
+ entity: `${"FinancialCore"}.${"Currency"}`,
601
+ multiple: false,
602
+ look: 'select',
603
+ textField: 'code',
604
+ valueField: 'id',
605
+ expose: [
606
+ { source: 'id', target: 'currency.id' },
607
+ { source: 'code', target: 'currency.code' },
608
+ { source: 'title', target: 'currency.title' },
609
+ { source: 'symbol', target: 'currency.symbol' },
610
+ ],
611
+ },
612
+ },
613
+ },
614
+ },
615
+ ],
616
+ columns: [
617
+ { name: 'title', options: { width: '400px', order: 1 } },
618
+ { name: 'code', options: { width: '150px', order: 2 } },
619
+ { name: 'type', options: { width: '150px', dataPath: 'type.title', order: 3 } },
620
+ { name: 'currencyId', options: { width: '150px', dataPath: 'currency.code', order: 4 } },
621
+ ],
622
+ interfaces: {
623
+ master: {
624
+ create: {
625
+ sections: [
626
+ {
627
+ id: 'basic-info',
628
+ },
629
+ {
630
+ id: 'geographic-data',
631
+ },
632
+ {
633
+ id: 'additional-info',
634
+ },
635
+ {
636
+ id: 'settings',
637
+ },
638
+ ],
639
+ properties: [
640
+ {
641
+ name: 'title',
642
+ layout: {
643
+ positions: {
644
+ sm: {
645
+ colSpan: 12,
646
+ },
647
+ md: {
648
+ colSpan: 6,
649
+ },
650
+ },
651
+ },
652
+ },
653
+ {
654
+ name: 'code',
655
+ layout: {
656
+ positions: {
657
+ sm: {
658
+ colSpan: 12,
659
+ },
660
+ md: {
661
+ colSpan: 6,
662
+ },
663
+ },
664
+ },
665
+ },
666
+ {
667
+ name: 'type',
668
+ layout: {
669
+ positions: {
670
+ sm: {
671
+ colSpan: 12,
672
+ },
673
+ md: {
674
+ colSpan: 6,
675
+ },
676
+ },
677
+ },
678
+ },
679
+ {
680
+ name: 'parentId',
681
+ layout: {
682
+ positions: {
683
+ sm: {
684
+ colSpan: 12,
685
+ },
686
+ md: {
687
+ colSpan: 6,
688
+ },
689
+ },
690
+ },
691
+ },
692
+ {
693
+ name: 'coordinates',
694
+ layout: {
695
+ positions: {
696
+ sm: {
697
+ colSpan: 12,
698
+ },
699
+ },
700
+ },
701
+ },
702
+ {
703
+ name: 'timezone',
704
+ layout: {
705
+ positions: {
706
+ sm: {
707
+ colSpan: 12,
708
+ },
709
+ md: {
710
+ colSpan: 4,
711
+ },
712
+ },
713
+ },
714
+ },
715
+ {
716
+ name: 'population',
717
+ layout: {
718
+ positions: {
719
+ sm: {
720
+ colSpan: 12,
721
+ },
722
+ md: {
723
+ colSpan: 4,
724
+ },
725
+ },
726
+ },
727
+ },
728
+ {
729
+ name: 'area',
730
+ layout: {
731
+ positions: {
732
+ sm: {
733
+ colSpan: 12,
734
+ },
735
+ md: {
736
+ colSpan: 4,
737
+ },
738
+ },
739
+ },
740
+ },
741
+ {
742
+ name: 'currencyId',
743
+ layout: {
744
+ positions: {
745
+ sm: {
746
+ colSpan: 12,
747
+ },
748
+ md: {
749
+ colSpan: 4,
750
+ },
751
+ },
752
+ },
753
+ },
754
+ ],
755
+ },
756
+ update: {
757
+ sections: [
758
+ {
759
+ id: 'basic-info',
760
+ },
761
+ {
762
+ id: 'geographic-data',
763
+ },
764
+ {
765
+ id: 'additional-info',
766
+ },
767
+ {
768
+ id: 'settings',
769
+ },
770
+ ],
771
+ properties: [
772
+ {
773
+ name: 'title',
774
+ layout: {
775
+ positions: {
776
+ sm: {
777
+ colSpan: 12,
778
+ },
779
+ md: {
780
+ colSpan: 6,
781
+ },
782
+ },
783
+ },
784
+ },
785
+ {
786
+ name: 'code',
787
+ layout: {
788
+ positions: {
789
+ sm: {
790
+ colSpan: 12,
791
+ },
792
+ md: {
793
+ colSpan: 6,
794
+ },
795
+ },
796
+ },
797
+ },
798
+ {
799
+ name: 'type',
800
+ layout: {
801
+ positions: {
802
+ sm: {
803
+ colSpan: 12,
804
+ },
805
+ md: {
806
+ colSpan: 6,
807
+ },
808
+ },
809
+ },
810
+ },
811
+ {
812
+ name: 'parentId',
813
+ layout: {
814
+ positions: {
815
+ sm: {
816
+ colSpan: 12,
817
+ },
818
+ md: {
819
+ colSpan: 6,
820
+ },
821
+ },
822
+ },
823
+ },
824
+ {
825
+ name: 'coordinates',
826
+ layout: {
827
+ positions: {
828
+ sm: {
829
+ colSpan: 12,
830
+ },
831
+ },
832
+ },
833
+ },
834
+ {
835
+ name: 'timezone',
836
+ layout: {
837
+ positions: {
838
+ sm: {
839
+ colSpan: 12,
840
+ },
841
+ md: {
842
+ colSpan: 4,
843
+ },
844
+ },
845
+ },
846
+ },
847
+ {
848
+ name: 'population',
849
+ layout: {
850
+ positions: {
851
+ sm: {
852
+ colSpan: 12,
853
+ },
854
+ md: {
855
+ colSpan: 4,
856
+ },
857
+ },
858
+ },
859
+ },
860
+ {
861
+ name: 'area',
862
+ layout: {
863
+ positions: {
864
+ sm: {
865
+ colSpan: 12,
866
+ },
867
+ md: {
868
+ colSpan: 4,
869
+ },
870
+ },
871
+ },
872
+ },
873
+ {
874
+ name: 'currencyId',
875
+ layout: {
876
+ positions: {
877
+ sm: {
878
+ colSpan: 12,
879
+ },
880
+ md: {
881
+ colSpan: 4,
882
+ },
883
+ },
884
+ },
885
+ },
886
+ ],
887
+ },
888
+ single: {
889
+ title: '{{title}}',
890
+ sections: [
891
+ {
892
+ id: 'basic-info',
893
+ layout: {
894
+ positions: {
895
+ lg: {
896
+ colSpan: 12,
897
+ },
898
+ },
899
+ },
900
+ },
901
+ {
902
+ id: 'geographic-data',
903
+ layout: {
904
+ positions: {
905
+ lg: {
906
+ colSpan: 12,
907
+ },
908
+ },
909
+ },
910
+ },
911
+ {
912
+ id: 'additional-info',
913
+ layout: {
914
+ positions: {
915
+ lg: {
916
+ colSpan: 12,
917
+ },
918
+ },
919
+ },
920
+ },
921
+ {
922
+ id: 'settings',
923
+ layout: {
924
+ positions: {
925
+ lg: {
926
+ colSpan: 12,
927
+ },
928
+ },
929
+ },
930
+ },
931
+ ],
932
+ properties: [
933
+ {
934
+ name: 'title',
935
+ layout: {
936
+ positions: {
937
+ lg: {
938
+ colSpan: 6,
939
+ order: 1,
940
+ },
941
+ },
942
+ },
943
+ },
944
+ {
945
+ name: 'code',
946
+ layout: {
947
+ positions: {
948
+ lg: {
949
+ colSpan: 6,
950
+ order: 2,
951
+ },
952
+ },
953
+ },
954
+ },
955
+ {
956
+ name: 'type',
957
+ layout: {
958
+ positions: {
959
+ lg: {
960
+ colSpan: 6,
961
+ order: 3,
962
+ },
963
+ },
964
+ },
965
+ },
966
+ {
967
+ name: 'parentId',
968
+ layout: {
969
+ positions: {
970
+ lg: {
971
+ colSpan: 6,
972
+ order: 4,
973
+ },
974
+ },
975
+ },
976
+ },
977
+ {
978
+ name: 'coordinates',
979
+ layout: {
980
+ positions: {
981
+ lg: {
982
+ colSpan: 12,
983
+ order: 5,
984
+ },
985
+ },
986
+ },
987
+ },
988
+ {
989
+ name: 'timezone',
990
+ layout: {
991
+ positions: {
992
+ lg: {
993
+ colSpan: 4,
994
+ order: 6,
995
+ },
996
+ },
997
+ },
998
+ },
999
+ {
1000
+ name: 'population',
1001
+ layout: {
1002
+ positions: {
1003
+ lg: {
1004
+ colSpan: 4,
1005
+ order: 7,
1006
+ },
1007
+ },
1008
+ },
1009
+ },
1010
+ {
1011
+ name: 'area',
1012
+ layout: {
1013
+ positions: {
1014
+ lg: {
1015
+ colSpan: 4,
1016
+ order: 8,
1017
+ },
1018
+ },
1019
+ },
1020
+ },
1021
+ {
1022
+ name: 'currencyId',
1023
+ layout: {
1024
+ positions: {
1025
+ lg: {
1026
+ colSpan: 4,
1027
+ order: 9,
1028
+ },
1029
+ },
1030
+ },
1031
+ },
1032
+ ],
1033
+ actions: [...entityMasterRecordActions()],
1034
+ },
1035
+ list: {
1036
+ actions: [...entityMasterCrudActions()],
1037
+ views: [
1038
+ createAllQueryView({
1039
+ sorts: [{ name: 'title', dir: 'asc' }],
1040
+ }),
1041
+ ],
1042
+ },
1043
+ },
1044
+ },
1045
+ };
1046
+ return entityDef;
1047
+ }
1048
+
1049
+ async function locationFactory() {
1050
+ const entityDef = {
1051
+ module: RootConfig.module.name,
1052
+ name: RootConfig.entities.location.name,
1053
+ icon: 'fa-solid fa-location-dot',
1054
+ title: RootConfig.entities.location.title,
1055
+ formats: {
1056
+ individual: RootConfig.entities.location.title,
1057
+ plural: RootConfig.entities.location.titlePlural,
1058
+ searchResult: {
1059
+ title: '{{ title }}',
1060
+ description: '{{ fullAddress }}',
1061
+ },
1062
+ },
1063
+ plugins: [
1064
+ { name: 'archive' },
1065
+ {
1066
+ name: 'computed-property',
1067
+ options: {
1068
+ fields: [
1069
+ {
1070
+ name: 'fullAddress',
1071
+ title: '@general:terms.common.address',
1072
+ 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") }) }}',
1073
+ group: {
1074
+ id: 'address',
1075
+ title: '@location-management:locations.entities.location.groups.address-details',
1076
+ },
1077
+ visible: false,
1078
+ recompute: { middleware: true },
1079
+ showAs: { type: AXPWidgetsCatalog.text },
1080
+ },
1081
+ ],
1082
+ },
1083
+ },
1084
+ ],
1085
+ groups: [
1086
+ {
1087
+ id: 'basic-info',
1088
+ title: '@general:terms.interface.basic-info',
1089
+ },
1090
+ {
1091
+ id: 'address',
1092
+ title: '@location-management:locations.entities.location.groups.address-details',
1093
+ },
1094
+ {
1095
+ id: 'geographic',
1096
+ title: '@general:terms.interface.geographic-details',
1097
+ },
1098
+ {
1099
+ id: 'additional',
1100
+ title: '@general:terms.interface.additional-info',
1101
+ },
1102
+ ],
1103
+ properties: [
1104
+ {
1105
+ name: 'code',
1106
+ title: '@location-management:locations.entities.location.fields.code',
1107
+ groupId: 'basic-info',
1108
+ options: {
1109
+ sort: {
1110
+ enabled: true,
1111
+ },
1112
+ filter: {
1113
+ advance: {
1114
+ enabled: true,
1115
+ },
1116
+ inline: {
1117
+ enabled: true,
1118
+ },
1119
+ },
1120
+ },
1121
+ schema: {
1122
+ dataType: 'string',
1123
+ interface: {
1124
+ type: AXPWidgetsCatalog.text,
1125
+ options: {
1126
+ placeholder: 'Optional location code',
1127
+ },
1128
+ },
1129
+ },
1130
+ },
1131
+ {
1132
+ name: 'title',
1133
+ title: '@general:terms.common.title',
1134
+ groupId: 'basic-info',
1135
+ options: {
1136
+ sort: {
1137
+ enabled: true,
1138
+ },
1139
+ filter: {
1140
+ advance: {
1141
+ enabled: true,
1142
+ },
1143
+ inline: {
1144
+ enabled: true,
1145
+ },
1146
+ },
1147
+ },
1148
+ schema: {
1149
+ dataType: 'string',
1150
+ interface: {
1151
+ type: AXPWidgetsCatalog.text,
1152
+ options: {
1153
+ placeholder: 'Enter location name',
1154
+ },
1155
+ },
1156
+ },
1157
+ validations: [
1158
+ {
1159
+ rule: 'required',
1160
+ },
1161
+ ],
1162
+ },
1163
+ {
1164
+ name: 'locationTypeId',
1165
+ title: '@location-management:locations.entities.location.fields.location-type',
1166
+ groupId: 'basic-info',
1167
+ options: {
1168
+ sort: {
1169
+ enabled: true,
1170
+ },
1171
+ filter: {
1172
+ advance: {
1173
+ enabled: true,
1174
+ },
1175
+ inline: {
1176
+ enabled: true,
1177
+ },
1178
+ },
1179
+ },
1180
+ schema: {
1181
+ dataType: 'object',
1182
+ interface: {
1183
+ type: AXPWidgetsCatalog.lookup,
1184
+ options: {
1185
+ entity: `${RootConfig.module.name}.${RootConfig.entities.locationType.name}`,
1186
+ look: 'select',
1187
+ expose: [
1188
+ { source: 'id', target: 'locationType.id' },
1189
+ { source: 'title', target: 'locationType.title' },
1190
+ ],
1191
+ },
1192
+ },
1193
+ },
1194
+ validations: [
1195
+ {
1196
+ rule: 'required',
1197
+ },
1198
+ ],
1199
+ },
1200
+ {
1201
+ name: 'street1',
1202
+ title: '@location-management:locations.entities.location.fields.street1',
1203
+ groupId: 'address',
1204
+ options: {
1205
+ sort: {
1206
+ enabled: true,
1207
+ },
1208
+ filter: {
1209
+ advance: {
1210
+ enabled: true,
1211
+ },
1212
+ inline: {
1213
+ enabled: true,
1214
+ },
1215
+ },
1216
+ },
1217
+ schema: {
1218
+ dataType: 'string',
1219
+ interface: {
1220
+ type: AXPWidgetsCatalog.text,
1221
+ options: {
1222
+ placeholder: 'Enter street address',
1223
+ },
1224
+ },
1225
+ },
1226
+ validations: [
1227
+ {
1228
+ rule: 'required',
1229
+ },
1230
+ ],
1231
+ },
1232
+ {
1233
+ name: 'street2',
1234
+ title: '@location-management:locations.entities.location.fields.street2',
1235
+ groupId: 'address',
1236
+ options: {
1237
+ filter: {
1238
+ advance: {
1239
+ enabled: true,
1240
+ },
1241
+ },
1242
+ },
1243
+ schema: {
1244
+ dataType: 'string',
1245
+ interface: {
1246
+ type: AXPWidgetsCatalog.text,
1247
+ options: {
1248
+ placeholder: 'Apartment, suite, etc.',
1249
+ },
1250
+ },
1251
+ },
1252
+ },
1253
+ {
1254
+ name: 'countryId',
1255
+ title: '@location-management:locations.entities.location.fields.country',
1256
+ groupId: 'address',
1257
+ options: {
1258
+ sort: {
1259
+ enabled: true,
1260
+ },
1261
+ filter: {
1262
+ advance: {
1263
+ enabled: true,
1264
+ },
1265
+ inline: {
1266
+ enabled: true,
1267
+ },
1268
+ },
1269
+ },
1270
+ schema: {
1271
+ dataType: 'object',
1272
+ interface: {
1273
+ type: AXPWidgetsCatalog.lookup,
1274
+ options: {
1275
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
1276
+ look: 'select',
1277
+ allowCreate: 'quick',
1278
+ create: {
1279
+ enable: true,
1280
+ },
1281
+ expose: [
1282
+ { source: 'id', target: 'country.id' },
1283
+ { source: 'title', target: 'country.title' },
1284
+ ],
1285
+ filter: {
1286
+ logic: 'and',
1287
+ filters: [
1288
+ { field: 'type.code', operator: { type: 'equal' }, value: 'country' },
1289
+ ],
1290
+ },
1291
+ },
1292
+ },
1293
+ },
1294
+ },
1295
+ {
1296
+ name: 'stateId',
1297
+ title: '@location-management:locations.entities.location.fields.state',
1298
+ groupId: 'address',
1299
+ options: {
1300
+ filter: {
1301
+ advance: {
1302
+ enabled: true,
1303
+ },
1304
+ inline: {
1305
+ enabled: true,
1306
+ },
1307
+ },
1308
+ },
1309
+ schema: {
1310
+ dataType: 'object',
1311
+ interface: {
1312
+ type: AXPWidgetsCatalog.lookup,
1313
+ options: {
1314
+ look: 'select',
1315
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
1316
+ allowCreate: 'quick',
1317
+ disabled: '{{ !context.eval("countryId") }}',
1318
+ create: {
1319
+ enable: true,
1320
+ context: {
1321
+ parentId: '{{ context.eval("countryId") }}',
1322
+ type: { code: 'state' },
1323
+ },
1324
+ },
1325
+ expose: [
1326
+ { source: 'id', target: 'state.id' },
1327
+ { source: 'title', target: 'state.title' },
1328
+ ],
1329
+ filter: {
1330
+ logic: 'and',
1331
+ filters: [
1332
+ {
1333
+ field: 'parentId',
1334
+ operator: {
1335
+ type: 'equal',
1336
+ },
1337
+ value: '{{ context.eval("countryId") }}',
1338
+ },
1339
+ {
1340
+ field: 'type.code',
1341
+ operator: {
1342
+ type: 'equal',
1343
+ },
1344
+ value: 'state',
1345
+ },
1346
+ ],
1347
+ },
1348
+ },
1349
+ triggers: [
1350
+ {
1351
+ event: "{{ events.context('countryId') }}",
1352
+ 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(); }}`,
1353
+ },
1354
+ ],
1355
+ },
1356
+ },
1357
+ },
1358
+ {
1359
+ name: 'cityId',
1360
+ title: '@location-management:locations.entities.location.fields.city',
1361
+ groupId: 'address',
1362
+ options: {
1363
+ filter: {
1364
+ advance: {
1365
+ enabled: true,
1366
+ },
1367
+ inline: {
1368
+ enabled: true,
1369
+ },
1370
+ },
1371
+ },
1372
+ schema: {
1373
+ dataType: 'object',
1374
+ interface: {
1375
+ type: AXPWidgetsCatalog.lookup,
1376
+ options: {
1377
+ look: 'select',
1378
+ entity: `${RootConfig.module.name}.${RootConfig.entities.geographicRegion.name}`,
1379
+ allowCreate: 'quick',
1380
+ disabled: '{{ !context.eval("stateId") }}',
1381
+ create: {
1382
+ enable: true,
1383
+ context: {
1384
+ parentId: '{{ context.eval("stateId") }}',
1385
+ type: { code: 'city' },
1386
+ },
1387
+ },
1388
+ expose: [
1389
+ { source: 'id', target: 'city.id' },
1390
+ { source: 'title', target: 'city.title' },
1391
+ ],
1392
+ filter: {
1393
+ logic: 'and',
1394
+ filters: [
1395
+ {
1396
+ field: 'parentId',
1397
+ operator: {
1398
+ type: 'equal',
1399
+ },
1400
+ value: '{{ context.eval("stateId") }}',
1401
+ },
1402
+ {
1403
+ field: 'type.code',
1404
+ operator: {
1405
+ type: 'equal',
1406
+ },
1407
+ value: 'city',
1408
+ },
1409
+ ],
1410
+ },
1411
+ },
1412
+ triggers: [
1413
+ {
1414
+ event: "{{ events.context('stateId') }}",
1415
+ action: `{{ widget.setValue(null); context.set('city.title', null); widget.refresh(); }}`,
1416
+ },
1417
+ {
1418
+ event: "{{ events.context('countryId') }}",
1419
+ action: `{{ widget.setValue(null); context.set('city.title', null); widget.refresh(); }}`,
1420
+ },
1421
+ ],
1422
+ },
1423
+ },
1424
+ },
1425
+ {
1426
+ name: 'postalCode',
1427
+ title: '@location-management:locations.entities.location.fields.postal-code',
1428
+ groupId: 'address',
1429
+ options: {
1430
+ filter: {
1431
+ advance: {
1432
+ enabled: true,
1433
+ },
1434
+ inline: {
1435
+ enabled: true,
1436
+ },
1437
+ },
1438
+ },
1439
+ schema: {
1440
+ dataType: 'string',
1441
+ interface: {
1442
+ type: AXPWidgetsCatalog.text,
1443
+ options: {
1444
+ placeholder: 'Postal/ZIP code',
1445
+ },
1446
+ },
1447
+ },
1448
+ validations: [
1449
+ {
1450
+ rule: 'required',
1451
+ },
1452
+ ],
1453
+ },
1454
+ {
1455
+ name: 'hasCoordinates',
1456
+ title: '@location-management:locations.entities.location.fields.coordinates',
1457
+ groupId: 'geographic',
1458
+ schema: {
1459
+ dataType: 'boolean',
1460
+ defaultValue: false,
1461
+ interface: {
1462
+ type: AXPWidgetsCatalog.toggle,
1463
+ },
1464
+ },
1465
+ },
1466
+ {
1467
+ name: 'coordinates',
1468
+ title: '@location-management:locations.entities.location.fields.coordinates',
1469
+ groupId: 'geographic',
1470
+ schema: {
1471
+ dataType: 'string',
1472
+ visible: '{{ context.eval("hasCoordinates") == true || !!context.eval("coordinates") }}',
1473
+ interface: {
1474
+ type: AXPWidgetsCatalog.map,
1475
+ options: {
1476
+ hasDraw: true,
1477
+ maxPolygon: 0,
1478
+ fitToDraw: true,
1479
+ },
1480
+ triggers: [
1481
+ {
1482
+ event: "{{ events.context('hasCoordinates') }}",
1483
+ action: `{{ widget.clear() }}`,
1484
+ },
1485
+ ],
1486
+ },
1487
+ },
1488
+ },
1489
+ {
1490
+ name: 'timezone',
1491
+ title: '@location-management:locations.entities.location.fields.timezone',
1492
+ groupId: 'geographic',
1493
+ options: {
1494
+ filter: {
1495
+ advance: {
1496
+ enabled: true,
1497
+ },
1498
+ },
1499
+ },
1500
+ schema: {
1501
+ dataType: 'string',
1502
+ defaultValue: `{{ settings.get('${AXPRegionalSetting.TimeZone}') }}`,
1503
+ interface: {
1504
+ type: AXPWidgetsCatalog.select,
1505
+ options: {
1506
+ allowSearch: true,
1507
+ valueField: 'code',
1508
+ placeholder: 'e.g., America/New_York',
1509
+ dataSource: AXPLocaleManagementDataSourceKeys.Timezones,
1510
+ },
1511
+ },
1512
+ },
1513
+ },
1514
+ {
1515
+ name: 'parentLocationId',
1516
+ title: '@location-management:locations.entities.location.fields.parent-location',
1517
+ groupId: 'basic-info',
1518
+ options: {
1519
+ filter: {
1520
+ advance: {
1521
+ enabled: true,
1522
+ },
1523
+ inline: {
1524
+ enabled: true,
1525
+ },
1526
+ },
1527
+ },
1528
+ schema: {
1529
+ dataType: 'object',
1530
+ interface: {
1531
+ type: AXPWidgetsCatalog.lookup,
1532
+ options: {
1533
+ entity: `${RootConfig.module.name}.${RootConfig.entities.location.name}`,
1534
+ expose: [
1535
+ { source: 'id', target: 'parentLocation.id' },
1536
+ { source: 'title', target: 'parentLocation.title' },
1537
+ ],
1538
+ },
1539
+ },
1540
+ },
1541
+ },
1542
+ {
1543
+ name: 'description',
1544
+ title: '@general:terms.common.description',
1545
+ groupId: 'basic-info',
1546
+ options: {
1547
+ filter: {
1548
+ advance: {
1549
+ enabled: true,
1550
+ },
1551
+ },
1552
+ },
1553
+ schema: {
1554
+ dataType: 'string',
1555
+ interface: {
1556
+ type: AXPWidgetsCatalog.largeText,
1557
+ options: {
1558
+ rows: 3,
1559
+ },
1560
+ },
1561
+ },
1562
+ },
1563
+ ],
1564
+ columns: [
1565
+ { name: 'code' },
1566
+ { name: 'title' },
1567
+ { name: 'locationTypeId', options: { dataPath: 'locationType.title' } },
1568
+ { name: 'street1' },
1569
+ { name: 'postalCode' },
1570
+ { name: 'cityId', options: { dataPath: 'city.title' } },
1571
+ { name: 'stateId', options: { dataPath: 'state.title' } },
1572
+ { name: 'countryId', options: { dataPath: 'country.title' } },
1573
+ ],
1574
+ relatedEntities: [
1575
+ {
1576
+ entity: `${RootConfig.module.name}.${RootConfig.entities.locationAssignment.name}`,
1577
+ title: '@location-management:locations.entities.location.related-entities.assignments.title',
1578
+ icon: RootConfig.entities.locationAssignment.icon,
1579
+ columns: [
1580
+ { name: 'ownerRef.id', options: { dataPath: 'ownerRef.title' } },
1581
+ { name: 'roleId', options: { dataPath: 'role.title' } },
1582
+ { name: 'personId', options: { dataPath: 'person.fullName' } },
1583
+ { name: 'person.phones' },
1584
+ { name: 'notes' },
1585
+ ],
1586
+ conditions: locationAssignmentLocationConditions('id'),
1587
+ actions: [...locationAssignmentReadOnlyRelatedActions()],
1588
+ layout: { type: 'page-list', position: 'after', order: 1 },
1589
+ },
1590
+ ],
1591
+ interfaces: {
1592
+ master: {
1593
+ create: {
1594
+ sections: [
1595
+ {
1596
+ id: 'basic-info',
1597
+ },
1598
+ {
1599
+ id: 'address',
1600
+ },
1601
+ {
1602
+ id: 'geographic',
1603
+ },
1604
+ {
1605
+ id: 'additional',
1606
+ },
1607
+ ],
1608
+ properties: [
1609
+ {
1610
+ name: 'code',
1611
+ },
1612
+ {
1613
+ name: 'title',
1614
+ },
1615
+ {
1616
+ name: 'locationTypeId',
1617
+ layout: {
1618
+ positions: {
1619
+ sm: {
1620
+ colSpan: 12,
1621
+ },
1622
+ md: {
1623
+ colSpan: 6,
1624
+ },
1625
+ },
1626
+ },
1627
+ },
1628
+ {
1629
+ name: 'street1',
1630
+ layout: {
1631
+ positions: {
1632
+ sm: {
1633
+ colSpan: 12,
1634
+ },
1635
+ },
1636
+ },
1637
+ },
1638
+ {
1639
+ name: 'street2',
1640
+ layout: {
1641
+ positions: {
1642
+ sm: {
1643
+ colSpan: 12,
1644
+ },
1645
+ },
1646
+ },
1647
+ },
1648
+ {
1649
+ name: 'countryId',
1650
+ layout: {
1651
+ positions: {
1652
+ sm: {
1653
+ colSpan: 12,
1654
+ },
1655
+ md: {
1656
+ colSpan: 4,
1657
+ },
1658
+ },
1659
+ },
1660
+ },
1661
+ {
1662
+ name: 'stateId',
1663
+ layout: {
1664
+ positions: {
1665
+ sm: {
1666
+ colSpan: 12,
1667
+ },
1668
+ md: {
1669
+ colSpan: 4,
1670
+ },
1671
+ },
1672
+ },
1673
+ },
1674
+ {
1675
+ name: 'cityId',
1676
+ layout: {
1677
+ positions: {
1678
+ sm: {
1679
+ colSpan: 12,
1680
+ },
1681
+ md: {
1682
+ colSpan: 4,
1683
+ },
1684
+ },
1685
+ },
1686
+ },
1687
+ {
1688
+ name: 'postalCode',
1689
+ layout: {
1690
+ positions: {
1691
+ sm: {
1692
+ colSpan: 12,
1693
+ },
1694
+ md: {
1695
+ colSpan: 4,
1696
+ },
1697
+ },
1698
+ },
1699
+ },
1700
+ {
1701
+ name: 'hasCoordinates',
1702
+ layout: {
1703
+ positions: {
1704
+ sm: {
1705
+ colSpan: 6,
1706
+ },
1707
+ },
1708
+ },
1709
+ },
1710
+ {
1711
+ name: 'coordinates',
1712
+ layout: {
1713
+ label: {
1714
+ visible: false,
1715
+ },
1716
+ positions: {
1717
+ sm: {
1718
+ colSpan: 12,
1719
+ },
1720
+ },
1721
+ },
1722
+ },
1723
+ {
1724
+ name: 'timezone',
1725
+ layout: {
1726
+ positions: {
1727
+ sm: {
1728
+ colSpan: 12,
1729
+ colStart: 1,
1730
+ },
1731
+ md: {
1732
+ colSpan: 4,
1733
+ colStart: 1,
1734
+ },
1735
+ },
1736
+ },
1737
+ },
1738
+ {
1739
+ name: 'parentLocationId',
1740
+ layout: {
1741
+ positions: {
1742
+ sm: {
1743
+ colSpan: 12,
1744
+ },
1745
+ md: {
1746
+ colSpan: 6,
1747
+ },
1748
+ },
1749
+ },
1750
+ },
1751
+ {
1752
+ name: 'description',
1753
+ },
1754
+ ],
1755
+ },
1756
+ update: {
1757
+ sections: [
1758
+ {
1759
+ id: 'basic-info',
1760
+ },
1761
+ {
1762
+ id: 'address',
1763
+ },
1764
+ {
1765
+ id: 'geographic',
1766
+ },
1767
+ {
1768
+ id: 'additional',
1769
+ },
1770
+ {
1771
+ id: 'settings',
1772
+ },
1773
+ ],
1774
+ properties: [
1775
+ {
1776
+ name: 'code',
1777
+ },
1778
+ {
1779
+ name: 'title',
1780
+ },
1781
+ {
1782
+ name: 'locationTypeId',
1783
+ layout: {
1784
+ positions: {
1785
+ sm: {
1786
+ colSpan: 12,
1787
+ },
1788
+ md: {
1789
+ colSpan: 6,
1790
+ },
1791
+ },
1792
+ },
1793
+ },
1794
+ {
1795
+ name: 'description',
1796
+ },
1797
+ {
1798
+ name: 'parentLocationId',
1799
+ layout: {
1800
+ positions: {
1801
+ sm: {
1802
+ colSpan: 12,
1803
+ },
1804
+ md: {
1805
+ colSpan: 6,
1806
+ },
1807
+ },
1808
+ },
1809
+ },
1810
+ {
1811
+ name: 'street1',
1812
+ layout: {
1813
+ positions: {
1814
+ sm: {
1815
+ colSpan: 12,
1816
+ },
1817
+ },
1818
+ },
1819
+ },
1820
+ {
1821
+ name: 'street2',
1822
+ layout: {
1823
+ positions: {
1824
+ sm: {
1825
+ colSpan: 12,
1826
+ },
1827
+ },
1828
+ },
1829
+ },
1830
+ {
1831
+ name: 'cityId',
1832
+ layout: {
1833
+ positions: {
1834
+ sm: {
1835
+ colSpan: 12,
1836
+ },
1837
+ md: {
1838
+ colSpan: 4,
1839
+ },
1840
+ },
1841
+ },
1842
+ },
1843
+ {
1844
+ name: 'stateId',
1845
+ layout: {
1846
+ positions: {
1847
+ sm: {
1848
+ colSpan: 12,
1849
+ },
1850
+ md: {
1851
+ colSpan: 4,
1852
+ },
1853
+ },
1854
+ },
1855
+ },
1856
+ {
1857
+ name: 'countryId',
1858
+ layout: {
1859
+ positions: {
1860
+ sm: {
1861
+ colSpan: 12,
1862
+ },
1863
+ md: {
1864
+ colSpan: 4,
1865
+ },
1866
+ },
1867
+ },
1868
+ },
1869
+ {
1870
+ name: 'postalCode',
1871
+ layout: {
1872
+ positions: {
1873
+ sm: {
1874
+ colSpan: 12,
1875
+ },
1876
+ md: {
1877
+ colSpan: 4,
1878
+ },
1879
+ },
1880
+ },
1881
+ },
1882
+ {
1883
+ name: 'hasCoordinates',
1884
+ layout: {
1885
+ positions: {
1886
+ sm: {
1887
+ colSpan: 6,
1888
+ },
1889
+ },
1890
+ },
1891
+ },
1892
+ {
1893
+ name: 'coordinates',
1894
+ layout: {
1895
+ label: {
1896
+ visible: false,
1897
+ },
1898
+ positions: {
1899
+ sm: {
1900
+ colSpan: 12,
1901
+ },
1902
+ },
1903
+ },
1904
+ },
1905
+ {
1906
+ name: 'timezone',
1907
+ layout: {
1908
+ positions: {
1909
+ sm: {
1910
+ colSpan: 12,
1911
+ colStart: 1,
1912
+ },
1913
+ md: {
1914
+ colSpan: 4,
1915
+ colStart: 1,
1916
+ },
1917
+ },
1918
+ },
1919
+ },
1920
+ ],
1921
+ },
1922
+ single: {
1923
+ title: '{{title}}',
1924
+ description: '{{ fullAddress }}',
1925
+ sections: [
1926
+ {
1927
+ id: 'basic-info',
1928
+ layout: {
1929
+ positions: {
1930
+ lg: {
1931
+ colSpan: 12,
1932
+ },
1933
+ },
1934
+ },
1935
+ },
1936
+ {
1937
+ id: 'address',
1938
+ layout: {
1939
+ positions: {
1940
+ lg: {
1941
+ colSpan: 12,
1942
+ },
1943
+ },
1944
+ },
1945
+ },
1946
+ {
1947
+ id: 'geographic',
1948
+ layout: {
1949
+ positions: {
1950
+ lg: {
1951
+ colSpan: 12,
1952
+ },
1953
+ },
1954
+ },
1955
+ },
1956
+ {
1957
+ id: 'additional',
1958
+ layout: {
1959
+ positions: {
1960
+ lg: {
1961
+ colSpan: 12,
1962
+ },
1963
+ },
1964
+ },
1965
+ },
1966
+ ],
1967
+ properties: [
1968
+ {
1969
+ name: 'code',
1970
+ },
1971
+ {
1972
+ name: 'title',
1973
+ },
1974
+ {
1975
+ name: 'locationTypeId',
1976
+ layout: {
1977
+ positions: {
1978
+ lg: {
1979
+ colSpan: 6,
1980
+ order: 3,
1981
+ },
1982
+ },
1983
+ },
1984
+ },
1985
+ {
1986
+ name: 'description',
1987
+ },
1988
+ {
1989
+ name: 'parentLocationId',
1990
+ layout: {
1991
+ positions: {
1992
+ lg: {
1993
+ colSpan: 6,
1994
+ order: 11,
1995
+ },
1996
+ },
1997
+ },
1998
+ },
1999
+ {
2000
+ name: 'street1',
2001
+ layout: {
2002
+ positions: {
2003
+ lg: {
2004
+ colSpan: 12,
2005
+ order: 4,
2006
+ },
2007
+ },
2008
+ },
2009
+ },
2010
+ {
2011
+ name: 'street2',
2012
+ layout: {
2013
+ positions: {
2014
+ lg: {
2015
+ colSpan: 12,
2016
+ order: 5,
2017
+ },
2018
+ },
2019
+ },
2020
+ },
2021
+ {
2022
+ name: 'cityId',
2023
+ layout: {
2024
+ positions: {
2025
+ lg: {
2026
+ colSpan: 4,
2027
+ order: 6,
2028
+ },
2029
+ },
2030
+ },
2031
+ },
2032
+ {
2033
+ name: 'stateId',
2034
+ layout: {
2035
+ positions: {
2036
+ lg: {
2037
+ colSpan: 4,
2038
+ order: 7,
2039
+ },
2040
+ },
2041
+ },
2042
+ },
2043
+ {
2044
+ name: 'countryId',
2045
+ layout: {
2046
+ positions: {
2047
+ lg: {
2048
+ colSpan: 4,
2049
+ order: 8,
2050
+ },
2051
+ },
2052
+ },
2053
+ },
2054
+ {
2055
+ name: 'postalCode',
2056
+ layout: {
2057
+ positions: {
2058
+ lg: {
2059
+ colSpan: 4,
2060
+ order: 9,
2061
+ },
2062
+ },
2063
+ },
2064
+ },
2065
+ {
2066
+ name: 'hasCoordinates',
2067
+ layout: {
2068
+ positions: {
2069
+ lg: {
2070
+ colSpan: 6,
2071
+ order: 10,
2072
+ },
2073
+ },
2074
+ },
2075
+ },
2076
+ {
2077
+ name: 'coordinates',
2078
+ layout: {
2079
+ label: {
2080
+ visible: false,
2081
+ },
2082
+ positions: {
2083
+ lg: {
2084
+ colSpan: 12,
2085
+ order: 11,
2086
+ },
2087
+ },
2088
+ },
2089
+ },
2090
+ {
2091
+ name: 'timezone',
2092
+ layout: {
2093
+ positions: {
2094
+ lg: {
2095
+ colSpan: 4,
2096
+ colStart: 1,
2097
+ order: 12,
2098
+ },
2099
+ },
2100
+ },
2101
+ },
2102
+ ],
2103
+ actions: [...entityMasterRecordActions()],
2104
+ },
2105
+ list: {
2106
+ actions: [...entityMasterCrudActions()],
2107
+ views: [
2108
+ createAllQueryView({
2109
+ sorts: [{ name: 'title', dir: 'asc' }],
2110
+ }),
2111
+ ],
2112
+ },
2113
+ },
2114
+ },
2115
+ };
2116
+ return entityDef;
2117
+ }
2118
+
2119
+ //#endregion
2120
+ //#region ---- Entity Factory ----
2121
+ async function locationAssignmentFactory() {
2122
+ const entityDef = {
2123
+ module: RootConfig.module.name,
2124
+ name: RootConfig.entities.locationAssignment.name,
2125
+ title: RootConfig.entities.locationAssignment.title,
2126
+ icon: RootConfig.entities.locationAssignment.icon,
2127
+ formats: {
2128
+ individual: RootConfig.entities.locationAssignment.title,
2129
+ plural: RootConfig.entities.locationAssignment.titlePlural,
2130
+ searchResult: {
2131
+ title: '{{ location.title }}',
2132
+ description: '@location-management:location-assignments.entities.location-assignment.search-result-description',
2133
+ },
2134
+ },
2135
+ plugins: [{ name: 'notes' }],
2136
+ groups: [{ id: 'basic-info', title: '@general:terms.interface.basic-info' }],
2137
+ properties: [
2138
+ {
2139
+ name: 'locationId',
2140
+ title: '@location-management:location-assignments.entities.location-assignment.fields.location.title',
2141
+ groupId: 'basic-info',
2142
+ options: {
2143
+ sort: { enabled: true },
2144
+ filter: { advance: { enabled: true }, inline: { enabled: true } },
2145
+ },
2146
+ schema: {
2147
+ dataType: 'string',
2148
+ interface: {
2149
+ type: AXPWidgetsList.Editors.LookupBox,
2150
+ options: {
2151
+ entity: `${RootConfig.module.name}.${RootConfig.entities.location.name}`,
2152
+ multiple: false,
2153
+ textField: 'title',
2154
+ columns: ['title', 'code', 'fullAddress', 'locationTypeId'],
2155
+ allowCreate: 'quick',
2156
+ expose: [
2157
+ { source: 'id', target: 'location.id' },
2158
+ { source: 'title', target: 'location.title' },
2159
+ { source: 'fullAddress', target: 'location.fullAddress' },
2160
+ { source: 'street1', target: 'location.street1' },
2161
+ { source: 'street2', target: 'location.street2' },
2162
+ { source: 'postalCode', target: 'location.postalCode' },
2163
+ { source: 'city.title', target: 'location.city.title' },
2164
+ { source: 'state.title', target: 'location.state.title' },
2165
+ { source: 'country.title', target: 'location.country.title' },
2166
+ ],
2167
+ },
2168
+ },
2169
+ },
2170
+ validations: [{ rule: 'required' }],
2171
+ },
2172
+ createLocationAssignmentOwnerRefTypeProperty('basic-info'),
2173
+ createLocationAssignmentOwnerRefLookupProperty('basic-info'),
2174
+ {
2175
+ name: 'roleId',
2176
+ title: '@location-management:location-assignments.entities.location-assignment.fields.role.title',
2177
+ groupId: 'basic-info',
2178
+ options: {
2179
+ sort: { enabled: true },
2180
+ filter: { advance: { enabled: true }, inline: { enabled: true } },
2181
+ },
2182
+ schema: {
2183
+ dataType: 'string',
2184
+ interface: {
2185
+ type: AXPWidgetsCatalog.lookup,
2186
+ options: {
2187
+ look: 'select',
2188
+ entity: `${RootConfig.module.name}.${RootConfig.entities.locationRole.name}`,
2189
+ multiple: false,
2190
+ expose: [
2191
+ { source: 'id', target: 'role.id' },
2192
+ { source: 'title', target: 'role.title' },
2193
+ ],
2194
+ },
2195
+ },
2196
+ },
2197
+ validations: [{ rule: 'required' }],
2198
+ },
2199
+ {
2200
+ name: 'personId',
2201
+ title: '@location-management:location-assignments.entities.location-assignment.fields.contact.title',
2202
+ groupId: 'basic-info',
2203
+ options: {
2204
+ sort: { enabled: true },
2205
+ filter: { advance: { enabled: true }, inline: { enabled: true } },
2206
+ },
2207
+ schema: {
2208
+ dataType: 'string',
2209
+ interface: {
2210
+ type: AXPWidgetsCatalog.lookup,
2211
+ options: {
2212
+ entity: 'PersonCore.Person',
2213
+ multiple: false,
2214
+ textField: 'fullName',
2215
+ columns: ['fullName', 'phones', 'emails'],
2216
+ allowCreate: 'quick',
2217
+ expose: [
2218
+ { source: 'id', target: 'person.id' },
2219
+ { source: 'fullName', target: 'person.fullName' },
2220
+ { source: 'phones', target: 'person.phones' },
2221
+ { source: 'emails', target: 'person.emails' },
2222
+ ],
2223
+ },
2224
+ },
2225
+ },
2226
+ },
2227
+ ],
2228
+ columns: [
2229
+ {
2230
+ name: 'locationId',
2231
+ title: '@general:terms.common.title',
2232
+ options: { dataPath: 'location.title' },
2233
+ },
2234
+ {
2235
+ name: 'roleId',
2236
+ title: '@location-management:location-assignments.entities.location-assignment.fields.role.title',
2237
+ options: { dataPath: 'role.title' },
2238
+ },
2239
+ {
2240
+ name: 'location.fullAddress',
2241
+ title: '@general:terms.geography.address',
2242
+ options: { width: '280px' },
2243
+ },
2244
+ {
2245
+ name: 'personId',
2246
+ title: '@general:terms.people.contact',
2247
+ options: { dataPath: 'person.fullName' },
2248
+ },
2249
+ {
2250
+ name: 'person.phones',
2251
+ title: '@general:terms.communication.phones',
2252
+ options: { width: '180px' },
2253
+ },
2254
+ {
2255
+ name: 'ownerRef.id',
2256
+ title: '@location-management:location-assignments.entities.location-assignment.fields.assignee.title',
2257
+ options: { dataPath: 'ownerRef.title' },
2258
+ },
2259
+ {
2260
+ name: 'notes',
2261
+ title: '@general:terms.common.notes',
2262
+ },
2263
+ ],
2264
+ interfaces: {
2265
+ master: {
2266
+ create: {
2267
+ sections: [{ id: 'basic-info' }],
2268
+ properties: [
2269
+ { name: 'locationId', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
2270
+ { name: 'ownerRef.id', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
2271
+ { name: 'roleId', layout: { positions: { lg: { colSpan: 6, order: 3 } } } },
2272
+ { name: 'personId', layout: { positions: { lg: { colSpan: 6, order: 4 } } } },
2273
+ ],
2274
+ },
2275
+ update: {
2276
+ sections: [{ id: 'basic-info' }],
2277
+ properties: [
2278
+ { name: 'locationId', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
2279
+ { name: 'ownerRef.id', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
2280
+ { name: 'roleId', layout: { positions: { lg: { colSpan: 6, order: 3 } } } },
2281
+ { name: 'personId', layout: { positions: { lg: { colSpan: 6, order: 4 } } } },
2282
+ ],
2283
+ },
2284
+ single: {
2285
+ title: '{{ location.title }}',
2286
+ sections: [{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } }],
2287
+ properties: [
2288
+ { name: 'locationId', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
2289
+ { name: 'ownerRef.id', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
2290
+ { name: 'roleId', layout: { positions: { lg: { colSpan: 6, order: 3 } } } },
2291
+ { name: 'personId', layout: { positions: { lg: { colSpan: 6, order: 4 } } } },
2292
+ ],
2293
+ actions: [...entityMasterRecordActions()],
2294
+ },
2295
+ list: {
2296
+ actions: [...entityMasterCrudActions()],
2297
+ views: [
2298
+ createAllQueryView({
2299
+ sorts: [{ name: 'locationId', dir: 'asc' }],
2300
+ }),
2301
+ ],
2302
+ },
2303
+ },
2304
+ },
2305
+ };
2306
+ return entityDef;
2307
+ }
2308
+ //#endregion
2309
+
2310
+ //#endregion
2311
+
2312
+ //#endregion
2313
+ //#region ---- Entity Factory ----
2314
+ async function locationRoleFactory() {
2315
+ const sections = [{ id: 'basic-info', layout: { positions: { lg: { colSpan: 12 } } } }];
2316
+ const createPropertyLayouts = [
2317
+ { name: 'title', layout: { positions: { lg: { colSpan: 12, order: 1 } } } },
2318
+ { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 2 } } } },
2319
+ ];
2320
+ const modifyPropertyLayouts = [
2321
+ { name: 'name', layout: { positions: { lg: { colSpan: 6, order: 1 } } } },
2322
+ { name: 'title', layout: { positions: { lg: { colSpan: 6, order: 2 } } } },
2323
+ { name: 'description', layout: { positions: { lg: { colSpan: 12, order: 3 } } } },
2324
+ ];
2325
+ const entityDef = {
2326
+ module: RootConfig.module.name,
2327
+ name: RootConfig.entities.locationRole.name,
2328
+ title: RootConfig.entities.locationRole.title,
2329
+ icon: RootConfig.entities.locationRole.icon,
2330
+ formats: {
2331
+ individual: RootConfig.entities.locationRole.title,
2332
+ plural: RootConfig.entities.locationRole.titlePlural,
2333
+ searchResult: {
2334
+ title: '{{ title }}',
2335
+ description: '@location-management:location-roles.entities.location-role.search-result-description',
2336
+ },
2337
+ },
2338
+ plugins: [
2339
+ { name: 'history' },
2340
+ { name: 'compare' },
2341
+ { name: 'clone' },
2342
+ { name: 'derived-name' },
2343
+ {
2344
+ name: 'unique-fields',
2345
+ options: {
2346
+ fields: 'name',
2347
+ scope: 'global',
2348
+ },
2349
+ },
2350
+ ],
2351
+ groups: [{ id: 'basic-info', title: '@general:terms.interface.basic-info' }],
2352
+ properties: [
2353
+ {
2354
+ name: 'id',
2355
+ title: '@general:terms.common.id',
2356
+ groupId: 'basic-info',
2357
+ schema: {
2358
+ dataType: 'uuid',
2359
+ visible: false,
2360
+ readonly: true,
2361
+ unique: { enabled: true },
2362
+ },
2363
+ },
2364
+ {
2365
+ name: 'name',
2366
+ title: '@location-management:location-roles.entities.location-role.fields.name.title',
2367
+ groupId: 'basic-info',
2368
+ options: {
2369
+ sort: { enabled: true },
2370
+ filter: { advance: { enabled: true }, inline: { enabled: true } },
2371
+ },
2372
+ schema: {
2373
+ dataType: 'string',
2374
+ interface: {
2375
+ type: AXPWidgetsList.Editors.TextBox,
2376
+ options: {
2377
+ placeholder: '@location-management:location-roles.entities.location-role.fields.name.placeholder',
2378
+ },
2379
+ },
2380
+ },
2381
+ validations: [{ rule: 'required' }, { rule: 'variable-name' }],
2382
+ },
2383
+ {
2384
+ name: 'title',
2385
+ title: '@general:terms.common.title',
2386
+ groupId: 'basic-info',
2387
+ options: {
2388
+ sort: { enabled: true },
2389
+ filter: { advance: { enabled: true }, inline: { enabled: true } },
2390
+ },
2391
+ schema: {
2392
+ dataType: 'string',
2393
+ interface: {
2394
+ type: AXPWidgetsList.Editors.TextBox,
2395
+ options: {
2396
+ placeholder: '@location-management:location-roles.entities.location-role.fields.title.placeholder',
2397
+ },
2398
+ },
2399
+ },
2400
+ validations: [{ rule: 'required' }],
2401
+ },
2402
+ {
2403
+ name: 'description',
2404
+ title: '@general:terms.common.description',
2405
+ groupId: 'basic-info',
2406
+ options: {
2407
+ sort: { enabled: false },
2408
+ filter: { advance: { enabled: true }, inline: { enabled: false } },
2409
+ },
2410
+ schema: {
2411
+ dataType: 'string',
2412
+ interface: {
2413
+ type: AXPWidgetsList.Editors.LargeTextBox,
2414
+ options: {
2415
+ rows: 3,
2416
+ placeholder: '@location-management:location-roles.entities.location-role.fields.description.placeholder',
2417
+ },
2418
+ },
2419
+ },
2420
+ },
2421
+ ],
2422
+ columns: [
2423
+ { name: 'title', options: { width: '220px', order: 1 } },
2424
+ { name: 'name', options: { width: '140px', order: 2 } },
2425
+ { name: 'description', options: { width: '320px', order: 3 } },
2426
+ ],
2427
+ interfaces: {
2428
+ master: {
2429
+ create: { sections, properties: createPropertyLayouts },
2430
+ update: { sections, properties: modifyPropertyLayouts },
2431
+ single: {
2432
+ title: '{{ title }}',
2433
+ sections,
2434
+ properties: modifyPropertyLayouts,
2435
+ actions: [...entityMasterRecordActions()],
2436
+ },
2437
+ list: {
2438
+ actions: [...entityMasterCrudActions()],
2439
+ views: [
2440
+ createAllQueryView({
2441
+ sorts: [{ name: 'title', dir: 'asc' }],
2442
+ }),
2443
+ ],
2444
+ },
2445
+ },
2446
+ },
2447
+ };
2448
+ return entityDef;
2449
+ }
2450
+ //#endregion
2451
+
2452
+ async function locationTypeFactory() {
2453
+ const i18n = RootConfig.config.i18n;
2454
+ const entityDef = {
2455
+ module: RootConfig.module.name,
2456
+ name: RootConfig.entities.locationType.name,
2457
+ title: RootConfig.entities.locationType.title,
2458
+ formats: {
2459
+ individual: RootConfig.entities.locationType.title,
2460
+ plural: RootConfig.entities.locationType.titlePlural,
2461
+ searchResult: {
2462
+ title: '{{ title }}',
2463
+ description: '{{ description }}',
2464
+ },
2465
+ },
2466
+ groups: [
2467
+ {
2468
+ id: 'basic-info',
2469
+ title: '@general:terms.interface.basic-info',
2470
+ },
2471
+ {
2472
+ id: 'appearance',
2473
+ title: '@general:terms.interface.appearance',
2474
+ },
2475
+ {
2476
+ id: 'settings',
2477
+ title: '@general:terms.interface.settings',
2478
+ },
2479
+ ],
2480
+ plugins: [
2481
+ { name: 'archive' },
2482
+ { name: 'color' },
2483
+ { name: 'icon' },
2484
+ ],
2485
+ properties: [
2486
+ {
2487
+ name: 'title',
2488
+ title: '@general:terms.common.title',
2489
+ groupId: 'basic-info',
2490
+ options: {
2491
+ sort: {
2492
+ enabled: true,
2493
+ },
2494
+ filter: {
2495
+ advance: {
2496
+ enabled: true,
2497
+ },
2498
+ inline: {
2499
+ enabled: true,
2500
+ },
2501
+ },
2502
+ },
2503
+ schema: {
2504
+ dataType: 'string',
2505
+ interface: {
2506
+ type: AXPWidgetsCatalog.text,
2507
+ options: {
2508
+ placeholder: 'Enter location type name',
2509
+ },
2510
+ },
2511
+ },
2512
+ validations: [
2513
+ {
2514
+ rule: 'required',
2515
+ },
2516
+ ],
2517
+ },
2518
+ {
2519
+ name: 'description',
2520
+ title: '@general:terms.common.description',
2521
+ groupId: 'basic-info',
2522
+ options: {
2523
+ filter: {
2524
+ advance: {
2525
+ enabled: true,
2526
+ },
2527
+ },
2528
+ },
2529
+ schema: {
2530
+ dataType: 'string',
2531
+ interface: {
2532
+ type: AXPWidgetsCatalog.largeText,
2533
+ options: {
2534
+ rows: 3,
2535
+ },
2536
+ },
2537
+ },
2538
+ },
2539
+ ],
2540
+ columns: [{ name: 'title' }, { name: 'description' }],
2541
+ interfaces: {
2542
+ master: {
2543
+ create: {
2544
+ sections: [
2545
+ {
2546
+ id: 'basic-info',
2547
+ },
2548
+ {
2549
+ id: 'appearance',
2550
+ },
2551
+ {
2552
+ id: 'settings',
2553
+ },
2554
+ ],
2555
+ properties: [
2556
+ {
2557
+ name: 'title',
2558
+ layout: {
2559
+ positions: {
2560
+ sm: {
2561
+ colSpan: 12,
2562
+ },
2563
+ },
2564
+ },
2565
+ },
2566
+ {
2567
+ name: 'description',
2568
+ layout: {
2569
+ positions: {
2570
+ sm: {
2571
+ colSpan: 12,
2572
+ },
2573
+ },
2574
+ },
2575
+ },
2576
+ ],
2577
+ },
2578
+ update: {
2579
+ sections: [
2580
+ {
2581
+ id: 'basic-info',
2582
+ },
2583
+ {
2584
+ id: 'appearance',
2585
+ },
2586
+ {
2587
+ id: 'settings',
2588
+ },
2589
+ ],
2590
+ properties: [
2591
+ {
2592
+ name: 'title',
2593
+ layout: {
2594
+ positions: {
2595
+ sm: {
2596
+ colSpan: 12,
2597
+ },
2598
+ },
2599
+ },
2600
+ },
2601
+ {
2602
+ name: 'description',
2603
+ layout: {
2604
+ positions: {
2605
+ sm: {
2606
+ colSpan: 12,
2607
+ },
2608
+ },
2609
+ },
2610
+ },
2611
+ ],
2612
+ },
2613
+ single: {
2614
+ title: '{{title}}',
2615
+ sections: [
2616
+ {
2617
+ id: 'basic-info',
2618
+ layout: {
2619
+ positions: {
2620
+ lg: {
2621
+ colSpan: 12,
2622
+ },
2623
+ },
2624
+ },
2625
+ },
2626
+ {
2627
+ id: 'appearance',
2628
+ layout: {
2629
+ positions: {
2630
+ lg: {
2631
+ colSpan: 12,
2632
+ },
2633
+ },
2634
+ },
2635
+ },
2636
+ {
2637
+ id: 'settings',
2638
+ layout: {
2639
+ positions: {
2640
+ lg: {
2641
+ colSpan: 12,
2642
+ },
2643
+ },
2644
+ },
2645
+ },
2646
+ ],
2647
+ properties: [
2648
+ {
2649
+ name: 'title',
2650
+ layout: {
2651
+ positions: {
2652
+ lg: {
2653
+ colSpan: 12,
2654
+ order: 1,
2655
+ },
2656
+ },
2657
+ },
2658
+ },
2659
+ {
2660
+ name: 'description',
2661
+ layout: {
2662
+ positions: {
2663
+ lg: {
2664
+ colSpan: 12,
2665
+ order: 2,
2666
+ },
2667
+ },
2668
+ },
2669
+ },
2670
+ ],
2671
+ actions: [...entityMasterRecordActions()],
2672
+ },
2673
+ list: {
2674
+ actions: [...entityMasterCrudActions()],
2675
+ views: [
2676
+ createAllQueryView({
2677
+ sorts: [{ name: 'title', dir: 'asc' }],
2678
+ }),
2679
+ ],
2680
+ },
2681
+ },
2682
+ },
2683
+ };
2684
+ return entityDef;
2685
+ }
2686
+
2687
+ //#region ---- Contracts barrel ----
2688
+
2689
+ /**
2690
+ * Generated bundle index. Do not edit.
2691
+ */
2692
+
2693
+ export { AXMLocationManagementDataSourceKeys, AXMLocationManagementFeatureKeys, AXMLocationManagementPermissionsKeys, AXPLocationManagementMenuKeys, LOCATION_ASSIGNMENT_LOCATION_PROPERTY_NAMES, LOCATION_ASSIGNMENT_PARTY_TYPE, LOCATION_ASSIGNMENT_REF_PROPERTY_NAMES, RootConfig, buildLocationAssignmentLocationSnapshot, buildLocationAssignmentPersonSnapshot, createLocationAssignmentOwnerRefLookupProperty, createLocationAssignmentOwnerRefTypeProperty, geographicRegionFactory, locationAssignmentDetailsCrudActionsForPartyContext, locationAssignmentFactory, locationAssignmentLocationConditions, locationAssignmentPartyConditions, locationAssignmentReadOnlyRelatedActions, locationFactory, locationRoleFactory, locationTypeFactory, omitLocationAssignmentLocationFromEditLayouts, omitLocationAssignmentRefFromEditLayouts, resolveLocationAssignmentDisplayTitle };
2694
+ //# sourceMappingURL=acorex-platform-module-location-management-client-contracts.mjs.map