Upload Files Booking, Mails, Attachments,
This commit is contained in:
parent
5daea268f7
commit
68b9d1ff88
92 changed files with 2837 additions and 1778 deletions
|
|
@ -4,7 +4,9 @@ namespace App\Http\Controllers;
|
|||
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingDraftItem;
|
||||
use App\Models\BookingFile;
|
||||
use App\Models\Customer;
|
||||
use App\Repositories\BookingFileRepository;
|
||||
use App\Repositories\BookingRepository;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use App\Repositories\DraftRepository;
|
||||
|
|
@ -43,6 +45,7 @@ class BookingController extends Controller
|
|||
$data = [
|
||||
'booking' => $booking,
|
||||
'id' => $id,
|
||||
|
||||
];
|
||||
return view('booking.detail', $data);
|
||||
|
||||
|
|
@ -186,17 +189,35 @@ class BookingController extends Controller
|
|||
public function loadModal(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if(Request::ajax()){
|
||||
$data['customers'] = [];
|
||||
if($data['action'] === "new-customer-mail" && isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])){
|
||||
$tmp = [];
|
||||
$tmp['email'] = $booking->customer ? $booking->customer->email : "";
|
||||
$tmp['name'] = $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | ";
|
||||
$tmp['name'] .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | ";
|
||||
$tmp['name'] .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-";
|
||||
$data['customers'][$booking->id] = $tmp;
|
||||
if(Request::ajax()) {
|
||||
if ($data['action'] === "new-customer-mail" || $data['action'] === "reply-customer-mail" || $data['action'] === "show-customer-mail" || $data['action'] === "edit-customer-mail"){
|
||||
$data['customers'] = [];
|
||||
if ($data['action'] === "new-customer-mail" && isset($data['booking_id']) && $booking = Booking::find($data['booking_id'])) {
|
||||
$tmp = [];
|
||||
$tmp['email'] = $booking->customer ? $booking->customer->email : "";
|
||||
$tmp['name'] = $booking->customer ? $booking->customer->firstname . " " . $booking->customer->name . " | " : "- | ";
|
||||
$tmp['name'] .= $booking->travel_country_id ? $booking->travel_country->name . " | " : "- | ";
|
||||
$tmp['name'] .= $booking->travelagenda_id ? $booking->travel_agenda->name . "" : "-";
|
||||
$data['customers'][$booking->id] = $tmp;
|
||||
}
|
||||
$ret = CustomerMailRepository::loadModal($data);
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === "modal-upload-booking-file") {
|
||||
$ret = view("booking.upload_modal", compact('data'))->render();
|
||||
}
|
||||
|
||||
if($data['action'] === "upload-booking-file"){
|
||||
if($data['booking_id']){
|
||||
$bookingFileRepo = new BookingFileRepository(new BookingFile());
|
||||
$bookingFileRepo->_set('disk', 'booking');
|
||||
$bookingFileRepo->_set('booking_id', $data['booking_id']);
|
||||
$bookingFileRepo->_set('dir', '/files/'.date('Y/m').'/');
|
||||
$bookingFileRepo->_set('identifier', 'booking');
|
||||
return $bookingFileRepo->uploadFile(Request::all());
|
||||
}
|
||||
}
|
||||
$ret = CustomerMailRepository::loadModal($data);
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue