list pending orders in table format

This commit is contained in:
omair saleh
2022-08-10 11:10:53 +08:00
parent 0af599041c
commit 91be2c8f77
+24
View File
@@ -10,6 +10,7 @@ use App\Models\Booking;
use App\Models\Company;
use App\Models\Transaction;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Maatwebsite\Excel\Excel;
@@ -245,3 +246,26 @@ Route::get('/segments', function (Request $request) {
return view('pages.segments.index', compact('segment'));
})->name('segments');
Route::get('/pending_orders', function(){
$payments = Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Booking::class)->whereIn('status', [ApprovalStatus::APPROVED])->get();
echo '<table>';
$i = 0;
foreach ($payments as $payment){
$booking = $payment->owner;
echo '<tr>';
echo '<td>'.$payment->update_at.'</td>';
echo '<td>'.$booking->marking.'</td>';
echo '<td>'.\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_METHODS_ID[$payment->payment_method].'</td>';
echo '<td>'.$payment->amount.' '.$payment->currency->short_code.'</td>';
echo '<td>'.$booking->company->reference.'</td>';
echo '<td></td>';
echo '<td>'.$payment->original_amount.' '.$payment->original_currency->short_code.'</td>';
echo '<td></td>';
echo '<td>'.$booking->service->name.'</td>';
echo '<td>'.$payment->update_at->diffForHumans().'</td>';
echo '</tr>';
}
echo '</table>';
});