Changes to inline report

This commit is contained in:
Fairuz
2021-09-27 11:06:38 +08:00
parent b8a145cb5c
commit 27684a2940
6 changed files with 19 additions and 13 deletions
@@ -33,14 +33,15 @@ class FetchPackingListProcessor
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function execute(){
public function execute($params){
$packingLists = PackingList::where('type', '=', PackingListType::SHIPPING_PACKING_LIST)
->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::SUSPENDED])
->whereDoesntHave('containers', function($query){
$query->where('status', '=', ApprovalStatus::COMPLETED);
})->orderBy('created_at','desc')->limit(5)->get();
})->orderBy('created_at','desc')->where('owner_id',$params['orderId'])->get();
//dd($packingLists);
$packingListsArray=[];
foreach($packingLists as $packingList){
@@ -25,7 +25,8 @@ class CustomcClearanceLogic extends AbstractControllerLogic
public function logic(Request $request) : JsonResponse
{
$packingLists = $this->listsPackingListProcessor->execute();
$params = $request->all();
$packingLists = $this->listsPackingListProcessor->execute($params);
$excelExportLogic = new ExportExcelLogic(collect($packingLists));
$this->excelExportLogic = $excelExportLogic;
@@ -9,7 +9,8 @@ use Maatwebsite\Excel\Facades\Excel;
class CustomcClearanceReportController
{
public function download(Request $request, CustomcClearanceLogic $customClearancelogic) {
public function download(int $orderId, Request $request, CustomcClearanceLogic $customClearancelogic) {
$request->merge(['orderId' => $orderId]);
$filename = date("Y-m-d H:i:s")." - Custom cleared report ";
$customClearancelogic->logic($request);
return Excel::download( $customClearancelogic->getExcelCollection(), $filename.'.xlsx');
@@ -61,6 +61,14 @@
<div class="btn btn-xs btn-success pointer" v-if="packingList.status === 5" @click="updateStatus(index, item.status === 1 ? 1 : 2)"><i class="fa fa-check m-r-5"></i>Release</div>
<div class="btn btn-xs btn-danger pointer" v-if="packingList.status !== 5" @click="updateStatus(index, 5)"><i class="fa fa-hand-paper-o m-r-5"></i>Hold</div>
</div>
<div class="col-auto" v-if="packingList.order == 2">
<a class="btn btn-xs btn-warning all-caps b-rad-none pointer" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Report&nbsp;<i class="fa fa-download m-r-10"></i>
</a>
<div class="dropdown-menu">
<a class="dropdown-item" :href="route('report.customclearance',packingList.order.id)">Origin custom cleared</a>
</div>
</div>
</div>
</div>
</div>
@@ -96,4 +104,4 @@
},
mixins: [componentHandler]
}
</script>
</script>
@@ -23,14 +23,7 @@
<div class="col"></div>
<div class="col-auto p-r-0">
<div class="btn-group">
<a class="btn btn-sm btn-warning all-caps b-rad-none pointer" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Report&nbsp;<i class="fa fa-download m-r-10"></i>
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="{{route('report.customclearance')}}">Origin custom cleared</a>
</div>
</div>
</div>
<div class="col-auto p-r-0">
<a href="{{route('orders.refresh')}}"><div class="btn btn-sm btn-warning all-caps b-rad-none pointer"><i class="fa fa-refresh m-r-10"></i>Refresh Orders</div></a>
+2
View File
@@ -109,6 +109,8 @@ Route::get('/order/{id}/download', 'Orders\DownloadOrderQrPdfController@download
Route::get('/report/customclearance', 'Reports\CustomcClearanceReportController@download')->name('report.customclearance');
Route::get('/report/customclearance/{orderid}', 'Reports\CustomcClearanceReportController@download')->name('report.customclearance');
//Route::get('/test', function(){
// $addresses = \App\Models\Address::all();
// foreach ($addresses as $address){