tnx-shared 5.3.334 → 5.3.336

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.
@@ -5638,6 +5638,7 @@
5638
5638
  EnumProperties["NG_REFLECT_TEXT"] = "ng-reflect-text";
5639
5639
  EnumProperties["NG_REFLECT_LABEL"] = "ng-reflect-label";
5640
5640
  EnumProperties["CRUD_LIST"] = "crud-list";
5641
+ EnumProperties["TREE_LIST"] = "tn-tree-table";
5641
5642
  EnumProperties["LABEL"] = "label";
5642
5643
  EnumProperties["TAG_NAME"] = "tagName";
5643
5644
  EnumProperties["TOOLTIP"] = "ptooltip";
@@ -12404,6 +12405,14 @@
12404
12405
  var url = this.serviceUri + "/ValidatePassword/?password=" + password;
12405
12406
  return this.defaultGet(url);
12406
12407
  };
12408
+ UserService.prototype.getUserCache = function (cacheKey) {
12409
+ var url = this.serviceUri + "/GetUserCache/" + cacheKey;
12410
+ return this.defaultGet(url);
12411
+ };
12412
+ UserService.prototype.setUserCache = function (data) {
12413
+ var url = this.serviceUri + "/SetUserCache";
12414
+ return this.defaultPost(url, data);
12415
+ };
12407
12416
  return UserService;
12408
12417
  }(BaseService));
12409
12418
  UserService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function UserService_Factory() { return new UserService(i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(ModuleConfigService), i0__namespace.ɵɵinject(AuthenService), i0__namespace.ɵɵinject(i4__namespace.OAuthService), i0__namespace.ɵɵinject(SignalRService), i0__namespace.ɵɵinject(ExceptionHandlerService), i0__namespace.ɵɵinject(ApplicationContextService)); }, token: UserService, providedIn: "root" });
@@ -22127,6 +22136,14 @@
22127
22136
  case 0:
22128
22137
  if (callBackWhenNotHaveStatus == null) {
22129
22138
  callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
22139
+ if (rowItem[fieldKey]
22140
+ && rowItem.workflowCode
22141
+ && rowItem.currentStateCode) {
22142
+ itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
22143
+ itemStatus.trangThai = rowItem.currentStateCode;
22144
+ itemStatus.workflowCode = rowItem.workflowCode;
22145
+ itemStatus.permission = exports.PermissionBase.READ;
22146
+ }
22130
22147
  };
22131
22148
  }
22132
22149
  itemId = data[fieldKey];
@@ -22141,7 +22158,7 @@
22141
22158
  else {
22142
22159
  sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }));
22143
22160
  }
22144
- return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission', sorts)];
22161
+ return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission', sorts, 'ForCrudList')];
22145
22162
  case 1:
22146
22163
  dataStatus = (_a.sent()).data;
22147
22164
  if (dataStatus == null) {
@@ -22160,10 +22177,11 @@
22160
22177
  textTrangThai: 'Chưa chạy quy trình'
22161
22178
  };
22162
22179
  if (itemId) {
22163
- var lstItemStatus = dataStatus.filter(function (q) { return q.itemId == itemId && q.userId == userIdCurrent; });
22164
- if (ignoreWorkflow === true && lstItemStatus.length === 0) {
22165
- lstItemStatus.push.apply(lstItemStatus, __spreadArray([], __read(dataStatus.filter(function (q) { return q.itemId === itemId; }))));
22166
- }
22180
+ // const lstItemStatus = dataStatus.filter(q => q.itemId == itemId && q.userId == userIdCurrent);
22181
+ // if (ignoreWorkflow === true && lstItemStatus.length === 0) {
22182
+ // lstItemStatus.push(...dataStatus.filter(q => q.itemId === itemId));
22183
+ // }
22184
+ var lstItemStatus = dataStatus.filter(function (q) { return q.itemId === itemId; });
22167
22185
  // let itemStatus = null;
22168
22186
  if (lstItemStatus.length) {
22169
22187
  itemStatus = lstItemStatus.find(function (q) { return (q.permission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT; });
@@ -22216,6 +22234,14 @@
22216
22234
  case 0:
22217
22235
  if (callBackWhenNotHaveStatus == null) {
22218
22236
  callBackWhenNotHaveStatus = function (itemStatus, rowItem) {
22237
+ if (rowItem[fieldKey]
22238
+ && rowItem.workflowCode
22239
+ && rowItem.currentStateCode) {
22240
+ itemStatus.textTrangThai = 'Đã bắt đầu quy trình';
22241
+ itemStatus.trangThai = rowItem.currentStateCode;
22242
+ itemStatus.workflowCode = rowItem.workflowCode;
22243
+ itemStatus.permission = exports.PermissionBase.READ;
22244
+ }
22219
22245
  };
22220
22246
  }
22221
22247
  lstItemId = data.filter(function (q) { return q[fieldKey]; }).map(function (q) { return q[fieldKey]; });
@@ -22227,13 +22253,11 @@
22227
22253
  filters.push(this.newFilter('tableName', exports.Operator.equal, this.tableName));
22228
22254
  }
22229
22255
  sorts = [];
22230
- if (!ignoreWorkflow) {
22231
- filters.push(this.newFilter('userId', exports.Operator.equal, userIdCurrent));
22232
- }
22233
- else {
22234
- sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }));
22235
- }
22236
- return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission', sorts)];
22256
+ // if (!ignoreWorkflow) {
22257
+ // filters.push(this.newFilter('userId', Operator.equal, userIdCurrent));
22258
+ // }
22259
+ sorts.push(new Sort({ field: 'permission', dir: -1 }), new Sort({ field: 'inComing', dir: -1 }));
22260
+ return [4 /*yield*/, this.getAll(filters, 'itemId,userId,trangThai,textTrangThai,workflowCode,permission', sorts, 'ForCrudList')];
22237
22261
  case 1:
22238
22262
  dataStatus = (_a.sent()).data;
22239
22263
  if (dataStatus == null) {
@@ -22966,7 +22990,6 @@
22966
22990
  }
22967
22991
  };
22968
22992
  ListComponentBase.prototype.initColumnSchema = function (cols) {
22969
- var _a, _b, _c, _d, _e;
22970
22993
  if (!cols || !cols.length)
22971
22994
  return;
22972
22995
  var colFunction = null, colGroup = null, colHasToggleIcon = null;
@@ -22989,7 +23012,7 @@
22989
23012
  colHasToggleIcon = this.setting.cols[0];
22990
23013
  }
22991
23014
  colHasToggleIcon.colHasToggleIcon = true;
22992
- this.componentKey = location.pathname + "/" + (((_e = (_d = (_c = (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.closest('crud-list')) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.tagName) === null || _e === void 0 ? void 0 : _e.toLowerCase()) || '') + (this.setting.settingKey ? '/' + this.setting.settingKey : '');
23015
+ this.getComponentKey();
22993
23016
  this.getColorSetting();
22994
23017
  this.getColumnSetting(colGroup);
22995
23018
  this.getPageSetting();
@@ -22998,6 +23021,12 @@
22998
23021
  this.applyColumnSetting();
22999
23022
  this.buildFilterColumn(this.setting.cols);
23000
23023
  };
23024
+ ListComponentBase.prototype.getComponentKey = function () {
23025
+ var _a, _b, _c, _d, _e;
23026
+ var parentClass = this.isTreeTable ? exports.EnumProperties.TREE_LIST : exports.EnumProperties.CRUD_LIST;
23027
+ var componentName = ((_e = (_d = (_c = (_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.closest(parentClass)) === null || _c === void 0 ? void 0 : _c.parentNode) === null || _d === void 0 ? void 0 : _d.tagName) === null || _e === void 0 ? void 0 : _e.toLowerCase()) || '';
23028
+ this.componentKey = "" + location.pathname + (componentName ? '/' + componentName : '') + (this.setting.settingKey ? '/' + this.setting.settingKey : '');
23029
+ };
23001
23030
  ListComponentBase.prototype.extendColumns = function (cols, appendCol) {
23002
23031
  var e_3, _h;
23003
23032
  var _this = this;
@@ -27878,11 +27907,12 @@
27878
27907
  ListBase.prototype.loadItemFromQueryParam = function () {
27879
27908
  var _this = this;
27880
27909
  if (this.loadDetailFromQueryParam === undefined || this.loadDetailFromQueryParam === true) {
27881
- var idInQueryString = null;
27910
+ var idInQueryString = null, isView = false;
27882
27911
  var pid = null; // permission Id được người khác share
27883
27912
  if (this._activatedRoute.snapshot
27884
27913
  && this._activatedRoute.snapshot.queryParams) {
27885
27914
  idInQueryString = this._activatedRoute.snapshot.queryParams.id || this._activatedRoute.snapshot.queryParams.entityKey;
27915
+ isView = !!this._activatedRoute.snapshot.queryParams.isView;
27886
27916
  pid = this._activatedRoute.snapshot.queryParams.pid;
27887
27917
  }
27888
27918
  if (pid) {
@@ -27890,22 +27920,36 @@
27890
27920
  }
27891
27921
  else if (idInQueryString) {
27892
27922
  // get detail data
27893
- this.setting.baseService.getDetailWithPermission(idInQueryString)
27894
- .then(function (res) {
27895
- if (!res.data) {
27923
+ if (isView) {
27924
+ this.setting.baseService.getDetail(idInQueryString)
27925
+ .then(function (res) {
27926
+ if (!res.data) {
27927
+ _this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
27928
+ }
27929
+ _this._viewOnly(res.data);
27930
+ }).catch(function (err) {
27931
+ _this._loggerService.logError('error on get detail from querystring', err);
27896
27932
  _this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
27897
- }
27898
- if ((res.data.basePermission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT
27899
- || (res.data.basePermission & exports.PermissionBase.READ) == exports.PermissionBase.READ) {
27900
- _this._edit(res.data);
27901
- }
27902
- else {
27903
- _this._notifierService.showWarning('Bạn không quyền xem bản ghi');
27904
- }
27905
- }).catch(function (err) {
27906
- _this._loggerService.logError('error on get detail from querystring', err);
27907
- _this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
27908
- });
27933
+ });
27934
+ }
27935
+ else {
27936
+ this.setting.baseService.getDetailWithPermission(idInQueryString)
27937
+ .then(function (res) {
27938
+ if (!res.data) {
27939
+ _this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
27940
+ }
27941
+ if ((res.data.basePermission & exports.PermissionBase.EDIT) == exports.PermissionBase.EDIT
27942
+ || (res.data.basePermission & exports.PermissionBase.READ) == exports.PermissionBase.READ) {
27943
+ _this._edit(res.data);
27944
+ }
27945
+ else {
27946
+ _this._notifierService.showWarning('Bạn không có quyền xem bản ghi');
27947
+ }
27948
+ }).catch(function (err) {
27949
+ _this._loggerService.logError('error on get detail from querystring', err);
27950
+ _this._notifierService.showWarning('Không tìm thấy bản ghi cần xem chi tiết');
27951
+ });
27952
+ }
27909
27953
  }
27910
27954
  }
27911
27955
  };
@@ -53820,7 +53864,7 @@
53820
53864
  TnDialogComponent.decorators = [
53821
53865
  { type: i0.Component, args: [{
53822
53866
  selector: 'tn-dialog',
53823
- template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [header]=\"header | translate\" [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\"\n [autoZIndex]=\"true\" [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\" [showHeader]=\"showHeader\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
53867
+ template: "<p-dialog #dialog [closeOnEscape]=\"closeOnEscape\" [appendTo]=\"'body'\" [focusOnShow]=\"false\" [focusTrap]=\"false\"\n [(visible)]=\"visible\" [modal]=\"modal\" [responsive]=\"true\" [maximizable]=\"maximizable\" [autoZIndex]=\"true\"\n [styleClass]=\"styleClass\" [maskStyleClass]=\"maskClass\" [showHeader]=\"showHeader\"\n [style]=\"{'width': popupSize.width + 'px', 'min-width': popupSize.width + 'px', 'height': popupSize.height + 'px', 'min-height': popupSize.height + 'px'}\"\n (onShow)=\"handleShowDialog($event)\" (onHide)=\"handleHideDialog($event)\">\n <tn-custom-scrollbar #scrollbar [useDefaultScrollBar]=\"useDefaultScrollBar\" [class]=\"scrollBarStyleClass\"\n [config]=\"scrollConfig\" [style]=\"scrollStyle\" class=\"tn-dialog-scrollbar\">\n <ng-content></ng-content>\n </tn-custom-scrollbar>\n <p-header *ngIf=\"showHeader\">\n <ng-container *ngIf=\"header && !headerTemplate\">\n <div>{{header | translate}}</div>\n </ng-container>\n <ng-container *ngIf=\"headerTemplate\">\n <ng-container *ngTemplateOutlet=\"headerTemplate\"></ng-container>\n </ng-container>\n </p-header>\n <p-footer *ngIf=\"showFooter\">\n <p-footer *ngIf=\"formBase && formBase.buttonTemplate\" style=\"display: flex;float: right\">\n <ng-container *ngTemplateOutlet=\"formBase.buttonTemplate\">\n </ng-container>\n </p-footer>\n <ng-container *ngIf=\"!formBase || !formBase.buttonTemplate\">\n <p-footer *ngIf=\"footer\">\n <ng-container *ngTemplateOutlet=\"footer\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"buttonTemplateInput\">\n <ng-container *ngTemplateOutlet=\"buttonTemplateInput\"></ng-container>\n </p-footer>\n <p-footer *ngIf=\"!footer && !buttonTemplateInput\">\n <button pButton preventTab type=\"button\" icon=\"pi pi-replay\" class=\"p-button-text p-button-secondary\"\n [label]=\"'FORM.CANCEL' | translate\" (click)=\"handleHideDialog($event)\"></button>\n </p-footer>\n </ng-container>\n </p-footer>\n</p-dialog>",
53824
53868
  styles: [""]
53825
53869
  },] }
53826
53870
  ];
@@ -53833,6 +53877,7 @@
53833
53877
  scrollbar: [{ type: i0.ViewChild, args: ['scrollbar', { static: true },] }],
53834
53878
  formBase: [{ type: i0.ContentChild, args: ['formBase', { static: false },] }],
53835
53879
  footer: [{ type: i0.ContentChild, args: ['footer', { static: true },] }],
53880
+ headerTemplate: [{ type: i0.ContentChild, args: ['headerTemplate', { static: true },] }],
53836
53881
  children: [{ type: i0.ContentChildren, args: [i0.TemplateRef, { descendants: true },] }],
53837
53882
  maskClass: [{ type: i0.Input }],
53838
53883
  styleClass: [{ type: i0.Input }],