diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..315b01a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,12 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "post-update-cmd", + "type": "shell", + "command": "composer run-script post-update-cmd", + } + ] +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/ReportController.php b/app/Http/Controllers/Admin/ReportController.php index 7c8366b..6754f02 100755 --- a/app/Http/Controllers/Admin/ReportController.php +++ b/app/Http/Controllers/Admin/ReportController.php @@ -43,7 +43,7 @@ class ReportController extends Controller private function prozessBookingSearch() { - $query = Booking::with( 'customer', 'lead', 'service_provider_entries', 'service_provider_entries.service_provider')->select('booking.*'); + $query = Booking::with( 'customer', 'lead', 'booking_strono','service_provider_entries', 'service_provider_entries.service_provider')->select('booking.*'); if(Request::get('filter_travel_date_from') != ""){ $travel_date_from = Carbon::parse(Request::get('filter_travel_date_from'))->format("Y-m-d"); @@ -106,6 +106,9 @@ class ReportController extends Controller ->addColumn('booking_date', function (Booking $booking) { return $booking->getBookingDateFormat(); }) + ->addColumn('booking_strono_date', function (Booking $booking) { + return $booking->booking_strono ? $booking->booking_strono->storno_date->format("d.m.Y") : ""; + }) ->addColumn('service_provider.names', function (Booking $booking) { $ret = ""; if($booking->service_provider_entries){ @@ -154,7 +157,6 @@ class ReportController extends Controller public function bookingsExport(){ - $query = $this->prozessBookingSearch(); $order = explode(",", Request::get('order')); @@ -183,6 +185,7 @@ class ReportController extends Controller $headers = array( 'BuchungsID', 'Status', + 'Storno', 'MyJack Nr.', 'Organisation', 'Reisepreis', @@ -206,6 +209,7 @@ class ReportController extends Controller $total_amount_final = 0; foreach($exports as $export) { + $storno_date = $export->booking_strono ? $export->booking_strono->storno_date->format("d.m.Y") : ""; if($export->service_provider_entries->count()){ $new = true; foreach ($export->service_provider_entries as $service_provider_entry){ @@ -218,6 +222,7 @@ class ReportController extends Controller $columns[] = array( 'BuchungsID' => $new ? $export->id : "", 'Status' => $new ? $export->lead->status->name : "", + 'Storno' => $new ? $storno_date : "", 'MyJack Nr.' => $new ? $export->merlin_order_number : "", 'Organisation' => $new ? $export->price : "", 'Reisepreis' => $new ? $export->price_total : "", @@ -243,6 +248,7 @@ class ReportController extends Controller $columns[] = array( 'BuchungsID' => $export->id, 'Status' => $export->lead->status->name, + 'Storno' => $storno_date, 'MyJack Nr.' => $export->merlin_order_number, 'Organisation' => $export->price, 'Reisepreis' => $export->price_total, @@ -266,6 +272,7 @@ class ReportController extends Controller $columns[] = array( 'BuchungsID' => "Total", 'Status' => "", + 'Storno' => "", 'MyJack Nr.' => "", 'Organisation' => Util::_number_format($total_price), 'Reisepreis' => Util::_number_format($total_price_total), diff --git a/app/Http/Controllers/BookingController.php b/app/Http/Controllers/BookingController.php index 3e68753..8c0800b 100755 --- a/app/Http/Controllers/BookingController.php +++ b/app/Http/Controllers/BookingController.php @@ -2,15 +2,16 @@ 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; use Request; +use App\Models\Booking; +use App\Models\Customer; +use App\Models\BookingFile; +use App\Models\BookingNotice; +use App\Models\BookingDraftItem; +use App\Repositories\DraftRepository; +use App\Repositories\BookingRepository; +use App\Repositories\BookingFileRepository; +use App\Repositories\CustomerMailRepository; class BookingController extends Controller { @@ -63,7 +64,12 @@ class BookingController extends Controller \Session()->flash('alert-save', '1'); return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice"); } - + if($data['action'] === 'edit_notice'){ + $booking = $this->bookingRepo->updateNotice($id, $data); + \Session()->flash('alert-save', '1'); + return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice"); + } + if($data['action'] === 'update_booking'){ $booking = $this->bookingRepo->updateBooking($id, $data); \Session()->flash('alert-save', '1'); @@ -220,6 +226,11 @@ class BookingController extends Controller $ret = view("booking.upload_modal", compact('data'))->render(); } + if($data['action'] === "edit_notice") { + $value = BookingNotice::findOrFail($data['id']); + $ret = view("booking.edit_notice_modal", compact('data', 'value'))->render(); + } + if($data['action'] === "upload-booking-file"){ if($data['booking_id']){ $bookingFileRepo = new BookingFileRepository(new BookingFile()); @@ -274,6 +285,14 @@ class BookingController extends Controller \Session()->flash('alert-success', 'Datei gelöscht'); return redirect(route('booking_detail', [$booking->id])); } + if($del === 'booking_notice'){ + $booking_notice = BookingNotice::findOrFail($id); + $booking = $booking_notice->booking; + $booking_notice->delete(); + \Session()->flash('alert-success', 'Notiz gelöscht'); + return redirect(route('booking_detail', [$booking->id])); + } + if($del === 'passolution_file'){ $booking = Booking::findOrFail($id); $booking->resyncPassolutionPDF(); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 829f031..66ccc2d 100755 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\BookingNotice; use App\Models\SfGuardUser; +use App\Models\TravelUserBookingFewoNotice; use App\User; use Auth; use Carbon\Carbon; @@ -42,10 +43,12 @@ class HomeController extends Controller return redirect('login'); } - $last_booking_notices = BookingNotice::orderBy('created_at', 'DESC')->limit(10)->get(); + $last_booking_notices = BookingNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get(); + $last_booking_fewo_notices = TravelUserBookingFewoNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get(); $data = [ 'user' => Auth::user(), 'last_booking_notices' => $last_booking_notices, + 'last_booking_fewo_notices' => $last_booking_fewo_notices ]; return view('home', $data); } diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index fed1f86..c1b0292 100755 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -384,8 +384,6 @@ class RequestController extends Controller ''; }) - - ->addColumn('sf_guard_user_id', function (Booking $booking) { return ''.($booking->sf_guard_user_id? $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name : "-").''; }) diff --git a/app/Http/Controllers/TravelUserBookingFewoController.php b/app/Http/Controllers/TravelUserBookingFewoController.php index 8b8efb3..a764da6 100755 --- a/app/Http/Controllers/TravelUserBookingFewoController.php +++ b/app/Http/Controllers/TravelUserBookingFewoController.php @@ -11,6 +11,7 @@ use App\Models\FewoLodging; use App\Models\FewoReservation; use App\Models\TravelBookingFewoChannel; use App\Models\TravelUserBookingFewo; +use App\Models\TravelUserBookingFewoNotice; use App\Models\TravelUserBookingFile; use App\Repositories\BookingFewoFileRepository; use App\Repositories\TravelUserBookingFewoRepository; @@ -82,6 +83,18 @@ class TravelUserBookingFewoController extends Controller public function store($id) { $data = Request::all(); + if($data['action'] === 'save_notice'){ + $travel_user_booking_fewo = $this->userBookingFewoRepo->updateNotice($id, $data); + \Session()->flash('alert-save', '1'); + return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])."#collapseBookingNotice"); + } + if($data['action'] === 'edit_notice'){ + $travel_user_booking_fewo = $this->userBookingFewoRepo->updateNotice($id, $data); + \Session()->flash('alert-save', '1'); + return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])."#collapseBookingNotice"); + } + + if($data['action'] === 'saveAll'){ return $this->userBookingFewoRepo->update($id, $data); } @@ -183,6 +196,19 @@ class TravelUserBookingFewoController extends Controller } } + public function loadModal(){ + $data = Request::all(); + $ret = ""; + if(Request::ajax()) { + if($data['action'] === "edit_notice") { + $value = TravelUserBookingFewoNotice::findOrFail($data['id']); + $ret = view("travel.user.booking.edit_notice_modal", compact('data', 'value'))->render(); + } + } + return response()->json(['response' => $data, 'html'=>$ret]); + } + + public function delete($id, $del="travel_user_booking_fewo"){ if($del === 'travel_user_booking_fewo') { @@ -206,6 +232,14 @@ class TravelUserBookingFewoController extends Controller \Session()->flash('alert-success', __('Buchung gelöscht sowie die Reservierung im Sterntrous Kalender')); } + + if($del === 'booking_fewo_notices'){ + $booking_fewo_notice = TravelUserBookingFewoNotice::findOrFail($id); + $travel_user_booking_fewo = $booking_fewo_notice->travel_user_booking_fewo; + $booking_fewo_notice->delete(); + \Session()->flash('alert-success', 'Notiz gelöscht'); + return redirect(route('travel_user_booking_fewo_detail', [$travel_user_booking_fewo->id])); + } if($del === 'booking_fewo_files'){ $booking_fewo_file = TravelUserBookingFile::findOrFail($id); diff --git a/app/Models/.EmailTemplate.php.GYiyxa b/app/Models/.EmailTemplate.php.GYiyxa new file mode 100644 index 0000000..e69de29 diff --git a/app/Models/Booking.php b/app/Models/Booking.php index 6381ce7..2b6227f 100644 --- a/app/Models/Booking.php +++ b/app/Models/Booking.php @@ -176,6 +176,13 @@ use Illuminate\Database\Eloquent\Model; * @property-read int|null $booking_provider_services_count * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingProviderService[] $booking_provider_services_checked * @property-read int|null $booking_provider_services_checked_count + * @property bool|null $comfort + * @property int|null $nationality_id + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BookingNotice[] $booking_notices + * @property-read int|null $booking_notices_count + * @property-read \App\Models\TravelNationality|null $travel_nationality + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereComfort($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Booking whereNationalityId($value) */ class Booking extends Model { @@ -529,6 +536,11 @@ class Booking extends Model return $this->hasMany(BookingNotice::class, 'booking_id')->orderBy('created_at', 'DESC'); } + public function booking_strono() + { + return $this->hasOne(BookingStorno::class); + } + public function hasBookingServicesUnchecked(){ $country_services = true; $provider_services = true; diff --git a/app/Models/BookingNotice.php b/app/Models/BookingNotice.php index d16f9b2..448e9e1 100644 --- a/app/Models/BookingNotice.php +++ b/app/Models/BookingNotice.php @@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model; /** * Class BookingNotice - * + * * @property int $id * @property int $booking_id * @property int $from_user_id @@ -20,13 +20,28 @@ use Illuminate\Database\Eloquent\Model; * @property string $message * @property bool $show * @property bool $important + * @property Carbon $edit_at * @property Carbon $created_at * @property Carbon $updated_at - * * @property Booking $booking * @property User $user - * * @package App\Models + * @property-read \App\User $from_user + * @property-read \App\User|null $to_user + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice newModelQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice newQuery() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice query() + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereBookingId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereCreatedAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereEditAt($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereFromUserId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereImportant($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereMessage($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereShow($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereToUserId($value) + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingNotice whereUpdatedAt($value) + * @mixin \Eloquent */ class BookingNotice extends Model { @@ -40,13 +55,18 @@ class BookingNotice extends Model 'important' => 'bool' ]; + protected $dates = [ + 'edit_at', + ]; + protected $fillable = [ 'booking_id', 'from_user_id', 'to_user_id', 'message', 'show', - 'important' + 'important', + 'edit_at' ]; public function booking() diff --git a/app/Models/BookingStorno.php b/app/Models/BookingStorno.php index e55ba2b..fb62cec 100644 --- a/app/Models/BookingStorno.php +++ b/app/Models/BookingStorno.php @@ -36,6 +36,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereTotal($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereUpdatedAt($value) * @mixin \Eloquent + * @property \Illuminate\Support\Carbon|null $storno_print + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingStorno whereStornoPrint($value) */ class BookingStorno extends Model { @@ -49,7 +51,8 @@ class BookingStorno extends Model ]; protected $dates = [ - 'storno_date' + 'storno_date', + 'storno_print' ]; protected $fillable = [ @@ -57,6 +60,7 @@ class BookingStorno extends Model 'total', 'storno', 'storno_date', + 'storno_print', 'binary_data', 'done' ]; diff --git a/app/Models/CustomerFewoMail.php b/app/Models/CustomerFewoMail.php index c5b0c34..74d574f 100644 --- a/app/Models/CustomerFewoMail.php +++ b/app/Models/CustomerFewoMail.php @@ -81,6 +81,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereDeletedAt($value) * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withTrashed() * @method static \Illuminate\Database\Query\Builder|\App\Models\CustomerFewoMail withoutTrashed() + * @property array|null $forward + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerFewoMail whereForward($value) */ class CustomerFewoMail extends Model { diff --git a/app/Models/CustomerMail.php b/app/Models/CustomerMail.php index 1f73148..a894c4c 100644 --- a/app/Models/CustomerMail.php +++ b/app/Models/CustomerMail.php @@ -77,6 +77,8 @@ use Illuminate\Database\Eloquent\Model; * @mixin \Eloquent * @property int|null $subdir * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSubdir($value) + * @property array|null $forward + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereForward($value) */ class CustomerMail extends Model { diff --git a/app/Models/Participant.php b/app/Models/Participant.php index a514622..4bf2419 100644 --- a/app/Models/Participant.php +++ b/app/Models/Participant.php @@ -33,6 +33,9 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantName($value) * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereParticipantSalutationId($value) * @mixin \Eloquent + * @property int|null $nationality_id + * @property-read \App\Models\TravelNationality|null $travel_nationality + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Participant whereNationalityId($value) */ class Participant extends Model { diff --git a/app/Models/SfGuardUser.php b/app/Models/SfGuardUser.php index 8b920f3..43cb9e5 100755 --- a/app/Models/SfGuardUser.php +++ b/app/Models/SfGuardUser.php @@ -53,6 +53,7 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SfGuardUser query() + * @property-read \App\User|null $user */ class SfGuardUser extends Model { diff --git a/app/Models/Sym/TravelCountry.php b/app/Models/Sym/TravelCountry.php index dfd39d0..ed2a8cf 100644 --- a/app/Models/Sym/TravelCountry.php +++ b/app/Models/Sym/TravelCountry.php @@ -49,6 +49,8 @@ use Illuminate\Database\Eloquent\Model; * @property-read \App\Models\TravelCountry|null $stern_travel_country * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCountryService[] $travel_country_services * @property-read int|null $travel_country_services_count + * @property string|null $destco + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Sym\TravelCountry whereDestco($value) */ class TravelCountry extends Model { diff --git a/app/Models/TravelCountry.php b/app/Models/TravelCountry.php index ca3c9fe..047f0c3 100644 --- a/app/Models/TravelCountry.php +++ b/app/Models/TravelCountry.php @@ -69,6 +69,8 @@ use Illuminate\Support\Str; * @property-read \App\Models\Sym\TravelCountry|null $crm_travel_country * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TravelCountryService[] $travel_country_services * @property-read int|null $travel_country_services_count + * @property string|null $destco + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelCountry whereDestco($value) */ class TravelCountry extends Model { diff --git a/app/Models/TravelNationality.php b/app/Models/TravelNationality.php index ec08d4d..b6ddc89 100644 --- a/app/Models/TravelNationality.php +++ b/app/Models/TravelNationality.php @@ -17,6 +17,8 @@ use Illuminate\Database\Eloquent\Model; * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality newQuery() * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality query() + * @property string|null $nat + * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelNationality whereNat($value) */ class TravelNationality extends Model { diff --git a/app/Models/TravelUserBookingFewo.php b/app/Models/TravelUserBookingFewo.php index 80225b5..2c10eac 100644 --- a/app/Models/TravelUserBookingFewo.php +++ b/app/Models/TravelUserBookingFewo.php @@ -251,6 +251,11 @@ class TravelUserBookingFewo extends Model return $this->hasOne(CustomerFewoMail::class, 'travel_user_booking_fewo_id')->latest(); } + public function booking_fewo_notices() + { + return $this->hasMany(TravelUserBookingFewoNotice::class, 'travel_user_booking_fewo_id')->orderBy('created_at', 'DESC'); + } + public function getStatuesName(){ if(isset(self::$statues[$this->status])){ return self::$statues[$this->status]; diff --git a/app/Models/TravelUserBookingFewoNotice.php b/app/Models/TravelUserBookingFewoNotice.php new file mode 100644 index 0000000..cce7df0 --- /dev/null +++ b/app/Models/TravelUserBookingFewoNotice.php @@ -0,0 +1,92 @@ + 'int', + 'from_user_id' => 'int', + 'to_user_id' => 'int', + 'show' => 'bool', + 'important' => 'bool' + ]; + + protected $dates = [ + 'edit_at' + ]; + + protected $fillable = [ + 'travel_user_booking_fewo_id', + 'from_user_id', + 'to_user_id', + 'message', + 'show', + 'important', + 'edit_at' + ]; + + public function travel_user_booking_fewo() + { + return $this->belongsTo(TravelUserBookingFewo::class); + } + + public function to_user() + { + return $this->belongsTo(User::class, 'to_user_id'); + } + + public function from_user() + { + return $this->belongsTo(User::class, 'from_user_id'); + } + + public function getName(){ + if($this->from_user){ + if($this->from_user->sf_guard_user){ + return $this->from_user->sf_guard_user->first_name." ".$this->from_user->sf_guard_user->last_name; + }else{ + $this->from_user->name; + } + } + } + + public function getSmallerMessage($max = 500){ + + $ret = substr($this->message, 0, $max); + if(strlen($this->message) > 500){ + $ret .= " ..."; + } + return $ret; + } +} diff --git a/app/Repositories/BookingRepository.php b/app/Repositories/BookingRepository.php index 79a1526..0b54139 100644 --- a/app/Repositories/BookingRepository.php +++ b/app/Repositories/BookingRepository.php @@ -27,13 +27,22 @@ class BookingRepository extends BaseRepository { public function updateNotice($id, $data){ $this->model = Booking::findOrFail($id); - BookingNotice::create([ - 'booking_id' => $this->model->id, - 'from_user_id' => Auth::user()->id, - 'to_user_id' => isset($this->model->sf_guard_user->user_id) ? $this->model->sf_guard_user->user_id : null, - 'message' => isset($data['booking_notice']) ? $data['booking_notice'] : "", - ] - ); + if($data['action'] === 'edit_notice' && isset($data['notice_id'])){ + $BookingNotice = BookingNotice::findOrFail($data['notice_id']); + $BookingNotice->message = isset($data['booking_notice']) ? $data['booking_notice'] : ""; + $BookingNotice->edit_at = now(); + $BookingNotice->save(); + }else{ + //save_notice + BookingNotice::create([ + 'booking_id' => $this->model->id, + 'from_user_id' => Auth::user()->id, + 'to_user_id' => isset($this->model->sf_guard_user->user_id) ? $this->model->sf_guard_user->user_id : null, + 'message' => isset($data['booking_notice']) ? $data['booking_notice'] : "", + ] + ); + } + return $this->model; } diff --git a/app/Repositories/TravelUserBookingFewoRepository.php b/app/Repositories/TravelUserBookingFewoRepository.php index 4cc8d71..cee9bc7 100644 --- a/app/Repositories/TravelUserBookingFewoRepository.php +++ b/app/Repositories/TravelUserBookingFewoRepository.php @@ -11,6 +11,7 @@ use App\Models\TravelClass; use App\Models\TravelProgram; use App\Models\TravelProgramDraft; use App\Models\TravelUserBookingFewo; +use App\Models\TravelUserBookingFewoNotice; use App\Services\Util; use PDF; use Carbon\Carbon; @@ -26,6 +27,26 @@ class TravelUserBookingFewoRepository extends BaseRepository { $this->model = $model; } + public function updateNotice($id, $data){ + + $model = TravelUserBookingFewo::findOrFail($id); + if($data['action'] === 'edit_notice' && isset($data['notice_id'])){ + $BookingNotice = TravelUserBookingFewoNotice::findOrFail($data['notice_id']); + $BookingNotice->message = isset($data['booking_fewo_notice']) ? $data['booking_fewo_notice'] : ""; + $BookingNotice->edit_at = now(); + $BookingNotice->save(); + }else{ + //save_notice + TravelUserBookingFewoNotice::create([ + 'travel_user_booking_fewo_id' => $model->id, + 'from_user_id' => \Auth::user()->id, + 'message' => isset($data['booking_fewo_notice']) ? $data['booking_fewo_notice'] : "", + ] + ); + } + + return $model; + } public function createTravelInfoPDF($id, $travel_info_user_text){ @@ -252,7 +273,6 @@ class TravelUserBookingFewoRepository extends BaseRepository { return redirect(route('travel_user_booking_fewo_detail', [$model->id])); } - private function calculatePriceNew(TravelUserBookingFewo $travel_user_booking_fewo){ $FewoSeasons = FewoSeason::where('from_date', '<', $travel_user_booking_fewo->getToDateRaw()) diff --git a/app/User.php b/app/User.php index cf05516..40ad762 100755 --- a/app/User.php +++ b/app/User.php @@ -77,6 +77,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable; * @property-read int|null $notifications_count * @property-read int|null $tokens_count * @property-read int|null $user_update_email_count + * @property-read \App\Models\SfGuardUser|null $sf_guard_user */ class User extends Authenticatable { @@ -84,6 +85,7 @@ class User extends Authenticatable use SoftDeletes; + protected $connection = 'mysql'; protected $permissionData = []; diff --git a/config/permissions.php b/config/permissions.php index f47348c..d1fc639 100755 --- a/config/permissions.php +++ b/config/permissions.php @@ -33,6 +33,8 @@ return [ 'cms-cn-au' => ['name' => 'ADMIN CMS > Inhalte > Autor' , 'color' => 'secondary'], ], 2 => [ + 'sua-bo-n-edit' => ['name' => 'SUPERADMIN > Buchungen > Notizen > bearbeiten' , 'color' => 'secondary'], + 'sua-fewo-n-edit' => ['name' => 'SUPERADMIN > FeWo > Notizen > bearbeiten' , 'color' => 'secondary'], 'sua-st' => ['name' => 'SUPERADMIN > Einstellungen' , 'color' => 'superadmin'], 'sua-st-al' => ['name' => 'SUPERADMIN > Einstellungen > Airline' , 'color' => 'superadmin'], 'sua-st-em' => ['name' => 'SUPERADMIN > Einstellungen > E-Mails' , 'color' => 'superadmin'], diff --git a/database/migrations/2020_03_19_152708_create_booking_storno_table.php b/database/migrations/2020_03_19_152708_create_booking_storno_table.php index 6318eb3..a2d26b8 100644 --- a/database/migrations/2020_03_19_152708_create_booking_storno_table.php +++ b/database/migrations/2020_03_19_152708_create_booking_storno_table.php @@ -23,6 +23,7 @@ class CreateBookingStornoTable extends Migration $table->decimal('total', 10, 2)->default(0.00); $table->decimal('storno', 10, 2)->default(0.00); $table->date('storno_date')->nullable(); + $table->date('storno_print')->nullable(); $table->binary('binary_data'); $table->tinyInteger('done')->nullable()->default(0); $table->dateTime('created_at'); diff --git a/database/migrations/2021_03_31_155913_create_booking_notices_table.php b/database/migrations/2021_03_31_155913_create_booking_notices_table.php index e64785f..244c759 100644 --- a/database/migrations/2021_03_31_155913_create_booking_notices_table.php +++ b/database/migrations/2021_03_31_155913_create_booking_notices_table.php @@ -25,6 +25,8 @@ class CreateBookingNoticesTable extends Migration $table->boolean('show')->default(false); $table->boolean('important')->default(false); + $table->timestamp('edit_at')->nullable(); + $table->timestamps(); $table->foreign('booking_id') diff --git a/database/migrations/2021_04_23_135103_create_booking_fewo_notices_table.php b/database/migrations/2021_04_23_135103_create_booking_fewo_notices_table.php new file mode 100644 index 0000000..a648433 --- /dev/null +++ b/database/migrations/2021_04_23_135103_create_booking_fewo_notices_table.php @@ -0,0 +1,49 @@ +create('booking_fewo_notices', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->unsignedInteger('travel_user_booking_fewo_id'); + //from + $table->unsignedInteger('from_user_id'); + //to + $table->unsignedInteger('to_user_id')->nullable(); + + $table->text('message')->nullable(); + $table->boolean('show')->default(false); + $table->boolean('important')->default(false); + + $table->timestamp('edit_at')->nullable(); + + $table->timestamps(); + + $table->foreign('travel_user_booking_fewo_id') + ->references('id') + ->on('travel_user_booking_fewos') + ->onDelete('CASCADE'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql_stern')->dropIfExists('booking_fewo_notices'); + } +} diff --git a/database/migrations/2021_04_23_135103_create_travel_user_booking_fewo_notices_table.php b/database/migrations/2021_04_23_135103_create_travel_user_booking_fewo_notices_table.php new file mode 100644 index 0000000..25aa5e5 --- /dev/null +++ b/database/migrations/2021_04_23_135103_create_travel_user_booking_fewo_notices_table.php @@ -0,0 +1,49 @@ +create('travel_user_booking_fewo_notices', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->unsignedInteger('travel_user_booking_fewo_id'); + //from + $table->unsignedInteger('from_user_id'); + //to + $table->unsignedInteger('to_user_id')->nullable(); + + $table->text('message')->nullable(); + $table->boolean('show')->default(false); + $table->boolean('important')->default(false); + + $table->timestamp('edit_at')->nullable(); + + $table->timestamps(); + + $table->foreign('travel_user_booking_fewo_id', 'travel_user_booking_fewo_notices_id_foreign') + ->references('id') + ->on('travel_user_booking_fewos') + ->onDelete('CASCADE'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('mysql_stern')->dropIfExists('travel_user_booking_fewo_notices'); + } +} diff --git a/resources/views/admin/report/bookings.blade.php b/resources/views/admin/report/bookings.blade.php index 25ebd31..fceefab 100755 --- a/resources/views/admin/report/bookings.blade.php +++ b/resources/views/admin/report/bookings.blade.php @@ -64,6 +64,7 @@