mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
feat: pdf export
This commit is contained in:
@@ -19,6 +19,13 @@
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Export</div>
|
||||
<!-- pdf format output button-->
|
||||
<a :href="route('group.pdf', item.id)" target="_blank">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<!-- txt format output button-->
|
||||
<a :href="route('group.text', item.id)" target="_blank">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
@@ -26,12 +33,19 @@
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<!-- xlsl format output button-->
|
||||
<!-- csv format output button-->
|
||||
<a :href="route('group.excel', item.id)" target="_blank">
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa solid fa-file-excel-o"></i>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<!-- invoice format output button
|
||||
|
||||
<button class="btn btn-xs b-rad-none">
|
||||
<i class="fa fa-list-alt" aria-hidden="true"></i>
|
||||
</button>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\DownloadMockUpWhiteFormPdfLogic;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
|
||||
use App\Http\Controllers\Accounting\BankStatementController;
|
||||
use App\Models\Remark;
|
||||
@@ -9,6 +10,7 @@ use App\Models\Wallet;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Company;
|
||||
use App\Models\Transaction;
|
||||
use Dompdf\Dompdf;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
@@ -536,6 +538,32 @@ Route::get('/group/text/{id}', function($id){
|
||||
}
|
||||
})->name('group.text');
|
||||
|
||||
route::get('/group/pdf/{id}', function ($id) {
|
||||
$group = \App\Models\Group::where('id', $id)->first();
|
||||
$supplier = $group->issuerCompany;
|
||||
|
||||
$transferFeeTransactions = $group->transactions()
|
||||
->with(['transactions' => function ($transaction) {
|
||||
return $transaction->where('type', TransactionType::TRANSFER_FEE);
|
||||
}])
|
||||
->get()
|
||||
->pluck('transactions')
|
||||
->flatten();
|
||||
|
||||
$html = view('pages.pdfs.currency_vendor_order', [
|
||||
'transactions' => $group->transactions,
|
||||
'transferFeeTransactions' => $transferFeeTransactions,
|
||||
'supplier' => $supplier
|
||||
])->render();
|
||||
|
||||
$dompdf = new Dompdf();
|
||||
$dompdf->loadHtml($html);
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
$dompdf->render();
|
||||
|
||||
return $dompdf->stream("group_pdf_{$id}.pdf");
|
||||
})->name('group.pdf');
|
||||
|
||||
route::get('/export/excel/{id}', 'Exports\ExportCustomersToExcelController@exportCurrencyVendorOrder');
|
||||
route:: get('/group/excel/{id}',function ($id) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user