@colijnit/sharedcomponents 260.1.4 → 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() {
@@ -17925,6 +17937,7 @@ class FormBuilderUserFormComponent {
17925
17937
  this.saveForm = new EventEmitter();
17926
17938
  this.definitiveChange = new EventEmitter();
17927
17939
  this.createNewFormResponse = new EventEmitter();
17940
+ this.errorMessage = new EventEmitter();
17928
17941
  this.cloneForm = NULL_FORM_FULL_OBJECT;
17929
17942
  }
17930
17943
  set form(form) {
@@ -17964,13 +17977,20 @@ class FormBuilderUserFormComponent {
17964
17977
  this.saveForm.next(this.formResponse);
17965
17978
  }
17966
17979
  handleCancelForm() {
17967
- // if (this.userForm && this.userForm.responseId) {
17968
- // this._formRepo.unlockFormResponse(this.userForm.responseId);
17969
- // }
17970
- this.cloneForm = undefined;
17971
- this.userForm = undefined;
17972
- this.formResponse = undefined;
17973
- 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
+ });
17974
17994
  }
17975
17995
  changeMultipleOption(id, formResponse, add) {
17976
17996
  const responseList = formResponse.response ? formResponse.response.split(',') : [];
@@ -18015,8 +18035,13 @@ class FormBuilderUserFormComponent {
18015
18035
  }
18016
18036
  else {
18017
18037
  this.mode = UserFormMode.Edit;
18018
- // const isLockedSuccesfully: boolean = await this._formRepo.lockFormResponse(formResponseId);
18019
18038
  this._prepareExistingForm();
18039
+ try {
18040
+ yield this._sharedConnectorService.lockFormResponse(this.userForm.responseId);
18041
+ }
18042
+ catch (e) {
18043
+ this.errorMessage.emit(e);
18044
+ }
18020
18045
  }
18021
18046
  this._loadDocs();
18022
18047
  if (this.enableQuestions) {
@@ -18075,7 +18100,7 @@ class FormBuilderUserFormComponent {
18075
18100
  this.handleCancelForm();
18076
18101
  }
18077
18102
  else {
18078
- this._promptService.showError('ERROR_INSERT_FORM_RESPONSE', 'ERROR_INSERT_FORM_RESPONSE_TITLE');
18103
+ this.errorMessage.emit("ERROR_INSERT_FORM_RESPONSE");
18079
18104
  }
18080
18105
  });
18081
18106
  this.createNewFormResponse.next(this.formResponse);
@@ -18087,7 +18112,7 @@ class FormBuilderUserFormComponent {
18087
18112
  this.handleCancelForm();
18088
18113
  }
18089
18114
  else {
18090
- this._promptService.showError('ERROR_SAVING_FORM_RESPONSE', 'ERROR_SAVING_FORM_RESPONSE_TITLE');
18115
+ this.errorMessage.emit("ERROR_SAVING_FORM_RESPONSE");
18091
18116
  }
18092
18117
  });
18093
18118
  break;
@@ -18101,7 +18126,7 @@ FormBuilderUserFormComponent.decorators = [
18101
18126
  { type: Component, args: [{
18102
18127
  selector: 'co-form-builder-user-form',
18103
18128
  template: `
18104
- <co-dialog [headerTemplate]="headerTemplate" [footerTemplate]="footerTemplate" (closeClick)="handleCancelForm()" >
18129
+ <co-dialog [headerTemplate]="headerTemplate" [footerTemplate]="footerTemplate" (closeClick)="handleCancelForm()">
18105
18130
  <div class="main-content-wrapper">
18106
18131
  <div class="section-wrapper mini-scrollbar" #sectionWrapper>
18107
18132
  <co-form #coForm (validSubmit)="onValid()" [keepInView]="sectionWrapper">
@@ -18243,6 +18268,7 @@ FormBuilderUserFormComponent.propDecorators = {
18243
18268
  saveForm: [{ type: Output }],
18244
18269
  definitiveChange: [{ type: Output }],
18245
18270
  createNewFormResponse: [{ type: Output }],
18271
+ errorMessage: [{ type: Output }],
18246
18272
  showClass: [{ type: HostBinding, args: ['class.co-form-builder-user-form',] }]
18247
18273
  };
18248
18274
  __decorate([