Merge branch 'branch-jagad' into 'main'
add validation for masa input See merge request fiqhpratama1/xpendify!33
This commit is contained in:
@@ -34,10 +34,10 @@ class FormEntertainmentPresentationController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.entertainment.view']);
|
||||
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
$forms = FormEntertaimentPresentation::whereMonth('tanggal', date('m'))
|
||||
->whereYear('tanggal', date('Y'))
|
||||
->where('tanggal', '<=', date('Y-m-' . env('CLOSING_DATE')))
|
||||
->whereRaw('DAY(CURDATE()) <= ' . env('CLOSING_DATE'))
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE')); // Starting date from .env for the current month
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE'); // Closing date for the next month
|
||||
|
||||
$forms = FormEntertaimentPresentation::whereBetween('tanggal', [$startDate, $closingDateNextMonth])
|
||||
->orderBy('tanggal', 'desc')
|
||||
->with('user')
|
||||
->get();
|
||||
@@ -127,6 +127,16 @@ class FormEntertainmentPresentationController extends Controller
|
||||
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||
]);
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE'));
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE');
|
||||
|
||||
if ($currentDate < $startDate || $currentDate > $closingDateNextMonth) {
|
||||
return response()->json([
|
||||
'error' => 'Current date is not within the valid range.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Entertainment')->first();
|
||||
|
||||
@@ -34,10 +34,10 @@ class FormMeetingSeminarController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.meeting.view']);
|
||||
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
$forms = FormMeetingSeminar::whereMonth('created_at', date('m'))
|
||||
->whereYear('created_at', date('Y'))
|
||||
->where('created_at', '<=', date('Y-m-' . env('CLOSING_DATE')))
|
||||
->whereRaw('DAY(CURDATE()) <= ' . env('CLOSING_DATE'))
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE')); // Starting date from .env for the current month
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE'); // Closing date for the next month
|
||||
|
||||
$forms = FormMeetingSeminar::whereBetween('created_at', [$startDate, $closingDateNextMonth])
|
||||
->orderBy('created_at', 'desc')
|
||||
->with('user')
|
||||
->get();
|
||||
@@ -128,6 +128,16 @@ class FormMeetingSeminarController extends Controller
|
||||
'bukti_hotel' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||
]);
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE'));
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE');
|
||||
|
||||
if ($currentDate < $startDate || $currentDate > $closingDateNextMonth) {
|
||||
return response()->json([
|
||||
'error' => 'Current date is not within the valid range.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Meeting / Seminar')->first();
|
||||
|
||||
@@ -30,12 +30,12 @@ class FormOtherController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.other.view']);
|
||||
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
$forms = FormOthers::whereMonth('tanggal', date('m'))
|
||||
->whereYear('tanggal', date('Y'))
|
||||
->where('tanggal', '<=', date('Y-m-' . env('CLOSING_DATE')))
|
||||
->whereRaw('DAY(CURDATE()) <= ' . env('CLOSING_DATE'))
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE')); // Starting date from .env for the current month
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE'); // Closing date for the next month
|
||||
|
||||
$forms = FormOthers::whereBetween('tanggal', [$startDate, $closingDateNextMonth])
|
||||
->orderBy('tanggal', 'desc')
|
||||
->with(['user', 'kategori'])
|
||||
->with('user')
|
||||
->get();
|
||||
|
||||
$availableBudget = null;
|
||||
@@ -124,6 +124,16 @@ class FormOtherController extends Controller
|
||||
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||
]);
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE'));
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE');
|
||||
|
||||
if ($currentDate < $startDate || $currentDate > $closingDateNextMonth) {
|
||||
return response()->json([
|
||||
'error' => 'Current date is not within the valid range.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('id', $request->kategori_id)->first();
|
||||
|
||||
@@ -34,10 +34,10 @@ class FormUpCountryController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.country.view']);
|
||||
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
$forms = FormUpCountry::whereMonth('tanggal', date('m'))
|
||||
->whereYear('tanggal', date('Y'))
|
||||
->where('tanggal', '<=', date('Y-m-' . env('CLOSING_DATE')))
|
||||
->whereRaw('DAY(CURDATE()) <= ' . env('CLOSING_DATE'))
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE')); // Starting date from .env for the current month
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE'); // Closing date for the next month
|
||||
|
||||
$forms = FormUpCountry::whereBetween('tanggal', [$startDate, $closingDateNextMonth])
|
||||
->orderBy('tanggal', 'desc')
|
||||
->with(['rayon', 'user'])
|
||||
->get();
|
||||
@@ -140,6 +140,16 @@ class FormUpCountryController extends Controller
|
||||
'bukti_hotel' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||
]);
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE'));
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE');
|
||||
|
||||
if ($currentDate < $startDate || $currentDate > $closingDateNextMonth) {
|
||||
return response()->json([
|
||||
'error' => 'Current date is not within the valid range.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Up Country')->first();
|
||||
|
||||
@@ -34,10 +34,10 @@ class FormVehicleController extends Controller
|
||||
$this->checkAuthorization(auth()->user(), ['forms.vehicle.view']);
|
||||
|
||||
$role = auth()->user()->getRoleNames()[0];
|
||||
$forms = FormVehicleRunningCost::whereMonth('tanggal', date('m'))
|
||||
->whereYear('tanggal', date('Y'))
|
||||
->where('tanggal', '<=', date('Y-m-' . env('CLOSING_DATE')))
|
||||
->whereRaw('DAY(CURDATE()) <= ' . env('CLOSING_DATE'))
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE')); // Starting date from .env for the current month
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE'); // Closing date for the next month
|
||||
|
||||
$forms = FormVehicleRunningCost::whereBetween('tanggal', [$startDate, $closingDateNextMonth])
|
||||
->orderBy('tanggal', 'desc')
|
||||
->with('user')
|
||||
->get();
|
||||
@@ -128,6 +128,16 @@ class FormVehicleController extends Controller
|
||||
'bukti_total' => ['nullable', 'file', 'max:51200', new FileType(['php', 'exe', 'js', 'sh', 'bat', 'exe', 'sh', 'php', 'vbs'])],
|
||||
]);
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
$startDate = date('Y-m-' . env('STARTING_DATE'));
|
||||
$closingDateNextMonth = date('Y-m-', strtotime('+1 month')) . env('CLOSING_DATE');
|
||||
|
||||
if ($currentDate < $startDate || $currentDate > $closingDateNextMonth) {
|
||||
return response()->json([
|
||||
'error' => 'Current date is not within the valid range.'
|
||||
], 400);
|
||||
}
|
||||
|
||||
$cabang = UserHasCabang::with('cabang')->where('user_id', auth()->user()->id)->first()->cabang;
|
||||
$region = Region::where('id', $cabang->region_id)->first();
|
||||
$kategori = Kategori::where('name', 'Vehicle Running Cost')->first();
|
||||
|
||||
@@ -22,6 +22,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<style>
|
||||
#loading-spinner-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
|
||||
z-index: 9999; /* High z-index to cover everything */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.spinner-wrapper {
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
|
||||
@@ -22,6 +22,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<style>
|
||||
#loading-spinner-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black background */
|
||||
z-index: 9999; /* High z-index to cover everything */
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.spinner-wrapper {
|
||||
text-align: center;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="card card-primary card-outline">
|
||||
|
||||
Reference in New Issue
Block a user