tnx-shared 5.3.408 → 5.3.409

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.
@@ -30665,9 +30665,11 @@
30665
30665
  _this.thumborEndpoint = '';
30666
30666
  _this.fileWithThumborEndpoint = '';
30667
30667
  _this.filePathEndpoint = '';
30668
+ _this.version = '';
30668
30669
  _this.endPoint = _moduleConfigService.getConfig().environment.apiDomain.fileEndpoint;
30669
30670
  _this.fileWithThumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.fileWithThumborEndpoint;
30670
30671
  _this.thumborEndpoint = _moduleConfigService.getConfig().environment.apiDomain.thumbor;
30672
+ _this.version = _moduleConfigService.getConfig().environment.apiVersion;
30671
30673
  _this.filePathEndpoint = _moduleConfigService.getConfig().environment.apiDomain.filePathEndpoint;
30672
30674
  return _this;
30673
30675
  }
@@ -30850,6 +30852,10 @@
30850
30852
  var url = this.serviceUri + "/UploadWithByteArray";
30851
30853
  return this._http.post(url, formData, { responseType: 'text' }).toPromise();
30852
30854
  };
30855
+ FileObjectService.prototype.kySoSmartCA = function (model) {
30856
+ var url = this.endPoint + "/" + this.version + "/KySoFile/SmartCASignFile";
30857
+ return this.defaultPost(url, model);
30858
+ };
30853
30859
  return FileObjectService;
30854
30860
  }(BaseService));
30855
30861
  FileObjectService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FileObjectService_Factory() { return new FileObjectService(i0__namespace.ɵɵinject(i1__namespace$1.HttpClient), i0__namespace.ɵɵinject(i0__namespace.INJECTOR), i0__namespace.ɵɵinject(ModuleConfigService)); }, token: FileObjectService, providedIn: "root" });
@@ -35762,6 +35768,7 @@
35762
35768
  command: function () {
35763
35769
  _this.signFileSmartCA(item);
35764
35770
  },
35771
+ visible: item.extension == '.PDF'
35765
35772
  },
35766
35773
  {
35767
35774
  label: 'Ký số cá nhân (USB)', icon: 'fas fa-signature',
@@ -36832,7 +36839,10 @@
36832
36839
  entity: rowData.entity,
36833
36840
  entityKey: rowData.entityKey,
36834
36841
  fileBase64Content: dataKySo.fileBase64Content,
36842
+ userChuKySoId: dataKySo.id,
36835
36843
  showKySoButton: true,
36844
+ width: dataKySo.width,
36845
+ height: dataKySo.height,
36836
36846
  };
36837
36847
  this.forms.fileViewer.show = true;
36838
36848
  return [2 /*return*/];
@@ -50540,6 +50550,27 @@
50540
50550
  return styleClass;
50541
50551
  };
50542
50552
  FileViewerComponent.prototype.kySoHandle = function () {
50553
+ return __awaiter(this, void 0, void 0, function () {
50554
+ var res;
50555
+ return __generator(this, function (_b) {
50556
+ switch (_b.label) {
50557
+ case 0:
50558
+ this.showWaitBox('Đang thực hiện ký số, vui lòng kiểm tra ứng dụng SmartCA');
50559
+ return [4 /*yield*/, this._fileObjectService.kySoSmartCA(this.model.data)];
50560
+ case 1:
50561
+ res = _b.sent();
50562
+ if (res.success) {
50563
+ this._notifierService.showSuccess('Thực hiện ký số thành công');
50564
+ }
50565
+ else {
50566
+ this._notifierService.showWarning(res.error);
50567
+ }
50568
+ this.hideWaitBox();
50569
+ this.show = false;
50570
+ return [2 /*return*/];
50571
+ }
50572
+ });
50573
+ });
50543
50574
  };
50544
50575
  FileViewerComponent.prototype.ngAfterViewInit = function () {
50545
50576
  var _this = this;
@@ -50570,17 +50601,35 @@
50570
50601
  var rect = target.getBoundingClientRect();
50571
50602
  var x = event.clientX - rect.left;
50572
50603
  var y = event.clientY - rect.top;
50573
- // Create marker at this position
50604
+ var WIDTH = this.model.data.width || 100;
50605
+ var HEIGHT = this.model.data.height || 100;
50606
+ // Convert pixel sang point TRƯỚC
50607
+ var clickXPoint = this.pixelToPoint(x);
50608
+ var clickYPoint = this.pixelToPoint(y);
50609
+ var widthPoint = this.pixelToPoint(WIDTH);
50610
+ var heightPoint = this.pixelToPoint(HEIGHT);
50611
+ // SAU ĐÓ mới tính toán như C#
50612
+ var x1 = clickXPoint;
50613
+ var y1 = clickYPoint - heightPoint;
50614
+ var x2 = clickXPoint + widthPoint;
50615
+ var y2 = clickYPoint;
50616
+ var rectangle = x1 + "," + y1 + "," + x2 + "," + y2;
50617
+ this.model.data.signatureLocation = rectangle;
50574
50618
  this.createMarker(target, x, y, pageNumber);
50575
50619
  }
50576
50620
  };
50577
50621
  FileViewerComponent.prototype.createMarker = function (parent, x, y, page) {
50578
50622
  var marker = document.createElement('div');
50579
50623
  marker.id = 'custom-marker';
50580
- marker.style.cssText = "\n position: absolute;\n left: " + x + "px;\n top: " + y + "px;\n width: 100px;\n height: 100px;\n background-image: url(" + this.model.data.fileBase64Content + ");\n pointer-events: none;\n background-size: contain; /* Fits the image */\n background-repeat: no-repeat; /* No tiling */\n background-position: center top; /* Positioning */\n z-index: 999;\n ";
50624
+ marker.style.cssText = "\n position: absolute;\n left: " + x + "px;\n top: " + y + "px;\n transform: translate(-50%,-50%);\n width: " + this.model.data.width + "px;\n height: " + this.model.data.height + "px;\n background-image: url(" + this.model.data.fileBase64Content + ");\n pointer-events: none;\n background-size: contain; /* Fits the image */\n background-repeat: no-repeat; /* No tiling */\n background-position: center top; /* Positioning */\n z-index: 999;\n ";
50625
+ this.model.data.page = page;
50581
50626
  var pageContainer = parent.closest('.page');
50582
50627
  pageContainer === null || pageContainer === void 0 ? void 0 : pageContainer.appendChild(marker);
50583
50628
  };
50629
+ FileViewerComponent.prototype.pixelToPoint = function (pixel, dpi) {
50630
+ if (dpi === void 0) { dpi = 96; }
50631
+ return Math.round(pixel * 72 / dpi * 100); // Làm tròn 2 chữ số thập phân
50632
+ };
50584
50633
  return FileViewerComponent;
50585
50634
  }(ComponentBase));
50586
50635
  FileViewerComponent.decorators = [