@colijnit/sharedcomponents 260.1.3 → 260.1.5

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.
@@ -1412,10 +1412,10 @@ class SharedConnectorService {
1412
1412
  });
1413
1413
  });
1414
1414
  }
1415
- getFormResponse(formResponseId) {
1415
+ insertFormResponse(formResponse) {
1416
1416
  return __awaiter(this, void 0, void 0, function* () {
1417
1417
  return new Promise((resolve, reject) => {
1418
- return this.mainConnector.getFormResponse(formResponseId).then((result) => {
1418
+ return this.mainConnector.insertFormResponse(formResponse).then((result) => {
1419
1419
  if (result.validationResult && result.validationResult.success) {
1420
1420
  if (result.resultObject) {
1421
1421
  resolve(this._boFactory.makeWithRawBackendData(FormResponse, result.resultObject));
@@ -1428,10 +1428,10 @@ class SharedConnectorService {
1428
1428
  });
1429
1429
  });
1430
1430
  }
1431
- insertFormResponse(formResponse) {
1431
+ updateFormResponse(formResponse) {
1432
1432
  return __awaiter(this, void 0, void 0, function* () {
1433
1433
  return new Promise((resolve, reject) => {
1434
- return this.mainConnector.insertFormResponse(formResponse).then((result) => {
1434
+ return this.mainConnector.updateFormResponse(formResponse).then((result) => {
1435
1435
  if (result.validationResult && result.validationResult.success) {
1436
1436
  if (result.resultObject) {
1437
1437
  resolve(this._boFactory.makeWithRawBackendData(FormResponse, result.resultObject));
@@ -1444,17 +1444,29 @@ class SharedConnectorService {
1444
1444
  });
1445
1445
  });
1446
1446
  }
1447
- updateFormResponse(formResponse) {
1447
+ lockFormResponse(formResponseId) {
1448
1448
  return __awaiter(this, void 0, void 0, function* () {
1449
1449
  return new Promise((resolve, reject) => {
1450
- return this.mainConnector.updateFormResponse(formResponse).then((result) => {
1450
+ return this.mainConnector.lockFormResponse(formResponseId).then((result) => {
1451
1451
  if (result.validationResult && result.validationResult.success) {
1452
- if (result.resultObject) {
1453
- resolve(this._boFactory.makeWithRawBackendData(FormResponse, result.resultObject));
1454
- }
1452
+ resolve(true);
1455
1453
  }
1456
1454
  else {
1457
- reject(result.validationMessagesAsString);
1455
+ reject(result.validationResult.messages[0].message);
1456
+ }
1457
+ });
1458
+ });
1459
+ });
1460
+ }
1461
+ unlockFormResponse(formResponseId) {
1462
+ return __awaiter(this, void 0, void 0, function* () {
1463
+ return new Promise((resolve, reject) => {
1464
+ return this.mainConnector.unlockFormResponse(formResponseId).then((result) => {
1465
+ if (result.validationResult && result.validationResult.success) {
1466
+ resolve(true);
1467
+ }
1468
+ else {
1469
+ reject(result.validationResult.messages[0].message);
1458
1470
  }
1459
1471
  });
1460
1472
  });
@@ -4474,7 +4486,6 @@ SendMethodPdfModule.decorators = [
4474
4486
  },] }
4475
4487
  ];
4476
4488
 
4477
- ;
4478
4489
  class SendMethodPurchaseComponent {
4479
4490
  constructor(sendMethodService) {
4480
4491
  this.sendMethodService = sendMethodService;
@@ -4492,7 +4503,8 @@ class SendMethodPurchaseComponent {
4492
4503
  this.overruleOptions = [
4493
4504
  { code: 1, description: 'Print' },
4494
4505
  { code: 2, description: 'E-mail' },
4495
- { code: 3, description: 'EDI' }
4506
+ { code: 3, description: 'EDI' },
4507
+ { code: 8, description: 'PDF' }
4496
4508
  ];
4497
4509
  }
4498
4510
  showClass() {
@@ -17214,12 +17226,12 @@ class TaskCreatorComponent {
17214
17226
  this._formMasterService = _formMasterService;
17215
17227
  this.icons = Icon;
17216
17228
  this.table = TableName$1.Transactions;
17229
+ this.allowEmailing = true;
17217
17230
  this.activityCreated = new EventEmitter();
17218
- this.optionCollection = [
17219
- { icon: this.iconService.getIcon(this.icons.CommentRegular), label: this.dictionaryService.get('REMARK', true) },
17220
- { icon: this.iconService.getIcon(this.icons.PersonDiggingRegular), label: this.dictionaryService.get('WORK', true) },
17221
- { icon: this.iconService.getIcon(this.icons.ListUlRegular), label: this.dictionaryService.get('TASK', true) },
17222
- ];
17231
+ this.optionCollection = [];
17232
+ this.remarkListItem = { icon: this.iconService.getIcon(this.icons.CommentRegular), label: this.dictionaryService.get('REMARK', true) };
17233
+ this.workListItem = { icon: this.iconService.getIcon(this.icons.PersonDiggingRegular), label: this.dictionaryService.get('WORK', true) };
17234
+ this.taskListItem = { icon: this.iconService.getIcon(this.icons.ListUlRegular), label: this.dictionaryService.get('TASK', true) };
17223
17235
  this.showFilesDialog = false;
17224
17236
  this.documents = [];
17225
17237
  this.oldDocuments = [];
@@ -17232,16 +17244,46 @@ class TaskCreatorComponent {
17232
17244
  this.workDescription = "";
17233
17245
  this.taskName = "";
17234
17246
  this.taskDescription = "";
17247
+ this._allowRemarkCreation = true;
17248
+ this._allowWorkCreation = true;
17249
+ this._allowTaskCreation = true;
17250
+ }
17251
+ set allowRemarkCreation(allow) {
17252
+ this._allowRemarkCreation = allow;
17253
+ this.setupOptionCollection();
17254
+ }
17255
+ set allowWorkCreation(allow) {
17256
+ this._allowWorkCreation = allow;
17257
+ this.setupOptionCollection();
17258
+ }
17259
+ set allowTaskCreation(allow) {
17260
+ this._allowTaskCreation = allow;
17261
+ this.setupOptionCollection();
17235
17262
  }
17236
17263
  showClass() {
17237
17264
  return true;
17238
17265
  }
17239
17266
  ngOnInit() {
17240
17267
  return __awaiter(this, void 0, void 0, function* () {
17241
- this.chosenActivityType = this.optionCollection[0];
17268
+ this.setupOptionCollection();
17242
17269
  this.senderAddress = yield this.sharedService.getEmailSenderByWorkflowCategoryAndKey('SERVICE_ORDER', this.remarkAndWorkKey);
17243
17270
  });
17244
17271
  }
17272
+ setupOptionCollection() {
17273
+ this.optionCollection = [];
17274
+ if (this._allowRemarkCreation) {
17275
+ this.optionCollection.push(this.remarkListItem);
17276
+ }
17277
+ if (this._allowWorkCreation) {
17278
+ this.optionCollection.push(this.workListItem);
17279
+ }
17280
+ if (this._allowTaskCreation) {
17281
+ this.optionCollection.push(this.taskListItem);
17282
+ }
17283
+ if (this.optionCollection.length > 0) {
17284
+ this.chosenActivityType = this.optionCollection[0];
17285
+ }
17286
+ }
17245
17287
  itemSelected(item) {
17246
17288
  this.chosenActivityType = item;
17247
17289
  }
@@ -17378,10 +17420,10 @@ class TaskCreatorComponent {
17378
17420
  });
17379
17421
  }
17380
17422
  findReportType() {
17381
- if (this.chosenActivityType === this.optionCollection[0]) {
17423
+ if (this.chosenActivityType === this.remarkListItem) {
17382
17424
  return ReportType.RemarkMessage;
17383
17425
  }
17384
- else if (this.chosenActivityType === this.optionCollection[1]) {
17426
+ else if (this.chosenActivityType === this.workListItem) {
17385
17427
  return ReportType.WorkMessage;
17386
17428
  }
17387
17429
  else {
@@ -17409,10 +17451,10 @@ class TaskCreatorComponent {
17409
17451
  history.emailAddresses = this._createEmailAddressString(this.emailAddresses);
17410
17452
  history.emailDateTime = new Date();
17411
17453
  history.message = 'Email Content created via Report';
17412
- if (this.chosenActivityType === this.optionCollection[0]) {
17454
+ if (this.chosenActivityType === this.remarkListItem) {
17413
17455
  yield this.sharedService.insertEmailHistoryForRemark(history);
17414
17456
  }
17415
- else if (this.chosenActivityType === this.optionCollection[1]) {
17457
+ else if (this.chosenActivityType === this.workListItem) {
17416
17458
  yield this.sharedService.insertEmailHistoryForWork(history);
17417
17459
  }
17418
17460
  else {
@@ -17471,69 +17513,69 @@ class TaskCreatorComponent {
17471
17513
  TaskCreatorComponent.decorators = [
17472
17514
  { type: Component, args: [{
17473
17515
  selector: "co-task-creator",
17474
- template: `
17475
- <div class="task-creator-wrapper">
17476
- <div class="top-rows">
17477
- <co-email-selector [(emailAddresses)]="emailAddresses" [(bccEmailAddresses)]="bccEmailAddresses"
17478
- [key]="remarkAndWorkKey" [workflowCategoryType]="workflowCategoryType"></co-email-selector>
17479
- <co-form #createForm class="creator-remarks input-fields">
17480
- <co-list-of-icons [collection]="optionCollection" (itemSelected)="itemSelected($event)"></co-list-of-icons>
17481
- <co-input-textarea *ngIf="chosenActivityType === optionCollection[0]"
17482
- [required]="chosenActivityType === optionCollection[0]"
17483
- [placeholder]="'REMARK' | sharedLocalize" [(model)]="remarkText"
17484
- class="large-remark"></co-input-textarea>
17485
- <co-input-textarea *ngIf="chosenActivityType === optionCollection[1]"
17486
- [required]="chosenActivityType === optionCollection[1]"
17487
- [placeholder]="'DESCRIPTION' | sharedLocalize" [(model)]="workDescription"
17488
- class="large-remark"></co-input-textarea>
17489
- <div class="task-input-fields" *ngIf="chosenActivityType === optionCollection[2]">
17490
- <co-input-text [(model)]="taskName" [placeholder]="'NAME' | sharedLocalize"
17491
- [required]="chosenActivityType === optionCollection[2]"></co-input-text>
17492
- <co-input-textarea [(model)]="taskDescription" [placeholder]="'DESCRIPTION' | sharedLocalize"
17493
- class="large-remark"
17494
- [required]="chosenActivityType === optionCollection[2]"></co-input-textarea>
17495
- </div>
17496
- </co-form>
17497
- </div>
17498
- <div class="extras-buttons">
17499
- <co-button [iconData]="iconService.getIcon(icons.PaperclipRegular)" (click)="openAttachmentDialog()"
17500
- [label]="documents.length === 0 ? '' : documents.length.toString()"></co-button>
17501
- <co-button *ngIf="chosenActivityType === optionCollection[0]"
17502
- [iconData]="iconService.getIcon(icons.PaperPlaneTopSolid)"
17503
- (click)="createRemarkClicked()"></co-button>
17504
- <co-button *ngIf="chosenActivityType === optionCollection[1]"
17505
- [iconData]="iconService.getIcon(icons.PaperPlaneTopSolid)"
17506
- (click)="createWorkClicked()"></co-button>
17507
- <co-button *ngIf="chosenActivityType === optionCollection[2]"
17508
- [iconData]="iconService.getIcon(icons.PaperPlaneTopSolid)"
17509
- (click)="createTaskClicked()"></co-button>
17510
- </div>
17511
- </div>
17512
- <co-dialog *ngIf="showFilesDialog" (closeClick)="attachmentDialogCancelled()"
17513
- [headerTemplate]="attachmentHeaderTemplate"
17514
- [footerTemplate]="attachmentFooterTemplate">
17515
-
17516
- <ng-template #attachmentHeaderTemplate>
17517
- <div class="co-dialog-wrapper-popup-title">
17518
- <co-icon [iconData]="iconService.getIcon(icons.PaperclipRegular)"></co-icon>
17519
- <div class="co-dialog-header-title" [textContent]="'ATTACHMENTS' | sharedLocalize"></div>
17520
- </div>
17521
- </ng-template>
17522
- <co-files-upload (documentsAdded)="addedDocument($event)" (documentDeleted)="deletedDocument"
17523
- [documents]="documents" [useWithoutSettingProps]="true"></co-files-upload>
17524
- </co-dialog>
17525
-
17526
-
17527
- <ng-template #attachmentFooterTemplate>
17528
- <div class="co-dialog-footer-button-wrapper">
17529
- <co-button class="save-button"
17530
- [iconData]="iconService.getIcon(icons.CheckDuotone)"
17531
- (click)="attachmentDialogClosed()"></co-button>
17532
- <co-button class="close-button"
17533
- [iconData]="iconService.getIcon(icons.CrossSkinny)"
17534
- (click)="attachmentDialogCancelled()"></co-button>
17535
- </div>
17536
- </ng-template>
17516
+ template: `
17517
+ <div class="task-creator-wrapper">
17518
+ <div class="top-rows">
17519
+ <co-email-selector [(emailAddresses)]="emailAddresses" [(bccEmailAddresses)]="bccEmailAddresses" *ngIf="allowEmailing"
17520
+ [key]="remarkAndWorkKey" [workflowCategoryType]="workflowCategoryType"></co-email-selector>
17521
+ <co-form #createForm class="creator-remarks input-fields">
17522
+ <co-list-of-icons [collection]="optionCollection" (itemSelected)="itemSelected($event)"></co-list-of-icons>
17523
+ <co-input-textarea *ngIf="chosenActivityType === remarkListItem"
17524
+ [required]="chosenActivityType === remarkListItem"
17525
+ [placeholder]="'REMARK' | sharedLocalize" [(model)]="remarkText"
17526
+ class="large-remark"></co-input-textarea>
17527
+ <co-input-textarea *ngIf="chosenActivityType === workListItem"
17528
+ [required]="chosenActivityType === workListItem"
17529
+ [placeholder]="'DESCRIPTION' | sharedLocalize" [(model)]="workDescription"
17530
+ class="large-remark"></co-input-textarea>
17531
+ <div class="task-input-fields" *ngIf="chosenActivityType === taskListItem">
17532
+ <co-input-text [(model)]="taskName" [placeholder]="'NAME' | sharedLocalize"
17533
+ [required]="chosenActivityType === taskListItem"></co-input-text>
17534
+ <co-input-textarea [(model)]="taskDescription" [placeholder]="'DESCRIPTION' | sharedLocalize"
17535
+ class="large-remark"
17536
+ [required]="chosenActivityType === taskListItem"></co-input-textarea>
17537
+ </div>
17538
+ </co-form>
17539
+ </div>
17540
+ <div class="extras-buttons">
17541
+ <co-button [iconData]="iconService.getIcon(icons.PaperclipRegular)" (click)="openAttachmentDialog()"
17542
+ [label]="documents.length === 0 ? '' : documents.length.toString()"></co-button>
17543
+ <co-button *ngIf="chosenActivityType === remarkListItem"
17544
+ [iconData]="iconService.getIcon(icons.PaperPlaneTopSolid)"
17545
+ (click)="createRemarkClicked()"></co-button>
17546
+ <co-button *ngIf="chosenActivityType === workListItem"
17547
+ [iconData]="iconService.getIcon(icons.PaperPlaneTopSolid)"
17548
+ (click)="createWorkClicked()"></co-button>
17549
+ <co-button *ngIf="chosenActivityType === taskListItem"
17550
+ [iconData]="iconService.getIcon(icons.PaperPlaneTopSolid)"
17551
+ (click)="createTaskClicked()"></co-button>
17552
+ </div>
17553
+ </div>
17554
+ <co-dialog *ngIf="showFilesDialog" (closeClick)="attachmentDialogCancelled()"
17555
+ [headerTemplate]="attachmentHeaderTemplate"
17556
+ [footerTemplate]="attachmentFooterTemplate">
17557
+
17558
+ <ng-template #attachmentHeaderTemplate>
17559
+ <div class="co-dialog-wrapper-popup-title">
17560
+ <co-icon [iconData]="iconService.getIcon(icons.PaperclipRegular)"></co-icon>
17561
+ <div class="co-dialog-header-title" [textContent]="'ATTACHMENTS' | sharedLocalize"></div>
17562
+ </div>
17563
+ </ng-template>
17564
+ <co-files-upload (documentsAdded)="addedDocument($event)" (documentDeleted)="deletedDocument"
17565
+ [documents]="documents" [useWithoutSettingProps]="true"></co-files-upload>
17566
+ </co-dialog>
17567
+
17568
+
17569
+ <ng-template #attachmentFooterTemplate>
17570
+ <div class="co-dialog-footer-button-wrapper">
17571
+ <co-button class="save-button"
17572
+ [iconData]="iconService.getIcon(icons.CheckDuotone)"
17573
+ (click)="attachmentDialogClosed()"></co-button>
17574
+ <co-button class="close-button"
17575
+ [iconData]="iconService.getIcon(icons.CrossSkinny)"
17576
+ (click)="attachmentDialogCancelled()"></co-button>
17577
+ </div>
17578
+ </ng-template>
17537
17579
  `,
17538
17580
  providers: [
17539
17581
  FormMasterService,
@@ -17559,6 +17601,10 @@ TaskCreatorComponent.propDecorators = {
17559
17601
  remarkAndWorkKey: [{ type: Input }],
17560
17602
  taskKey: [{ type: Input }],
17561
17603
  workflowCategoryType: [{ type: Input }],
17604
+ allowRemarkCreation: [{ type: Input }],
17605
+ allowWorkCreation: [{ type: Input }],
17606
+ allowTaskCreation: [{ type: Input }],
17607
+ allowEmailing: [{ type: Input }],
17562
17608
  activityCreated: [{ type: Output }],
17563
17609
  showClass: [{ type: HostBinding, args: ["class.co-task-creator",] }],
17564
17610
  hidden: [{ type: HostBinding, args: ['class.co-shared-hidden',] }]
@@ -17891,6 +17937,7 @@ class FormBuilderUserFormComponent {
17891
17937
  this.saveForm = new EventEmitter();
17892
17938
  this.definitiveChange = new EventEmitter();
17893
17939
  this.createNewFormResponse = new EventEmitter();
17940
+ this.errorMessage = new EventEmitter();
17894
17941
  this.cloneForm = NULL_FORM_FULL_OBJECT;
17895
17942
  }
17896
17943
  set form(form) {
@@ -17930,13 +17977,20 @@ class FormBuilderUserFormComponent {
17930
17977
  this.saveForm.next(this.formResponse);
17931
17978
  }
17932
17979
  handleCancelForm() {
17933
- // if (this.userForm && this.userForm.responseId) {
17934
- // this._formRepo.unlockFormResponse(this.userForm.responseId);
17935
- // }
17936
- this.cloneForm = undefined;
17937
- this.userForm = undefined;
17938
- this.formResponse = undefined;
17939
- this.cancelForm.next();
17980
+ return __awaiter(this, void 0, void 0, function* () {
17981
+ if (this.userForm && this.userForm.responseId) {
17982
+ try {
17983
+ yield this._sharedConnectorService.unlockFormResponse(this.userForm.responseId);
17984
+ }
17985
+ catch (e) {
17986
+ this.errorMessage.emit(e);
17987
+ }
17988
+ }
17989
+ this.cloneForm = undefined;
17990
+ this.userForm = undefined;
17991
+ this.formResponse = undefined;
17992
+ this.cancelForm.next();
17993
+ });
17940
17994
  }
17941
17995
  changeMultipleOption(id, formResponse, add) {
17942
17996
  const responseList = formResponse.response ? formResponse.response.split(',') : [];
@@ -17981,8 +18035,13 @@ class FormBuilderUserFormComponent {
17981
18035
  }
17982
18036
  else {
17983
18037
  this.mode = UserFormMode.Edit;
17984
- // const isLockedSuccesfully: boolean = await this._formRepo.lockFormResponse(formResponseId);
17985
18038
  this._prepareExistingForm();
18039
+ try {
18040
+ yield this._sharedConnectorService.lockFormResponse(this.userForm.responseId);
18041
+ }
18042
+ catch (e) {
18043
+ this.errorMessage.emit(e);
18044
+ }
17986
18045
  }
17987
18046
  this._loadDocs();
17988
18047
  if (this.enableQuestions) {
@@ -18041,7 +18100,7 @@ class FormBuilderUserFormComponent {
18041
18100
  this.handleCancelForm();
18042
18101
  }
18043
18102
  else {
18044
- this._promptService.showError('ERROR_INSERT_FORM_RESPONSE', 'ERROR_INSERT_FORM_RESPONSE_TITLE');
18103
+ this.errorMessage.emit("ERROR_INSERT_FORM_RESPONSE");
18045
18104
  }
18046
18105
  });
18047
18106
  this.createNewFormResponse.next(this.formResponse);
@@ -18053,7 +18112,7 @@ class FormBuilderUserFormComponent {
18053
18112
  this.handleCancelForm();
18054
18113
  }
18055
18114
  else {
18056
- this._promptService.showError('ERROR_SAVING_FORM_RESPONSE', 'ERROR_SAVING_FORM_RESPONSE_TITLE');
18115
+ this.errorMessage.emit("ERROR_SAVING_FORM_RESPONSE");
18057
18116
  }
18058
18117
  });
18059
18118
  break;
@@ -18067,7 +18126,7 @@ FormBuilderUserFormComponent.decorators = [
18067
18126
  { type: Component, args: [{
18068
18127
  selector: 'co-form-builder-user-form',
18069
18128
  template: `
18070
- <co-dialog [headerTemplate]="headerTemplate" [footerTemplate]="footerTemplate" (closeClick)="handleCancelForm()" >
18129
+ <co-dialog [headerTemplate]="headerTemplate" [footerTemplate]="footerTemplate" (closeClick)="handleCancelForm()">
18071
18130
  <div class="main-content-wrapper">
18072
18131
  <div class="section-wrapper mini-scrollbar" #sectionWrapper>
18073
18132
  <co-form #coForm (validSubmit)="onValid()" [keepInView]="sectionWrapper">
@@ -18209,6 +18268,7 @@ FormBuilderUserFormComponent.propDecorators = {
18209
18268
  saveForm: [{ type: Output }],
18210
18269
  definitiveChange: [{ type: Output }],
18211
18270
  createNewFormResponse: [{ type: Output }],
18271
+ errorMessage: [{ type: Output }],
18212
18272
  showClass: [{ type: HostBinding, args: ['class.co-form-builder-user-form',] }]
18213
18273
  };
18214
18274
  __decorate([