@hitsoft/e-donusum 1.0.115 → 1.0.116

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.
Files changed (37) hide show
  1. package/esm2020/lib/auto-send-rules/auto-send-rule/auto-send-rule.module.mjs +1 -1
  2. package/esm2020/lib/components/hit-despatches/hit-despatch.component.mjs +11 -36
  3. package/esm2020/lib/components/hit-inbound-despatches/hit-inbound-despatch.component.mjs +6 -50
  4. package/esm2020/lib/components/hit-inbound-invoices/hit-inbound-invoice.component.mjs +10 -36
  5. package/esm2020/lib/components/hit-invoices/hit-invoice.component.mjs +8 -37
  6. package/esm2020/lib/components/hit-params-companies/hit-params-company.component.mjs +4 -3
  7. package/esm2020/lib/hit-proxy/hit-despatches/hit-despatch.service.mjs +5 -28
  8. package/esm2020/lib/hit-proxy/hit-inbound-despatches/hit-inbound-despatch.service.mjs +3 -3
  9. package/esm2020/lib/hit-proxy/hit-inbound-invoices/hit-inbound-invoice.service.mjs +2 -16
  10. package/esm2020/lib/hit-proxy/hit-invoices/hit-invoice.service.mjs +8 -44
  11. package/esm2020/lib/hit-proxy/shared/hit-shared.service.mjs +7 -94
  12. package/esm2020/lib/proxy/auto-send-rule-doc-types/index.mjs +1 -1
  13. package/esm2020/lib/proxy/auto-send-rule-scenarios/index.mjs +1 -1
  14. package/esm2020/lib/proxy/auto-send-rules/index.mjs +1 -1
  15. package/esm2020/lib/proxy/document-serials/index.mjs +1 -1
  16. package/esm2020/lib/proxy/gib-partner-pks/index.mjs +1 -1
  17. package/esm2020/lib/proxy/note-rule-doc-types/index.mjs +1 -1
  18. package/esm2020/lib/proxy/note-rule-scenarios/index.mjs +1 -1
  19. package/esm2020/lib/proxy/note-rules/index.mjs +1 -1
  20. package/esm2020/lib/proxy/params-companies/index.mjs +1 -1
  21. package/esm2020/lib/proxy/params-generals/index.mjs +1 -1
  22. package/esm2020/lib/proxy/params-integrators/index.mjs +1 -1
  23. package/esm2020/lib/proxy/paramse-dispatches/index.mjs +1 -1
  24. package/esm2020/lib/proxy/paramse-invoices/index.mjs +1 -1
  25. package/esm2020/lib/proxy/xslt-formats/index.mjs +1 -1
  26. package/esm2020/lib/proxy/xslt-rule-doc-types/index.mjs +1 -1
  27. package/esm2020/lib/proxy/xslt-rule-scenarios/index.mjs +1 -1
  28. package/esm2020/lib/proxy/xslt-rules/index.mjs +1 -1
  29. package/fesm2015/hitsoft-e-donusum.mjs +56 -337
  30. package/fesm2015/hitsoft-e-donusum.mjs.map +1 -1
  31. package/fesm2020/hitsoft-e-donusum.mjs +56 -335
  32. package/fesm2020/hitsoft-e-donusum.mjs.map +1 -1
  33. package/lib/hit-proxy/hit-despatches/hit-despatch.service.d.ts +2 -7
  34. package/lib/hit-proxy/hit-inbound-invoices/hit-inbound-invoice.service.d.ts +1 -4
  35. package/lib/hit-proxy/hit-invoices/hit-invoice.service.d.ts +2 -11
  36. package/lib/hit-proxy/shared/hit-shared.service.d.ts +1 -1
  37. package/package.json +1 -1
@@ -17,17 +17,16 @@ import { PageModule } from '@abp/ng.components/page';
17
17
  import { DateAdapter } from '@abp/ng.theme.shared/extensions';
18
18
  import * as i4 from '@angular/forms';
19
19
  import { Validators } from '@angular/forms';
20
- import { finalize, tap, filter, switchMap, map } from 'rxjs/operators';
20
+ import { finalize, tap, filter, switchMap } from 'rxjs/operators';
21
21
  import * as i6 from '@swimlane/ngx-datatable';
22
22
  import * as i5 from '@angular/common';
23
23
  import * as AspNetData from 'devextreme-aspnet-data-nojquery';
24
24
  import * as i11 from 'devextreme-angular';
25
25
  import { DxDataGridModule, DxTextAreaModule, DxTextBoxModule, DxHtmlEditorModule, DxSelectBoxModule, DxLookupModule, DxTabPanelModule, DxCheckBoxModule, DxDateBoxModule, DxNumberBoxModule, DxTemplateModule, DxDropDownBoxModule, DxRadioGroupModule, DxPopupModule } from 'devextreme-angular';
26
26
  import * as i3$1 from 'devextreme-angular/ui/nested';
27
- import { finalize as finalize$1, tap as tap$1, filter as filter$1, switchMap as switchMap$1, firstValueFrom, BehaviorSubject, ReplaySubject, map as map$1 } from 'rxjs';
27
+ import { finalize as finalize$1, tap as tap$1, filter as filter$1, switchMap as switchMap$1, firstValueFrom, BehaviorSubject, ReplaySubject } from 'rxjs';
28
28
  import * as i13 from 'devextreme-angular/core';
29
29
  import { __awaiter } from 'tslib';
30
- import * as i3$2 from '@angular/common/http';
31
30
  import * as i1$2 from '@angular/platform-browser';
32
31
  import trMessages from 'devextreme/localization/messages/tr.json';
33
32
  import { loadMessages, locale } from 'devextreme/localization';
@@ -6593,7 +6592,7 @@ class HitParamsCompanyComponent {
6593
6592
  }
6594
6593
  buildForm() {
6595
6594
  debugger;
6596
- const { companyName, companyCenter, taxNumber, taxOffice, mersisNo, tradeRegisterNo, street, buildingNo, postalCode, district, city, country, telNo, faxNo, email, webSite, extraAddress, isFreeZone, isTestCompany, setupIndex, } = this.paramsCompanyDto || {};
6595
+ const { companyName, companyCenter, taxNumber, taxOffice, mersisNo, tradeRegisterNo, street, buildingNo, postalCode, district, city, country, telNo, faxNo, email, webSite, extraAddress, isFreeZone, isTestCompany, setupIndex, setupCompleted } = this.paramsCompanyDto || {};
6597
6596
  this.formParamsCompany = this.fb.group({
6598
6597
  companyName: [companyName !== null && companyName !== void 0 ? companyName : null, [Validators.required, Validators.maxLength(256)]],
6599
6598
  companyCenter: [companyCenter !== null && companyCenter !== void 0 ? companyCenter : null, [Validators.required, Validators.maxLength(256)]],
@@ -6614,7 +6613,8 @@ class HitParamsCompanyComponent {
6614
6613
  extraAddress: [extraAddress !== null && extraAddress !== void 0 ? extraAddress : null, [Validators.maxLength(512)]],
6615
6614
  isFreeZone: [isFreeZone !== null && isFreeZone !== void 0 ? isFreeZone : false, []],
6616
6615
  isTestCompany: [isTestCompany !== null && isTestCompany !== void 0 ? isTestCompany : true, [Validators.required]],
6617
- setupIndex: this.setupIndex
6616
+ setupIndex: this.setupIndex,
6617
+ setupCompleted: setupCompleted
6618
6618
  });
6619
6619
  debugger;
6620
6620
  }
@@ -9013,12 +9013,9 @@ var InvoiceType;
9013
9013
  })(InvoiceType || (InvoiceType = {}));
9014
9014
 
9015
9015
  class HitInvoiceService {
9016
- constructor(restService, devexService, http, configState // ← ekle
9017
- ) {
9016
+ constructor(restService, devexService) {
9018
9017
  this.restService = restService;
9019
9018
  this.devexService = devexService;
9020
- this.http = http;
9021
- this.configState = configState;
9022
9019
  this.apiName = 'eDonusum';
9023
9020
  this.LoadInvoices = this.devexService.createStore({
9024
9021
  key: "id",
@@ -9096,34 +9093,10 @@ class HitInvoiceService {
9096
9093
  url: '/api/e-donusum/invoices/get-invoice-response',
9097
9094
  params: { startDate: startDate, endDate: endDate, }
9098
9095
  }, { apiName: this.apiName });
9099
- this.getInvoiceViewToken = (invoiceUUID) => {
9100
- var _a, _b;
9101
- const httpClient = this.restService.http;
9102
- // ABP'nin base URL'sini al
9103
- const baseUrl = ((_a = this.restService.configState) === null || _a === void 0 ? void 0 : _a.getDeep('environment.apis.eDonusum.url'))
9104
- || ((_b = this.restService.configState) === null || _b === void 0 ? void 0 : _b.getDeep('environment.apis.default.url'))
9105
- || 'https://localhost:44359';
9106
- return httpClient.get(`${baseUrl}/api/e-donusum/invoices/get-invoice-view/${invoiceUUID}`, {
9107
- responseType: 'blob',
9108
- observe: 'response',
9109
- headers: {
9110
- 'Authorization': `Bearer ${this.getToken()}`
9111
- }
9112
- }).pipe(map(response => {
9113
- var _a;
9114
- const cd = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get('Content-Disposition');
9115
- let filename = 'fatura.pdf';
9116
- if (cd) {
9117
- const match = cd.match(/filename[^;=\n]*=["']?([^"';\n]+)["']?/i);
9118
- if (match)
9119
- filename = match[1].trim();
9120
- }
9121
- return {
9122
- blobUrl: URL.createObjectURL(response.body),
9123
- filename: filename
9124
- };
9125
- }));
9126
- };
9096
+ this.getInvoiceView = (invoiceUUID) => this.restService.request({
9097
+ method: 'GET',
9098
+ url: `/api/e-donusum/invoices/get-invoice-view/${invoiceUUID}`,
9099
+ }, { apiName: this.apiName });
9127
9100
  this.showAllFiles = (invoiceUUID) => this.restService.request({
9128
9101
  method: 'GET',
9129
9102
  url: `/api/e-donusum/invoices/show-all-files/${invoiceUUID}`,
@@ -9144,24 +9117,15 @@ class HitInvoiceService {
9144
9117
  params: { blobID: blobID }
9145
9118
  }, { apiName: this.apiName });
9146
9119
  }
9147
- // invoice.service.ts - yeni method ekle
9148
- getInvoiceViewUrl(invoiceUUID) {
9149
- return `/api/e-donusum/invoices/get-invoice-view/${invoiceUUID}`;
9150
- }
9151
- getToken() {
9152
- return localStorage.getItem('access_token')
9153
- || sessionStorage.getItem('access_token')
9154
- || '';
9155
- }
9156
9120
  }
9157
- HitInvoiceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitInvoiceService, deps: [{ token: i1.RestService }, { token: DevexpressRestService }, { token: i3$2.HttpClient }, { token: i1.ConfigStateService }], target: i0.ɵɵFactoryTarget.Injectable });
9121
+ HitInvoiceService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitInvoiceService, deps: [{ token: i1.RestService }, { token: DevexpressRestService }], target: i0.ɵɵFactoryTarget.Injectable });
9158
9122
  HitInvoiceService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitInvoiceService, providedIn: 'root' });
9159
9123
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitInvoiceService, decorators: [{
9160
9124
  type: Injectable,
9161
9125
  args: [{
9162
9126
  providedIn: 'root',
9163
9127
  }]
9164
- }], ctorParameters: function () { return [{ type: i1.RestService }, { type: DevexpressRestService }, { type: i3$2.HttpClient }, { type: i1.ConfigStateService }]; } });
9128
+ }], ctorParameters: function () { return [{ type: i1.RestService }, { type: DevexpressRestService }]; } });
9165
9129
 
9166
9130
  class HitFileDocumentTypeService {
9167
9131
  constructor(restService, devexService) {
@@ -9216,101 +9180,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9216
9180
  class HitSharedService {
9217
9181
  constructor() {
9218
9182
  this.apiName = 'eDonusum';
9219
- /*previewFile = (base64, filename: string = 'fatura.pdf') => {
9220
- const cleanBase64 = base64.includes(',') ? base64.split(',')[1] : base64;
9221
- const bytes = Uint8Array.from(atob(cleanBase64), c => c.charCodeAt(0));
9222
-
9223
- // File objesi blob'a filename metadata'sı ekler
9224
- const file = new File([bytes], filename, { type: 'application/pdf' });
9225
- const url = URL.createObjectURL(file);
9226
-
9227
- const newTab = window.open('', '_blank');
9228
- newTab.history.pushState({}, filename, `/${filename}`);
9229
- newTab.document.write(`
9230
- <html>
9231
- <head><title>${filename}</title></head>
9232
- <body style="margin:0;overflow:hidden">
9233
- <iframe
9234
- src="${url}#toolbar=1"
9235
- style="width:100%;height:100vh;border:none;"
9236
- ></iframe>
9237
- </body>
9238
- </html>
9239
- `);
9240
-
9241
- setTimeout(() => URL.revokeObjectURL(url), 60_000);
9242
- }*/
9243
- this.previewFile = (base64, filename = 'fatura.pdf') => {
9183
+ this.previewFile = (base64) => {
9244
9184
  const cleanBase64 = base64.includes(',') ? base64.split(',')[1] : base64;
9245
9185
  const bytes = Uint8Array.from(atob(cleanBase64), c => c.charCodeAt(0));
9246
- const file = new File([bytes], filename, { type: 'application/pdf' });
9247
- const url = URL.createObjectURL(file);
9248
- const newTab = window.open('', '_blank');
9249
- newTab.history.pushState({}, filename, `/${filename}`);
9250
- newTab.document.write(`<!DOCTYPE html>
9251
- <html>
9252
- <head>
9253
- <title>${filename}</title>
9254
- <style>
9255
- * { margin:0; padding:0; box-sizing:border-box; }
9256
- body { background:#525659; font-family:sans-serif; }
9257
- #toolbar {
9258
- position:fixed; top:0; left:0; right:0; height:48px;
9259
- background:#323639; display:flex; align-items:center;
9260
- padding:0 16px; gap:16px; z-index:99;
9261
- color:white; font-size:14px;
9262
- }
9263
- #pages { margin-top:56px; display:flex; flex-direction:column; align-items:center; padding:16px; gap:16px; }
9264
- canvas { box-shadow:0 2px 8px #0006; background:white; }
9265
- </style>
9266
- </head>
9267
- <body>
9268
- <div id="toolbar">
9269
- <span>${filename}</span>
9270
- <span id="pageInfo"></span>
9271
- <button onclick="changePage(-1)" style="background:#555;color:white;border:none;padding:4px 10px;cursor:pointer;border-radius:4px">◀</button>
9272
- <button onclick="changePage(1)" style="background:#555;color:white;border:none;padding:4px 10px;cursor:pointer;border-radius:4px">▶</button>
9273
- <a href="${url}" download="${filename}"
9274
- style="margin-left:auto;background:#1976d2;color:white;padding:6px 14px;border-radius:4px;text-decoration:none">
9275
- ⬇ İndir (${filename})
9276
- </a>
9277
- </div>
9278
- <div id="pages"></div>
9279
- <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js"></script>
9280
- <script>
9281
- pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js';
9282
- let currentPage = 1, totalPages = 0, pdfDoc = null;
9283
-
9284
- pdfjsLib.getDocument('${url}').promise.then(pdf => {
9285
- pdfDoc = pdf;
9286
- totalPages = pdf.numPages;
9287
- renderPage(currentPage);
9288
- });
9289
-
9290
- function renderPage(num) {
9291
- pdfDoc.getPage(num).then(page => {
9292
- const viewport = page.getViewport({ scale: 1.5 });
9293
- const canvas = document.createElement('canvas');
9294
- canvas.width = viewport.width;
9295
- canvas.height = viewport.height;
9296
- document.getElementById('pages').innerHTML = '';
9297
- document.getElementById('pages').appendChild(canvas);
9298
- page.render({ canvasContext: canvas.getContext('2d'), viewport });
9299
- document.getElementById('pageInfo').textContent = num + ' / ' + totalPages;
9300
- });
9301
- }
9302
-
9303
- function changePage(delta) {
9304
- const next = currentPage + delta;
9305
- if (next >= 1 && next <= totalPages) {
9306
- currentPage = next;
9307
- renderPage(currentPage);
9308
- }
9309
- }
9310
- </script>
9311
- </body>
9312
- </html>
9313
- `);
9186
+ const blob = new Blob([bytes], { type: 'application/pdf' });
9187
+ const url = URL.createObjectURL(blob);
9188
+ // Yeni tab (preview)
9189
+ window.open(url, '_blank', 'noopener');
9190
+ // İstersen kısa süre sonra URL'i serbest bırak (preview açıldıktan sonra)
9314
9191
  setTimeout(() => URL.revokeObjectURL(url), 60000);
9315
9192
  };
9316
9193
  }
@@ -9540,42 +9417,13 @@ class HitInvoiceComponent {
9540
9417
  this.invoiceService.getInvoiceResponses(new Date().toISOString(), new Date().toISOString()).subscribe(() => this.dxInvoiceInstance.instance.refresh());
9541
9418
  }
9542
9419
  getInvoiceView(record) {
9543
- this.invoiceService.getInvoiceViewToken(record.uuId).subscribe(({ blobUrl, filename }) => {
9544
- const newTab = window.open('', '_blank');
9545
- newTab.document.write(`
9546
- <html>
9547
- <head>
9548
- <title>${filename}</title>
9549
- <style>
9550
- * { margin: 0; padding: 0; box-sizing: border-box; }
9551
- body { display: flex; flex-direction: column; height: 100vh; font-family: sans-serif; }
9552
- .bar {
9553
- background: #1976d2; color: white;
9554
- padding: 6px 16px; display: flex;
9555
- align-items: center; justify-content: space-between;
9556
- flex-shrink: 0;
9557
- }
9558
- .bar span { font-size: 14px; }
9559
- .bar a {
9560
- color: white; text-decoration: none; font-size: 13px;
9561
- background: rgba(255,255,255,0.2); padding: 4px 14px;
9562
- border-radius: 4px; border: 1px solid rgba(255,255,255,0.4);
9563
- }
9564
- .bar a:hover { background: rgba(255,255,255,0.35); }
9565
- iframe { flex: 1; border: none; width: 100%; }
9566
- </style>
9567
- </head>
9568
- <body>
9569
- <div class="bar">
9570
- <span>📄 ${filename}</span>
9571
- <a href="${blobUrl}" download="${filename}">⬇ İndir</a>
9572
- </div>
9573
- <iframe src="${blobUrl}"></iframe>
9574
- </body>
9575
- </html>
9576
- `);
9577
- newTab.document.close();
9578
- setTimeout(() => URL.revokeObjectURL(blobUrl), 300000);
9420
+ this.invoiceService.getInvoiceView(record.uuId).subscribe(item => {
9421
+ const source = `data:${item.mimeType};base64,${item.content}`;
9422
+ this.hitSharedService.previewFile(item.content);
9423
+ /*const link = document.createElement('a');
9424
+ link.href = source;
9425
+ link.download = `${item.filename}`;
9426
+ link.click();*/
9579
9427
  });
9580
9428
  }
9581
9429
  showAllFiles(record) {
@@ -10206,20 +10054,7 @@ class HitInboundInvoiceService {
10206
10054
  method: 'GET',
10207
10055
  url: `/api/e-donusum/invoices/get-inbound-invoice-view/${invoiceGUID}`,
10208
10056
  params: { invoiceGUID: invoiceGUID }
10209
- }, { apiName: this.apiName }).pipe(map$1(item => {
10210
- // base64 string → blob
10211
- const byteCharacters = atob(item.content);
10212
- const byteNumbers = new Array(byteCharacters.length);
10213
- for (let i = 0; i < byteCharacters.length; i++) {
10214
- byteNumbers[i] = byteCharacters.charCodeAt(i);
10215
- }
10216
- const byteArray = new Uint8Array(byteNumbers);
10217
- const blob = new Blob([byteArray], { type: 'application/pdf' });
10218
- return {
10219
- blobUrl: URL.createObjectURL(blob),
10220
- filename: item.filename || 'fatura.pdf'
10221
- };
10222
- }));
10057
+ }, { apiName: this.apiName });
10223
10058
  this.getBankAccountByCurrency = (actCurr) => this.restService.request({
10224
10059
  method: 'GET',
10225
10060
  url: '/api/e-donusum/invoices/get-bank-accounts',
@@ -10490,41 +10325,14 @@ class HitInboundInvoiceComponent {
10490
10325
  this.service.getInboundInvoice(new Date().toISOString(), new Date().toISOString()).subscribe(() => this.dxInboundInvoiceInstance.instance.refresh());
10491
10326
  }
10492
10327
  getInvoicePreview(record) {
10493
- this.service.getInboundInvoiceView(record.uuId).subscribe(({ blobUrl, filename }) => {
10494
- const newTab = window.open('', '_blank');
10495
- newTab.document.write(`
10496
- <html>
10497
- <head>
10498
- <title>${filename}</title>
10499
- <style>
10500
- * { margin: 0; padding: 0; box-sizing: border-box; }
10501
- body { display: flex; flex-direction: column; height: 100vh; font-family: sans-serif; }
10502
- .bar {
10503
- background: #1976d2; color: white;
10504
- padding: 6px 16px; display: flex;
10505
- align-items: center; justify-content: space-between;
10506
- flex-shrink: 0;
10507
- }
10508
- .bar span { font-size: 14px; }
10509
- .bar a {
10510
- color: white; text-decoration: none; font-size: 13px;
10511
- background: rgba(255,255,255,0.2); padding: 4px 14px;
10512
- border-radius: 4px; border: 1px solid rgba(255,255,255,0.4);
10513
- }
10514
- iframe { flex: 1; border: none; width: 100%; }
10515
- </style>
10516
- </head>
10517
- <body>
10518
- <div class="bar">
10519
- <span>📄 ${filename}</span>
10520
- <a href="${blobUrl}" download="${filename}">⬇ İndir</a>
10521
- </div>
10522
- <iframe src="${blobUrl}"></iframe>
10523
- </body>
10524
- </html>
10525
- `);
10526
- newTab.document.close();
10527
- setTimeout(() => URL.revokeObjectURL(blobUrl), 300000);
10328
+ debugger;
10329
+ this.service.getInboundInvoiceView(record.uuId).subscribe(item => {
10330
+ const source = `data:${item.mimeType};base64,${item.content}`;
10331
+ this.hitSharedService.previewFile(item.content);
10332
+ /*const link = document.createElement('a');
10333
+ link.href = source;
10334
+ link.download = `${item.filename}`;
10335
+ link.click();*/
10528
10336
  });
10529
10337
  }
10530
10338
  openResponseModal(record) {
@@ -10877,6 +10685,7 @@ class HitInboundInvoiceComponent {
10877
10685
  this.isModalBusyForDocument = true;
10878
10686
  const dataSource = this.dxDocumentLines.instance.getDataSource();
10879
10687
  dataSource.store().load().then((gridLines) => {
10688
+ console.log("GERÇEK DATA:", gridLines); // her zaman array
10880
10689
  if (gridLines.length == 0) {
10881
10690
  if (this.isDraft) {
10882
10691
  this.confirmation
@@ -11235,10 +11044,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
11235
11044
  }], ctorParameters: function () { return [{ type: i1$2.DomSanitizer }]; } });
11236
11045
 
11237
11046
  class HitDespatchService {
11238
- constructor(restService, devexService, http) {
11047
+ constructor(restService, devexService) {
11239
11048
  this.restService = restService;
11240
11049
  this.devexService = devexService;
11241
- this.http = http;
11242
11050
  this.apiName = 'eDonusum';
11243
11051
  this.LoadDespatches = this.devexService.createStore({
11244
11052
  key: "id",
@@ -11279,27 +11087,7 @@ class HitDespatchService {
11279
11087
  this.getDespatchView = (despatchUUID) => this.restService.request({
11280
11088
  method: 'GET',
11281
11089
  url: `/api/e-donusum/despatches/get-despatch-view/${despatchUUID}`,
11282
- }, { apiName: this.apiName }).pipe(map(item => {
11283
- let blob;
11284
- // base64 string mi yoksa byte array mi kontrol et
11285
- if (typeof item.content === 'string') {
11286
- // base64 string
11287
- const byteCharacters = atob(item.content);
11288
- const byteNumbers = new Array(byteCharacters.length);
11289
- for (let i = 0; i < byteCharacters.length; i++) {
11290
- byteNumbers[i] = byteCharacters.charCodeAt(i);
11291
- }
11292
- blob = new Blob([new Uint8Array(byteNumbers)], { type: 'application/pdf' });
11293
- }
11294
- else {
11295
- // byte[] array
11296
- blob = new Blob([new Uint8Array(item.content)], { type: 'application/pdf' });
11297
- }
11298
- return {
11299
- blobUrl: URL.createObjectURL(blob),
11300
- filename: item.filename || 'irsaliye.pdf'
11301
- };
11302
- }));
11090
+ }, { apiName: this.apiName });
11303
11091
  this.downloadFileById = (blobID) => this.restService.request({
11304
11092
  method: 'GET',
11305
11093
  url: `/api/e-donusum/despatches/download-file-by-id/${blobID}`,
@@ -11347,14 +11135,14 @@ class HitDespatchService {
11347
11135
  }, { apiName: this.apiName });
11348
11136
  }
11349
11137
  }
11350
- HitDespatchService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitDespatchService, deps: [{ token: i1.RestService }, { token: DevexpressRestService }, { token: i3$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
11138
+ HitDespatchService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitDespatchService, deps: [{ token: i1.RestService }, { token: DevexpressRestService }], target: i0.ɵɵFactoryTarget.Injectable });
11351
11139
  HitDespatchService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitDespatchService, providedIn: 'root' });
11352
11140
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: HitDespatchService, decorators: [{
11353
11141
  type: Injectable,
11354
11142
  args: [{
11355
11143
  providedIn: 'root',
11356
11144
  }]
11357
- }], ctorParameters: function () { return [{ type: i1.RestService }, { type: DevexpressRestService }, { type: i3$2.HttpClient }]; } });
11145
+ }], ctorParameters: function () { return [{ type: i1.RestService }, { type: DevexpressRestService }]; } });
11358
11146
 
11359
11147
  class HitDespatchComponent {
11360
11148
  constructor(list, service, fileDocumentTypeService, gibPartnerPkService, hitDocumentSerialService, confirmation, toasterService, hitSharedService) {
@@ -11536,41 +11324,16 @@ class HitDespatchComponent {
11536
11324
  return "";
11537
11325
  }
11538
11326
  getDespatchView(record) {
11539
- this.service.getDespatchView(record.uuId).subscribe(({ blobUrl, filename }) => {
11540
- const newTab = window.open('', '_blank');
11541
- newTab.document.write(`
11542
- <html>
11543
- <head>
11544
- <title>${filename}</title>
11545
- <style>
11546
- * { margin: 0; padding: 0; box-sizing: border-box; }
11547
- body { display: flex; flex-direction: column; height: 100vh; font-family: sans-serif; }
11548
- .bar {
11549
- background: #1976d2; color: white;
11550
- padding: 6px 16px; display: flex;
11551
- align-items: center; justify-content: space-between;
11552
- flex-shrink: 0;
11553
- }
11554
- .bar span { font-size: 14px; }
11555
- .bar a {
11556
- color: white; text-decoration: none; font-size: 13px;
11557
- background: rgba(255,255,255,0.2); padding: 4px 14px;
11558
- border-radius: 4px; border: 1px solid rgba(255,255,255,0.4);
11559
- }
11560
- iframe { flex: 1; border: none; width: 100%; }
11561
- </style>
11562
- </head>
11563
- <body>
11564
- <div class="bar">
11565
- <span>📄 ${filename}</span>
11566
- <a href="${blobUrl}" download="${filename}">⬇ İndir</a>
11567
- </div>
11568
- <iframe src="${blobUrl}"></iframe>
11569
- </body>
11570
- </html>
11571
- `);
11572
- newTab.document.close();
11573
- setTimeout(() => URL.revokeObjectURL(blobUrl), 300000);
11327
+ this.service.getDespatchView(record.uuId).subscribe(item => {
11328
+ const source = `data:${item.mimeType};base64,${item.content}`;
11329
+ // const newTab = window.open();
11330
+ // newTab.document.title = record.id
11331
+ // newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
11332
+ this.hitSharedService.previewFile(item.content);
11333
+ /*const link = document.createElement('a');
11334
+ link.href = source;
11335
+ link.download = `${item.filename}`;
11336
+ link.click();*/
11574
11337
  });
11575
11338
  }
11576
11339
  getDespatchResponses() {
@@ -11746,8 +11509,8 @@ class HitInboundDespatchService {
11746
11509
  }, { apiName: this.apiName });
11747
11510
  this.getDespatchPreviewInbound = (despatchGUID) => this.restService.request({
11748
11511
  method: 'GET',
11749
- url: `/api/e-donusum/despatches/get-html-preview-inbound/${despatchGUID}`
11750
- //params: { despatchGUID: despatchGUID}
11512
+ url: `/api/e-donusum/despatches/get-html-preview-inbound/${despatchGUID}`,
11513
+ params: { despatchGUID: despatchGUID }
11751
11514
  }, { apiName: this.apiName });
11752
11515
  }
11753
11516
  }
@@ -11876,56 +11639,12 @@ class HitInboundDespatchComponent {
11876
11639
  return "";
11877
11640
  }
11878
11641
  getInboundDespatchPreview(record) {
11642
+ debugger;
11879
11643
  this.despatchService.getDespatchPreviewInbound(record.id).subscribe(despatch => {
11880
- let htmlContent;
11881
- if (typeof despatch.previewHTML === 'string') {
11882
- htmlContent = atob(despatch.previewHTML);
11883
- }
11884
- else {
11885
- htmlContent = new TextDecoder().decode(new Uint8Array(despatch.previewHTML));
11886
- }
11887
- const filename = `Irsaliye-${record.despatchId || record.id}`;
11888
- const newTab = window.open('', '_blank');
11889
- newTab.document.open();
11890
- newTab.document.write(`
11891
- <html>
11892
- <head>
11893
- <title>${filename}</title>
11894
- <style>
11895
- * { margin: 0; padding: 0; box-sizing: border-box; }
11896
- body { display: flex; flex-direction: column; height: 100vh; font-family: sans-serif; }
11897
- .bar {
11898
- background: #1976d2; color: white;
11899
- padding: 6px 16px; display: flex;
11900
- align-items: center; justify-content: space-between;
11901
- flex-shrink: 0;
11902
- }
11903
- .bar span { font-size: 14px; }
11904
- .bar a {
11905
- color: white; text-decoration: none; font-size: 13px;
11906
- background: rgba(255,255,255,0.2); padding: 4px 14px;
11907
- border-radius: 4px; border: 1px solid rgba(255,255,255,0.4);
11908
- }
11909
- iframe { flex: 1; border: none; width: 100%; }
11910
- </style>
11911
- </head>
11912
- <body>
11913
- <div class="bar">
11914
- <span>📄 ${filename}</span>
11915
- <a id="dlBtn" download="${filename}.html">⬇ İndir</a>
11916
- </div>
11917
- <iframe id="previewFrame"></iframe>
11918
- <script>
11919
- const html = ${JSON.stringify(htmlContent)};
11920
- const blob = new Blob([html], { type: 'text/html' });
11921
- const url = URL.createObjectURL(blob);
11922
- document.getElementById('previewFrame').src = url;
11923
- document.getElementById('dlBtn').href = url;
11924
- </script>
11925
- </body>
11926
- </html>
11927
- `);
11928
- newTab.document.close();
11644
+ const source = `data:text/html;base64,${despatch.previewHTML}`;
11645
+ const newTab = window.open();
11646
+ newTab.document.title = record.id;
11647
+ newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
11929
11648
  });
11930
11649
  }
11931
11650
  }