Laravel Vapor - New UI for admin to download reports (sync code from Shipping Portal)

This commit is contained in:
Dillon Ngo
2024-10-12 14:54:01 +08:00
parent 060cd62381
commit 0a8794cb9a
3 changed files with 61 additions and 10 deletions
@@ -58,9 +58,11 @@
} else {
console.error('Request failed with status:', response.status);
}
this.isDownloading = false;
})
.catch((error) => {
console.error('Network error:', error);
this.isDownloading = false;
});
},
handleClick(){
@@ -74,6 +76,7 @@
}
else{
window.open(this.url, '_blank');
this.isDownloading = false;
}
},
successHandler(response) {
@@ -0,0 +1,44 @@
@extends('layouts.base_portal')
@section('inner_content')
<div class="row d-none" :class="[{'d-flex': $store.getters.isAdmin}]" v-if="$store.getters.isAdmin">
<!-- Group 1: XXX Downloads -->
<div class="col-12">
<!-- <h4>Packaging Downloads</h4> -->
<div class="row">
<div class="col-md-6">
<div class="card mb-3">
<div class="card-body d-flex justify-content-between align-items-center">
<span>customers.csv</span>
<open-link-in-new-tab-component custom-class="btn btn-primary" :url="route('customer.export')">
<i class="fa fa-download"></i> Download
</open-link-in-new-tab-component>
</div>
</div>
</div>
</div>
</div>
<!-- Group 2: XXX Downloads -->
<div class="col-12">
<!-- <h4>Order Downloads</h4>
<div class="row">
<div class="col-md-6">
<div class="card mb-3">
<div class="card-body d-flex justify-content-between align-items-center">
<div>
<span>customer-latest-order-date.csv</span>
<p class="text-muted mb-0">(last 12 months)</p>
</div>
<open-link-in-new-tab-component custom-class="btn btn-primary" :url="route('customer.latest.order.date.export')" :is-url-protected="true">
<i class="fa fa-download"></i> Download
</open-link-in-new-tab-component>
</div>
</div>
</div>
</div> -->
</div>
</div>
@endsection
+14 -10
View File
@@ -289,7 +289,7 @@ Route::get('billplz/bills/{bill_no}', function($bill_no){
})->name('billplz.bill');
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export')->name('customer.export');
Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions');
Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('newDebtor.export');
Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export');
@@ -1234,14 +1234,18 @@ Route::get('check-duplicate-refunds', function () {
});
//Laravel Vapor - Starts
Route::get('/aws-image-upload', 'AWS\AWSImageUploadController@imageUpload')->name('aws.image.upload');
Route::post('/aws-image-upload', 'AWS\AWSImageUploadController@imageUploadPost')->name('aws.image.upload.post');
Route::get('/aws-image/{filename}', 'AWS\AWSImageUploadController@displayImage')->name('aws.image.displayImage');
// Route::get('/aws-image-upload', 'AWS\AWSImageUploadController@imageUpload')->name('aws.image.upload');
// Route::post('/aws-image-upload', 'AWS\AWSImageUploadController@imageUploadPost')->name('aws.image.upload.post');
// Route::get('/aws-image/{filename}', 'AWS\AWSImageUploadController@displayImage')->name('aws.image.displayImage');
Route::get('/token', function (Request $request) {
$token = $request->session()->token();
echo $token;
$token = csrf_token();
echo $token;
});
// Route::get('/token', function (Request $request) {
// $token = $request->session()->token();
// echo $token;
// $token = csrf_token();
// echo $token;
// });
Route::get('/downloads', function () {
return view('pages.downloads.index');
})->name('admin.download');
//Laravel Vapor - Ends