@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.
@@ -2101,12 +2101,12 @@
2101
2101
  });
2102
2102
  });
2103
2103
  };
2104
- SharedConnectorService.prototype.getFormResponse = function (formResponseId) {
2104
+ SharedConnectorService.prototype.insertFormResponse = function (formResponse) {
2105
2105
  return __awaiter(this, void 0, void 0, function () {
2106
2106
  var _this = this;
2107
2107
  return __generator(this, function (_a) {
2108
2108
  return [2 /*return*/, new Promise(function (resolve, reject) {
2109
- return _this.mainConnector.getFormResponse(formResponseId).then(function (result) {
2109
+ return _this.mainConnector.insertFormResponse(formResponse).then(function (result) {
2110
2110
  if (result.validationResult && result.validationResult.success) {
2111
2111
  if (result.resultObject) {
2112
2112
  resolve(_this._boFactory.makeWithRawBackendData(formResponse_bo.FormResponse, result.resultObject));
@@ -2120,12 +2120,12 @@
2120
2120
  });
2121
2121
  });
2122
2122
  };
2123
- SharedConnectorService.prototype.insertFormResponse = function (formResponse) {
2123
+ SharedConnectorService.prototype.updateFormResponse = function (formResponse) {
2124
2124
  return __awaiter(this, void 0, void 0, function () {
2125
2125
  var _this = this;
2126
2126
  return __generator(this, function (_a) {
2127
2127
  return [2 /*return*/, new Promise(function (resolve, reject) {
2128
- return _this.mainConnector.insertFormResponse(formResponse).then(function (result) {
2128
+ return _this.mainConnector.updateFormResponse(formResponse).then(function (result) {
2129
2129
  if (result.validationResult && result.validationResult.success) {
2130
2130
  if (result.resultObject) {
2131
2131
  resolve(_this._boFactory.makeWithRawBackendData(formResponse_bo.FormResponse, result.resultObject));
@@ -2139,19 +2139,34 @@
2139
2139
  });
2140
2140
  });
2141
2141
  };
2142
- SharedConnectorService.prototype.updateFormResponse = function (formResponse) {
2142
+ SharedConnectorService.prototype.lockFormResponse = function (formResponseId) {
2143
2143
  return __awaiter(this, void 0, void 0, function () {
2144
2144
  var _this = this;
2145
2145
  return __generator(this, function (_a) {
2146
2146
  return [2 /*return*/, new Promise(function (resolve, reject) {
2147
- return _this.mainConnector.updateFormResponse(formResponse).then(function (result) {
2147
+ return _this.mainConnector.lockFormResponse(formResponseId).then(function (result) {
2148
2148
  if (result.validationResult && result.validationResult.success) {
2149
- if (result.resultObject) {
2150
- resolve(_this._boFactory.makeWithRawBackendData(formResponse_bo.FormResponse, result.resultObject));
2151
- }
2149
+ resolve(true);
2152
2150
  }
2153
2151
  else {
2154
- reject(result.validationMessagesAsString);
2152
+ reject(result.validationResult.messages[0].message);
2153
+ }
2154
+ });
2155
+ })];
2156
+ });
2157
+ });
2158
+ };
2159
+ SharedConnectorService.prototype.unlockFormResponse = function (formResponseId) {
2160
+ return __awaiter(this, void 0, void 0, function () {
2161
+ var _this = this;
2162
+ return __generator(this, function (_a) {
2163
+ return [2 /*return*/, new Promise(function (resolve, reject) {
2164
+ return _this.mainConnector.unlockFormResponse(formResponseId).then(function (result) {
2165
+ if (result.validationResult && result.validationResult.success) {
2166
+ resolve(true);
2167
+ }
2168
+ else {
2169
+ reject(result.validationResult.messages[0].message);
2155
2170
  }
2156
2171
  });
2157
2172
  })];
@@ -4924,7 +4939,6 @@
4924
4939
  },] }
4925
4940
  ];
4926
4941
 
4927
- ;
4928
4942
  var SendMethodPurchaseComponent = /** @class */ (function () {
4929
4943
  function SendMethodPurchaseComponent(sendMethodService) {
4930
4944
  this.sendMethodService = sendMethodService;
@@ -4942,7 +4956,8 @@
4942
4956
  this.overruleOptions = [
4943
4957
  { code: 1, description: 'Print' },
4944
4958
  { code: 2, description: 'E-mail' },
4945
- { code: 3, description: 'EDI' }
4959
+ { code: 3, description: 'EDI' },
4960
+ { code: 8, description: 'PDF' }
4946
4961
  ];
4947
4962
  }
4948
4963
  SendMethodPurchaseComponent.prototype.showClass = function () {
@@ -17143,6 +17158,7 @@
17143
17158
  this.saveForm = new i0.EventEmitter();
17144
17159
  this.definitiveChange = new i0.EventEmitter();
17145
17160
  this.createNewFormResponse = new i0.EventEmitter();
17161
+ this.errorMessage = new i0.EventEmitter();
17146
17162
  this.cloneForm = NULL_FORM_FULL_OBJECT;
17147
17163
  }
17148
17164
  Object.defineProperty(FormBuilderUserFormComponent.prototype, "form", {
@@ -17186,13 +17202,32 @@
17186
17202
  this.saveForm.next(this.formResponse);
17187
17203
  };
17188
17204
  FormBuilderUserFormComponent.prototype.handleCancelForm = function () {
17189
- // if (this.userForm && this.userForm.responseId) {
17190
- // this._formRepo.unlockFormResponse(this.userForm.responseId);
17191
- // }
17192
- this.cloneForm = undefined;
17193
- this.userForm = undefined;
17194
- this.formResponse = undefined;
17195
- this.cancelForm.next();
17205
+ return __awaiter(this, void 0, void 0, function () {
17206
+ var e_1;
17207
+ return __generator(this, function (_b) {
17208
+ switch (_b.label) {
17209
+ case 0:
17210
+ if (!(this.userForm && this.userForm.responseId)) return [3 /*break*/, 4];
17211
+ _b.label = 1;
17212
+ case 1:
17213
+ _b.trys.push([1, 3, , 4]);
17214
+ return [4 /*yield*/, this._sharedConnectorService.unlockFormResponse(this.userForm.responseId)];
17215
+ case 2:
17216
+ _b.sent();
17217
+ return [3 /*break*/, 4];
17218
+ case 3:
17219
+ e_1 = _b.sent();
17220
+ this.errorMessage.emit(e_1);
17221
+ return [3 /*break*/, 4];
17222
+ case 4:
17223
+ this.cloneForm = undefined;
17224
+ this.userForm = undefined;
17225
+ this.formResponse = undefined;
17226
+ this.cancelForm.next();
17227
+ return [2 /*return*/];
17228
+ }
17229
+ });
17230
+ });
17196
17231
  };
17197
17232
  FormBuilderUserFormComponent.prototype.changeMultipleOption = function (id, formResponse, add) {
17198
17233
  var responseList = formResponse.response ? formResponse.response.split(',') : [];
@@ -17228,25 +17263,39 @@
17228
17263
  FormBuilderUserFormComponent.prototype._prepareNewForm = function () {
17229
17264
  var _a;
17230
17265
  return __awaiter(this, void 0, void 0, function () {
17266
+ var e_2;
17231
17267
  return __generator(this, function (_b) {
17232
- this.cloneForm = this._boFactory.makeWithRawBackendData(form_bo.Form, this.form);
17233
- if (!((_a = this.userForm) === null || _a === void 0 ? void 0 : _a.responseId)) {
17234
- this.formResponse = this._boFactory.makeWithRawBackendData(formResponse_bo.FormResponse, this.userForm);
17235
- this.formResponse.formId = this.form.formId;
17236
- this.formResponse.table = this.table;
17237
- this.formResponse.key = this.key;
17238
- FormUtils.MergeResponseWithForm(this.cloneForm, this.formResponse);
17239
- }
17240
- else {
17241
- this.mode = exports.UserFormMode.Edit;
17242
- // const isLockedSuccesfully: boolean = await this._formRepo.lockFormResponse(formResponseId);
17243
- this._prepareExistingForm();
17244
- }
17245
- this._loadDocs();
17246
- if (this.enableQuestions) {
17247
- this._enableQuestions();
17268
+ switch (_b.label) {
17269
+ case 0:
17270
+ this.cloneForm = this._boFactory.makeWithRawBackendData(form_bo.Form, this.form);
17271
+ if (!!((_a = this.userForm) === null || _a === void 0 ? void 0 : _a.responseId)) return [3 /*break*/, 1];
17272
+ this.formResponse = this._boFactory.makeWithRawBackendData(formResponse_bo.FormResponse, this.userForm);
17273
+ this.formResponse.formId = this.form.formId;
17274
+ this.formResponse.table = this.table;
17275
+ this.formResponse.key = this.key;
17276
+ FormUtils.MergeResponseWithForm(this.cloneForm, this.formResponse);
17277
+ return [3 /*break*/, 5];
17278
+ case 1:
17279
+ this.mode = exports.UserFormMode.Edit;
17280
+ this._prepareExistingForm();
17281
+ _b.label = 2;
17282
+ case 2:
17283
+ _b.trys.push([2, 4, , 5]);
17284
+ return [4 /*yield*/, this._sharedConnectorService.lockFormResponse(this.userForm.responseId)];
17285
+ case 3:
17286
+ _b.sent();
17287
+ return [3 /*break*/, 5];
17288
+ case 4:
17289
+ e_2 = _b.sent();
17290
+ this.errorMessage.emit(e_2);
17291
+ return [3 /*break*/, 5];
17292
+ case 5:
17293
+ this._loadDocs();
17294
+ if (this.enableQuestions) {
17295
+ this._enableQuestions();
17296
+ }
17297
+ return [2 /*return*/];
17248
17298
  }
17249
- return [2 /*return*/];
17250
17299
  });
17251
17300
  });
17252
17301
  };
@@ -17303,7 +17352,7 @@
17303
17352
  _this.handleCancelForm();
17304
17353
  }
17305
17354
  else {
17306
- _this._promptService.showError('ERROR_INSERT_FORM_RESPONSE', 'ERROR_INSERT_FORM_RESPONSE_TITLE');
17355
+ _this.errorMessage.emit("ERROR_INSERT_FORM_RESPONSE");
17307
17356
  }
17308
17357
  });
17309
17358
  this.createNewFormResponse.next(this.formResponse);
@@ -17315,7 +17364,7 @@
17315
17364
  _this.handleCancelForm();
17316
17365
  }
17317
17366
  else {
17318
- _this._promptService.showError('ERROR_SAVING_FORM_RESPONSE', 'ERROR_SAVING_FORM_RESPONSE_TITLE');
17367
+ _this.errorMessage.emit("ERROR_SAVING_FORM_RESPONSE");
17319
17368
  }
17320
17369
  });
17321
17370
  break;
@@ -17329,7 +17378,7 @@
17329
17378
  FormBuilderUserFormComponent.decorators = [
17330
17379
  { type: i0.Component, args: [{
17331
17380
  selector: 'co-form-builder-user-form',
17332
- template: "\n <co-dialog [headerTemplate]=\"headerTemplate\" [footerTemplate]=\"footerTemplate\" (closeClick)=\"handleCancelForm()\" >\n <div class=\"main-content-wrapper\">\n <div class=\"section-wrapper mini-scrollbar\" #sectionWrapper>\n <co-form #coForm (validSubmit)=\"onValid()\" [keepInView]=\"sectionWrapper\">\n <ng-container\n *ngFor=\"let question of cloneForm.questions; let index = index\">\n <div [class.active]=\"form.questions.indexOf(question) === form.questions.indexOf(activeQuestion)\" class=\"headers-row\" fxLayout=\"column\"\n [class.disabled]=\"question.disabled && index !== 0\"\n (keydown)=\"enabledNextQuestion(question)\">\n <span class=\"form-rubric-header\"\n [textContent]=\"question.sequence+ '. ' + (question.question)\"></span>\n <div class=\"answer-wrapper\" [ngSwitch]=\"question.questionType\">\n <co-input-text *ngSwitchCase=\"formQuestionType.ShortAnswer\"\n [(model)]=\"question.responseQuestion.response\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-text>\n <co-input-textarea *ngSwitchCase=\"formQuestionType.LongAnswer\"\n [(model)]=\"question.responseQuestion.response\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-textarea>\n <ng-container *ngSwitchCase=\"formQuestionType.MultipleChoiceSingleOption\"\n\n >\n <co-form>\n <co-input-radio-button *ngFor=\"let answer of question.formQuestionAnswers\"\n [label]=\"answer.answer\"\n [model]=\"answer.answerId == question.responseQuestion.response\"\n [disabled]=\"question.disabled && index !== 0\"\n (modelChange)=\"question.responseQuestion.response = answer.answerId + ''; enabledNextQuestion(question, answer)\"\n ></co-input-radio-button>\n </co-form>\n </ng-container>\n <ng-container *ngSwitchCase=\"formQuestionType.MultipleChoiceMultipleOptions\">\n <co-input-checkbox *ngFor=\"let answer of question.formQuestionAnswers\"\n [label]=\"answer.answer\"\n [readonly]=\"readonly\"\n [model]=\"question.responseQuestion.response ? \n question.responseQuestion.response.indexOf(answer.answerId) > -1 : \n question.responseQuestion.response\"\n [disabled]=\"question.disabled && index !== 0\"\n (modelChange)=\"changeMultipleOption(answer.answerId, question.responseQuestion, $event); enabledNextQuestion(question, answer)\"\n ></co-input-checkbox>\n </ng-container>\n <co-list-of-values *ngSwitchCase=\"formQuestionType.DropDownList\"\n [model]=\"question.responseQuestion\"\n [collection]=\"question.formQuestionAnswers\"\n [displayField]=\"'answer'\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n (modelChange)=\"changeLovOption(question.responseQuestion, $event); enabledNextQuestion(question, $event)\"\n ></co-list-of-values>\n <co-user-form-input-scale *ngSwitchCase=\"formQuestionType.LinearScale\"\n [label]=\"question.question\"\n [idField]=\"'answerId'\"\n [selected]=\"question.responseQuestion.response\"\n [scaleModel]=\"question.formQuestionAnswers\"\n [descriptionField]=\"'answer'\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n (selectionChange)=\"question.responseQuestion.response = $event.answerId + ''\"\n ></co-user-form-input-scale>\n <co-input-date *ngSwitchCase=\"formQuestionType.Date\"\n [(model)]=\"question.responseQuestion.dateResponse\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-date>\n <co-input-time *ngSwitchCase=\"formQuestionType.Time\"\n [model]=\"question.responseQuestion?.timeResponse ?? 1\"\n (modelChange)=\"changeTime(question.responseQuestion, $event)\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-time>\n </div>\n </div>\n <div class=\"goto-question\" *ngIf=\"question === activeQuestion && gotoQuestion\"\n [textContent]=\"('GOTO_NEXT_QUESTION' | sharedLocalize) + ' ' + gotoQuestion\"></div>\n </ng-container>\n </co-form>\n </div>\n <div class=\"section-wrapper mini-scrollbar\" #sectionWrapper>\n <co-input-checkbox [model]=\"formResponse?.isFinal\" (modelChange)=\"handleDefinitiveChange($event)\" [label]=\"'DEFINITIVE' | sharedLocalize\"></co-input-checkbox>\n </div>\n\n\n </div>\n\n </co-dialog>\n <ng-template #headerTemplate>\n <div class=\"header-wrapper\">\n <span class=\"form-title\" [textContent]=\"form?.formName\"></span>\n </div>\n </ng-template>\n <ng-template #footerTemplate>\n <div class=\"footer-wrapper\">\n <div class=\"attachments-wrapper\">\n <div class=\"row\">\n <co-icon [iconData]=\"iconCacheService.getIcon(icons.PaperclipRegular)\" (click)=\"handleOpenFilesUpload()\"></co-icon>\n <input type=\"file\" accept=\"image/*\" capture=\"environment\">\n <co-files-upload #filesUploadComponent [documents]=\"formResponse.documents\" class=\"co-files-upload\"></co-files-upload>\n </div>\n </div>\n <div class=\"row\">\n <co-button class=\"save-button\" (click)=\"commitUserForm()\" [iconData]=\"iconCacheService.getIcon(icons.CheckDuotone)\"></co-button>\n <co-button class=\"close-button\" [iconData]=\"iconCacheService.getIcon(icons.CrossSkinny)\" (click)=\"handleCancelForm()\"></co-button>\n </div>\n </div>\n\n </ng-template>\n\n ",
17381
+ template: "\n <co-dialog [headerTemplate]=\"headerTemplate\" [footerTemplate]=\"footerTemplate\" (closeClick)=\"handleCancelForm()\">\n <div class=\"main-content-wrapper\">\n <div class=\"section-wrapper mini-scrollbar\" #sectionWrapper>\n <co-form #coForm (validSubmit)=\"onValid()\" [keepInView]=\"sectionWrapper\">\n <ng-container\n *ngFor=\"let question of cloneForm.questions; let index = index\">\n <div [class.active]=\"form.questions.indexOf(question) === form.questions.indexOf(activeQuestion)\" class=\"headers-row\" fxLayout=\"column\"\n [class.disabled]=\"question.disabled && index !== 0\"\n (keydown)=\"enabledNextQuestion(question)\">\n <span class=\"form-rubric-header\"\n [textContent]=\"question.sequence+ '. ' + (question.question)\"></span>\n <div class=\"answer-wrapper\" [ngSwitch]=\"question.questionType\">\n <co-input-text *ngSwitchCase=\"formQuestionType.ShortAnswer\"\n [(model)]=\"question.responseQuestion.response\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-text>\n <co-input-textarea *ngSwitchCase=\"formQuestionType.LongAnswer\"\n [(model)]=\"question.responseQuestion.response\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-textarea>\n <ng-container *ngSwitchCase=\"formQuestionType.MultipleChoiceSingleOption\"\n\n >\n <co-form>\n <co-input-radio-button *ngFor=\"let answer of question.formQuestionAnswers\"\n [label]=\"answer.answer\"\n [model]=\"answer.answerId == question.responseQuestion.response\"\n [disabled]=\"question.disabled && index !== 0\"\n (modelChange)=\"question.responseQuestion.response = answer.answerId + ''; enabledNextQuestion(question, answer)\"\n ></co-input-radio-button>\n </co-form>\n </ng-container>\n <ng-container *ngSwitchCase=\"formQuestionType.MultipleChoiceMultipleOptions\">\n <co-input-checkbox *ngFor=\"let answer of question.formQuestionAnswers\"\n [label]=\"answer.answer\"\n [readonly]=\"readonly\"\n [model]=\"question.responseQuestion.response ? \n question.responseQuestion.response.indexOf(answer.answerId) > -1 : \n question.responseQuestion.response\"\n [disabled]=\"question.disabled && index !== 0\"\n (modelChange)=\"changeMultipleOption(answer.answerId, question.responseQuestion, $event); enabledNextQuestion(question, answer)\"\n ></co-input-checkbox>\n </ng-container>\n <co-list-of-values *ngSwitchCase=\"formQuestionType.DropDownList\"\n [model]=\"question.responseQuestion\"\n [collection]=\"question.formQuestionAnswers\"\n [displayField]=\"'answer'\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n (modelChange)=\"changeLovOption(question.responseQuestion, $event); enabledNextQuestion(question, $event)\"\n ></co-list-of-values>\n <co-user-form-input-scale *ngSwitchCase=\"formQuestionType.LinearScale\"\n [label]=\"question.question\"\n [idField]=\"'answerId'\"\n [selected]=\"question.responseQuestion.response\"\n [scaleModel]=\"question.formQuestionAnswers\"\n [descriptionField]=\"'answer'\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n (selectionChange)=\"question.responseQuestion.response = $event.answerId + ''\"\n ></co-user-form-input-scale>\n <co-input-date *ngSwitchCase=\"formQuestionType.Date\"\n [(model)]=\"question.responseQuestion.dateResponse\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-date>\n <co-input-time *ngSwitchCase=\"formQuestionType.Time\"\n [model]=\"question.responseQuestion?.timeResponse ?? 1\"\n (modelChange)=\"changeTime(question.responseQuestion, $event)\"\n [required]=\"question.mandatory\"\n [readonly]=\"readonly\"\n [disabled]=\"question.disabled && index !== 0\"\n ></co-input-time>\n </div>\n </div>\n <div class=\"goto-question\" *ngIf=\"question === activeQuestion && gotoQuestion\"\n [textContent]=\"('GOTO_NEXT_QUESTION' | sharedLocalize) + ' ' + gotoQuestion\"></div>\n </ng-container>\n </co-form>\n </div>\n <div class=\"section-wrapper mini-scrollbar\" #sectionWrapper>\n <co-input-checkbox [model]=\"formResponse?.isFinal\" (modelChange)=\"handleDefinitiveChange($event)\" [label]=\"'DEFINITIVE' | sharedLocalize\"></co-input-checkbox>\n </div>\n\n\n </div>\n\n </co-dialog>\n <ng-template #headerTemplate>\n <div class=\"header-wrapper\">\n <span class=\"form-title\" [textContent]=\"form?.formName\"></span>\n </div>\n </ng-template>\n <ng-template #footerTemplate>\n <div class=\"footer-wrapper\">\n <div class=\"attachments-wrapper\">\n <div class=\"row\">\n <co-icon [iconData]=\"iconCacheService.getIcon(icons.PaperclipRegular)\" (click)=\"handleOpenFilesUpload()\"></co-icon>\n <input type=\"file\" accept=\"image/*\" capture=\"environment\">\n <co-files-upload #filesUploadComponent [documents]=\"formResponse.documents\" class=\"co-files-upload\"></co-files-upload>\n </div>\n </div>\n <div class=\"row\">\n <co-button class=\"save-button\" (click)=\"commitUserForm()\" [iconData]=\"iconCacheService.getIcon(icons.CheckDuotone)\"></co-button>\n <co-button class=\"close-button\" [iconData]=\"iconCacheService.getIcon(icons.CrossSkinny)\" (click)=\"handleCancelForm()\"></co-button>\n </div>\n </div>\n\n </ng-template>\n\n ",
17333
17382
  encapsulation: i0.ViewEncapsulation.None
17334
17383
  },] }
17335
17384
  ];
@@ -17354,6 +17403,7 @@
17354
17403
  saveForm: [{ type: i0.Output }],
17355
17404
  definitiveChange: [{ type: i0.Output }],
17356
17405
  createNewFormResponse: [{ type: i0.Output }],
17406
+ errorMessage: [{ type: i0.Output }],
17357
17407
  showClass: [{ type: i0.HostBinding, args: ['class.co-form-builder-user-form',] }]
17358
17408
  };
17359
17409
  __decorate([