@hitsoft/e-donusum 1.0.72 → 1.0.74

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.
@@ -9308,10 +9308,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
9308
9308
  class HitSharedService {
9309
9309
  constructor() {
9310
9310
  this.apiName = 'eDonusum';
9311
- this.previewFile = (fileName, source) => {
9312
- const newTab = window.open();
9313
- newTab.document.title = fileName;
9314
- newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
9311
+ this.previewFile = (base64) => {
9312
+ const cleanBase64 = base64.includes(',') ? base64.split(',')[1] : base64;
9313
+ const bytes = Uint8Array.from(atob(cleanBase64), c => c.charCodeAt(0));
9314
+ const blob = new Blob([bytes], { type: 'application/pdf' });
9315
+ const url = URL.createObjectURL(blob);
9316
+ // Yeni tab (preview)
9317
+ window.open(url, '_blank', 'noopener');
9318
+ // İstersen kısa süre sonra URL'i serbest bırak (preview açıldıktan sonra)
9319
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
9315
9320
  };
9316
9321
  }
9317
9322
  }
@@ -9503,6 +9508,7 @@ class HitInvoiceComponent {
9503
9508
  getInvoiceView(record) {
9504
9509
  this.invoiceService.getInvoiceView(record.uuId).subscribe(item => {
9505
9510
  const source = `data:${item.mimeType};base64,${item.content}`;
9511
+ this.hitSharedService.previewFile(item.content);
9506
9512
  const link = document.createElement('a');
9507
9513
  link.href = source;
9508
9514
  link.download = `${item.filename}`;
@@ -9517,7 +9523,7 @@ class HitInvoiceComponent {
9517
9523
  debugger;
9518
9524
  this.invoiceService.getInvoicePreview(record.id, record.resourceDocType).subscribe(fatura => {
9519
9525
  const source = `data:text/html;base64,${fatura.previewHTML}`;
9520
- this.hitSharedService.previewFile(fatura.fileName, source);
9526
+ this.hitSharedService.previewFile(fatura.previewHTML);
9521
9527
  /* const newTab = window.open();
9522
9528
  newTab.document.title = record.id
9523
9529
  newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
@@ -9528,7 +9534,7 @@ class HitInvoiceComponent {
9528
9534
  debugger;
9529
9535
  this.invoiceService.getXMLPreview(record.id, record.resourceDocType).subscribe(fatura => {
9530
9536
  const source = `data:${fatura.mimeType};base64,${fatura.content}`;
9531
- this.hitSharedService.previewFile(fatura.fileName, source);
9537
+ this.hitSharedService.previewFile(fatura.content);
9532
9538
  /*const link = document.createElement('a');
9533
9539
  link.href = source;
9534
9540
  link.download = `${fatura.filename}`;
@@ -9560,7 +9566,7 @@ class HitInvoiceComponent {
9560
9566
  DownloadFile(record) {
9561
9567
  this.invoiceService.downloadFileById(record.contentMasterId).subscribe(item => {
9562
9568
  const source = `data:${item.mimeType};base64,${item.content}`;
9563
- this.hitSharedService.previewFile(item.fileName, source);
9569
+ this.hitSharedService.previewFile(item.content);
9564
9570
  /*const link = document.createElement('a');
9565
9571
  link.href = source;
9566
9572
  link.download = `${item.filename}`;
@@ -10392,7 +10398,7 @@ class HitInboundInvoiceComponent {
10392
10398
  debugger;
10393
10399
  this.service.getInboundInvoiceView(record.uuId).subscribe(item => {
10394
10400
  const source = `data:${item.mimeType};base64,${item.content}`;
10395
- this.hitSharedService.previewFile(item.fileName, source);
10401
+ this.hitSharedService.previewFile(item.content);
10396
10402
  /*const link = document.createElement('a');
10397
10403
  link.href = source;
10398
10404
  link.download = `${item.filename}`;
@@ -11274,7 +11280,7 @@ class HitDespatchComponent {
11274
11280
  debugger;
11275
11281
  this.service.getDespatchPreview(record.id, record.resourceDocType).subscribe(fatura => {
11276
11282
  const source = `data:text/html;base64,${fatura.previewHTML}`;
11277
- this.hitSharedService.previewFile(record.id, source);
11283
+ this.hitSharedService.previewFile(fatura.previewHTML);
11278
11284
  /*const newTab = window.open();
11279
11285
  newTab.document.title = record.id
11280
11286
  newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
@@ -11285,7 +11291,7 @@ class HitDespatchComponent {
11285
11291
  debugger;
11286
11292
  this.service.getDespatchXML(record.id, record.resourceDocType).subscribe(irsaliye => {
11287
11293
  const source = `data:${irsaliye.mimeType};base64,${irsaliye.content}`;
11288
- this.hitSharedService.previewFile(irsaliye.fileName, source);
11294
+ this.hitSharedService.previewFile(irsaliye.content);
11289
11295
  /*const link = document.createElement('a');
11290
11296
  link.href = source;
11291
11297
  link.download = `${irsaliye.filename}`;
@@ -11313,7 +11319,7 @@ class HitDespatchComponent {
11313
11319
  getDespatchView(record) {
11314
11320
  this.service.getDespatchView(record.uuId).subscribe(item => {
11315
11321
  const source = `data:${item.mimeType};base64,${item.content}`;
11316
- this.hitSharedService.previewFile(item.fileName, source);
11322
+ this.hitSharedService.previewFile(item.content);
11317
11323
  /*const link = document.createElement('a');
11318
11324
  link.href = source;
11319
11325
  link.download = `${item.filename}`;
@@ -11389,7 +11395,7 @@ class HitDespatchComponent {
11389
11395
  debugger;
11390
11396
  this.service.getReceiptAdvicePreview(record.id).subscribe(despatch => {
11391
11397
  const source = `data:text/html;base64,${despatch.previewHTML}`;
11392
- this.hitSharedService.previewFile(record.id, source);
11398
+ this.hitSharedService.previewFile(despatch.previewHTML);
11393
11399
  /* const newTab = window.open();
11394
11400
  newTab.document.title = record.id
11395
11401
  newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;