@apptimate/core-lib 4.6.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.6.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,18 +237,25 @@ 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
-
253
+ { key: 'construction__mtrs', label: 'Transfer Requests', path: '/construction/procurement/mtrs', module: 'Construction', defaultGroup: 'Procurement', permission: null },
254
+
236
255
  { key: 'construction__site_ledger', label: 'Project Ledger', path: '/construction/site-inventory/ledger', module: 'Construction', defaultGroup: 'Project Inventory', permission: null },
237
256
  { key: 'construction__site_issues', label: 'Project Issues', path: '/construction/site-inventory/issues', module: 'Construction', defaultGroup: 'Project Inventory', permission: null },
238
257
  { key: 'construction__wastage_returns', label: 'Wastage & Returns', path: '/construction/site-inventory/wastage-returns', module: 'Construction', defaultGroup: 'Project Inventory', permission: null },
239
258
 
240
- { key: 'construction__variations', label: 'Subcontractor Variations', path: '/construction/variations', module: 'Construction', defaultGroup: 'Subcontractor Variations', permission: null },
241
-
242
259
  { key: 'construction__workforce', label: 'Workforce Master', path: '/construction/workforce', module: 'Construction', defaultGroup: 'Workforce', permission: null },
243
260
  { key: 'construction__shifts', label: 'Shift Master', path: '/construction/shifts', module: 'Construction', defaultGroup: 'Workforce', permission: null },
244
261
  { key: 'construction__attendance', label: 'Attendance & Timesheets', path: '/construction/attendance', module: 'Construction', defaultGroup: 'Workforce', permission: null },
@@ -249,39 +266,32 @@ export const MENU_ITEM_REGISTRY: RegistryItem[] = [
249
266
  { key: 'construction__fuel_logs', label: 'Fuel Logs', path: '/construction/equipment/fuel-logs', module: 'Construction', defaultGroup: 'Equipment & Plant', permission: null },
250
267
  { key: 'construction__maintenance', label: 'Maintenance', path: '/construction/equipment/maintenance', module: 'Construction', defaultGroup: 'Equipment & Plant', permission: null },
251
268
 
252
- { key: 'construction__schedule_calendar', label: 'Resource Calendar', path: '/construction/scheduling/calendar', module: 'Construction', defaultGroup: 'Scheduling', permission: null },
253
-
254
- { key: 'construction__main_contract', label: 'Main Contract', path: '/construction/contracts/main-contract', module: 'Construction', defaultGroup: 'Contracts', permission: null },
255
- { key: 'construction__subcontractors', label: 'Subcontractors', path: '/construction/contracts/subcontractors', module: 'Construction', defaultGroup: 'Contracts', permission: null },
256
- { key: 'construction__ipcs', label: 'Progress Billing', path: '/construction/contracts/ipcs', module: 'Construction', defaultGroup: 'Contracts', permission: null },
257
-
258
269
  { key: 'construction__dsr', label: 'Daily Site Reports', path: '/construction/site-execution/dsr', module: 'Construction', defaultGroup: 'Site Execution', permission: null },
259
270
  { key: 'construction__progress', label: 'Progress Measurement', path: '/construction/site-execution/progress', module: 'Construction', defaultGroup: 'Site Execution', permission: null },
260
271
  { key: 'construction__subcontractor_progress', label: 'Subcontractor Progress', path: '/construction/site-execution/subcontractor-progress', module: 'Construction', defaultGroup: 'Site Execution', permission: null },
261
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
+
262
280
  { key: 'construction__drawings', label: 'Drawing Register', path: '/construction/document-control/drawings', module: 'Construction', defaultGroup: 'Document Control', permission: null },
263
281
  { key: 'construction__rfis', label: 'RFIs', path: '/construction/document-control/rfis', module: 'Construction', defaultGroup: 'Document Control', permission: null },
264
-
265
- { key: 'construction__quality_ir', label: 'Inspection Requests', path: '/construction/quality/ir', module: 'Construction', defaultGroup: 'Quality', permission: null },
266
- { key: 'construction__quality_ncr', label: 'Non-Conformance Reports', path: '/construction/quality/ncr', module: 'Construction', defaultGroup: 'Quality', permission: null },
267
- { key: 'construction__punch_list', label: 'Snag List', path: '/construction/quality/punch-list', module: 'Construction', defaultGroup: 'Quality', permission: null },
268
- { key: 'construction__material_testing', label: 'Material Testing', path: '/construction/quality/material-testing', module: 'Construction', defaultGroup: 'Quality', permission: null },
269
-
270
- { key: 'construction__safety_incidents', label: 'Incident Log', path: '/construction/safety/incidents', module: 'Construction', defaultGroup: 'Safety', permission: null },
271
- { key: 'construction__ptw', label: 'Permit to Work', path: '/construction/safety/ptw', module: 'Construction', defaultGroup: 'Safety', permission: null },
272
282
 
273
283
  { key: 'construction__approval_workflows', label: 'Approval Workflows', path: '/construction/settings/approvals', module: 'Construction', defaultGroup: 'Configuration', permission: null },
274
284
  { key: 'construction__test_types', label: 'Test Types', path: '/construction/settings/test-types', module: 'Construction', defaultGroup: 'Configuration', permission: null },
275
285
  { key: 'construction__settings', label: 'Settings', path: '/construction/settings', module: 'Construction', defaultGroup: 'Configuration', permission: null },
276
286
 
277
287
  // ── CRM Module ──
278
- { key: 'crm__dashboard', label: 'Overview', path: '/crm', module: 'CRM', defaultGroup: 'Overview', permission: null },
279
288
  { key: 'crm__spaces', label: 'Spaces', path: '/crm/spaces', module: 'CRM', defaultGroup: 'Sales', permission: 'crm_space.view' },
280
- { key: 'crm__leads', label: 'Leads', path: '/crm/leads', module: 'CRM', defaultGroup: 'Sales', permission: 'crm_lead.view' },
281
- { key: 'crm__sales', label: 'Confirmed Sales', path: '/crm/sales', module: 'CRM', defaultGroup: 'Sales', permission: 'crm_sale.view' },
282
289
  { key: 'crm__tasks', label: 'Tasks', path: '/crm/tasks', module: 'CRM', defaultGroup: 'Operations', permission: 'crm_task.view' },
283
- { key: 'crm__payments', label: 'Expected Payments', path: '/crm/payments', module: 'CRM', defaultGroup: 'Operations', permission: 'crm_expected_payment.view' },
284
- { 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' },
285
295
  ];
286
296
 
287
297
  /**
@@ -496,6 +506,7 @@ export const MENU_PRESETS: MenuPreset[] = [
496
506
  secondaryItems: [
497
507
  'construction__dashboard',
498
508
  'construction__projects',
509
+ 'construction__rate_cards',
499
510
  'construction__mtrs',
500
511
  'construction__prs',
501
512
  'construction__pos',
@@ -538,14 +549,7 @@ export const MENU_PRESETS: MenuPreset[] = [
538
549
  label: 'CRM',
539
550
  iconName: 'UsersRound',
540
551
  secondaryItems: [
541
- 'crm__dashboard',
542
- 'crm__customers',
543
- 'crm__spaces',
544
- 'crm__leads',
545
- 'crm__sales',
546
- 'crm__tasks',
547
- 'crm__payments',
548
- 'crm__settings_custom_fields',
552
+ ...CRM_SECONDARY_ITEM_KEYS,
549
553
  ],
550
554
  }
551
555
  ],
@@ -566,12 +570,18 @@ export const APP_MENUS: MainMenuItem[] = buildMenusFromConfig({
566
570
  export function buildMenusFromConfig(config: {
567
571
  primaryMenus: { id: string; label: string; iconName: string; secondaryItems: SecondaryItemConfig[] }[];
568
572
  }): MainMenuItem[] {
569
- return config.primaryMenus.map(pm => ({
570
- id: pm.id,
571
- label: pm.label,
572
- iconName: pm.iconName,
573
- groups: resolveRegistryKeys(pm.secondaryItems),
574
- }));
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
+ });
575
585
  }
576
586
 
577
587
  export function filterMenusByPermission(menus: MainMenuItem[], can: (code: string) => boolean): MainMenuItem[] {