mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
Merge conflict fix
This commit is contained in:
@@ -30,8 +30,9 @@ class BookingController extends Controller
|
||||
// set timeout
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
$time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
$difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
|
||||
// TODO : you can make it better
|
||||
if($difference_in_seconds < 0 ){
|
||||
@@ -95,7 +96,7 @@ class BookingController extends Controller
|
||||
// TODO : transfer_amount change name to bia
|
||||
$booking->transfer_amount = $booking->bia;
|
||||
|
||||
$booking->track_status = "(". $booking->admin_status ."/8)";
|
||||
$booking->track_status = "(". $booking->admin_status ."/7)";
|
||||
switch ($booking->admin_status) {
|
||||
case 1:
|
||||
$status_desc = "Waiting customer upload bank slip";
|
||||
@@ -126,52 +127,96 @@ class BookingController extends Controller
|
||||
}
|
||||
$booking->status_desc = $status_desc;
|
||||
}
|
||||
|
||||
return $bookings;
|
||||
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id', $id)->first();
|
||||
// just added to try
|
||||
|
||||
$user_bankslip = $booking->userBankSlip()->first();
|
||||
|
||||
if ($user_bankslip){
|
||||
$booking->user_bankslip_path = Storage::url($user_bankslip->bankslip_path);
|
||||
}
|
||||
$china_bankslip = $booking->chinaBankSlip()->first();
|
||||
$po = $booking->purchaseOrder()->first();
|
||||
$invoice = $booking->invoice()->first();
|
||||
|
||||
if($booking){
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U'));
|
||||
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
|
||||
if ($user_bankslip){
|
||||
$booking->user_bankslip_path = Storage::url($user_bankslip->bankslip_path);
|
||||
$booking->reject_reason = $user_bankslip->reject_reason;
|
||||
$date1 = new DateTime($user_bankslip->updated_at);
|
||||
}
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['success'=>false, 'message'=>'not found'], 404);
|
||||
}
|
||||
return $booking;
|
||||
if($china_bankslip){
|
||||
$booking->china_bankslip_path = Storage::url($china_bankslip->china_bank_slip_path);
|
||||
}
|
||||
|
||||
if($po){
|
||||
$booking->user_po_path = Storage::url($po->image_path);
|
||||
}
|
||||
|
||||
if($invoice){
|
||||
$booking->invoice_path = Storage::url($invoice->invoice_path);
|
||||
}
|
||||
|
||||
// set timeout
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
$difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['success'=>false, 'message'=>'not found'], 404);
|
||||
}
|
||||
|
||||
return $booking;
|
||||
}
|
||||
}
|
||||
|
||||
public function adminShow($id)
|
||||
{
|
||||
$booking = Booking::where('id', $id)->first();
|
||||
$user_bankslip_path = $booking->userBankSlip()->first()->bankslip_path;
|
||||
$booking->user_bankslip_path = Storage::url($user_bankslip_path);
|
||||
$booking = Booking::where('id', $id)->firstOrFail();
|
||||
|
||||
|
||||
$user_bankslip = $booking->userBankSlip()->first();
|
||||
$china_bankslip = $booking->chinaBankSlip()->first();
|
||||
$po = $booking->purchaseOrder()->first();
|
||||
$invoice = $booking->invoice()->first();
|
||||
|
||||
if($booking){
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$difference_in_seconds = ($date1->format('U') + 600) - ($date2->format('U'));
|
||||
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
if ($user_bankslip){
|
||||
$booking->user_bankslip_path = Storage::url($user_bankslip->bankslip_path);
|
||||
$booking->reject_reason = $user_bankslip->reject_reason;
|
||||
$date1 = new DateTime($user_bankslip->updated_at);
|
||||
}
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['success'=>false, 'message'=>'not found'], 404);
|
||||
}
|
||||
return $booking;
|
||||
if($china_bankslip){
|
||||
$booking->china_bankslip_path = Storage::url($china_bankslip->china_bank_slip_path);
|
||||
}
|
||||
|
||||
if($po){
|
||||
$booking->user_po_path = Storage::url($po->image_path);
|
||||
}
|
||||
|
||||
if($invoice){
|
||||
$booking->invoice_path = Storage::url($invoice->invoice_path);
|
||||
}
|
||||
|
||||
// set timeout
|
||||
$date1 = new DateTime($booking->created_at);
|
||||
$date2 = new DateTime();
|
||||
$time_in_seconds = SettingCredit::orderby('updated_at','desc')->first()->time_limit;
|
||||
$difference_in_seconds = ($date1->format('U') + $time_in_seconds) - ($date2->format('U'));
|
||||
$booking->timeout = $difference_in_seconds;
|
||||
|
||||
if (!$booking){
|
||||
return response()->json(['success'=>false, 'message'=>'not found'], 404);
|
||||
}
|
||||
return $booking;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,6 +377,7 @@ class BookingController extends Controller
|
||||
return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400);
|
||||
}
|
||||
|
||||
|
||||
if($bankslip_file = $request->file('file'))
|
||||
{
|
||||
/* End Validation */
|
||||
@@ -346,7 +392,12 @@ class BookingController extends Controller
|
||||
'user_bankslip', $bankslip_file, $unique_image_path
|
||||
);
|
||||
|
||||
$user_bankslip = new UserBankSlip;
|
||||
$user_bankslip = $booking->userBankSlip()->first();
|
||||
|
||||
// if user bankslip not exist, create new one
|
||||
if(!$user_bankslip){
|
||||
$user_bankslip = new UserBankSlip;
|
||||
}
|
||||
$user_bankslip->booking_id = $booking->id;
|
||||
$user_bankslip->bankslip_path = $upload_path;
|
||||
$user_bankslip->transfer_amount = $request->input('transfer_amount');
|
||||
@@ -444,7 +495,7 @@ class BookingController extends Controller
|
||||
return response()->json(['user_po_path'=> $user_po->image_path ],200);
|
||||
}
|
||||
|
||||
return response()->json(['message'=> 'waiting customer to upload their po'],400);
|
||||
return response()->json(['message'=> 'waiting customer to upload their po'], 200);
|
||||
}
|
||||
|
||||
public function delete(Booking $book_id)
|
||||
@@ -545,12 +596,13 @@ class BookingController extends Controller
|
||||
}
|
||||
|
||||
// Rejected bankslip cannot be approve again
|
||||
if($userBankSlip->is_reject == 1)
|
||||
{
|
||||
return response()->json(['message'=>'Bankslip already rejected'],200);
|
||||
}
|
||||
// if($userBankSlip->is_reject == 1)
|
||||
// {
|
||||
// return response()->json(['message'=>'Bankslip already rejected'],200);
|
||||
// }
|
||||
|
||||
$userBankSlip->is_approve = 1;
|
||||
$userBankSlip->is_reject = 0;
|
||||
$userBankSlip->estimated_arrival_time = $request->input('estimated_arrival_time');
|
||||
$userBankSlip->save();
|
||||
|
||||
@@ -582,13 +634,12 @@ class BookingController extends Controller
|
||||
}
|
||||
|
||||
$userBankSlip->is_reject = 1;
|
||||
$userBankSlip->reject_reason = $request->reject_reason;
|
||||
$userBankSlip->reject_reason = $request->input('reject_reason');
|
||||
$userBankSlip->save();
|
||||
|
||||
// TODO : reject user bankinslip
|
||||
// update booking status
|
||||
$booking->status = 0;
|
||||
$booking->admin_status = 0;
|
||||
$booking->status = 2; // upload user bankslip
|
||||
$booking->admin_status = 1; // user booking
|
||||
$booking->save();
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
@@ -667,7 +718,8 @@ class BookingController extends Controller
|
||||
return response()->json(["message"=> "Please upload your purchase order"],400);
|
||||
}
|
||||
|
||||
$booking->status = 6;
|
||||
$booking->status = 6; // wait invoice
|
||||
$booking->admin_status = 6; // upload invoice
|
||||
$booking->save();
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user