@apptimate/core-lib 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apptimate/core-lib",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "main": "src/index.ts",
5
5
  "types": "src/index.ts",
6
6
  "publishConfig": {
@@ -35,6 +35,12 @@ export async function getBankAccountsLookup(): Promise<IApiResponse> {
35
35
  return response.responseData as IApiResponse;
36
36
  }
37
37
 
38
+ export async function searchAvailableChequeLeaves(query: string): Promise<IApiResponse> {
39
+ const qs = new URLSearchParams({ q: query }).toString();
40
+ const response = await sendRequest({ url: `${FIN_BASE}/cheque-leaves/search-available?${qs}`, method: "GET" });
41
+ return response.responseData as IApiResponse;
42
+ }
43
+
38
44
  // ── Finance: Warehouses Lookup ──
39
45
 
40
46
  export async function getWarehousesLookup(allOrgs: boolean = false): Promise<IApiResponse> {
@@ -61,6 +61,16 @@ export interface RegistryItem {
61
61
  permission?: string | null;
62
62
  }
63
63
 
64
+ export const CRM_SECONDARY_ITEM_KEYS = [
65
+ 'crm__spaces',
66
+ 'crm__tasks',
67
+ 'crm__activity_log',
68
+ 'crm__expected_payments',
69
+ 'crm__clarifications',
70
+ 'crm__summary',
71
+ 'crm__target_summary',
72
+ ] as const;
73
+
64
74
  export const MENU_ITEM_REGISTRY: RegistryItem[] = [
65
75
  // ── Core Module ──
66
76
  { key: 'core__users', label: 'Users', path: '/users', module: 'Core', defaultGroup: 'User Management', permission: 'user.view' },
@@ -227,19 +237,24 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
227
237
 
228
238
  // ── Construction Module ──
229
239
  { key: 'construction__dashboard', label: 'Overview', path: '/construction', module: 'Construction', defaultGroup: 'Overview', permission: null },
230
- { key: 'construction__projects', label: 'Projects', path: '/construction/projects', module: 'Construction', defaultGroup: 'Core', permission: null },
231
- { key: 'construction__mtrs', label: 'Transfer Requests', path: '/construction/procurement/mtrs', module: 'Construction', defaultGroup: 'Procurement', permission: null },
240
+
241
+ { key: 'construction__projects', label: 'Projects', path: '/construction/projects', module: 'Construction', defaultGroup: 'Core Setup & Planning', permission: null },
242
+ { key: 'construction__rate_cards', label: 'Rate Cards', path: '/construction/rate-cards', module: 'Construction', defaultGroup: 'Core Setup & Planning', permission: null },
243
+ { key: 'construction__schedule_calendar', label: 'Resource Calendar', path: '/construction/scheduling/calendar', module: 'Construction', defaultGroup: 'Core Setup & Planning', permission: null },
244
+
245
+ { key: 'construction__main_contract', label: 'Main Contract', path: '/construction/contracts/main-contract', module: 'Construction', defaultGroup: 'Contracts & Billing', permission: null },
246
+ { key: 'construction__subcontractors', label: 'Subcontractors', path: '/construction/contracts/subcontractors', module: 'Construction', defaultGroup: 'Contracts & Billing', permission: null },
247
+ { key: 'construction__ipcs', label: 'Progress Billing', path: '/construction/contracts/ipcs', module: 'Construction', defaultGroup: 'Contracts & Billing', permission: null },
248
+ { key: 'construction__variations', label: 'Subcontractor Variations', path: '/construction/variations', module: 'Construction', defaultGroup: 'Contracts & Billing', permission: null },
249
+
232
250
  { key: 'construction__prs', label: 'Purchase Requisitions', path: '/construction/procurement/prs', module: 'Construction', defaultGroup: 'Procurement', permission: null },
233
251
  { key: 'construction__pos', label: 'Purchase Orders', path: '/construction/procurement/pos', module: 'Construction', defaultGroup: 'Procurement', permission: null },
234
252
  { key: 'construction__grns', label: 'Goods Receipt', path: '/construction/procurement/grns', module: 'Construction', defaultGroup: 'Procurement', permission: null },
235
-
236
- { key: 'construction__site_ledger', label: 'Site Ledger', path: '/construction/site-inventory/ledger', module: 'Construction', defaultGroup: 'Site Inventory', permission: null },
237
- { key: 'construction__site_issues', label: 'Site Issues', path: '/construction/site-inventory/issues', module: 'Construction', defaultGroup: 'Site Inventory', permission: null },
238
- { key: 'construction__wastage_returns', label: 'Wastage & Returns', path: '/construction/site-inventory/wastage-returns', module: 'Construction', defaultGroup: 'Site Inventory', permission: null },
239
-
240
- { key: 'construction__boq', label: 'BOQ Master', path: '/construction/boq', module: 'Construction', defaultGroup: 'Bill of Quantities', permission: null },
241
- { key: 'construction__boq_revisions', label: 'BOQ Revisions', path: '/construction/boq/revisions', module: 'Construction', defaultGroup: 'Bill of Quantities', permission: null },
242
- { key: 'construction__variations', label: 'Subcontractor Variations', path: '/construction/variations', module: 'Construction', defaultGroup: 'Subcontractor Variations', permission: null },
253
+ { key: 'construction__mtrs', label: 'Transfer Requests', path: '/construction/procurement/mtrs', module: 'Construction', defaultGroup: 'Procurement', permission: null },
254
+
255
+ { key: 'construction__site_ledger', label: 'Project Ledger', path: '/construction/site-inventory/ledger', module: 'Construction', defaultGroup: 'Project Inventory', permission: null },
256
+ { key: 'construction__site_issues', label: 'Project Issues', path: '/construction/site-inventory/issues', module: 'Construction', defaultGroup: 'Project Inventory', permission: null },
257
+ { key: 'construction__wastage_returns', label: 'Wastage & Returns', path: '/construction/site-inventory/wastage-returns', module: 'Construction', defaultGroup: 'Project Inventory', permission: null },
243
258
 
244
259
  { key: 'construction__workforce', label: 'Workforce Master', path: '/construction/workforce', module: 'Construction', defaultGroup: 'Workforce', permission: null },
245
260
  { key: 'construction__shifts', label: 'Shift Master', path: '/construction/shifts', module: 'Construction', defaultGroup: 'Workforce', permission: null },
@@ -251,40 +266,32 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
251
266
  { key: 'construction__fuel_logs', label: 'Fuel Logs', path: '/construction/equipment/fuel-logs', module: 'Construction', defaultGroup: 'Equipment & Plant', permission: null },
252
267
  { key: 'construction__maintenance', label: 'Maintenance', path: '/construction/equipment/maintenance', module: 'Construction', defaultGroup: 'Equipment & Plant', permission: null },
253
268
 
254
- { key: 'construction__schedule_tasks', label: 'Schedule Tasks', path: '/construction/scheduling/tasks', module: 'Construction', defaultGroup: 'Scheduling', permission: null },
255
- { key: 'construction__schedule_calendar', label: 'Resource Calendar', path: '/construction/scheduling/calendar', module: 'Construction', defaultGroup: 'Scheduling', permission: null },
256
-
257
- { key: 'construction__main_contract', label: 'Main Contract', path: '/construction/contracts/main-contract', module: 'Construction', defaultGroup: 'Contracts', permission: null },
258
- { key: 'construction__subcontractors', label: 'Subcontractors', path: '/construction/contracts/subcontractors', module: 'Construction', defaultGroup: 'Contracts', permission: null },
259
- { key: 'construction__ipcs', label: 'Progress Billing', path: '/construction/contracts/ipcs', module: 'Construction', defaultGroup: 'Contracts', permission: null },
260
-
261
269
  { key: 'construction__dsr', label: 'Daily Site Reports', path: '/construction/site-execution/dsr', module: 'Construction', defaultGroup: 'Site Execution', permission: null },
262
270
  { key: 'construction__progress', label: 'Progress Measurement', path: '/construction/site-execution/progress', module: 'Construction', defaultGroup: 'Site Execution', permission: null },
263
271
  { key: 'construction__subcontractor_progress', label: 'Subcontractor Progress', path: '/construction/site-execution/subcontractor-progress', module: 'Construction', defaultGroup: 'Site Execution', permission: null },
264
272
 
273
+ { key: 'construction__quality_ir', label: 'Inspection Requests', path: '/construction/quality/ir', module: 'Construction', defaultGroup: 'Quality & Safety', permission: null },
274
+ { key: 'construction__quality_ncr', label: 'Non-Conformance Reports', path: '/construction/quality/ncr', module: 'Construction', defaultGroup: 'Quality & Safety', permission: null },
275
+ { key: 'construction__punch_list', label: 'Snag List', path: '/construction/quality/punch-list', module: 'Construction', defaultGroup: 'Quality & Safety', permission: null },
276
+ { key: 'construction__material_testing', label: 'Material Testing', path: '/construction/quality/material-testing', module: 'Construction', defaultGroup: 'Quality & Safety', permission: null },
277
+ { key: 'construction__safety_incidents', label: 'Incident Log', path: '/construction/safety/incidents', module: 'Construction', defaultGroup: 'Quality & Safety', permission: null },
278
+ { key: 'construction__ptw', label: 'Permit to Work', path: '/construction/safety/ptw', module: 'Construction', defaultGroup: 'Quality & Safety', permission: null },
279
+
265
280
  { key: 'construction__drawings', label: 'Drawing Register', path: '/construction/document-control/drawings', module: 'Construction', defaultGroup: 'Document Control', permission: null },
266
281
  { key: 'construction__rfis', label: 'RFIs', path: '/construction/document-control/rfis', module: 'Construction', defaultGroup: 'Document Control', permission: null },
267
-
268
- { key: 'construction__quality_ir', label: 'Inspection Requests', path: '/construction/quality/ir', module: 'Construction', defaultGroup: 'Quality', permission: null },
269
- { key: 'construction__quality_ncr', label: 'Non-Conformance Reports', path: '/construction/quality/ncr', module: 'Construction', defaultGroup: 'Quality', permission: null },
270
- { key: 'construction__punch_list', label: 'Snag List', path: '/construction/quality/punch-list', module: 'Construction', defaultGroup: 'Quality', permission: null },
271
- { key: 'construction__material_testing', label: 'Material Testing', path: '/construction/quality/material-testing', module: 'Construction', defaultGroup: 'Quality', permission: null },
272
-
273
- { key: 'construction__safety_incidents', label: 'Incident Log', path: '/construction/safety/incidents', module: 'Construction', defaultGroup: 'Safety', permission: null },
274
- { key: 'construction__ptw', label: 'Permit to Work', path: '/construction/safety/ptw', module: 'Construction', defaultGroup: 'Safety', permission: null },
275
282
 
276
283
  { key: 'construction__approval_workflows', label: 'Approval Workflows', path: '/construction/settings/approvals', module: 'Construction', defaultGroup: 'Configuration', permission: null },
277
284
  { key: 'construction__test_types', label: 'Test Types', path: '/construction/settings/test-types', module: 'Construction', defaultGroup: 'Configuration', permission: null },
278
285
  { key: 'construction__settings', label: 'Settings', path: '/construction/settings', module: 'Construction', defaultGroup: 'Configuration', permission: null },
279
286
 
280
287
  // ── CRM Module ──
281
- { key: 'crm__dashboard', label: 'Overview', path: '/crm', module: 'CRM', defaultGroup: 'Overview', permission: null },
282
288
  { key: 'crm__spaces', label: 'Spaces', path: '/crm/spaces', module: 'CRM', defaultGroup: 'Sales', permission: 'crm_space.view' },
283
- { key: 'crm__leads', label: 'Leads', path: '/crm/leads', module: 'CRM', defaultGroup: 'Sales', permission: 'crm_lead.view' },
284
- { key: 'crm__sales', label: 'Confirmed Sales', path: '/crm/sales', module: 'CRM', defaultGroup: 'Sales', permission: 'crm_sale.view' },
285
289
  { key: 'crm__tasks', label: 'Tasks', path: '/crm/tasks', module: 'CRM', defaultGroup: 'Operations', permission: 'crm_task.view' },
286
- { key: 'crm__payments', label: 'Expected Payments', path: '/crm/payments', module: 'CRM', defaultGroup: 'Operations', permission: 'crm_expected_payment.view' },
287
- { key: 'crm__settings_custom_fields', label: 'Custom Fields', path: '/crm/settings/custom-fields', module: 'CRM', defaultGroup: 'Settings', permission: 'crm_custom_field.view' },
290
+ { key: 'crm__activity_log', label: 'Activity Log', path: '/crm/activity-log', module: 'CRM', defaultGroup: 'Operations', permission: 'crm_activity_log.view' },
291
+ { key: 'crm__expected_payments', label: 'Payment Schedule', path: '/crm/expected-payments', module: 'CRM', defaultGroup: 'Finance', permission: 'crm_expected_payment.view' },
292
+ { key: 'crm__clarifications', label: 'Clarifications', path: '/crm/clarifications', module: 'CRM', defaultGroup: 'Insights', permission: 'crm_clarification.view' },
293
+ { key: 'crm__summary', label: 'Summary', path: '/crm/summary', module: 'CRM', defaultGroup: 'Insights', permission: 'crm_summary.view' },
294
+ { key: 'crm__target_summary', label: 'Target Summary', path: '/crm/target-summary', module: 'CRM', defaultGroup: 'Insights', permission: 'crm_target_summary.view' },
288
295
  ];
289
296
 
290
297
  /**
@@ -499,6 +506,7 @@ export const MENU_PRESETS: MenuPreset[] = [
499
506
  secondaryItems: [
500
507
  'construction__dashboard',
501
508
  'construction__projects',
509
+ 'construction__rate_cards',
502
510
  'construction__mtrs',
503
511
  'construction__prs',
504
512
  'construction__pos',
@@ -506,8 +514,6 @@ export const MENU_PRESETS: MenuPreset[] = [
506
514
  'construction__site_ledger',
507
515
  'construction__site_issues',
508
516
  'construction__wastage_returns',
509
- 'construction__boq',
510
- 'construction__boq_revisions',
511
517
  'construction__variations',
512
518
  'construction__workforce',
513
519
  'construction__shifts',
@@ -517,7 +523,6 @@ export const MENU_PRESETS: MenuPreset[] = [
517
523
  'construction__equipment_allocation',
518
524
  'construction__fuel_logs',
519
525
  'construction__maintenance',
520
- 'construction__schedule_tasks',
521
526
  'construction__schedule_calendar',
522
527
  'construction__main_contract',
523
528
  'construction__subcontractors',
@@ -544,14 +549,7 @@ export const MENU_PRESETS: MenuPreset[] = [
544
549
  label: 'CRM',
545
550
  iconName: 'UsersRound',
546
551
  secondaryItems: [
547
- 'crm__dashboard',
548
- 'crm__customers',
549
- 'crm__spaces',
550
- 'crm__leads',
551
- 'crm__sales',
552
- 'crm__tasks',
553
- 'crm__payments',
554
- 'crm__settings_custom_fields',
552
+ ...CRM_SECONDARY_ITEM_KEYS,
555
553
  ],
556
554
  }
557
555
  ],
@@ -572,12 +570,18 @@ export const APP_MENUS: MainMenuItem[] = buildMenusFromConfig({
572
570
  export function buildMenusFromConfig(config: {
573
571
  primaryMenus: { id: string; label: string; iconName: string; secondaryItems: SecondaryItemConfig[] }[];
574
572
  }): MainMenuItem[] {
575
- return config.primaryMenus.map(pm => ({
576
- id: pm.id,
577
- label: pm.label,
578
- iconName: pm.iconName,
579
- groups: resolveRegistryKeys(pm.secondaryItems),
580
- }));
573
+ return config.primaryMenus.map(pm => {
574
+ const secondaryItems = pm.id === 'crm'
575
+ ? [...CRM_SECONDARY_ITEM_KEYS]
576
+ : pm.secondaryItems;
577
+
578
+ return {
579
+ id: pm.id,
580
+ label: pm.label,
581
+ iconName: pm.iconName,
582
+ groups: resolveRegistryKeys(secondaryItems),
583
+ };
584
+ });
581
585
  }
582
586
 
583
587
  export function filterMenusByPermission(menus: MainMenuItem[], can: (code: string) => boolean): MainMenuItem[] {