@platform-modules/civil-aviation-authority 2.3.292 → 2.3.294
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/dist/data-source.js +2 -0
- package/dist/i18n/workflow-chat-i18n.json +9 -1
- package/dist/i18n/workflow-chat-message.builder.d.ts +12 -0
- package/dist/i18n/workflow-chat-message.builder.js +215 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/models/ContractServiceRequestDocumentModel.d.ts +13 -0
- package/dist/models/ContractServiceRequestDocumentModel.js +60 -0
- package/dist/models/ContractServiceRequestModel.d.ts +2 -0
- package/dist/models/ContractServiceRequestModel.js +8 -0
- package/dist/models/FollowUpReportItemModel.d.ts +5 -2
- package/dist/models/FollowUpReportItemModel.js +17 -7
- package/dist/models/FollowUpReportRequestModel.d.ts +7 -1
- package/dist/models/FollowUpReportRequestModel.js +7 -1
- package/dist/models/RespondToEnquiriesAttachmentModel.d.ts +2 -1
- package/dist/models/RespondToEnquiriesAttachmentModel.js +7 -2
- package/package.json +1 -1
- package/sql/caa_api_payload_changes_2026_07.sql +79 -0
- package/sql/fix_maintenance_subject_classification_enum_2026_07.sql +48 -0
- package/src/data-source.ts +2 -0
- package/src/i18n/workflow-chat-i18n.json +9 -1
- package/src/i18n/workflow-chat-message.builder.ts +261 -10
- package/src/index.ts +3 -1
- package/src/models/ContractServiceRequestDocumentModel.ts +35 -0
- package/src/models/ContractServiceRequestModel.ts +6 -0
- package/src/models/FollowUpReportItemModel.ts +14 -8
- package/src/models/FollowUpReportRequestModel.ts +9 -0
- package/src/models/RespondToEnquiriesAttachmentModel.ts +6 -1
package/dist/data-source.js
CHANGED
|
@@ -271,6 +271,7 @@ const ComplaintLostPropertyReportChatModel_1 = require("./models/ComplaintLostPr
|
|
|
271
271
|
const ComplaintLostPropertyReportRequestModel_1 = require("./models/ComplaintLostPropertyReportRequestModel");
|
|
272
272
|
const ComplaintLostPropertyReportWorkflowModel_1 = require("./models/ComplaintLostPropertyReportWorkflowModel");
|
|
273
273
|
const ContractServiceRequestModel_1 = require("./models/ContractServiceRequestModel");
|
|
274
|
+
const ContractServiceRequestDocumentModel_1 = require("./models/ContractServiceRequestDocumentModel");
|
|
274
275
|
const CountryMasterModel_1 = require("./models/CountryMasterModel");
|
|
275
276
|
const CyberSecurityAuditRequestModel_1 = require("./models/CyberSecurityAuditRequestModel");
|
|
276
277
|
const CyberSecurityRiskManagementRequestModel_1 = require("./models/CyberSecurityRiskManagementRequestModel");
|
|
@@ -593,6 +594,7 @@ exports.AppDataSource = new typeorm_1.DataSource({
|
|
|
593
594
|
ComplaintLostPropertyReportRequestModel_1.ComplaintLostPropertyReportRequest,
|
|
594
595
|
ComplaintLostPropertyReportWorkflowModel_1.ComplaintLostPropertyReportWorkflow,
|
|
595
596
|
ContractServiceRequestModel_1.ContractServiceRequest,
|
|
597
|
+
ContractServiceRequestDocumentModel_1.ContractServiceRequestDocument,
|
|
596
598
|
CountryMasterModel_1.CountryMaster,
|
|
597
599
|
CyberSecurityAuditRequestModel_1.CyberSecurityAuditRequest,
|
|
598
600
|
CyberSecurityRiskManagementRequestModel_1.CyberSecurityRiskManagementRequest,
|
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"en": "Request Approved{{comment}}",
|
|
41
41
|
"ar": "تمت الموافقة على الطلب{{comment}}"
|
|
42
42
|
},
|
|
43
|
+
"request_approved_assigned_to_user": {
|
|
44
|
+
"en": "Request Approved: Request assigned to {{assignedUserName}} by {{roleName}} ({{actorUserName}} - {{employeeId}})",
|
|
45
|
+
"ar": "تمت الموافقة على الطلب: تم تعيين الطلب إلى {{assignedUserName}} من قبل {{roleName}} ({{actorUserName}} - {{employeeId}})"
|
|
46
|
+
},
|
|
47
|
+
"request_approved_assigned_to_technician": {
|
|
48
|
+
"en": "Request Approved: Request assigned to technician {{assignedUserName}} by {{roleName}} ({{actorUserName}} - {{employeeId}})",
|
|
49
|
+
"ar": "تمت الموافقة على الطلب: تم تعيين الطلب إلى الفني {{assignedUserName}} من قبل {{roleName}} ({{actorUserName}} - {{employeeId}})"
|
|
50
|
+
},
|
|
43
51
|
"request_rejected": {
|
|
44
52
|
"en": "Request Rejected{{comment}}",
|
|
45
53
|
"ar": "تم رفض الطلب{{comment}}"
|
|
@@ -106,7 +114,7 @@
|
|
|
106
114
|
},
|
|
107
115
|
"it_helpdesk_wf_status_by_role": {
|
|
108
116
|
"en": "Request {{status}} by {{approverRoleName}}{{comment}}",
|
|
109
|
-
"ar": "
|
|
117
|
+
"ar": "{{statusAr}} الطلب من قبل {{approverRoleName}}{{comment}}"
|
|
110
118
|
},
|
|
111
119
|
"it_helpdesk_wf_l3_step_rejected": {
|
|
112
120
|
"en": "{{roleName}} rejected the request{{comment}}",
|
|
@@ -69,6 +69,18 @@ export declare function buildSynchronizedWorkflowMessage(ctx: WorkflowMessageCon
|
|
|
69
69
|
* Use for every chat insert/update across all CAA modules.
|
|
70
70
|
*/
|
|
71
71
|
export declare function buildSynchronizedChatMessage(ctx: ChatMessageContext): BilingualText;
|
|
72
|
+
export type RequestApprovedAssignedWorkflowParams = {
|
|
73
|
+
assignedUserName: string;
|
|
74
|
+
roleName: string;
|
|
75
|
+
roleArabicName?: string | null;
|
|
76
|
+
actorUserName: string;
|
|
77
|
+
employeeId: string | number;
|
|
78
|
+
assigneeLabel?: 'user' | 'technician';
|
|
79
|
+
};
|
|
80
|
+
/** Parse legacy English-only assignment comments used as workflow log suffixes. */
|
|
81
|
+
export declare function tryParseRequestAssignedComment(comment?: string | null): Omit<RequestApprovedAssignedWorkflowParams, 'roleArabicName'> | null;
|
|
82
|
+
/** Bilingual workflow content for approved assignment steps (HR, IT, Tender, etc.). */
|
|
83
|
+
export declare function buildRequestApprovedAssignedWorkflowFields(params: RequestApprovedAssignedWorkflowParams): BilingualText;
|
|
72
84
|
/** Standard workflow log UPDATE fields for all CAA module repositories. */
|
|
73
85
|
export declare function buildWorkflowLogUpdateFields(params: {
|
|
74
86
|
approvalStatus: string;
|
|
@@ -20,6 +20,8 @@ exports.workflowTemplate = workflowTemplate;
|
|
|
20
20
|
exports.chatTemplate = chatTemplate;
|
|
21
21
|
exports.buildSynchronizedWorkflowMessage = buildSynchronizedWorkflowMessage;
|
|
22
22
|
exports.buildSynchronizedChatMessage = buildSynchronizedChatMessage;
|
|
23
|
+
exports.tryParseRequestAssignedComment = tryParseRequestAssignedComment;
|
|
24
|
+
exports.buildRequestApprovedAssignedWorkflowFields = buildRequestApprovedAssignedWorkflowFields;
|
|
23
25
|
exports.buildWorkflowLogUpdateFields = buildWorkflowLogUpdateFields;
|
|
24
26
|
exports.toWorkflowPersistFields = toWorkflowPersistFields;
|
|
25
27
|
exports.toChatPersistFields = toChatPersistFields;
|
|
@@ -233,9 +235,73 @@ function buildSynchronizedChatMessage(ctx) {
|
|
|
233
235
|
return chatTemplate('request_received');
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
|
-
|
|
238
|
+
/** Parse legacy English-only assignment comments used as workflow log suffixes. */
|
|
239
|
+
function tryParseRequestAssignedComment(comment) {
|
|
240
|
+
const text = comment?.trim();
|
|
241
|
+
if (!text)
|
|
242
|
+
return null;
|
|
243
|
+
const technicianMatch = text.match(/^Request assigned to technician (.+?) by (.+?) \((.+?) - (.+?)\)$/);
|
|
244
|
+
if (technicianMatch) {
|
|
245
|
+
return {
|
|
246
|
+
assignedUserName: technicianMatch[1].trim(),
|
|
247
|
+
roleName: technicianMatch[2].trim(),
|
|
248
|
+
actorUserName: technicianMatch[3].trim(),
|
|
249
|
+
employeeId: technicianMatch[4].trim(),
|
|
250
|
+
assigneeLabel: 'technician',
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
const userMatch = text.match(/^Request assigned to (.+?) by (.+?) \((.+?) - (.+?)\)$/);
|
|
254
|
+
if (userMatch) {
|
|
255
|
+
return {
|
|
256
|
+
assignedUserName: userMatch[1].trim(),
|
|
257
|
+
roleName: userMatch[2].trim(),
|
|
258
|
+
actorUserName: userMatch[3].trim(),
|
|
259
|
+
employeeId: userMatch[4].trim(),
|
|
260
|
+
assigneeLabel: 'user',
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
/** Bilingual workflow content for approved assignment steps (HR, IT, Tender, etc.). */
|
|
266
|
+
function buildRequestApprovedAssignedWorkflowFields(params) {
|
|
267
|
+
const assignedUserEn = params.assignedUserName?.trim() || 'User';
|
|
268
|
+
const roleEn = params.roleName?.trim() || 'Approver';
|
|
269
|
+
const roleAr = resolveBilingualName(roleEn, params.roleArabicName);
|
|
270
|
+
const actorEn = params.actorUserName?.trim() || 'User';
|
|
271
|
+
const employeeId = String(params.employeeId ?? 'N/A');
|
|
272
|
+
const templateKey = params.assigneeLabel === 'technician'
|
|
273
|
+
? 'request_approved_assigned_to_technician'
|
|
274
|
+
: 'request_approved_assigned_to_user';
|
|
275
|
+
return renderSynchronizedWorkflowMessage(templateKey, {
|
|
276
|
+
assignedUserName: assignedUserEn,
|
|
277
|
+
roleName: roleEn,
|
|
278
|
+
actorUserName: actorEn,
|
|
279
|
+
employeeId,
|
|
280
|
+
}, {
|
|
281
|
+
assignedUserName: assignedUserEn,
|
|
282
|
+
roleName: roleAr,
|
|
283
|
+
actorUserName: actorEn,
|
|
284
|
+
employeeId,
|
|
285
|
+
});
|
|
286
|
+
}
|
|
237
287
|
/** Standard workflow log UPDATE fields for all CAA module repositories. */
|
|
238
288
|
function buildWorkflowLogUpdateFields(params) {
|
|
289
|
+
if (params.approvalStatus === 'Approved') {
|
|
290
|
+
const assignment = tryParseRequestAssignedComment(params.comment);
|
|
291
|
+
if (assignment) {
|
|
292
|
+
const bilingual = buildRequestApprovedAssignedWorkflowFields({
|
|
293
|
+
...assignment,
|
|
294
|
+
roleName: params.roleName?.trim() || assignment.roleName,
|
|
295
|
+
roleArabicName: params.roleArabicName,
|
|
296
|
+
});
|
|
297
|
+
return {
|
|
298
|
+
content: bilingual.en,
|
|
299
|
+
content_ar: bilingual.ar,
|
|
300
|
+
status: params.workflowStatus,
|
|
301
|
+
status_ar: resolveWorkflowStatusAr(params.workflowStatus),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
}
|
|
239
305
|
let action;
|
|
240
306
|
if (params.approvalStatus === 'Approved')
|
|
241
307
|
action = 'approved';
|
|
@@ -516,6 +582,22 @@ function buildItHelpdeskReassignModifiers(params) {
|
|
|
516
582
|
}
|
|
517
583
|
return { en, ar };
|
|
518
584
|
}
|
|
585
|
+
function resolveItHelpdeskGenericStatusAr(status) {
|
|
586
|
+
switch (status.trim()) {
|
|
587
|
+
case 'Approved':
|
|
588
|
+
return 'تمت الموافقة على';
|
|
589
|
+
case 'Rejected':
|
|
590
|
+
return 'تم رفض';
|
|
591
|
+
case 'Closed':
|
|
592
|
+
return 'تم إغلاق';
|
|
593
|
+
case 'Assigned':
|
|
594
|
+
return 'تم تعيين';
|
|
595
|
+
case 'Reassigned':
|
|
596
|
+
return 'تمت إعادة تعيين';
|
|
597
|
+
default:
|
|
598
|
+
return resolveChatStatusAr(status) ?? status.toLowerCase();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
519
601
|
function buildItHelpdeskMuscatWorkflowLog(params) {
|
|
520
602
|
const comment = formatColonCommentSuffix('comment' in params ? params.comment : undefined);
|
|
521
603
|
const modifiers = 'modifiers' in params && params.modifiers ? params.modifiers : { en: '', ar: '' };
|
|
@@ -590,7 +672,7 @@ function buildItHelpdeskMuscatWorkflowLog(params) {
|
|
|
590
672
|
const approverEn = params.approverRoleName.trim();
|
|
591
673
|
const approverAr = resolveBilingualName(approverEn, params.approverRoleArabicName);
|
|
592
674
|
const statusEn = params.status.toLowerCase();
|
|
593
|
-
const statusAr =
|
|
675
|
+
const statusAr = resolveItHelpdeskGenericStatusAr(params.status);
|
|
594
676
|
return renderSynchronizedWorkflowMessage('it_helpdesk_wf_status_by_role', { status: statusEn, statusAr, approverRoleName: approverEn, comment }, { status: statusEn, statusAr, approverRoleName: approverAr, comment });
|
|
595
677
|
}
|
|
596
678
|
case 'technician_completed': {
|
|
@@ -692,13 +774,20 @@ function resolveArabicWorkflowActorName(actors, parsedEnglishName) {
|
|
|
692
774
|
}
|
|
693
775
|
/** Arabic role/user label for chat templates. */
|
|
694
776
|
function resolveArabicChatRoleName(actors, parsedEnglishRole) {
|
|
777
|
+
const parsed = parsedEnglishRole?.trim();
|
|
695
778
|
if (actors?.roleName?.trim()) {
|
|
696
|
-
|
|
779
|
+
const actorRole = actors.roleName.trim();
|
|
780
|
+
if (!parsed || parsed.toLowerCase() === actorRole.toLowerCase()) {
|
|
781
|
+
return resolveBilingualName(actorRole, actors.roleArabicName);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
if (actors?.roleArabicName?.trim() && parsed) {
|
|
785
|
+
return resolveBilingualName(parsed, actors.roleArabicName);
|
|
697
786
|
}
|
|
698
787
|
if (actors?.userName?.trim()) {
|
|
699
788
|
return resolveBilingualName(actors.userName, actors.userArabicName);
|
|
700
789
|
}
|
|
701
|
-
return resolveBilingualName(
|
|
790
|
+
return resolveBilingualName(parsed, actors?.roleArabicName);
|
|
702
791
|
}
|
|
703
792
|
function escapeRegexLiteral(value) {
|
|
704
793
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -707,16 +796,36 @@ function escapeRegexLiteral(value) {
|
|
|
707
796
|
function matchTemplateMessage(templateEn, message) {
|
|
708
797
|
if (!/\{\{\w+\}\}/.test(templateEn))
|
|
709
798
|
return null;
|
|
710
|
-
const
|
|
799
|
+
const captures = [];
|
|
711
800
|
let regexBody = '';
|
|
712
801
|
let cursor = 0;
|
|
802
|
+
let groupIndex = 0;
|
|
713
803
|
const tokenRe = /\{\{(\w+)\}\}/g;
|
|
714
804
|
let tokenMatch;
|
|
715
805
|
while ((tokenMatch = tokenRe.exec(templateEn)) !== null) {
|
|
716
806
|
regexBody += escapeRegexLiteral(templateEn.slice(cursor, tokenMatch.index));
|
|
717
807
|
const key = tokenMatch[1];
|
|
718
|
-
|
|
719
|
-
|
|
808
|
+
const afterToken = templateEn.slice(tokenMatch.index + tokenMatch[0].length);
|
|
809
|
+
if (key === 'comment') {
|
|
810
|
+
groupIndex += 1;
|
|
811
|
+
captures.push({ key, groupIndex });
|
|
812
|
+
regexBody += '(.*)';
|
|
813
|
+
cursor = tokenMatch.index + tokenMatch[0].length;
|
|
814
|
+
continue;
|
|
815
|
+
}
|
|
816
|
+
if (afterToken.startsWith('{{comment}}')) {
|
|
817
|
+
groupIndex += 1;
|
|
818
|
+
captures.push({ key, groupIndex });
|
|
819
|
+
groupIndex += 1;
|
|
820
|
+
captures.push({ key: 'comment', groupIndex });
|
|
821
|
+
regexBody += '([^:]+?)(: .*)?';
|
|
822
|
+
tokenRe.lastIndex = tokenMatch.index + tokenMatch[0].length + '{{comment}}'.length;
|
|
823
|
+
cursor = tokenRe.lastIndex;
|
|
824
|
+
continue;
|
|
825
|
+
}
|
|
826
|
+
groupIndex += 1;
|
|
827
|
+
captures.push({ key, groupIndex });
|
|
828
|
+
regexBody += '(.+?)';
|
|
720
829
|
cursor = tokenMatch.index + tokenMatch[0].length;
|
|
721
830
|
}
|
|
722
831
|
regexBody += escapeRegexLiteral(templateEn.slice(cursor));
|
|
@@ -724,8 +833,8 @@ function matchTemplateMessage(templateEn, message) {
|
|
|
724
833
|
if (!match)
|
|
725
834
|
return null;
|
|
726
835
|
const params = {};
|
|
727
|
-
|
|
728
|
-
params[key] = match[
|
|
836
|
+
captures.forEach(({ key, groupIndex: idx }) => {
|
|
837
|
+
params[key] = match[idx] ?? '';
|
|
729
838
|
});
|
|
730
839
|
return params;
|
|
731
840
|
}
|
|
@@ -741,14 +850,48 @@ function buildArabicChatTemplateParams(params, actors) {
|
|
|
741
850
|
}
|
|
742
851
|
return arParams;
|
|
743
852
|
}
|
|
853
|
+
function buildArabicWorkflowTemplateParams(params, actors) {
|
|
854
|
+
const arParams = { ...params };
|
|
855
|
+
if (params.roleName !== undefined) {
|
|
856
|
+
arParams.roleName = resolveArabicChatRoleName(actors, params.roleName.trim());
|
|
857
|
+
}
|
|
858
|
+
if (params.approverRoleName !== undefined) {
|
|
859
|
+
arParams.approverRoleName = resolveArabicChatRoleName(actors, params.approverRoleName.trim());
|
|
860
|
+
}
|
|
861
|
+
if (params.assignedRoleName !== undefined) {
|
|
862
|
+
arParams.assignedRoleName = resolveArabicChatRoleName(actors, params.assignedRoleName.trim());
|
|
863
|
+
}
|
|
864
|
+
if (params.name !== undefined) {
|
|
865
|
+
arParams.name = resolveArabicWorkflowActorName(actors, params.name.trim());
|
|
866
|
+
}
|
|
867
|
+
if (params.status !== undefined && params.statusAr === undefined) {
|
|
868
|
+
const normalizedStatus = params.status.charAt(0).toUpperCase() + params.status.slice(1).toLowerCase();
|
|
869
|
+
arParams.statusAr = resolveItHelpdeskGenericStatusAr(normalizedStatus);
|
|
870
|
+
}
|
|
871
|
+
return arParams;
|
|
872
|
+
}
|
|
873
|
+
function countTemplatePlaceholders(templateEn) {
|
|
874
|
+
return (templateEn.match(/\{\{\w+\}\}/g) || []).length;
|
|
875
|
+
}
|
|
876
|
+
function listWorkflowTemplatesBySpecificity() {
|
|
877
|
+
return Object.entries(WORKFLOW_TEMPLATES).sort(([, a], [, b]) => countTemplatePlaceholders(b.en) - countTemplatePlaceholders(a.en));
|
|
878
|
+
}
|
|
744
879
|
function resolveWorkflowContentAr(content, actors) {
|
|
745
880
|
if (content == null || content.trim() === '')
|
|
746
881
|
return null;
|
|
747
882
|
const normalized = content.trim();
|
|
748
883
|
for (const tpl of Object.values(WORKFLOW_TEMPLATES)) {
|
|
749
|
-
if (tpl.en === normalized)
|
|
884
|
+
if (tpl.en === normalized || tpl.en.toLowerCase() === normalized.toLowerCase())
|
|
750
885
|
return tpl.ar;
|
|
751
886
|
}
|
|
887
|
+
for (const [, tpl] of listWorkflowTemplatesBySpecificity()) {
|
|
888
|
+
if (!/\{\{\w+\}\}/.test(tpl.en))
|
|
889
|
+
continue;
|
|
890
|
+
const params = matchTemplateMessage(tpl.en, normalized);
|
|
891
|
+
if (!params)
|
|
892
|
+
continue;
|
|
893
|
+
return interpolate(tpl.ar, buildArabicWorkflowTemplateParams(params, actors));
|
|
894
|
+
}
|
|
752
895
|
const commentIdx = normalized.indexOf(': ');
|
|
753
896
|
if (commentIdx > 0) {
|
|
754
897
|
const baseEn = normalized.slice(0, commentIdx).trim();
|
|
@@ -783,6 +926,28 @@ function resolveWorkflowContentAr(content, actors) {
|
|
|
783
926
|
const nameAr = resolveArabicWorkflowActorName(actors, namePartEn);
|
|
784
927
|
return interpolate(WORKFLOW_TEMPLATES.request_approval_pending_from.ar, { name: nameAr });
|
|
785
928
|
}
|
|
929
|
+
// Legacy HR worker strings (pre-i18n catalog)
|
|
930
|
+
if (normalized === 'Send Notification') {
|
|
931
|
+
return WORKFLOW_TEMPLATES.notification_sent_pending?.ar ?? null;
|
|
932
|
+
}
|
|
933
|
+
const notificationSuccessVariants = [
|
|
934
|
+
'notification sent successfully',
|
|
935
|
+
'notification sent sucessfully',
|
|
936
|
+
'notification sent',
|
|
937
|
+
];
|
|
938
|
+
if (notificationSuccessVariants.includes(normalized.toLowerCase())) {
|
|
939
|
+
return WORKFLOW_TEMPLATES.notification_sent_successfully?.ar ?? null;
|
|
940
|
+
}
|
|
941
|
+
const legacyPendingPrefix = 'Approval pending from ';
|
|
942
|
+
if (normalized.startsWith(legacyPendingPrefix)) {
|
|
943
|
+
const namePartEn = normalized.slice(legacyPendingPrefix.length).trim();
|
|
944
|
+
const nameAr = resolveArabicWorkflowActorName(actors, namePartEn);
|
|
945
|
+
return interpolate(WORKFLOW_TEMPLATES.request_approval_pending_from.ar, { name: nameAr });
|
|
946
|
+
}
|
|
947
|
+
if (normalized === 'Approval Pending from HR Section' ||
|
|
948
|
+
normalized === 'Approval Pending from Records Department') {
|
|
949
|
+
return WORKFLOW_TEMPLATES.request_approval_pending?.ar ?? null;
|
|
950
|
+
}
|
|
786
951
|
return null;
|
|
787
952
|
}
|
|
788
953
|
function resolveChatMessageAr(message, actors) {
|
|
@@ -812,9 +977,48 @@ function enrichWorkflowLog(log) {
|
|
|
812
977
|
const status = log.status != null ? String(log.status) : null;
|
|
813
978
|
const content = log.content != null ? String(log.content) : null;
|
|
814
979
|
const actors = extractBilingualActorsFromRecord(log);
|
|
980
|
+
const resolvedAr = resolveWorkflowContentAr(content, actors);
|
|
981
|
+
const existingAr = log.content_ar != null && String(log.content_ar).trim() !== ''
|
|
982
|
+
? String(log.content_ar)
|
|
983
|
+
: null;
|
|
984
|
+
// Re-resolve when stored AR still embeds the English actor parsed from `content`.
|
|
985
|
+
const pendingPrefix = WORKFLOW_TEMPLATES.request_approval_pending_from?.en.split('{{name}}')[0].trim();
|
|
986
|
+
let content_ar = existingAr ?? resolvedAr;
|
|
987
|
+
if (content &&
|
|
988
|
+
pendingPrefix &&
|
|
989
|
+
content.startsWith(pendingPrefix) &&
|
|
990
|
+
existingAr &&
|
|
991
|
+
resolvedAr &&
|
|
992
|
+
existingAr !== resolvedAr) {
|
|
993
|
+
const namePartEn = content.slice(pendingPrefix.length).trim();
|
|
994
|
+
if (namePartEn && existingAr.includes(namePartEn)) {
|
|
995
|
+
content_ar = resolvedAr;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
if (content &&
|
|
999
|
+
existingAr &&
|
|
1000
|
+
resolvedAr &&
|
|
1001
|
+
existingAr !== resolvedAr &&
|
|
1002
|
+
/Request assigned to/i.test(existingAr)) {
|
|
1003
|
+
content_ar = resolvedAr;
|
|
1004
|
+
}
|
|
1005
|
+
if (content &&
|
|
1006
|
+
existingAr &&
|
|
1007
|
+
resolvedAr &&
|
|
1008
|
+
existingAr !== resolvedAr &&
|
|
1009
|
+
actors?.roleName?.trim() &&
|
|
1010
|
+
actors?.roleArabicName?.trim() &&
|
|
1011
|
+
existingAr.includes(actors.roleName.trim())) {
|
|
1012
|
+
content_ar = resolvedAr;
|
|
1013
|
+
}
|
|
1014
|
+
if ((content_ar == null || content_ar === '') && content) {
|
|
1015
|
+
const notificationAr = resolveWorkflowContentAr(content, actors);
|
|
1016
|
+
if (notificationAr)
|
|
1017
|
+
content_ar = notificationAr;
|
|
1018
|
+
}
|
|
815
1019
|
return {
|
|
816
1020
|
...log,
|
|
817
|
-
content_ar
|
|
1021
|
+
content_ar,
|
|
818
1022
|
status_ar: log.status_ar ?? resolveWorkflowStatusAr(status),
|
|
819
1023
|
};
|
|
820
1024
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -409,6 +409,7 @@ export { RespondToEnquiriesRequestAttachment } from './models/RespondToEnquiries
|
|
|
409
409
|
export * from './models/RequestATenderRequestModel';
|
|
410
410
|
export * from './models/RequestTenderAnalysisRequestModel';
|
|
411
411
|
export * from './models/ContractServiceRequestModel';
|
|
412
|
+
export * from './models/ContractServiceRequestDocumentModel';
|
|
412
413
|
export * from './models/SlaConfigModel';
|
|
413
414
|
export * from './models/SlaRequestModel';
|
|
414
415
|
export * from './models/SlaMyRequestsViewModel';
|
package/dist/index.js
CHANGED
|
@@ -598,6 +598,7 @@ Object.defineProperty(exports, "RespondToEnquiriesRequestAttachment", { enumerab
|
|
|
598
598
|
__exportStar(require("./models/RequestATenderRequestModel"), exports);
|
|
599
599
|
__exportStar(require("./models/RequestTenderAnalysisRequestModel"), exports);
|
|
600
600
|
__exportStar(require("./models/ContractServiceRequestModel"), exports);
|
|
601
|
+
__exportStar(require("./models/ContractServiceRequestDocumentModel"), exports);
|
|
601
602
|
__exportStar(require("./models/SlaConfigModel"), exports);
|
|
602
603
|
__exportStar(require("./models/SlaRequestModel"), exports);
|
|
603
604
|
__exportStar(require("./models/SlaMyRequestsViewModel"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseModel } from './BaseModel';
|
|
2
|
+
export declare class ContractServiceRequestDocument extends BaseModel {
|
|
3
|
+
request_id: number;
|
|
4
|
+
service_id: number | null;
|
|
5
|
+
sub_service_id: number | null;
|
|
6
|
+
document_name: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
file_url: string;
|
|
9
|
+
file_name: string | null;
|
|
10
|
+
file_type: string | null;
|
|
11
|
+
file_size: number | null;
|
|
12
|
+
uploaded_by: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContractServiceRequestDocument = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const BaseModel_1 = require("./BaseModel");
|
|
15
|
+
let ContractServiceRequestDocument = class ContractServiceRequestDocument extends BaseModel_1.BaseModel {
|
|
16
|
+
};
|
|
17
|
+
exports.ContractServiceRequestDocument = ContractServiceRequestDocument;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: false }),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], ContractServiceRequestDocument.prototype, "request_id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
24
|
+
__metadata("design:type", Object)
|
|
25
|
+
], ContractServiceRequestDocument.prototype, "service_id", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: true }),
|
|
28
|
+
__metadata("design:type", Object)
|
|
29
|
+
], ContractServiceRequestDocument.prototype, "sub_service_id", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: false }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], ContractServiceRequestDocument.prototype, "document_name", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
36
|
+
__metadata("design:type", Object)
|
|
37
|
+
], ContractServiceRequestDocument.prototype, "description", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: false }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], ContractServiceRequestDocument.prototype, "file_url", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], ContractServiceRequestDocument.prototype, "file_name", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], ContractServiceRequestDocument.prototype, "file_type", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
|
|
52
|
+
__metadata("design:type", Object)
|
|
53
|
+
], ContractServiceRequestDocument.prototype, "file_size", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)({ type: 'integer', nullable: false }),
|
|
56
|
+
__metadata("design:type", Number)
|
|
57
|
+
], ContractServiceRequestDocument.prototype, "uploaded_by", void 0);
|
|
58
|
+
exports.ContractServiceRequestDocument = ContractServiceRequestDocument = __decorate([
|
|
59
|
+
(0, typeorm_1.Entity)({ name: 'contract_service_request_documents' })
|
|
60
|
+
], ContractServiceRequestDocument);
|
|
@@ -14,6 +14,8 @@ export declare class ContractServiceRequest extends BaseModel {
|
|
|
14
14
|
request_id: string | null;
|
|
15
15
|
project_or_budget_code: string;
|
|
16
16
|
company_name: string;
|
|
17
|
+
company_phone_number: string | null;
|
|
18
|
+
notes: string | null;
|
|
17
19
|
status: RespondToEnquiriesRequestStatus;
|
|
18
20
|
reviewer_user_id: number | null;
|
|
19
21
|
assigned_to_user_id: number | null;
|
|
@@ -68,6 +68,14 @@ __decorate([
|
|
|
68
68
|
(0, typeorm_1.Column)({ type: "varchar", length: 255, nullable: false }),
|
|
69
69
|
__metadata("design:type", String)
|
|
70
70
|
], ContractServiceRequest.prototype, "company_name", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 30, nullable: true }),
|
|
73
|
+
__metadata("design:type", Object)
|
|
74
|
+
], ContractServiceRequest.prototype, "company_phone_number", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
77
|
+
__metadata("design:type", Object)
|
|
78
|
+
], ContractServiceRequest.prototype, "notes", void 0);
|
|
71
79
|
__decorate([
|
|
72
80
|
(0, typeorm_1.Column)({
|
|
73
81
|
type: "enum",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseModel } from './BaseModel';
|
|
2
|
-
import { FollowUpReportSubjectClassification } from './FollowUpReportRequestModel';
|
|
3
2
|
export declare class FollowUpReportItem extends BaseModel {
|
|
4
3
|
request_id: number;
|
|
5
4
|
service_id: number | null;
|
|
@@ -7,10 +6,14 @@ export declare class FollowUpReportItem extends BaseModel {
|
|
|
7
6
|
reference_type: string | null;
|
|
8
7
|
letter_date: Date | null;
|
|
9
8
|
subject: string | null;
|
|
10
|
-
subject_classification:
|
|
9
|
+
subject_classification: string | null;
|
|
11
10
|
general_manager_comment: string | null;
|
|
12
11
|
response_date_target: string | null;
|
|
13
12
|
action_status: string | null;
|
|
14
13
|
action_taken: string | null;
|
|
15
14
|
delay_period: string | null;
|
|
15
|
+
file_url: string | null;
|
|
16
|
+
file_name: string | null;
|
|
17
|
+
file_type: string | null;
|
|
18
|
+
file_size: number | null;
|
|
16
19
|
}
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.FollowUpReportItem = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const BaseModel_1 = require("./BaseModel");
|
|
15
|
-
const FollowUpReportRequestModel_1 = require("./FollowUpReportRequestModel");
|
|
16
15
|
let FollowUpReportItem = class FollowUpReportItem extends BaseModel_1.BaseModel {
|
|
17
16
|
};
|
|
18
17
|
exports.FollowUpReportItem = FollowUpReportItem;
|
|
@@ -41,12 +40,7 @@ __decorate([
|
|
|
41
40
|
__metadata("design:type", Object)
|
|
42
41
|
], FollowUpReportItem.prototype, "subject", void 0);
|
|
43
42
|
__decorate([
|
|
44
|
-
(0, typeorm_1.Column)({
|
|
45
|
-
type: 'enum',
|
|
46
|
-
enum: FollowUpReportRequestModel_1.FollowUpReportSubjectClassification,
|
|
47
|
-
enumName: 'maintenance_subject_classification_en',
|
|
48
|
-
nullable: true,
|
|
49
|
-
}),
|
|
43
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
50
44
|
__metadata("design:type", Object)
|
|
51
45
|
], FollowUpReportItem.prototype, "subject_classification", void 0);
|
|
52
46
|
__decorate([
|
|
@@ -69,6 +63,22 @@ __decorate([
|
|
|
69
63
|
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
70
64
|
__metadata("design:type", Object)
|
|
71
65
|
], FollowUpReportItem.prototype, "delay_period", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: true }),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], FollowUpReportItem.prototype, "file_url", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
|
|
72
|
+
__metadata("design:type", Object)
|
|
73
|
+
], FollowUpReportItem.prototype, "file_name", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], FollowUpReportItem.prototype, "file_type", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], FollowUpReportItem.prototype, "file_size", void 0);
|
|
72
82
|
exports.FollowUpReportItem = FollowUpReportItem = __decorate([
|
|
73
83
|
(0, typeorm_1.Entity)({ name: 'followup_report_items' })
|
|
74
84
|
], FollowUpReportItem);
|
|
@@ -5,8 +5,14 @@ export declare enum FollowUpReportSubjectClassification {
|
|
|
5
5
|
VERY_URGENT = "Very Urgent",
|
|
6
6
|
CONFIDENTIAL = "Confidential",
|
|
7
7
|
INFORMATIONAL = "Informational",
|
|
8
|
-
NORMAL = "Normal"
|
|
8
|
+
NORMAL = "Normal",
|
|
9
|
+
IMPORTANT = "Important",
|
|
10
|
+
HIGHLY_CONFIDENTIAL = "Highly Confidential",
|
|
11
|
+
RESTRICTED = "Restricted",
|
|
12
|
+
LIMITED = "Limited"
|
|
9
13
|
}
|
|
14
|
+
/** Allowed API/DB values for follow-up report subject classification. */
|
|
15
|
+
export declare const FOLLOW_UP_REPORT_SUBJECT_CLASSIFICATION_VALUES: FollowUpReportSubjectClassification[];
|
|
10
16
|
/** Concerned department under General Manager of Support Services */
|
|
11
17
|
export declare enum FollowUpReportConcernedDepartment {
|
|
12
18
|
IT = "IT",
|
|
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.FollowUpReportRequests = exports.FollowUpReportRequestStatus = exports.FollowUpReportConcernedDepartment = exports.FollowUpReportSubjectClassification = void 0;
|
|
12
|
+
exports.FollowUpReportRequests = exports.FollowUpReportRequestStatus = exports.FollowUpReportConcernedDepartment = exports.FOLLOW_UP_REPORT_SUBJECT_CLASSIFICATION_VALUES = exports.FollowUpReportSubjectClassification = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const BaseModel_1 = require("./BaseModel");
|
|
15
15
|
/** Subject / handling priority classification */
|
|
@@ -20,7 +20,13 @@ var FollowUpReportSubjectClassification;
|
|
|
20
20
|
FollowUpReportSubjectClassification["CONFIDENTIAL"] = "Confidential";
|
|
21
21
|
FollowUpReportSubjectClassification["INFORMATIONAL"] = "Informational";
|
|
22
22
|
FollowUpReportSubjectClassification["NORMAL"] = "Normal";
|
|
23
|
+
FollowUpReportSubjectClassification["IMPORTANT"] = "Important";
|
|
24
|
+
FollowUpReportSubjectClassification["HIGHLY_CONFIDENTIAL"] = "Highly Confidential";
|
|
25
|
+
FollowUpReportSubjectClassification["RESTRICTED"] = "Restricted";
|
|
26
|
+
FollowUpReportSubjectClassification["LIMITED"] = "Limited";
|
|
23
27
|
})(FollowUpReportSubjectClassification || (exports.FollowUpReportSubjectClassification = FollowUpReportSubjectClassification = {}));
|
|
28
|
+
/** Allowed API/DB values for follow-up report subject classification. */
|
|
29
|
+
exports.FOLLOW_UP_REPORT_SUBJECT_CLASSIFICATION_VALUES = Object.values(FollowUpReportSubjectClassification);
|
|
24
30
|
/** Concerned department under General Manager of Support Services */
|
|
25
31
|
var FollowUpReportConcernedDepartment;
|
|
26
32
|
(function (FollowUpReportConcernedDepartment) {
|
|
@@ -9,5 +9,6 @@ export declare class RespondToEnquiriesRequestAttachment extends BaseModel {
|
|
|
9
9
|
file_type: string;
|
|
10
10
|
file_size: number | null;
|
|
11
11
|
description: string;
|
|
12
|
-
|
|
12
|
+
document_name: string | null;
|
|
13
|
+
constructor(request_id: number, uploaded_by: number, file_url: string, service_id?: number | null, sub_service_id?: number | null, file_name?: string, file_type?: string, file_size?: number, description?: string, document_name?: string);
|
|
13
14
|
}
|
|
@@ -13,7 +13,7 @@ exports.RespondToEnquiriesRequestAttachment = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const BaseModel_1 = require("./BaseModel");
|
|
15
15
|
let RespondToEnquiriesRequestAttachment = class RespondToEnquiriesRequestAttachment extends BaseModel_1.BaseModel {
|
|
16
|
-
constructor(request_id, uploaded_by, file_url, service_id, sub_service_id, file_name, file_type, file_size, description) {
|
|
16
|
+
constructor(request_id, uploaded_by, file_url, service_id, sub_service_id, file_name, file_type, file_size, description, document_name) {
|
|
17
17
|
super();
|
|
18
18
|
this.request_id = request_id;
|
|
19
19
|
this.service_id = service_id || null;
|
|
@@ -24,6 +24,7 @@ let RespondToEnquiriesRequestAttachment = class RespondToEnquiriesRequestAttachm
|
|
|
24
24
|
this.file_type = file_type || "";
|
|
25
25
|
this.file_size = file_size || null;
|
|
26
26
|
this.description = description || "";
|
|
27
|
+
this.document_name = document_name || null;
|
|
27
28
|
}
|
|
28
29
|
};
|
|
29
30
|
exports.RespondToEnquiriesRequestAttachment = RespondToEnquiriesRequestAttachment;
|
|
@@ -63,7 +64,11 @@ __decorate([
|
|
|
63
64
|
(0, typeorm_1.Column)({ type: "text", nullable: true }),
|
|
64
65
|
__metadata("design:type", String)
|
|
65
66
|
], RespondToEnquiriesRequestAttachment.prototype, "description", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 500, nullable: true }),
|
|
69
|
+
__metadata("design:type", Object)
|
|
70
|
+
], RespondToEnquiriesRequestAttachment.prototype, "document_name", void 0);
|
|
66
71
|
exports.RespondToEnquiriesRequestAttachment = RespondToEnquiriesRequestAttachment = __decorate([
|
|
67
72
|
(0, typeorm_1.Entity)({ name: "respond_to_enquiries_request_attachments" }),
|
|
68
|
-
__metadata("design:paramtypes", [Number, Number, String, Object, Object, String, String, Number, String])
|
|
73
|
+
__metadata("design:paramtypes", [Number, Number, String, Object, Object, String, String, Number, String, String])
|
|
69
74
|
], RespondToEnquiriesRequestAttachment);
|