Files
exchange/routes/web.php

90 lines
3.5 KiB
PHP

<?php
use App\InvoiceStatuses;
use Carbon\Carbon;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', 'WelcomeController@index');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
Route::get('/po-approval', function(){
$approvedInvoices = InvoiceStatuses::where(function($q) {
$q->where('status', 'approve')
->orWhere('status', 'request_change');
})->distinct()->get(['invoice_id'])->pluck('invoice_id');
$invoices = InvoiceStatuses::whereNotIn('invoice_id', $approvedInvoices)->get();
echo "<h1>Total PO Pending Approval:<b>".count($invoices)."</b></h1>";
foreach ($invoices as $invoice){
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$invoice->invoice->booking->id."/upload-invoice'>".$invoice->invoice->booking->id."</a><br>";
}
})->name('po.approval');
Route::get('/old-invoices', function(){
$bookings = \App\Booking::where('status', 6)->where('user_id', '!=', 1)->whereHas('purchaseOrder', function($q){
$q->whereNotNull('image_path');
})->get();
$months = $bookings->groupBy(function($item) {
return $item->created_at->format('Y-m');
});
echo "<h1>Total pending invoices:<b>".count($bookings)."</b></h1>";
foreach ($months as $month => $bookings) {
echo "<h3>".$month."(".count($bookings).")</h3><br>";
foreach ($bookings as $booking) {
echo "<a target='_blank' href='https://exchange.cief-malaysia.com/booking/".$booking->id."/upload-invoice'>".$booking->id."</a> <small>date: ".$booking->created_at."</small><br>";
}
echo "<br><br><br>";
}
})->name('invoice.old');
Route::group(['middleware' => ['role:admin']], function() {
Route::get('bulkBookings', function () {
return view('booking.bulkBooking');
})->name('booking.bulk.form');
Route::post('/bulkBookings', 'BulkBookingController@index')->name('booking.bulk');
});
Route::get('{path}', 'WelcomeController@index')->where('path', '(.*)');
Auth::routes();
//Route::get('/home', 'WelcomeController@index')->name('home');
//
//<Start Announcement Routes>
//
//create data
Route::get('/announcement/create', 'Announcement\CreateAnnouncementController@create')->name('announcement.create');
//store data
Route::post('/announcement/post', 'Announcement\PostAnnouncementController@store')->name('announcement.post');
//list all data
Route::get('/announcements/view', 'Announcement\ViewAnnouncementsController@index')->name('announcements.view');
//list a data
Route::get('/announcement/{id}/view', 'Announcement\ViewAnnouncementController@show')->name('announcement.view');
//edit data
Route::get('/announcement/{id}/edit', 'Announcement\EditAnnouncementController@edit')->name('announcement.edit');
//update data
Route::put('/announcement/{id}/update', 'Announcement\UpdateAnnouncementController@update')->name('announcement.update');
//delete data
Route::delete('/announcement/{id}/delete', 'Announcement\DeleteAnnouncementController@destroy')->name('announcement.delete');
//
//</Start Announcement Routes>
//
//Route::get('/man', 'man');