mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
feat: displays table on new address
This commit is contained in:
+102
@@ -539,6 +539,108 @@ Route::get('/group/text/{id}', function($id){
|
||||
}
|
||||
})->name('group.text');
|
||||
|
||||
Route::get('/group/excel/{id}', function($id){
|
||||
|
||||
$group = \App\Models\Group::where('id', $id)->first();
|
||||
|
||||
echo '<title>Transaction Details</title>';
|
||||
echo '<style>';
|
||||
echo 'table {';
|
||||
echo ' border-collapse: collapse;';
|
||||
echo ' width: 100%;';
|
||||
echo '}';
|
||||
echo 'th, td {';
|
||||
echo ' border: 1px solid black;';
|
||||
echo ' padding: 8px;';
|
||||
echo ' text-align: left;';
|
||||
echo '}';
|
||||
echo 'th {';
|
||||
echo ' background-color: #f2f2f2;';
|
||||
echo '}';
|
||||
echo '</style>';
|
||||
echo '</head>';
|
||||
echo '<body>';
|
||||
|
||||
echo '<h2>Transaction Details</h2>';
|
||||
|
||||
|
||||
echo '<table>';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th>RATE</th>';
|
||||
echo '<th>DATE</th>';
|
||||
echo '<th>No.</th>';
|
||||
echo '<th>Bank Details</th>';
|
||||
echo '<th>Bank Name</th>';
|
||||
echo '<th>Bank Branch</th>';
|
||||
echo '<th>Bank Account Number</th>';
|
||||
echo '<th>Order Amount</th>';
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
|
||||
foreach ($group->transactions as $i => $transaction) {
|
||||
$booking = $transaction->owner->owner;
|
||||
echo '<tr>';
|
||||
echo '<td>' . $group->currency_rate . '</td>';
|
||||
echo '<td>' . $group->created_at . '</td>';
|
||||
echo '<td>' . ($i + 1) . '</td>';
|
||||
echo '<td>' . $booking->bank->holder_name . '</td>';
|
||||
echo '<td>' . $booking->bank->bank_name . '</td>';
|
||||
echo '<td>' . $booking->bank->bank_branch . '</td>';
|
||||
echo '<td>' . $booking->bank->account_no . '</td>';
|
||||
echo '<td>' . $transaction->original_currency->short_code . ' ' . round($transaction->original_amount, 2) . '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
|
||||
echo '</body>';
|
||||
|
||||
|
||||
/*
|
||||
$group = \App\Models\Group::where('id', $id)->first();
|
||||
|
||||
// Send headers to tell the browser it's a CSV file with UTF-8 encoding
|
||||
header('Content-Type: text/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename="transactions.csv"');
|
||||
|
||||
// Create a file handle for output
|
||||
$output = fopen('php://output', 'w');
|
||||
|
||||
// Write the BOM (Byte Order Mark) to indicate UTF-8 encoding
|
||||
fputs($output, "\xEF\xBB\xBF");
|
||||
|
||||
// Write the headers row
|
||||
fputcsv($output, ['RATE', 'DATE', 'No.', 'Bank Details', 'Bank Name', 'Bank Branch', 'Bank Account Number', 'Order Amount']);
|
||||
|
||||
// Loop through transactions
|
||||
foreach ($group->transactions as $i => $transaction) {
|
||||
$booking = $transaction->owner->owner;
|
||||
|
||||
// Write transaction details row
|
||||
fputcsv($output, [
|
||||
$group->currency_rate,
|
||||
$group->created_at,
|
||||
$i + 1,
|
||||
$booking->bank->holder_name,
|
||||
$booking->bank->bank_name,
|
||||
$booking->bank->bank_branch,
|
||||
'"' . $booking->bank->account_no . '"',
|
||||
$transaction->original_currency->short_code . ' ' . round($transaction->original_amount, 2),
|
||||
]);
|
||||
}
|
||||
|
||||
// Close the file handle
|
||||
fclose($output);
|
||||
|
||||
// Exit to prevent any additional output
|
||||
exit();
|
||||
*/
|
||||
|
||||
})->name('group.excel');
|
||||
|
||||
Route::get('/wallet/audit', function (Request $request) {
|
||||
$wallets = \App\Models\Wallet::all();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user