kcommons 18.27.0 → 18.27.2
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/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/typings/company.typings.d.ts +5 -2
- package/build/typings/company.typings.js +1 -0
- package/build/typings/entityApprovalChainEntry.typings.d.ts +5 -2
- package/build/typings/entityApprovalChainEntry.typings.js +1 -0
- package/build/typings/escalation.typings.d.ts +163 -0
- package/build/typings/escalation.typings.js +73 -0
- package/build/typings/kpis/checkpoint/checkpointOpsKpis.typings.d.ts +5 -0
- package/build/typings/kpis/exitCheckpoint/exitCheckpointKpis.typings.d.ts +3 -0
- package/build/typings/kpis/gate/gateKpis.typings.d.ts +11 -0
- package/build/typings/kpis/gateOps/gateOpsKpis.typings.d.ts +16 -0
- package/build/typings/kpis/kpiSorting.typings.d.ts +4 -0
- package/build/typings/kpis/kpiSorting.typings.js +9 -0
- package/build/typings/kpis/kpiVesItems.typings.d.ts +13 -0
- package/build/typings/kpis/kpiVesItems.typings.js +14 -0
- package/build/utils/businessTime.util.d.ts +10 -0
- package/build/utils/businessTime.util.js +48 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ export * from "./typings/freightComparativeVehiclesQuantitySplit.typings";
|
|
|
106
106
|
export * from "./typings/freightComparativeEarlyAccessRequests.typings";
|
|
107
107
|
export * from "./typings/freightQuote.typings";
|
|
108
108
|
export * from "./typings/freightOrder.typings";
|
|
109
|
+
export * from "./typings/escalation.typings";
|
|
109
110
|
export * from "./typings/system/queueJob.typings";
|
|
110
111
|
export * from "./typings/system/erpPluginConfigCompany.typings";
|
|
111
112
|
export * from "./typings/system/erpPluginsMetadata.typings";
|
|
@@ -177,6 +178,7 @@ export * from "./typings/verification_apis/bankAccountVerification.typings";
|
|
|
177
178
|
export * from "./typings/verification_apis/cinVerification.typings";
|
|
178
179
|
export * from "./typings/verification_apis/aadhaarVerification.typings";
|
|
179
180
|
export * from "./typings/kpis/basKPIS.typings";
|
|
181
|
+
export * from "./typings/kpis/kpiSorting.typings";
|
|
180
182
|
export * from "./typings/kpis/company/main/purchase/totalSavings.typings";
|
|
181
183
|
export * from "./typings/kpis/company/main/purchase/purchaseTrend.typings";
|
|
182
184
|
export * from "./typings/kpis/company/main/purchase/avgVendorResponseRatePerRFQKPI.typings";
|
|
@@ -189,6 +191,7 @@ export * from "./typings/kpis/company/item/itemSpecific/stockTrend.typings";
|
|
|
189
191
|
export * from "./typings/kpis/company/item/mainDashboard/inventoryAndItemDetailsKpi.typings";
|
|
190
192
|
export * from "./typings/kpis/company/item/mainDashboard/purchaseVSIssuanceKPI.typings";
|
|
191
193
|
export * from "./typings/kpis/company/item/mainDashboard/mainItemDashboardSummaryKPI.typings";
|
|
194
|
+
export * from "./typings/kpis/kpiVesItems.typings";
|
|
192
195
|
export * from "./typings/kpis/gateOps/gateOpsKpis.typings";
|
|
193
196
|
export * from "./typings/kpis/checkpoint/checkpointOpsKpis.typings";
|
|
194
197
|
export * from "./typings/kpis/exitCheckpoint/exitCheckpointKpis.typings";
|
package/build/index.js
CHANGED
|
@@ -126,6 +126,7 @@ __exportStar(require("./typings/freightComparativeVehiclesQuantitySplit.typings"
|
|
|
126
126
|
__exportStar(require("./typings/freightComparativeEarlyAccessRequests.typings"), exports);
|
|
127
127
|
__exportStar(require("./typings/freightQuote.typings"), exports);
|
|
128
128
|
__exportStar(require("./typings/freightOrder.typings"), exports);
|
|
129
|
+
__exportStar(require("./typings/escalation.typings"), exports);
|
|
129
130
|
// System
|
|
130
131
|
__exportStar(require("./typings/system/queueJob.typings"), exports);
|
|
131
132
|
__exportStar(require("./typings/system/erpPluginConfigCompany.typings"), exports);
|
|
@@ -205,6 +206,7 @@ __exportStar(require("./typings/verification_apis/cinVerification.typings"), exp
|
|
|
205
206
|
__exportStar(require("./typings/verification_apis/aadhaarVerification.typings"), exports);
|
|
206
207
|
// KPIs
|
|
207
208
|
__exportStar(require("./typings/kpis/basKPIS.typings"), exports);
|
|
209
|
+
__exportStar(require("./typings/kpis/kpiSorting.typings"), exports);
|
|
208
210
|
// Main Dashboard KPIS
|
|
209
211
|
__exportStar(require("./typings/kpis/company/main/purchase/totalSavings.typings"), exports);
|
|
210
212
|
__exportStar(require("./typings/kpis/company/main/purchase/purchaseTrend.typings"), exports);
|
|
@@ -220,6 +222,7 @@ __exportStar(require("./typings/kpis/company/item/mainDashboard/inventoryAndItem
|
|
|
220
222
|
__exportStar(require("./typings/kpis/company/item/mainDashboard/purchaseVSIssuanceKPI.typings"), exports);
|
|
221
223
|
__exportStar(require("./typings/kpis/company/item/mainDashboard/mainItemDashboardSummaryKPI.typings"), exports);
|
|
222
224
|
// Gate Ops KPIs
|
|
225
|
+
__exportStar(require("./typings/kpis/kpiVesItems.typings"), exports);
|
|
223
226
|
__exportStar(require("./typings/kpis/gateOps/gateOpsKpis.typings"), exports);
|
|
224
227
|
// Checkpoint Ops KPIs
|
|
225
228
|
__exportStar(require("./typings/kpis/checkpoint/checkpointOpsKpis.typings"), exports);
|
|
@@ -78,6 +78,7 @@ import { INestedTransporterGroups } from "./transporterGroup.typings";
|
|
|
78
78
|
import { INestedVehicle } from "./vehicle.typings";
|
|
79
79
|
import { INestedTransporterLogs } from "./transporterLogs.typings";
|
|
80
80
|
import { INestedReportsPluginConfigCompany } from "./system/reportsPluginConfigCompany.typings";
|
|
81
|
+
import { IEscalationConfig } from "./escalation.typings";
|
|
81
82
|
export declare enum PRICING_PLANS {
|
|
82
83
|
BASIC = "BASIC",
|
|
83
84
|
GROWTH = "GROWTH",
|
|
@@ -174,7 +175,8 @@ export declare enum COMPANY_INCLUDE {
|
|
|
174
175
|
company_freight_comparative_vehicles = "company_freight_comparative_vehicles",
|
|
175
176
|
company_fos = "company_fos",
|
|
176
177
|
company_fo_vehicles = "company_fo_vehicles",
|
|
177
|
-
transporter_logs = "transporter_logs"
|
|
178
|
+
transporter_logs = "transporter_logs",
|
|
179
|
+
escalation_configs = "escalation_configs"
|
|
178
180
|
}
|
|
179
181
|
export interface ICompany extends IAddress {
|
|
180
182
|
id: string;
|
|
@@ -290,8 +292,9 @@ export interface ICompany extends IAddress {
|
|
|
290
292
|
company_fos: INestedFO[] | null;
|
|
291
293
|
company_fo_vehicles: INestedFOVehicle[] | null;
|
|
292
294
|
transporter_logs: INestedTransporterLogs[] | null;
|
|
295
|
+
escalation_configs: IEscalationConfig[] | null;
|
|
293
296
|
}
|
|
294
|
-
export interface INestedCompany extends Omit<ICompany, "associated_purchase_locations" | "associated_vendors" | "associated_permissions" | "associated_roles" | "approval_configs" | "subdepartments" | "subcategories" | "categories" | "items" | "offices" | "stores" | "employees" | "departments" | "vendor_groups" | "company_indents" | "indent_items" | "company_mis" | "mi_items" | "company_prs" | "pr_items" | "company_rfqs" | "company_quotes" | "entity_approval_chain_entries" | "company_negotiations" | "company_pos" | "company_grns" | "company_grns_items" | "company_mrns" | "company_mrns_items" | "company_boms" | "company_bom_items" | "company_comparatives" | "company_comparative_items" | "company_notifications" | "extra_question_ans" | "extra_core_related_questions" | "company_specific_vendor_items" | "po_asn_items_junction" | "company_contact_people" | "company_item_vendor_versions" | "istds" | "istd_items" | "inventory_logs" | "invoices" | "logs" | "vendor_onboarding_requests" | "vendor_management_bodies" | "item_management_bodies" | "rollback_forms_sent_by_company" | "company_checkpoints" | "company_ves" | "queue_jobs" | "company_terms_and_conditions" | "company_config" | "erp_plugins" | "company_temporary_worker_form" | "extra_questions" | "is_deleted" | "payment_terms" | "po_grn_items_junction" | "vendor_onboarding_request_categories" | "company_amended_po_items" | "sub_pos" | "sub_po_items" | "item_questionnaire" | "rfq_questionnaire" | "rfq_questionnaire_answers" | "company_customer_categories" | "associated_customer" | "customer_management_bodies" | "qa_locations" | "accounts_locations" | "vendor_documents_manual_verification_by_company" | "erp_plugings_metadata" | "invoice" | "quality_clearance_documents" | "audits" | "approval_comments" | "vendor_logs" | "report_plugins" | "imr_fine_masters" | "transporter_documents_manual_verification_by_company" | "created_transporter_groups" | "vehicles" | "company_freight_quotes" | "company_freight_comparatives" | "company_freight_comparative_vehicles" | "company_fos" | "company_fo_vehicles" | "transporter_logs" | "report_plugins"> {
|
|
297
|
+
export interface INestedCompany extends Omit<ICompany, "associated_purchase_locations" | "associated_vendors" | "associated_permissions" | "associated_roles" | "approval_configs" | "subdepartments" | "subcategories" | "categories" | "items" | "offices" | "stores" | "employees" | "departments" | "vendor_groups" | "company_indents" | "indent_items" | "company_mis" | "mi_items" | "company_prs" | "pr_items" | "company_rfqs" | "company_quotes" | "entity_approval_chain_entries" | "company_negotiations" | "company_pos" | "company_grns" | "company_grns_items" | "company_mrns" | "company_mrns_items" | "company_boms" | "company_bom_items" | "company_comparatives" | "company_comparative_items" | "company_notifications" | "extra_question_ans" | "extra_core_related_questions" | "company_specific_vendor_items" | "po_asn_items_junction" | "company_contact_people" | "company_item_vendor_versions" | "istds" | "istd_items" | "inventory_logs" | "invoices" | "logs" | "vendor_onboarding_requests" | "vendor_management_bodies" | "item_management_bodies" | "rollback_forms_sent_by_company" | "company_checkpoints" | "company_ves" | "queue_jobs" | "company_terms_and_conditions" | "company_config" | "erp_plugins" | "company_temporary_worker_form" | "extra_questions" | "is_deleted" | "payment_terms" | "po_grn_items_junction" | "vendor_onboarding_request_categories" | "company_amended_po_items" | "sub_pos" | "sub_po_items" | "item_questionnaire" | "rfq_questionnaire" | "rfq_questionnaire_answers" | "company_customer_categories" | "associated_customer" | "customer_management_bodies" | "qa_locations" | "accounts_locations" | "vendor_documents_manual_verification_by_company" | "erp_plugings_metadata" | "invoice" | "quality_clearance_documents" | "audits" | "approval_comments" | "vendor_logs" | "report_plugins" | "imr_fine_masters" | "transporter_documents_manual_verification_by_company" | "created_transporter_groups" | "vehicles" | "company_freight_quotes" | "company_freight_comparatives" | "company_freight_comparative_vehicles" | "company_fos" | "company_fo_vehicles" | "transporter_logs" | "report_plugins" | "escalation_configs"> {
|
|
295
298
|
}
|
|
296
299
|
export interface ICompanyVendorAdditionalInfoMappingConfig {
|
|
297
300
|
additional_info_form_que_id: string;
|
|
@@ -98,6 +98,7 @@ var COMPANY_INCLUDE;
|
|
|
98
98
|
COMPANY_INCLUDE["company_fos"] = "company_fos";
|
|
99
99
|
COMPANY_INCLUDE["company_fo_vehicles"] = "company_fo_vehicles";
|
|
100
100
|
COMPANY_INCLUDE["transporter_logs"] = "transporter_logs";
|
|
101
|
+
COMPANY_INCLUDE["escalation_configs"] = "escalation_configs";
|
|
101
102
|
})(COMPANY_INCLUDE || (exports.COMPANY_INCLUDE = COMPANY_INCLUDE = {}));
|
|
102
103
|
// export interface IUpdateVendorOnboardingRequestCategoriesInputs
|
|
103
104
|
// extends Pick<ICompany, "vendor_onboarding_request_categories"> {}
|
|
@@ -25,6 +25,7 @@ import { INestedCompanyTransporter } from "./companyTransporter.typings";
|
|
|
25
25
|
import { INestedFreightComparative } from "./freightComparative.typings";
|
|
26
26
|
import { INestedFRR } from "./frr.typings";
|
|
27
27
|
import { INestedFO } from "./freightOrder.typings";
|
|
28
|
+
import { IEscalationRuntime } from "./escalation.typings";
|
|
28
29
|
export declare enum ENTITY_APPROVAL_CHAIN_ENTRY_PARENT_DOCS {
|
|
29
30
|
INDENT = "INDENT",
|
|
30
31
|
PR = "PR",
|
|
@@ -81,7 +82,8 @@ export declare enum ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES {
|
|
|
81
82
|
company_transporter = "company_transporter",
|
|
82
83
|
frr = "frr",
|
|
83
84
|
freight_comparative = "freight_comparative",
|
|
84
|
-
fo = "fo"
|
|
85
|
+
fo = "fo",
|
|
86
|
+
escalation_runtimes = "escalation_runtimes"
|
|
85
87
|
}
|
|
86
88
|
export interface IEntityApprovalChainEntry {
|
|
87
89
|
id: string;
|
|
@@ -154,6 +156,7 @@ export interface IEntityApprovalChainEntry {
|
|
|
154
156
|
for_accounts_approval_of_imr: INestedEntityApprovalChainEntry[] | null;
|
|
155
157
|
imr_changelogs: INestedInvoiceMatchingRecordChangelog[] | null;
|
|
156
158
|
logs: INestedEntityApprovalChainEntryLog[] | null;
|
|
159
|
+
escalation_runtimes?: IEscalationRuntime[] | null;
|
|
157
160
|
}
|
|
158
|
-
export interface INestedEntityApprovalChainEntry extends Omit<IEntityApprovalChainEntry, "company" | "user" | "role" | "indent" | "mi" | "pr" | "rfq" | "comparative" | "po" | "sub_po" | "grn" | "mrn" | "source_istd" | "dest_istd" | "vendor_onboarding_request" | "company_vendor" | "vendor_onboarding_request_scores" | "item" | "asn" | "ves" | "company_customer" | "parent_qcd" | "for_qa_approval_of_imr" | "for_audits_approval_of_imr" | "for_accounts_approval_of_imr" | "imr_changelogs" | "logs" | "company_transporter" | "frr" | "freight_comparative"> {
|
|
161
|
+
export interface INestedEntityApprovalChainEntry extends Omit<IEntityApprovalChainEntry, "company" | "user" | "role" | "indent" | "mi" | "pr" | "rfq" | "comparative" | "po" | "sub_po" | "grn" | "mrn" | "source_istd" | "dest_istd" | "vendor_onboarding_request" | "company_vendor" | "vendor_onboarding_request_scores" | "item" | "asn" | "ves" | "company_customer" | "parent_qcd" | "for_qa_approval_of_imr" | "for_audits_approval_of_imr" | "for_accounts_approval_of_imr" | "imr_changelogs" | "logs" | "company_transporter" | "frr" | "freight_comparative" | "escalation_runtimes"> {
|
|
159
162
|
}
|
|
@@ -60,4 +60,5 @@ var ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES;
|
|
|
60
60
|
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["frr"] = "frr";
|
|
61
61
|
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["freight_comparative"] = "freight_comparative";
|
|
62
62
|
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["fo"] = "fo";
|
|
63
|
+
ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES["escalation_runtimes"] = "escalation_runtimes";
|
|
63
64
|
})(ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES || (exports.ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES = ENTITY_APPROVAL_CHAIN_ENTRY_INCLUDES = {}));
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { IPaginationFilters } from "./common/paginationFilters.typings";
|
|
2
|
+
import { INestedCompany } from "./company.typings";
|
|
3
|
+
export declare enum ESCALATION_NOTIFICATION_TYPE {
|
|
4
|
+
EMAIL = "EMAIL",
|
|
5
|
+
WHATSAPP = "WHATSAPP",
|
|
6
|
+
BOTH = "BOTH"
|
|
7
|
+
}
|
|
8
|
+
export declare enum ESCALATION_RUNTIME_STATUS {
|
|
9
|
+
ACTIVE = "ACTIVE",
|
|
10
|
+
CLOSED = "CLOSED",
|
|
11
|
+
EXCEEDED = "EXCEEDED",
|
|
12
|
+
CANCELLED = "CANCELLED"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ESCALATION_RESOURCE_TYPE {
|
|
15
|
+
VENDOR_ONBOARDING_REQUEST = "VENDOR_ONBOARDING_REQUEST",
|
|
16
|
+
WAITLISTED_VENDOR = "WAITLISTED_VENDOR"
|
|
17
|
+
}
|
|
18
|
+
export declare enum ESCALATION_EVENT_TYPE {
|
|
19
|
+
SEND_PAT = "SEND_PAT",
|
|
20
|
+
SEND_FOR_APPROVAL = "SEND_FOR_APPROVAL",
|
|
21
|
+
APPROVE = "APPROVE",
|
|
22
|
+
SYNC_TO_ERP = "SYNC_TO_ERP",
|
|
23
|
+
ONBOARD = "ONBOARD"
|
|
24
|
+
}
|
|
25
|
+
export declare const ESCALATION_RESOURCE_EVENTS: Record<ESCALATION_RESOURCE_TYPE, ESCALATION_EVENT_TYPE[]>;
|
|
26
|
+
export declare enum ESCALATION_SYNC_REASON {
|
|
27
|
+
CREATED = "CREATED",
|
|
28
|
+
UPDATED = "UPDATED",
|
|
29
|
+
PAT_SUBMITTED = "PAT_SUBMITTED",
|
|
30
|
+
PAT_ROLLED_BACK = "PAT_ROLLED_BACK",
|
|
31
|
+
CANCELLED = "CANCELLED",
|
|
32
|
+
ROLLED_BACK_TO_INITIATOR = "ROLLED_BACK_TO_INITIATOR",
|
|
33
|
+
DISABLED = "DISABLED",
|
|
34
|
+
DELETED = "DELETED",
|
|
35
|
+
DAILY_CHECK = "DAILY_CHECK"
|
|
36
|
+
}
|
|
37
|
+
export declare enum ESCALATION_CONFIG_INCLUDE {
|
|
38
|
+
company = "company",
|
|
39
|
+
levels = "levels",
|
|
40
|
+
runtimes = "runtimes"
|
|
41
|
+
}
|
|
42
|
+
export declare enum ESCALATION_CONFIG_LEVEL_INCLUDE {
|
|
43
|
+
escalation_config = "escalation_config"
|
|
44
|
+
}
|
|
45
|
+
export declare enum ESCALATION_RUNTIME_INCLUDE {
|
|
46
|
+
escalation_config = "escalation_config",
|
|
47
|
+
executions = "executions"
|
|
48
|
+
}
|
|
49
|
+
export declare enum ESCALATION_EXECUTION_LOG_INCLUDE {
|
|
50
|
+
escalation_runtime = "escalation_runtime"
|
|
51
|
+
}
|
|
52
|
+
export interface IEscalationConfigLevel {
|
|
53
|
+
id: string;
|
|
54
|
+
escalation_config_id: string;
|
|
55
|
+
level: number;
|
|
56
|
+
name: string;
|
|
57
|
+
is_enabled: boolean;
|
|
58
|
+
delay_in_working_seconds: number;
|
|
59
|
+
notification_type: ESCALATION_NOTIFICATION_TYPE;
|
|
60
|
+
extra_to_user_ids: string[];
|
|
61
|
+
cc_user_ids: string[];
|
|
62
|
+
bcc_user_ids: string[];
|
|
63
|
+
created_at: string;
|
|
64
|
+
updated_at: string;
|
|
65
|
+
escalation_config: INestedEscalationConfig | null;
|
|
66
|
+
}
|
|
67
|
+
export interface INestedEscalationConfigLevel extends Omit<IEscalationConfigLevel, "escalation_config"> {
|
|
68
|
+
}
|
|
69
|
+
export interface IEscalationConfig {
|
|
70
|
+
id: string;
|
|
71
|
+
company_id: string;
|
|
72
|
+
resource_type: string;
|
|
73
|
+
event: string;
|
|
74
|
+
is_enabled: boolean;
|
|
75
|
+
created_at: string;
|
|
76
|
+
updated_at: string;
|
|
77
|
+
company: INestedCompany | null;
|
|
78
|
+
levels: INestedEscalationConfigLevel[] | null;
|
|
79
|
+
runtimes: INestedEscalationRuntime[] | null;
|
|
80
|
+
}
|
|
81
|
+
export interface INestedEscalationConfig extends Omit<IEscalationConfig, "company" | "levels" | "runtimes"> {
|
|
82
|
+
}
|
|
83
|
+
export interface IEscalationExecutionLog {
|
|
84
|
+
id: string;
|
|
85
|
+
company_id: string;
|
|
86
|
+
escalation_runtime_id: string;
|
|
87
|
+
resource_type: string;
|
|
88
|
+
resource_id: string;
|
|
89
|
+
event: string;
|
|
90
|
+
approval_order: number | null;
|
|
91
|
+
level: number;
|
|
92
|
+
name: string | null;
|
|
93
|
+
notification_type: ESCALATION_NOTIFICATION_TYPE;
|
|
94
|
+
responsible_user_ids: string[];
|
|
95
|
+
extra_to_user_ids: string[];
|
|
96
|
+
cc_user_ids: string[];
|
|
97
|
+
bcc_user_ids: string[];
|
|
98
|
+
triggered_at: string;
|
|
99
|
+
triggered_after_working_seconds: number | null;
|
|
100
|
+
is_successful: boolean;
|
|
101
|
+
error_message: string | null;
|
|
102
|
+
channel_outcomes: Record<string, unknown> | null;
|
|
103
|
+
start_event: string | null;
|
|
104
|
+
start_metadata: Record<string, unknown> | null;
|
|
105
|
+
created_at: string;
|
|
106
|
+
updated_at: string;
|
|
107
|
+
escalation_runtime: INestedEscalationRuntime | null;
|
|
108
|
+
}
|
|
109
|
+
export interface INestedEscalationExecutionLog extends Omit<IEscalationExecutionLog, "escalation_runtime"> {
|
|
110
|
+
}
|
|
111
|
+
export interface IEscalationRuntime {
|
|
112
|
+
id: string;
|
|
113
|
+
company_id: string;
|
|
114
|
+
escalation_config_id: string | null;
|
|
115
|
+
resource_type: string;
|
|
116
|
+
resource_id: string;
|
|
117
|
+
event: string;
|
|
118
|
+
approval_order: number | null;
|
|
119
|
+
current_level: number | null;
|
|
120
|
+
status: ESCALATION_RUNTIME_STATUS;
|
|
121
|
+
started_at: string;
|
|
122
|
+
last_sent_at: string | null;
|
|
123
|
+
next_due_at: string | null;
|
|
124
|
+
job_id: string | null;
|
|
125
|
+
start_event: string | null;
|
|
126
|
+
start_metadata: Record<string, unknown> | null;
|
|
127
|
+
created_at: string;
|
|
128
|
+
updated_at: string;
|
|
129
|
+
escalation_config: INestedEscalationConfig | null;
|
|
130
|
+
executions: INestedEscalationExecutionLog[] | null;
|
|
131
|
+
}
|
|
132
|
+
export interface INestedEscalationRuntime extends Omit<IEscalationRuntime, "escalation_config" | "executions"> {
|
|
133
|
+
}
|
|
134
|
+
export interface IEscalationConfigFilters {
|
|
135
|
+
resource_type?: string | null;
|
|
136
|
+
event?: string | null;
|
|
137
|
+
is_enabled?: boolean | null;
|
|
138
|
+
include?: ESCALATION_CONFIG_INCLUDE[] | null;
|
|
139
|
+
}
|
|
140
|
+
export interface IEscalationConfigFiltersWithPagination extends IPaginationFilters, IEscalationConfigFilters {
|
|
141
|
+
}
|
|
142
|
+
export interface IEscalationRuntimeFilters {
|
|
143
|
+
resource_type?: string | null;
|
|
144
|
+
resource_id?: string | null;
|
|
145
|
+
event?: string | null;
|
|
146
|
+
status?: ESCALATION_RUNTIME_STATUS | null;
|
|
147
|
+
approval_order?: number | null;
|
|
148
|
+
escalation_config_id?: string | null;
|
|
149
|
+
include?: ESCALATION_RUNTIME_INCLUDE[] | null;
|
|
150
|
+
}
|
|
151
|
+
export interface IEscalationRuntimeFiltersWithPagination extends IPaginationFilters, IEscalationRuntimeFilters {
|
|
152
|
+
}
|
|
153
|
+
export interface IEscalationExecutionLogFilters {
|
|
154
|
+
resource_type?: string | null;
|
|
155
|
+
resource_id?: string | null;
|
|
156
|
+
event?: string | null;
|
|
157
|
+
escalation_runtime_id?: string | null;
|
|
158
|
+
level?: number | null;
|
|
159
|
+
is_successful?: boolean | null;
|
|
160
|
+
include?: ESCALATION_EXECUTION_LOG_INCLUDE[] | null;
|
|
161
|
+
}
|
|
162
|
+
export interface IEscalationExecutionLogFiltersWithPagination extends IPaginationFilters, IEscalationExecutionLogFilters {
|
|
163
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ESCALATION_EXECUTION_LOG_INCLUDE = exports.ESCALATION_RUNTIME_INCLUDE = exports.ESCALATION_CONFIG_LEVEL_INCLUDE = exports.ESCALATION_CONFIG_INCLUDE = exports.ESCALATION_SYNC_REASON = exports.ESCALATION_RESOURCE_EVENTS = exports.ESCALATION_EVENT_TYPE = exports.ESCALATION_RESOURCE_TYPE = exports.ESCALATION_RUNTIME_STATUS = exports.ESCALATION_NOTIFICATION_TYPE = void 0;
|
|
4
|
+
var ESCALATION_NOTIFICATION_TYPE;
|
|
5
|
+
(function (ESCALATION_NOTIFICATION_TYPE) {
|
|
6
|
+
ESCALATION_NOTIFICATION_TYPE["EMAIL"] = "EMAIL";
|
|
7
|
+
ESCALATION_NOTIFICATION_TYPE["WHATSAPP"] = "WHATSAPP";
|
|
8
|
+
ESCALATION_NOTIFICATION_TYPE["BOTH"] = "BOTH";
|
|
9
|
+
})(ESCALATION_NOTIFICATION_TYPE || (exports.ESCALATION_NOTIFICATION_TYPE = ESCALATION_NOTIFICATION_TYPE = {}));
|
|
10
|
+
var ESCALATION_RUNTIME_STATUS;
|
|
11
|
+
(function (ESCALATION_RUNTIME_STATUS) {
|
|
12
|
+
ESCALATION_RUNTIME_STATUS["ACTIVE"] = "ACTIVE";
|
|
13
|
+
ESCALATION_RUNTIME_STATUS["CLOSED"] = "CLOSED";
|
|
14
|
+
ESCALATION_RUNTIME_STATUS["EXCEEDED"] = "EXCEEDED";
|
|
15
|
+
ESCALATION_RUNTIME_STATUS["CANCELLED"] = "CANCELLED";
|
|
16
|
+
})(ESCALATION_RUNTIME_STATUS || (exports.ESCALATION_RUNTIME_STATUS = ESCALATION_RUNTIME_STATUS = {}));
|
|
17
|
+
var ESCALATION_RESOURCE_TYPE;
|
|
18
|
+
(function (ESCALATION_RESOURCE_TYPE) {
|
|
19
|
+
ESCALATION_RESOURCE_TYPE["VENDOR_ONBOARDING_REQUEST"] = "VENDOR_ONBOARDING_REQUEST";
|
|
20
|
+
ESCALATION_RESOURCE_TYPE["WAITLISTED_VENDOR"] = "WAITLISTED_VENDOR";
|
|
21
|
+
})(ESCALATION_RESOURCE_TYPE || (exports.ESCALATION_RESOURCE_TYPE = ESCALATION_RESOURCE_TYPE = {}));
|
|
22
|
+
var ESCALATION_EVENT_TYPE;
|
|
23
|
+
(function (ESCALATION_EVENT_TYPE) {
|
|
24
|
+
ESCALATION_EVENT_TYPE["SEND_PAT"] = "SEND_PAT";
|
|
25
|
+
ESCALATION_EVENT_TYPE["SEND_FOR_APPROVAL"] = "SEND_FOR_APPROVAL";
|
|
26
|
+
ESCALATION_EVENT_TYPE["APPROVE"] = "APPROVE";
|
|
27
|
+
ESCALATION_EVENT_TYPE["SYNC_TO_ERP"] = "SYNC_TO_ERP";
|
|
28
|
+
ESCALATION_EVENT_TYPE["ONBOARD"] = "ONBOARD";
|
|
29
|
+
})(ESCALATION_EVENT_TYPE || (exports.ESCALATION_EVENT_TYPE = ESCALATION_EVENT_TYPE = {}));
|
|
30
|
+
exports.ESCALATION_RESOURCE_EVENTS = {
|
|
31
|
+
[ESCALATION_RESOURCE_TYPE.VENDOR_ONBOARDING_REQUEST]: [
|
|
32
|
+
ESCALATION_EVENT_TYPE.SEND_PAT,
|
|
33
|
+
ESCALATION_EVENT_TYPE.SEND_FOR_APPROVAL,
|
|
34
|
+
ESCALATION_EVENT_TYPE.APPROVE,
|
|
35
|
+
],
|
|
36
|
+
[ESCALATION_RESOURCE_TYPE.WAITLISTED_VENDOR]: [
|
|
37
|
+
ESCALATION_EVENT_TYPE.SEND_FOR_APPROVAL,
|
|
38
|
+
ESCALATION_EVENT_TYPE.APPROVE,
|
|
39
|
+
ESCALATION_EVENT_TYPE.SYNC_TO_ERP,
|
|
40
|
+
ESCALATION_EVENT_TYPE.ONBOARD,
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
var ESCALATION_SYNC_REASON;
|
|
44
|
+
(function (ESCALATION_SYNC_REASON) {
|
|
45
|
+
ESCALATION_SYNC_REASON["CREATED"] = "CREATED";
|
|
46
|
+
ESCALATION_SYNC_REASON["UPDATED"] = "UPDATED";
|
|
47
|
+
ESCALATION_SYNC_REASON["PAT_SUBMITTED"] = "PAT_SUBMITTED";
|
|
48
|
+
ESCALATION_SYNC_REASON["PAT_ROLLED_BACK"] = "PAT_ROLLED_BACK";
|
|
49
|
+
ESCALATION_SYNC_REASON["CANCELLED"] = "CANCELLED";
|
|
50
|
+
ESCALATION_SYNC_REASON["ROLLED_BACK_TO_INITIATOR"] = "ROLLED_BACK_TO_INITIATOR";
|
|
51
|
+
ESCALATION_SYNC_REASON["DISABLED"] = "DISABLED";
|
|
52
|
+
ESCALATION_SYNC_REASON["DELETED"] = "DELETED";
|
|
53
|
+
ESCALATION_SYNC_REASON["DAILY_CHECK"] = "DAILY_CHECK";
|
|
54
|
+
})(ESCALATION_SYNC_REASON || (exports.ESCALATION_SYNC_REASON = ESCALATION_SYNC_REASON = {}));
|
|
55
|
+
var ESCALATION_CONFIG_INCLUDE;
|
|
56
|
+
(function (ESCALATION_CONFIG_INCLUDE) {
|
|
57
|
+
ESCALATION_CONFIG_INCLUDE["company"] = "company";
|
|
58
|
+
ESCALATION_CONFIG_INCLUDE["levels"] = "levels";
|
|
59
|
+
ESCALATION_CONFIG_INCLUDE["runtimes"] = "runtimes";
|
|
60
|
+
})(ESCALATION_CONFIG_INCLUDE || (exports.ESCALATION_CONFIG_INCLUDE = ESCALATION_CONFIG_INCLUDE = {}));
|
|
61
|
+
var ESCALATION_CONFIG_LEVEL_INCLUDE;
|
|
62
|
+
(function (ESCALATION_CONFIG_LEVEL_INCLUDE) {
|
|
63
|
+
ESCALATION_CONFIG_LEVEL_INCLUDE["escalation_config"] = "escalation_config";
|
|
64
|
+
})(ESCALATION_CONFIG_LEVEL_INCLUDE || (exports.ESCALATION_CONFIG_LEVEL_INCLUDE = ESCALATION_CONFIG_LEVEL_INCLUDE = {}));
|
|
65
|
+
var ESCALATION_RUNTIME_INCLUDE;
|
|
66
|
+
(function (ESCALATION_RUNTIME_INCLUDE) {
|
|
67
|
+
ESCALATION_RUNTIME_INCLUDE["escalation_config"] = "escalation_config";
|
|
68
|
+
ESCALATION_RUNTIME_INCLUDE["executions"] = "executions";
|
|
69
|
+
})(ESCALATION_RUNTIME_INCLUDE || (exports.ESCALATION_RUNTIME_INCLUDE = ESCALATION_RUNTIME_INCLUDE = {}));
|
|
70
|
+
var ESCALATION_EXECUTION_LOG_INCLUDE;
|
|
71
|
+
(function (ESCALATION_EXECUTION_LOG_INCLUDE) {
|
|
72
|
+
ESCALATION_EXECUTION_LOG_INCLUDE["escalation_runtime"] = "escalation_runtime";
|
|
73
|
+
})(ESCALATION_EXECUTION_LOG_INCLUDE || (exports.ESCALATION_EXECUTION_LOG_INCLUDE = ESCALATION_EXECUTION_LOG_INCLUDE = {}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IKpiVesItem, KPI_VES_ITEMS_SOURCE } from "../kpiVesItems.typings";
|
|
1
2
|
import { SUPPLIER_INVOICE_STATUS } from "../../supplierInvoice.typings";
|
|
2
3
|
import { IPaginationFilters } from "../../common/paginationFilters.typings";
|
|
3
4
|
export interface ICheckpointOpsKPICommonFilters {
|
|
@@ -16,6 +17,8 @@ export interface ICheckpointOpsExpectedVehicleUnit {
|
|
|
16
17
|
ves_id: string;
|
|
17
18
|
ves_no: string;
|
|
18
19
|
vehicle_no: string;
|
|
20
|
+
items: IKpiVesItem[];
|
|
21
|
+
items_source: KPI_VES_ITEMS_SOURCE;
|
|
19
22
|
vendor_name: string | null;
|
|
20
23
|
store_location_id: string;
|
|
21
24
|
store_location_name: string;
|
|
@@ -26,6 +29,8 @@ export interface ICheckpointOpsInMarkedVehicleUnit {
|
|
|
26
29
|
ves_id: string;
|
|
27
30
|
ves_no: string;
|
|
28
31
|
vehicle_no: string;
|
|
32
|
+
items: IKpiVesItem[];
|
|
33
|
+
items_source: KPI_VES_ITEMS_SOURCE;
|
|
29
34
|
vendor_name: string | null;
|
|
30
35
|
store_location_id: string;
|
|
31
36
|
store_location_name: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IKpiVesItem, KPI_VES_ITEMS_SOURCE } from "../kpiVesItems.typings";
|
|
1
2
|
import { SUPPLIER_INVOICE_STATUS } from "../../supplierInvoice.typings";
|
|
2
3
|
import { IPaginationFilters } from "../../common/paginationFilters.typings";
|
|
3
4
|
export interface IExitCheckpointVehicleColumnsFilters {
|
|
@@ -16,6 +17,8 @@ interface IExitCheckpointVehicleBase {
|
|
|
16
17
|
ves_id: string;
|
|
17
18
|
ves_no: string;
|
|
18
19
|
vehicle_no: string;
|
|
20
|
+
items: IKpiVesItem[];
|
|
21
|
+
items_source: KPI_VES_ITEMS_SOURCE;
|
|
19
22
|
vendor_name: string | null;
|
|
20
23
|
store_location_id: string;
|
|
21
24
|
store_location_name: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { IKpiVesItem, KPI_VES_ITEMS_SOURCE } from "../kpiVesItems.typings";
|
|
1
2
|
import { SUPPLIER_INVOICE_STATUS } from "../../supplierInvoice.typings";
|
|
2
3
|
import { IPaginationFilters } from "../../common/paginationFilters.typings";
|
|
4
|
+
import { VES_STATUS } from "../../company/masters/ves.typings";
|
|
3
5
|
export interface IGateKpiCardsResponse {
|
|
4
6
|
gi_made_today: number;
|
|
5
7
|
gi_made_this_month: number;
|
|
@@ -7,6 +9,7 @@ export interface IGateKpiCardsResponse {
|
|
|
7
9
|
gi_pending_erp_sync: number;
|
|
8
10
|
ves_marked_as_in: number;
|
|
9
11
|
ves_pending_gi: number;
|
|
12
|
+
invoices_pending_verification: number;
|
|
10
13
|
}
|
|
11
14
|
export interface IGateVehicleColumnsFilters {
|
|
12
15
|
store_location_id?: string;
|
|
@@ -19,6 +22,8 @@ interface IGateVehicleBase {
|
|
|
19
22
|
ves_id: string;
|
|
20
23
|
ves_no: string;
|
|
21
24
|
vehicle_no: string;
|
|
25
|
+
items: IKpiVesItem[];
|
|
26
|
+
items_source: KPI_VES_ITEMS_SOURCE;
|
|
22
27
|
vendor_name: string | null;
|
|
23
28
|
store_location_id: string;
|
|
24
29
|
store_location_name: string;
|
|
@@ -26,6 +31,12 @@ interface IGateVehicleBase {
|
|
|
26
31
|
}
|
|
27
32
|
export interface IGateArrivedVehicleUnit extends IGateVehicleBase {
|
|
28
33
|
arrived_at: string;
|
|
34
|
+
ves_status: VES_STATUS;
|
|
35
|
+
waiting_duration_ms: number;
|
|
36
|
+
}
|
|
37
|
+
export interface IGatePendingApprovalVehicleUnit extends IGateVehicleBase {
|
|
38
|
+
arrived_at: string;
|
|
39
|
+
sent_for_approval_at: string;
|
|
29
40
|
waiting_duration_ms: number;
|
|
30
41
|
}
|
|
31
42
|
export interface IGateRequestedVehicleUnit extends IGateVehicleBase {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IKpiVesItem, KPI_VES_ITEMS_SOURCE } from "../kpiVesItems.typings";
|
|
1
2
|
import { SUPPLIER_INVOICE_STATUS } from "../../supplierInvoice.typings";
|
|
2
3
|
import { IPaginationFilters } from "../../common/paginationFilters.typings";
|
|
3
4
|
export interface IGateOpsKpiCardsResponse {
|
|
@@ -6,9 +7,20 @@ export interface IGateOpsKpiCardsResponse {
|
|
|
6
7
|
invalid_invoice_count: number;
|
|
7
8
|
total_ves_recorded_count: number;
|
|
8
9
|
}
|
|
10
|
+
export interface IGateOpsExpectedVehicleItem {
|
|
11
|
+
asn_item_id: string;
|
|
12
|
+
item_id: string;
|
|
13
|
+
item_name: string;
|
|
14
|
+
code_sku: string;
|
|
15
|
+
uom: string;
|
|
16
|
+
dispatched_quantity: number;
|
|
17
|
+
}
|
|
9
18
|
export interface IGateOpsExpectedVehicleUnit {
|
|
10
19
|
asn_id: string;
|
|
20
|
+
asn_no: string;
|
|
11
21
|
vehicle_no: string;
|
|
22
|
+
items: IGateOpsExpectedVehicleItem[];
|
|
23
|
+
total_dispatched_quantity: number;
|
|
12
24
|
vendor_name: string | null;
|
|
13
25
|
store_location_id: string;
|
|
14
26
|
store_location_name: string;
|
|
@@ -20,6 +32,8 @@ export interface IGateOpsParkedVehicleUnit {
|
|
|
20
32
|
ves_id: string;
|
|
21
33
|
ves_no: string;
|
|
22
34
|
vehicle_no: string;
|
|
35
|
+
items: IKpiVesItem[];
|
|
36
|
+
items_source: KPI_VES_ITEMS_SOURCE;
|
|
23
37
|
vendor_name: string | null;
|
|
24
38
|
store_location_id: string;
|
|
25
39
|
store_location_name: string;
|
|
@@ -31,6 +45,8 @@ export interface IGateOpsRequestedVehicleUnit {
|
|
|
31
45
|
ves_id: string;
|
|
32
46
|
ves_no: string;
|
|
33
47
|
vehicle_no: string;
|
|
48
|
+
items: IKpiVesItem[];
|
|
49
|
+
items_source: KPI_VES_ITEMS_SOURCE;
|
|
34
50
|
vendor_name: string | null;
|
|
35
51
|
store_location_id: string;
|
|
36
52
|
store_location_name: string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KPI_SORTING_ORDER = void 0;
|
|
4
|
+
// Sort order on created date for the operational dashboard vehicle columns
|
|
5
|
+
var KPI_SORTING_ORDER;
|
|
6
|
+
(function (KPI_SORTING_ORDER) {
|
|
7
|
+
KPI_SORTING_ORDER["oldest_first"] = "oldest_first";
|
|
8
|
+
KPI_SORTING_ORDER["newest_first"] = "newest_first";
|
|
9
|
+
})(KPI_SORTING_ORDER || (exports.KPI_SORTING_ORDER = KPI_SORTING_ORDER = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum KPI_VES_ITEMS_SOURCE {
|
|
2
|
+
SUPPLIER_INVOICE = "SUPPLIER_INVOICE",
|
|
3
|
+
ASN = "ASN",
|
|
4
|
+
VES = "VES"
|
|
5
|
+
}
|
|
6
|
+
export interface IKpiVesItem {
|
|
7
|
+
id: string;
|
|
8
|
+
item_id: string | null;
|
|
9
|
+
item_name: string;
|
|
10
|
+
code_sku: string | null;
|
|
11
|
+
uom: string;
|
|
12
|
+
quantity: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KPI_VES_ITEMS_SOURCE = void 0;
|
|
4
|
+
// Items shown on a VES card in the vehicle dashboards (gate ops, gate, checkpoint, exit checkpoint)
|
|
5
|
+
// Source depends on the VES's supplier invoice:
|
|
6
|
+
// - VERIFIED invoice -> supplier invoice items
|
|
7
|
+
// - RAISED invoice -> ASN items when an ASN is linked, otherwise supplier invoice items
|
|
8
|
+
// - anything else -> VES items
|
|
9
|
+
var KPI_VES_ITEMS_SOURCE;
|
|
10
|
+
(function (KPI_VES_ITEMS_SOURCE) {
|
|
11
|
+
KPI_VES_ITEMS_SOURCE["SUPPLIER_INVOICE"] = "SUPPLIER_INVOICE";
|
|
12
|
+
KPI_VES_ITEMS_SOURCE["ASN"] = "ASN";
|
|
13
|
+
KPI_VES_ITEMS_SOURCE["VES"] = "VES";
|
|
14
|
+
})(KPI_VES_ITEMS_SOURCE || (exports.KPI_VES_ITEMS_SOURCE = KPI_VES_ITEMS_SOURCE = {}));
|
|
@@ -54,4 +54,14 @@ export interface FormatBusinessDurationOptions {
|
|
|
54
54
|
/** Working days in a week. Derive with getWorkingDaysPerWeek() from the company's week-off rules; falls back to WORKING_DAYS_PER_WEEK. */
|
|
55
55
|
workingDaysPerWeek?: number;
|
|
56
56
|
}
|
|
57
|
+
export declare function addWorkingSeconds(start: Date, delaySeconds: number, options?: BusinessCalendarOptions): Date;
|
|
58
|
+
export declare function businessCalendarFromCompanyConfig(config: {
|
|
59
|
+
shift_start_time?: string | null;
|
|
60
|
+
shift_end_time?: string | null;
|
|
61
|
+
week_off?: unknown;
|
|
62
|
+
public_holidays?: string[];
|
|
63
|
+
}, range?: {
|
|
64
|
+
start: Date;
|
|
65
|
+
end: Date;
|
|
66
|
+
}): BusinessCalendarOptions;
|
|
57
67
|
export declare function formatBusinessDuration(seconds: number, options?: FormatBusinessDurationOptions): string;
|
|
@@ -11,6 +11,8 @@ exports.normalizeEndTime = normalizeEndTime;
|
|
|
11
11
|
exports.calculateSameDayWorkingSeconds = calculateSameDayWorkingSeconds;
|
|
12
12
|
exports.calculateMultiDayWorkingSeconds = calculateMultiDayWorkingSeconds;
|
|
13
13
|
exports.calculateWorkingSeconds = calculateWorkingSeconds;
|
|
14
|
+
exports.addWorkingSeconds = addWorkingSeconds;
|
|
15
|
+
exports.businessCalendarFromCompanyConfig = businessCalendarFromCompanyConfig;
|
|
14
16
|
exports.formatBusinessDuration = formatBusinessDuration;
|
|
15
17
|
const date_fns_1 = require("date-fns");
|
|
16
18
|
exports.SHIFT_START_HOUR = 0;
|
|
@@ -215,6 +217,52 @@ function calculateWorkingSeconds(start, end, options) {
|
|
|
215
217
|
? calculateSameDayWorkingSeconds(normalizedStart, normalizedEnd)
|
|
216
218
|
: calculateMultiDayWorkingSeconds(normalizedStart, normalizedEnd, options);
|
|
217
219
|
}
|
|
220
|
+
function addWorkingSeconds(start, delaySeconds, options) {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
if (!delaySeconds || delaySeconds <= 0) {
|
|
223
|
+
return normalizeStartTime(start, options);
|
|
224
|
+
}
|
|
225
|
+
const startHour = (_a = options === null || options === void 0 ? void 0 : options.shiftStartHour) !== null && _a !== void 0 ? _a : exports.SHIFT_START_HOUR;
|
|
226
|
+
const endHour = (_b = options === null || options === void 0 ? void 0 : options.shiftEndHour) !== null && _b !== void 0 ? _b : exports.SHIFT_END_HOUR;
|
|
227
|
+
let cursor = normalizeStartTime(start, options);
|
|
228
|
+
let remaining = delaySeconds;
|
|
229
|
+
while (remaining > 0) {
|
|
230
|
+
if (isNonWorkingDay(cursor, options)) {
|
|
231
|
+
cursor = atHour(addBusinessDays(cursor, 1), startHour);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
const dayEnd = atHour(cursor, endHour);
|
|
235
|
+
const available = Math.max(0, (0, date_fns_1.differenceInSeconds)(dayEnd, cursor));
|
|
236
|
+
if (remaining <= available) {
|
|
237
|
+
return new Date(cursor.getTime() + remaining * 1000);
|
|
238
|
+
}
|
|
239
|
+
remaining -= available;
|
|
240
|
+
cursor = atHour(addBusinessDays(cursor, 1), startHour);
|
|
241
|
+
}
|
|
242
|
+
return cursor;
|
|
243
|
+
}
|
|
244
|
+
function businessCalendarFromCompanyConfig(config, range) {
|
|
245
|
+
var _a;
|
|
246
|
+
const weekOff = Array.isArray(config.week_off) ? config.week_off : [];
|
|
247
|
+
const weekOffDays = weekOff.filter((item) => typeof item === 'number' && Number.isInteger(item));
|
|
248
|
+
const weekOffRules = weekOff.filter((item) => typeof item === 'object' &&
|
|
249
|
+
item !== null &&
|
|
250
|
+
!Array.isArray(item) &&
|
|
251
|
+
Number.isInteger(item.day) &&
|
|
252
|
+
Array.isArray(item.occurrences));
|
|
253
|
+
const holidays = ((_a = config.public_holidays) !== null && _a !== void 0 ? _a : [])
|
|
254
|
+
.map((value) => new Date(value))
|
|
255
|
+
.filter((date) => !Number.isNaN(date.getTime()));
|
|
256
|
+
const occurrenceWeekOffDates = range && weekOffRules.length > 0
|
|
257
|
+
? expandWeekOffRulesToDates(weekOffRules, range.start, range.end)
|
|
258
|
+
: [];
|
|
259
|
+
return {
|
|
260
|
+
shiftStartHour: parseShiftTimeToHour(config.shift_start_time),
|
|
261
|
+
shiftEndHour: parseShiftTimeToHour(config.shift_end_time),
|
|
262
|
+
weekOffDays,
|
|
263
|
+
holidays: [...holidays, ...occurrenceWeekOffDates],
|
|
264
|
+
};
|
|
265
|
+
}
|
|
218
266
|
function formatBusinessDuration(seconds, options) {
|
|
219
267
|
if (!seconds || seconds <= 0)
|
|
220
268
|
return "0s";
|