tnx-shared 5.3.399 → 5.3.401

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.
@@ -31143,6 +31143,24 @@ class FileManagerComponent extends DataListBase {
31143
31143
  && this._deviceDetectorService.isDesktop()
31144
31144
  && this.layout !== EnumFileLayout.SIMPLE_FOR_LIST && !this.parentSetting.hiddenKySoUsbCaNhan),
31145
31145
  },
31146
+ {
31147
+ label: 'Bút phê', icon: 'fas fa-comment-dots',
31148
+ command: () => {
31149
+ this.addComment(item);
31150
+ },
31151
+ visible: (this._fileObjectService.isTypeFileKySo(item.name)
31152
+ && this._deviceDetectorService.isDesktop()
31153
+ && this.layout !== EnumFileLayout.SIMPLE_FOR_LIST && !this.parentSetting.hiddenKySoUsbCaNhan),
31154
+ },
31155
+ {
31156
+ label: 'Bút phê và ký', icon: 'fas fa-comment-medical',
31157
+ command: () => {
31158
+ this.addCommentAndSign(item);
31159
+ },
31160
+ visible: (this._fileObjectService.isTypeFileKySo(item.name)
31161
+ && this._deviceDetectorService.isDesktop()
31162
+ && this.layout !== EnumFileLayout.SIMPLE_FOR_LIST && !this.parentSetting.hiddenKySoUsbCaNhan),
31163
+ },
31146
31164
  {
31147
31165
  label: 'Ký số đơn vị (USB)', icon: 'fas fa-signature',
31148
31166
  command: () => {
@@ -31835,6 +31853,135 @@ class FileManagerComponent extends DataListBase {
31835
31853
  }
31836
31854
  }));
31837
31855
  }
31856
+ addComment(file) {
31857
+ this._notifierService.showConfirm('Bạn có chắc chắn muốn bút phê văn bản này?').then((rs) => __awaiter(this, void 0, void 0, function* () {
31858
+ if (rs) {
31859
+ let sourceFileId = file.id;
31860
+ let sourceFile = file;
31861
+ // Ký số file word - cần convert sang pdf trước
31862
+ if (this._fileExplorerService.needConvertBeforeSign(file.name)) {
31863
+ // convert file before sign
31864
+ try {
31865
+ const rsConvert = yield this._fileExplorerService.convertDocumentToPdfAndSave({
31866
+ instanceId: sourceFileId,
31867
+ name: this._fileExplorerService.changeFileExtension(file.name, 'pdf'),
31868
+ folderInstanceId: file.parentFolderId,
31869
+ ownerType: this._userService.getCurrentUser().userId.toString(),
31870
+ });
31871
+ if (!rsConvert || !rsConvert.success) {
31872
+ this._notifierService.showWarning(`Có lỗi xảy ra khi chuyển đổi tài liệu ${file.name} thành pdf để ký. Vui lòng thử lại sau`);
31873
+ return;
31874
+ }
31875
+ else {
31876
+ this._notifierService.showSuccess(`Chuyển đổi tài liệu ${file.name} thành pdf thành công`);
31877
+ sourceFileId = rsConvert.data;
31878
+ sourceFile = { id: sourceFileId };
31879
+ this._triggerProcessData();
31880
+ }
31881
+ }
31882
+ catch (e) {
31883
+ this._notifierService.showWarning(`Có lỗi xảy ra khi chuyển đổi tài liệu ${file.name} thành pdf để ký. Vui lòng thử lại sau`);
31884
+ return;
31885
+ }
31886
+ }
31887
+ this._fileExplorerService.generateLinkDownload({
31888
+ fileId: sourceFileId,
31889
+ }).then(rs => {
31890
+ const url = this._downloadLinkService.getDownloadForSignUrl(rs.data);
31891
+ const prms = {};
31892
+ prms['FileUploadHandler'] = `${this._moduleConfig.environment.apiDomain.fileEndpoint}/${this._moduleConfig.environment.apiVersion}/KySoFile/SavePhysicalSignedFile`;
31893
+ prms['SessionId'] = '';
31894
+ prms['FileName'] = url;
31895
+ // tslint:disable-next-line: variable-name
31896
+ const json_prms = JSON.stringify(prms);
31897
+ vgca_comment(json_prms, (result) => {
31898
+ const resultObj = JSON.parse(result);
31899
+ if (resultObj.FileServer != '') {
31900
+ this._fileExplorerService.saveSignedFile({
31901
+ sourceFile: sourceFile,
31902
+ tempFileId: resultObj.FileServer,
31903
+ }).then(rss => {
31904
+ this._triggerProcessData();
31905
+ this._notifierService.showSuccess('Tạo bút phê thành công');
31906
+ });
31907
+ }
31908
+ });
31909
+ });
31910
+ }
31911
+ }));
31912
+ }
31913
+ addCommentAndSign(file) {
31914
+ return __awaiter(this, void 0, void 0, function* () {
31915
+ const rs = yield this._notifierService.showConfirm('Bạn có chắc chắn muốn tạo bút phê và ký văn bản này?');
31916
+ if (rs) {
31917
+ let sourceFileId = file.id;
31918
+ let sourceFile = file;
31919
+ // Ký số file word - cần convert sang pdf trước
31920
+ if (this._fileExplorerService.needConvertBeforeSign(file.name)) {
31921
+ // convert file before sign
31922
+ try {
31923
+ const rsConvert = yield this._fileExplorerService.convertDocumentToPdfAndSave({
31924
+ instanceId: sourceFileId,
31925
+ name: this._fileExplorerService.changeFileExtension(file.name, 'pdf'),
31926
+ folderInstanceId: file.parentFolderId,
31927
+ ownerType: this._userService.getCurrentUser().userId.toString(),
31928
+ });
31929
+ if (!rsConvert || !rsConvert.success) {
31930
+ this._notifierService.showWarning(`Có lỗi xảy ra khi chuyển đổi tài liệu ${file.name} thành pdf để ký. Vui lòng thử lại sau`);
31931
+ return;
31932
+ }
31933
+ else {
31934
+ this._notifierService.showSuccess(`Chuyển đổi tài liệu ${file.name} thành pdf thành công`);
31935
+ sourceFileId = rsConvert.data;
31936
+ sourceFile = { id: sourceFileId };
31937
+ this._triggerProcessData();
31938
+ }
31939
+ }
31940
+ catch (e) {
31941
+ this._notifierService.showWarning(`Có lỗi xảy ra khi chuyển đổi tài liệu ${file.name} thành pdf để ký. Vui lòng thử lại sau`);
31942
+ return;
31943
+ }
31944
+ }
31945
+ const downloadLink = yield this._fileExplorerService.generateLinkDownload({
31946
+ fileId: sourceFileId,
31947
+ });
31948
+ const url = this._downloadLinkService.getDownloadForSignUrl(downloadLink.data);
31949
+ const prms = {
31950
+ FileUploadHandler: `${this._moduleConfig.environment.apiDomain.fileEndpoint}/${this._moduleConfig.environment.apiVersion}/KySoFile/SavePhysicalSignedFile`,
31951
+ SessionId: '',
31952
+ FileName: url
31953
+ };
31954
+ const json_prms = JSON.stringify(prms);
31955
+ // Wrap callback-based functions in Promises
31956
+ const commentResult = yield new Promise((resolve) => {
31957
+ vgca_comment(json_prms, (result) => resolve(result));
31958
+ });
31959
+ const resultObj = JSON.parse(commentResult);
31960
+ const downloadLink2 = yield this._fileExplorerService.generateLinkDownload({
31961
+ fileId: resultObj.FileServer,
31962
+ });
31963
+ const url2 = this._downloadLinkService.getDownloadForSignUrl(downloadLink2.data);
31964
+ const prms2 = {
31965
+ FileUploadHandler: `${this._moduleConfig.environment.apiDomain.fileEndpoint}/${this._moduleConfig.environment.apiVersion}/KySoFile/SavePhysicalSignedFile`,
31966
+ SessionId: '',
31967
+ FileName: url2
31968
+ };
31969
+ const json_prms2 = JSON.stringify(prms2);
31970
+ const signResult = yield new Promise((resolve) => {
31971
+ vgca_sign_approved(json_prms2, (result) => resolve(result));
31972
+ });
31973
+ const signResultObj = JSON.parse(signResult);
31974
+ if (signResultObj.FileServer != '') {
31975
+ yield this._fileExplorerService.saveSignedFile({
31976
+ sourceFile: sourceFile,
31977
+ tempFileId: signResultObj.FileServer,
31978
+ });
31979
+ this._triggerProcessData();
31980
+ this._notifierService.showSuccess('Tạo bút phê và ký thành công');
31981
+ }
31982
+ }
31983
+ });
31984
+ }
31838
31985
  signFileDonVi(file) {
31839
31986
  this._notifierService
31840
31987
  .showConfirm('Bạn có chắc chắn muốn ký số đơn vị văn bản này?')