tnx-shared 5.3.413 → 5.3.415

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.
@@ -2,4 +2,4 @@ FROM euniversitytnapi/tn.clientbase.angular
2
2
  ARG app_name_lower_case
3
3
  RUN rm -rf /usr/share/nginx/html/*
4
4
  COPY ./dist/${app_name_lower_case} /usr/share/nginx/html
5
- CMD ["nginx", "-g", "daemon off;"]
5
+ CMD ["nginx", "-g", "daemon off;" ]
@@ -1357,6 +1357,7 @@
1357
1357
  this.function = new CrudFormCustomFunction();
1358
1358
  this.hiddenKySoSimCaNhan = false;
1359
1359
  this.hiddenKySoUsbCaNhan = false;
1360
+ this.hiddenKySoVNPTCA = false;
1360
1361
  this.hiddenKySoDonVi = false;
1361
1362
  this.hiddenKySoSmartCA = false;
1362
1363
  this.hiddenButPhe = false;
@@ -5108,6 +5109,76 @@
5108
5109
  doc = null; // Dọn dẹp tham chiếu (không cần thiết nếu scope kết thúc)
5109
5110
  return result;
5110
5111
  };
5112
+ CommonService.prototype.tryParseFlexibleNumber = function (input) {
5113
+ if (input == null || typeof input !== 'string')
5114
+ return input;
5115
+ var str = input.trim();
5116
+ if (str === '')
5117
+ return input;
5118
+ // Xử lý dấu +/- ở đầu
5119
+ var sign = '';
5120
+ var startIndex = 0;
5121
+ if (str[0] === '-' || str[0] === '+') {
5122
+ sign = str[0];
5123
+ startIndex = 1;
5124
+ }
5125
+ var numericPart = str.slice(startIndex);
5126
+ if (numericPart === '')
5127
+ return null;
5128
+ if ((numericPart === null || numericPart === void 0 ? void 0 : numericPart.length) > 1 && numericPart[0] === '0') {
5129
+ // Kiểm tra có phải dạng "0.xxx" hoặc "0,xxx"?
5130
+ var secondChar = numericPart[1];
5131
+ if (secondChar !== '.' && secondChar !== ',') {
5132
+ // Ví dụ: "0123", "00", "01.23" → từ chối
5133
+ return input;
5134
+ }
5135
+ }
5136
+ // Kiểm tra từng ký tự — dừng ngay nếu gặp ký tự không hợp lệ
5137
+ var commaCount = 0, dotCount = 0, lastComma = -1, lastDot = -1;
5138
+ for (var i = 0; i < numericPart.length; i++) {
5139
+ var char = numericPart[i];
5140
+ if (char >= '0' && char <= '9')
5141
+ continue;
5142
+ else if (char === ',') {
5143
+ commaCount++;
5144
+ lastComma = i;
5145
+ }
5146
+ else if (char === '.') {
5147
+ dotCount++;
5148
+ lastDot = i;
5149
+ }
5150
+ else
5151
+ return input; // ký tự không hợp lệ
5152
+ }
5153
+ // Sau khi xác minh tất cả ký tự hợp lệ, mới xử lý định dạng
5154
+ var normalized = str.slice(startIndex); // loại bỏ dấu
5155
+ if (commaCount === 0 && dotCount === 0) {
5156
+ // OK: số nguyên
5157
+ }
5158
+ else if (dotCount === 1 && (commaCount === 0 || lastDot > lastComma)) {
5159
+ // Chuẩn Mỹ: xóa dấu phẩy
5160
+ normalized = normalized.replace(/,/g, '');
5161
+ }
5162
+ else if (commaCount === 1 && (dotCount === 0 || lastComma > lastDot)) {
5163
+ // Chuẩn VN: xóa dấu chấm, đổi phẩy → chấm
5164
+ var temp = '';
5165
+ for (var i = 0; i < normalized.length; i++) {
5166
+ if (normalized[i] === '.')
5167
+ continue;
5168
+ if (normalized[i] === ',')
5169
+ temp += '.';
5170
+ else
5171
+ temp += normalized[i];
5172
+ }
5173
+ normalized = temp;
5174
+ }
5175
+ else {
5176
+ // Quá nhiều dấu → không xác định
5177
+ return input;
5178
+ }
5179
+ var num = parseFloat(sign + normalized);
5180
+ return isNaN(num) ? input : num;
5181
+ };
5111
5182
  return CommonService;
5112
5183
  }());
5113
5184
  CommonService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function CommonService_Factory() { return new CommonService(i0__namespace.ɵɵinject(ModuleConfigService)); }, token: CommonService, providedIn: "root" });
@@ -23964,7 +24035,7 @@
23964
24035
  this.getValueRow(rowData, index + 1, value);
23965
24036
  }
23966
24037
  else {
23967
- rowData[index] = value;
24038
+ rowData[index] = this._commonService.tryParseFlexibleNumber(value);
23968
24039
  }
23969
24040
  };
23970
24041
  ListComponentBase.prototype.headHtmlToString = function (arrHeadEle) {
@@ -35661,6 +35732,7 @@
35661
35732
  visible: this.showFileVersion
35662
35733
  }),
35663
35734
  ];
35735
+ this.checkPlugin();
35664
35736
  this.initSetting();
35665
35737
  };
35666
35738
  FileManagerComponent.prototype.initSetting = function () {
@@ -35791,6 +35863,16 @@
35791
35863
  && this._deviceDetectorService.isDesktop()
35792
35864
  && this.layout !== exports.EnumFileLayout.SIMPLE_FOR_LIST && !this.parentSetting.hiddenKySoUsbCaNhan),
35793
35865
  },
35866
+ {
35867
+ label: 'Ký số VNPTCA', icon: 'fas fa-signature',
35868
+ command: function () {
35869
+ _this.model.selectedItem = item;
35870
+ _this.signVNPTCA(item);
35871
+ },
35872
+ visible: (this._fileObjectService.isTypeFileKySo(item.name)
35873
+ && this._deviceDetectorService.isDesktop()
35874
+ && this.layout !== exports.EnumFileLayout.SIMPLE_FOR_LIST && !this.parentSetting.hiddenKySoVNPTCA),
35875
+ },
35794
35876
  {
35795
35877
  label: 'Bút phê', icon: 'fas fa-comment-dots',
35796
35878
  command: function () {
@@ -37124,6 +37206,168 @@
37124
37206
  FileManagerComponent.prototype.getPathImage = function (fileId) {
37125
37207
  return this._fileObjectService.getUrlImage(fileId);
37126
37208
  };
37209
+ FileManagerComponent.prototype.signVNPTCA = function (item) {
37210
+ return __awaiter(this, void 0, void 0, function () {
37211
+ var sourceFileId, rsConvert, e_7, dataInput, sigOptions, dataJS, data, e_8;
37212
+ return __generator(this, function (_b) {
37213
+ switch (_b.label) {
37214
+ case 0:
37215
+ sourceFileId = item.id;
37216
+ if (!this._fileExplorerService.needConvertBeforeSign(item.name)) return [3 /*break*/, 4];
37217
+ _b.label = 1;
37218
+ case 1:
37219
+ _b.trys.push([1, 3, , 4]);
37220
+ return [4 /*yield*/, this._fileExplorerService.convertDocumentToPdfAndSave({
37221
+ instanceId: item.id,
37222
+ name: this._fileExplorerService.changeFileExtension(item.name, 'pdf'),
37223
+ folderInstanceId: item.parentFolderId,
37224
+ ownerType: this._userService.getCurrentUser().userId.toString(),
37225
+ })];
37226
+ case 2:
37227
+ rsConvert = _b.sent();
37228
+ if (!rsConvert || !rsConvert.success) {
37229
+ this._notifierService.showWarning("C\u00F3 l\u1ED7i x\u1EA3y ra khi chuy\u1EC3n \u0111\u1ED5i t\u00E0i li\u1EC7u " + item.name + " th\u00E0nh pdf \u0111\u1EC3 k\u00FD. Vui l\u00F2ng th\u1EED l\u1EA1i sau");
37230
+ return [2 /*return*/];
37231
+ }
37232
+ else {
37233
+ this._notifierService.showSuccess("Chuy\u1EC3n \u0111\u1ED5i t\u00E0i li\u1EC7u " + item.name + " th\u00E0nh pdf th\u00E0nh c\u00F4ng");
37234
+ sourceFileId = rsConvert.data;
37235
+ this.model.selectedItem.id = rsConvert.data;
37236
+ this._triggerProcessData();
37237
+ }
37238
+ return [3 /*break*/, 4];
37239
+ case 3:
37240
+ e_7 = _b.sent();
37241
+ this._notifierService.showWarning("C\u00F3 l\u1ED7i x\u1EA3y ra khi chuy\u1EC3n \u0111\u1ED5i t\u00E0i li\u1EC7u " + item.name + " th\u00E0nh pdf \u0111\u1EC3 k\u00FD. Vui l\u00F2ng th\u1EED l\u1EA1i sau");
37242
+ return [2 /*return*/];
37243
+ case 4: return [4 /*yield*/, this._fileExplorerService.getBase64FromFileId(sourceFileId)];
37244
+ case 5:
37245
+ dataInput = (_b.sent()).split(',')[1];
37246
+ sigOptions = new PdfSigner();
37247
+ sigOptions.page = 1;
37248
+ sigOptions.AdvancedCustom = true;
37249
+ sigOptions.SigType = 1;
37250
+ dataJS = {
37251
+ data: dataInput,
37252
+ type: 'pdf',
37253
+ sigOptions: JSON.stringify(sigOptions)
37254
+ };
37255
+ _b.label = 6;
37256
+ case 6:
37257
+ _b.trys.push([6, 8, , 9]);
37258
+ return [4 /*yield*/, vnpt_plugin.signArrDataAdvanced([JSON.stringify(dataJS)], "", false)];
37259
+ case 7:
37260
+ data = _b.sent();
37261
+ this.handeResult(data);
37262
+ return [3 /*break*/, 9];
37263
+ case 8:
37264
+ e_8 = _b.sent();
37265
+ console.log(e_8);
37266
+ return [3 /*break*/, 9];
37267
+ case 9: return [2 /*return*/];
37268
+ }
37269
+ });
37270
+ });
37271
+ };
37272
+ FileManagerComponent.prototype.checkPlugin = function () {
37273
+ var _this = this;
37274
+ try {
37275
+ // checkbrowser support
37276
+ // Kiem tra plugin
37277
+ var timer = null;
37278
+ var key = this._moduleConfig.environment.VNPTLicenseKey;
37279
+ vnpt_plugin.checkPlugin().then(function (data) {
37280
+ if (data === "1") {
37281
+ console.log("Plugin đã sẵn sàng");
37282
+ vnpt_plugin.setLicenseKey(key).then(function (data) {
37283
+ vnpt_plugin.SetShowCertListDialog(true);
37284
+ }).catch(function (e) {
37285
+ console.log(e);
37286
+ });
37287
+ }
37288
+ else {
37289
+ // app dung cho ban 1.0.0.9 tro len
37290
+ if (vnpt_plugin.getOsName() !== "MAC") {
37291
+ if (vnpt_plugin.checkBrowserSupportWS()) {
37292
+ var protoUrl = "vnpt-plugin:\/\/resolve?domain=vnpt";
37293
+ window.protocolCheck("vnpt-plugin:\/\/resolve?domain=a", function () {
37294
+ console.log("VNPT-CA Plugin chưa được cài đặt hoặc chưa được bật");
37295
+ clearTimeout(timer); // clear
37296
+ });
37297
+ timer = setTimeout(_this.checkPlugin, 1500);
37298
+ }
37299
+ }
37300
+ else {
37301
+ console.log("VNPT-CA Plugin chưa được cài đặt hoặc chưa được bật");
37302
+ }
37303
+ }
37304
+ }).catch(function (e) {
37305
+ console.log("VNPT-CA Plugin chưa được cài đặt hoặc chưa được bật");
37306
+ });
37307
+ }
37308
+ catch (e) {
37309
+ console.log(e);
37310
+ }
37311
+ };
37312
+ FileManagerComponent.prototype.handeResult = function (data) {
37313
+ var _this = this;
37314
+ if (typeof JSON.parse(data).code !== 'undefined') {
37315
+ var jsOb = JSON.parse(data);
37316
+ }
37317
+ else {
37318
+ var jsOb = JSON.parse(JSON.parse(data)[0]);
37319
+ }
37320
+ switch (jsOb.code) {
37321
+ case 0:
37322
+ this._fileExplorerService.kySimSaveSignedFile({
37323
+ sourceFile: this.model.selectedItem,
37324
+ fileContents: jsOb.data,
37325
+ }).then(function (rss) {
37326
+ _this._notifierService.showSuccess("Ký thành công");
37327
+ _this._triggerProcessData();
37328
+ });
37329
+ break;
37330
+ case 1:
37331
+ this._notifierService.showWarning("Dữ liệu đầu vào không đúng định dạng");
37332
+ break;
37333
+ case 2:
37334
+ this._notifierService.showWarning("Không lấy được thông tin chứng thư số");
37335
+ break;
37336
+ case 3:
37337
+ this._notifierService.showWarning("Có lỗi trong quá trình ký số");
37338
+ break;
37339
+ case 4:
37340
+ this._notifierService.showSuccess("Chứng thư số không có khóa bí mật");
37341
+ break;
37342
+ case 5:
37343
+ this._notifierService.showSuccess("Lỗi không xác định");
37344
+ break;
37345
+ case 6:
37346
+ this._notifierService.showSuccess("Ký pdf: không tìm thấy tham số số trang cần ký");
37347
+ break;
37348
+ case 7:
37349
+ this._notifierService.showSuccess("Ký pdf: trang đặt chữ ký không tồn tại");
37350
+ break;
37351
+ case 8:
37352
+ this._notifierService.showSuccess("Ký xml: không tìm thấy thẻ ký số");
37353
+ break;
37354
+ case 9:
37355
+ this._notifierService.showSuccess("Ký pdf: không tìm thấy id của thẻ ký số");
37356
+ break;
37357
+ case 10:
37358
+ this._notifierService.showSuccess("Dữ liệu ký đã chứa một hoặc nhiều chữ ký không hợp lệ");
37359
+ break;
37360
+ case 11:
37361
+ this._notifierService.showSuccess("Người dùng hủy bỏ");
37362
+ break;
37363
+ case 13:
37364
+ this._notifierService.showWarning("Dữ liệu ký rỗng");
37365
+ break;
37366
+ default:
37367
+ this._notifierService.showSuccess("Lỗi không xác định");
37368
+ break;
37369
+ }
37370
+ };
37127
37371
  return FileManagerComponent;
37128
37372
  }(DataListBase));
37129
37373
  FileManagerComponent.decorators = [
@@ -57942,6 +58186,7 @@
57942
58186
  ];
57943
58187
 
57944
58188
  // 1
58189
+ // 2
57945
58190
  function coreDeclaration() {
57946
58191
  return [
57947
58192
  AddressComponent,