From 34a3d2196b4e674728def1b85ca4221550e5d10b Mon Sep 17 00:00:00 2001 From: Kevin Adametz Date: Thu, 14 Apr 2022 13:22:03 +0200 Subject: [PATCH] Lead create Booking --- .../Controllers/API/BookingController.php | 13 +- app/Http/Controllers/LeadController.php | 5 + .../Settings/ServiceProviderController.php | 14 +- app/Models/Customer.php | 30 +- app/Models/TravelProgram.php | 294 ++++++++++++------ app/Models/TravelUser.php | 33 +- app/Models/TravelUserBookingFewo.php | 48 ++- app/Repositories/LeadRepository.php | 80 ++++- app/Services/HTMLHelper.php | 4 +- app/Services/Model.php | 2 +- app/Services/Placeholder.php | 16 +- resources/views/lead/_detail_lead.blade.php | 29 +- resources/views/lead/_detail_status.blade.php | 7 +- resources/views/lead/modal-new-mail.blade.php | 2 +- .../lead/modal-show-mail-inner.blade.php | 2 +- .../views/travel/program/detail.blade.php | 39 ++- .../booking/mail/modal-new-mail.blade.php | 2 +- .../mail/modal-show-mail-inner.blade.php | 2 +- 18 files changed, 462 insertions(+), 160 deletions(-) diff --git a/app/Http/Controllers/API/BookingController.php b/app/Http/Controllers/API/BookingController.php index 3469766..a6e111b 100755 --- a/app/Http/Controllers/API/BookingController.php +++ b/app/Http/Controllers/API/BookingController.php @@ -29,13 +29,14 @@ class BookingController extends Controller { $request = \Request::all(); - if($request['key'] !== $this->successKey){ + if(!isset($request['key']) || $request['key'] !== $this->successKey){ return response()->json(['error' => "key"], 401); } $travel_booking = TravelBooking::find($request['travel_booking_id']); - // $travel_booking = TravelBooking::find(2458); - if(!$travel_booking){ + //# vor testing + //$travel_booking = TravelBooking::find(2922); + if(!isset($travel_booking) || !$travel_booking){ return response()->json(['error' => 'no-booking-found'], $this->successStatus); } @@ -81,8 +82,6 @@ class BookingController extends Controller 'new_drafts' => $travel_booking->drafts === null ? 0 : 1, 'sf_guard_user_id' => 15, 'branch_id' => 4, - 'travel_country_id' => isset($travel_booking->selected_travel['travel_country_id'][0]) ? $travel_booking->selected_travel['travel_country_id'][0] : null, - 'travel_category_id' => isset($travel_booking->selected_travel['travel_category_id']) ? $travel_booking->selected_travel['travel_category_id'] : null, 'pax' => $travel_booking->selected_adults, 'title' => isset($travel_booking->selected_travel['travel_title']) ? $travel_booking->selected_travel['travel_title'] : "", 'comfort' => $comfort, @@ -100,13 +99,15 @@ class BookingController extends Controller 'participant_birthdate' => null, 'participant_salutation_id' => null, 'nationality_id' => null, - 'travel_company_id' => null, 'price' => $travel_booking->price, 'price_total' => $travel_booking->price_total, 'deposit_total' => $travel_booking->deposit_total, 'final_payment' => $travel_booking->final_payment, 'final_payment_date' => $travel_booking->final_payment_date->format('Y-m-d'), + 'travel_country_id' => isset($travel_booking->selected_travel['travel_country_id'][0]) ? $travel_booking->selected_travel['travel_country_id'][0] : null, + 'travel_category_id' => isset($travel_booking->selected_travel['travel_category_id']) ? $travel_booking->selected_travel['travel_category_id'] : null, 'travelagenda_id' => isset($travel_booking->selected_travel['travelagenda_id']) ? $travel_booking->selected_travel['travelagenda_id'] : null, + 'travel_company_id' => isset($travel_booking->selected_travel['travel_company_id']) ? $travel_booking->selected_travel['travel_company_id'] : 4, ]; //createBooking diff --git a/app/Http/Controllers/LeadController.php b/app/Http/Controllers/LeadController.php index 3c96a75..2908695 100755 --- a/app/Http/Controllers/LeadController.php +++ b/app/Http/Controllers/LeadController.php @@ -60,6 +60,11 @@ class LeadController extends Controller { $data = Request::all(); + if($data['action'] === 'createBooking'){ + $lead = $this->leadRepo->createBooking($id, $data); + \Session()->flash('alert-save', '1'); + return redirect(route('lead_detail', [$id]).'#collapseLeadBooking'); + } if($data['action'] === 'saveCustomer'){ $customer = $this->custRepo->updateCustomerFromLead($id, $data); \Session()->flash('alert-save', '1'); diff --git a/app/Http/Controllers/Settings/ServiceProviderController.php b/app/Http/Controllers/Settings/ServiceProviderController.php index a8214e3..12539e6 100755 --- a/app/Http/Controllers/Settings/ServiceProviderController.php +++ b/app/Http/Controllers/Settings/ServiceProviderController.php @@ -31,6 +31,7 @@ class ServiceProviderController extends Controller $model = new ServiceProvider(); $id = 'new'; $model->active = 1; + $model->id = 0; }else{ $model = ServiceProvider::findOrFail($id); $id = $model->id; @@ -49,7 +50,6 @@ class ServiceProviderController extends Controller public function update($id){ $data = Request::all(); - if(isset($data['update-action'])){ if($data['update-action'] === 'save-service-provider-service'){ $data['active'] = true;//isset($data['active']) ? true : false; @@ -70,7 +70,6 @@ class ServiceProviderController extends Controller $data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null; - if($id === "new"){ $model = ServiceProvider::create($data); }else{ @@ -87,8 +86,17 @@ class ServiceProviderController extends Controller public function delete($id, $del="service_provider"){ if($del === 'service_provider') { - abort(404, 'Noch keine Funktion'); + //abort(403, 'Noch keine Funktion'); $model = ServiceProvider::findOrFail($id); + if($model->service_provider_entries->count() > 0){ + \Session()->flash('alert-error', 'Der Leistungträger kann nicht gelöscht werden, dieser hat Einträge'); + return redirect()->back(); + } + + if($model->service_provider_services->count() > 0){ + \Session()->flash('alert-error', 'Der Leistungträger kann nicht gelöscht werden, dieser hat Einträge Service'); + return redirect()->back(); + } $model->delete(); \Session()->flash('alert-success', 'Eintrag gelöscht'); return redirect()->back(); diff --git a/app/Models/Customer.php b/app/Models/Customer.php index c408d5b..94e618e 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -125,8 +125,24 @@ class Customer extends Model ]; public static $salutationType = [ - 1 => 'Mann', - 2 => 'Frau' + 1 => 'Herr', + 2 => 'Frau', + 3 => 'Divers/keine Anrede', + 4 => 'Firma' + ]; + + public static $salutationNameType = [ + 1 => 'Herr', + 2 => 'Frau', + 3 => '', + 4 => 'Firma' + ]; + + public static $salutationDearType = [ + 1 => 'geehrter', + 2 => 'geehrte', + 3 => 'geehrte:r', + 4 => '' ]; public function travel_country() @@ -155,7 +171,15 @@ class Customer extends Model } public function getSalutation(){ - return $this->salutation_id == 1 ? 'Herr' : 'Frau'; + return isset(self::$salutationType[$this->salutation_id]) ? self::$salutationType[$this->salutation_id] : ''; + } + + public function getSalutationName(){ + return isset(self::$salutationNameType[$this->salutation_id]) ? self::$salutationNameType[$this->salutation_id] : ''; + } + + public function getSalutationDear(){ + return isset(self::$salutationDearType[$this->salutation_id]) ? self::$salutationDearType[$this->salutation_id] : ''; } public function fullName() diff --git a/app/Models/TravelProgram.php b/app/Models/TravelProgram.php index 9d059ff..da60216 100644 --- a/app/Models/TravelProgram.php +++ b/app/Models/TravelProgram.php @@ -1,26 +1,29 @@ 'float', + 'category_id' => 'int', + 'program_duration' => 'int', + 'is_seasonal' => 'bool', + 'youth' => 'bool', + 'program_type' => 'int', + 'organizer' => 'int', + 'generalnote' => 'int', + 'status' => 'int', + 'max_age_for_children' => 'int', + 'insurance_1' => 'int', + 'insurance_2' => 'int', + 'insurance_3' => 'int', + 'insurance_4' => 'int', + 'in_slider' => 'bool', + 'show_map' => 'bool', + 'travel_country' => 'int', + 'travel_category' => 'int', + 'travel_agenda' => 'int', + 'travel_company' => 'int', + 'deposit_percent' => 'int', + 'netto_prices_in_euro' => 'bool', + 'default_flight_price' => 'float', + 'travel_arrival_point_id' => 'int', + 'position' => 'int', + 'discount' => 'float', + 'discount_is_percent_value' => 'int' + ]; - public function classes() + protected $fillable = [ + 'profit_margin', + 'category_id', + 'program_code', + 'program_duration', + 'is_seasonal', + 'youth', + 'title', + 'subtitle', + 'slider_info', + 'program_type', + 'organizer', + 'generalnote', + 'status', + 'included', + 'class_description', + 'excluded', + 'advices', + 'notes', + 'url', + 'max_age_for_children', + 'html_description', + 'insurance_1', + 'insurance_2', + 'insurance_3', + 'insurance_4', + 'in_slider', + 'show_map', + 'map_html', + 'map_image', + 'map_image_ext', + 'travel_country', + 'travel_category', + 'travel_agenda', + 'travel_company', + 'deposit_percent', + 'netto_prices_in_euro', + 'text_right', + 'default_flight_price', + 'travel_arrival_point_id', + 'weekdays', + 'position', + 'discount', + 'discount_is_percent_value' + ]; + + public static $programTypeTypes = [ + 0 => 'Eigenveranstaltung', + 1 => 'Vermittlung' + ]; + + public static $travelCategoryTypes = [ + 1 => 'Ägypten-Reise', + 2 => 'Israel-Reise', + 3 => 'Jordanien-Reise', + 4 => 'Reise ohne Conversion-Code' + ]; + + public function travel_arrival_point() + { + return $this->belongsTo(TravelArrivalPoint::class); + } + + public function travel_organizer() + { + return $this->belongsTo(TravelOrganizer::class, 'organizer'); + } + + public function travel_insurance() + { + return $this->belongsTo(TravelInsurance::class, 'insurance_3'); + } + + public function travel_category() + { + return $this->belongsTo(TravelCategory::class, 'category_id'); + } + + public function travel_general_note() + { + return $this->belongsTo(TravelGeneralNote::class, 'generalnote'); + } + + public function option() + { + return $this->hasOne(Option::class, 'program_id'); + } + + public function classes() { - return $this->hasMany('App\Models\TravelClass', 'program_id', 'id'); + return $this->hasMany(TravelClass::class, 'program_id'); } - public function travel_program_drafts() - { - return $this->hasMany('App\Models\TravelProgramDraft', 'travel_program_id', 'id'); - } - public function travel_program_country() - { - return $this->hasOne('App\Models\TravelProgramCountry', 'program_id', 'id'); - } + public function travel_classes() + { + return $this->hasMany(TravelClass::class, 'program_id'); + } - public function hasTravelProgramDrafts (){ + public function travel_departure_points() + { + return $this->hasMany(TravelDeparturePoint::class, 'program_id'); + } + + public function travel_periods() + { + return $this->hasMany(TravelPeriod::class, 'program_id'); + } + + public function travel_program_country() + { + return $this->hasOne(TravelProgramCountry::class, 'program_id'); + } + + public function travel_program_destination() + { + return $this->hasOne(TravelProgramDestination::class, 'program_id'); + } + + public function travel_program_drafts() + { + return $this->hasMany(TravelProgramDraft::class); + } + + public function travel_program_images() + { + return $this->hasMany(TravelProgramImage::class, 'program_id'); + } + + public function travel_program_option() + { + return $this->hasOne(TravelProgramOption::class, 'program_id'); + } + + public function travel_program_related() + { + return $this->hasOne(TravelProgramRelated::class, 'program_2'); + } + + public function hasTravelProgramDrafts (){ if($this->travel_program_drafts->count()){ return true; } @@ -161,7 +267,7 @@ class TravelProgram extends Model return []; } - public function setWeekdaysFromArray($value){ + public function setWeekdaysFromArray($value){ if($value){ if(is_array($value)){ if($value[0] === NULL){ diff --git a/app/Models/TravelUser.php b/app/Models/TravelUser.php index 2113f88..766d7af 100644 --- a/app/Models/TravelUser.php +++ b/app/Models/TravelUser.php @@ -109,6 +109,27 @@ class TravelUser extends Model 'last_user_data' ]; + public static $salutationType = [ + 1 => 'Herr', + 2 => 'Frau', + 3 => 'Divers/keine Anrede', + 4 => 'Firma' + ]; + + public static $salutationNameType = [ + 1 => 'Herr', + 2 => 'Frau', + 3 => '', + 4 => 'Firma' + ]; + + public static $salutationDearType = [ + 1 => 'geehrter', + 2 => 'geehrte', + 3 => 'geehrte:r', + 4 => '' + ]; + public function travel_nationality() { return $this->belongsTo(\App\Models\TravelNationality::class); @@ -132,7 +153,15 @@ class TravelUser extends Model $this->attributes['birthday'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL; } - public function getSalutation(){ - return $this->salutation_id == 1 ? 'Herr' : 'Frau'; + public function getSalutation(){ + return isset(self::$salutationType[$this->salutation_id]) ? self::$salutationType[$this->salutation_id] : ''; + } + + public function getSalutationName(){ + return isset(self::$salutationNameType[$this->salutation_id]) ? self::$salutationNameType[$this->salutation_id] : ''; + } + + public function getSalutationDear(){ + return isset(self::$salutationDearType[$this->salutation_id]) ? self::$salutationDearType[$this->salutation_id] : ''; } } diff --git a/app/Models/TravelUserBookingFewo.php b/app/Models/TravelUserBookingFewo.php index 6f48078..1e1518d 100644 --- a/app/Models/TravelUserBookingFewo.php +++ b/app/Models/TravelUserBookingFewo.php @@ -274,13 +274,13 @@ class TravelUserBookingFewo extends Model } - public function getPersonsAttribute($value) + public function getPersonsAttribute() { $this->attributes['persons'] = $this->adults + $this->children; return $this->attributes['persons']; } - public function setPersonsAttribute( $value ) { + public function setPersonsAttribute($value) { $this->attributes['persons'] = $this->adults + $this->children; @@ -321,10 +321,9 @@ class TravelUserBookingFewo extends Model return $ret; } - public function getBookingDateAttribute($value) + public function getBookingDateAttribute() { - if(!$value){ return ""; } - return Carbon::parse($value)->format(Util::formatDateDB()); + return isset($this->attributes['booking_date']) ? Carbon::parse($this->attributes['booking_date'])->format(Util::formatDateDB()) : NULL; } public function setBookingDateAttribute( $value ) { @@ -332,10 +331,9 @@ class TravelUserBookingFewo extends Model } //from_date - public function getFromDateAttribute($value) + public function getFromDateAttribute() { - if(!$value){ return ""; } - return Carbon::parse($value)->format(Util::formatDateDB()); + return isset($this->attributes['from_date']) ? Carbon::parse($this->attributes['from_date'])->format(Util::formatDateDB()) : NULL; } public function setFromDateAttribute( $value ) { $this->attributes['from_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL; @@ -346,10 +344,9 @@ class TravelUserBookingFewo extends Model } //to_date - public function getToDateAttribute($value) + public function getToDateAttribute() { - if(!$value){ return ""; } - return Carbon::parse($value)->format(Util::formatDateDB()); + return isset($this->attributes['to_date']) ? Carbon::parse($this->attributes['to_date'])->format(Util::formatDateDB()) : NULL; } public function setToDateAttribute( $value ) { $this->attributes['to_date'] = isset($value) ? (new Carbon($value))->format('Y-m-d') : NULL; @@ -367,8 +364,7 @@ class TravelUserBookingFewo extends Model public function getPriceTravelAttribute($value) { - if(!$value){ return 0; } - return number_format(($this->attributes['price_travel']), 2, ',', '.'); + return isset($this->attributes['price_travel']) ? number_format(($this->attributes['price_travel']), 2, ',', '.') : 0; } public function getPriceTravelRaw() @@ -399,8 +395,7 @@ class TravelUserBookingFewo extends Model } public function getPriceBalanceAttribute($value) { - if(!$value){ return 0; } - return number_format(($this->attributes['price_balance']), 2, ',', '.'); + return isset($this->attributes['price_balance']) ? number_format(($this->attributes['price_balance']), 2, ',', '.') : 0; } public function getPriceBalanceRaw() { @@ -415,10 +410,10 @@ class TravelUserBookingFewo extends Model } public function getPriceTravelTotalAttribute($value) { - if(!$value){ + if(!isset($this->attributes['price_travel_total']) || $this->attributes['price_travel_total'] == 0){ $this->attributes['price_travel_total'] = $this->getPriceTravelRaw() + $this->getPriceBalanceRaw() + $this->getPriceExtraRaw(); - } - return number_format(($this->attributes['price_travel_total']), 2, ',', '.'); + } + return isset($this->attributes['price_travel_total']) ? number_format(($this->attributes['price_travel_total']), 2, ',', '.') : 0; } public function getPriceTravelTotalRaw() { @@ -436,8 +431,7 @@ class TravelUserBookingFewo extends Model public function getPriceDepositAttribute($value) { - if(!$value){ return 0; } - return number_format(($this->attributes['price_deposit']), 2, ',', '.'); + return isset($this->attributes['price_deposit']) ? number_format(($this->attributes['price_deposit']), 2, ',', '.') : 0; } public function getPriceDepositRaw() @@ -453,8 +447,7 @@ class TravelUserBookingFewo extends Model public function getPriceServiceAttribute($value) { - if(!$value){ return 0; } - return number_format(($this->attributes['price_service']), 2, ',', '.'); + return isset($this->attributes['price_service']) ? number_format(($this->attributes['price_service']), 2, ',', '.') : 0; } public function getPriceServiceRaw() @@ -471,8 +464,7 @@ class TravelUserBookingFewo extends Model public function getPriceTotalAttribute($value) { - if(!$value){ return 0; } - return number_format(($this->attributes['price_total']), 2, ',', '.'); + return isset($this->attributes['price_total']) ? number_format(($this->attributes['price_total']), 2, ',', '.') : 0; } public function getPriceTotalRaw() @@ -696,8 +688,12 @@ class TravelUserBookingFewo extends Model if($this->travel_user){ if($this->travel_user->salutation_id == 1){ $salutation = __('Dear Sir')." ".$this->travel_user->last_name; - }else{ - $salutation = __('Dear Mrs')." ".$this->travel_user->last_name; + } + if($this->travel_user->salutation_id == 2){ + $salutation = __('Dear Sir')." ".$this->travel_user->last_name; + } + if($this->travel_user->salutation_id == 4){ + $salutation = __('Dear customer')." ".$this->travel_user->last_name; } } return $salutation; diff --git a/app/Repositories/LeadRepository.php b/app/Repositories/LeadRepository.php index 2965156..dc78924 100644 --- a/app/Repositories/LeadRepository.php +++ b/app/Repositories/LeadRepository.php @@ -4,9 +4,11 @@ namespace App\Repositories; use App\Models\Lead; +use App\Models\Booking; use App\Models\LeadNotice; -use App\Models\LeadParticipant; +use App\Models\Participant; use App\Models\StatusHistory; +use App\Models\LeadParticipant; class LeadRepository extends BaseRepository { @@ -120,5 +122,81 @@ class LeadRepository extends BaseRepository { return $this->model; } + public function createBooking($id, $data){ + $this->model = Lead::findOrFail($id); + + if ($this->model->bookings->count() > 0){ + abort(403, 'Die Anfrage hat bereits eine Buchnung.'); + } + + $data = [ + 'booking_date' => date('Y-m-d'), //now + 'customer_id' => $this->model->customer->id, + 'lead_id' => $this->model->id, + 'new_drafts' => 1, + 'sf_guard_user_id' => $this->model->sf_guard_user_id, + 'branch_id' => 4, + 'pax' => $this->model->pax, + 'title' => "", + 'comfort' => false, + 'start_date' => $this->model->travelperiod_start, + 'end_date' => $this->model->travelperiod_end, + 'website_id' => 1, + 'travel_number' => null, + 'participant_name' => null, + 'participant_firstname' => null, + 'participant_birthdate' => null, + 'participant_salutation_id' => null, + 'nationality_id' => null, + 'price' => $this->model->price, + 'price_total' => null, + 'deposit_total' => null, + 'final_payment' => null, + 'final_payment_date' => null, + 'travel_country_id' => $this->model->travelcountry_id, + 'travel_category_id' => $this->model->travelcategory_id, + 'travelagenda_id' => $this->model->travelagenda_id, + 'travel_company_id' => 4, + ]; + + //createBooking + $booking = Booking::create($data); + + // copy participants + if($this->model->lead_participants){ + foreach($this->model->lead_participants as $participant){ + Participant::create([ + 'booking_id' => $booking->id, + 'participant_name' => $participant->participant_name, + 'participant_firstname' => $participant->participant_firstname, + 'participant_birthdate' => $participant->participant_birthdate, + 'participant_salutation_id' => $participant->participant_salutation_id, + 'participant_child' => $participant->participant_child, + 'nationality_id' => $participant->nationality_id, + ]); + } + } + + //inquiries + //offers ??? + /*if($lead->getInquiry()->count() > 0) + { + foreach($lead->getInquiry() as $inquiry) + { + $arrangement = new Arrangement(); + $arrangement->setArrangementType($inquiry->getInquiryType()->getArrangementType()); + $arrangement->setBegin($inquiry->getBegin()); + $arrangement->setEnd($inquiry->getEnd()); + $arrangement->setDataS($inquiry->getDataS()); + $arrangement->setInPdf($inquiry->getInPdf()); + $arrangement->setBooking($booking); + $arrangement->save(); + } + }*/ + + return $this->model; + } + + } \ No newline at end of file diff --git a/app/Services/HTMLHelper.php b/app/Services/HTMLHelper.php index 98b2505..75dce78 100644 --- a/app/Services/HTMLHelper.php +++ b/app/Services/HTMLHelper.php @@ -75,7 +75,9 @@ class HTMLHelper private static $salutation = [ 1 => 'Herr', 2 => 'Frau', - 3 => 'Firma', + 3 => 'Divers/keine Anrede', + 4 => 'Firma', + ]; diff --git a/app/Services/Model.php b/app/Services/Model.php index 9fc8165..551be60 100644 --- a/app/Services/Model.php +++ b/app/Services/Model.php @@ -74,7 +74,7 @@ class Model } public static function getSalutationArray($emtpy = false){ - $Salutation = Salutation::orderBy('name')->get()->pluck('name', 'id'); + $Salutation = Salutation::orderBy('id')->get()->pluck('name', 'id'); return $emtpy ? $Salutation->prepend('-', 0) : $Salutation; } diff --git a/app/Services/Placeholder.php b/app/Services/Placeholder.php index 648310e..e9b7676 100644 --- a/app/Services/Placeholder.php +++ b/app/Services/Placeholder.php @@ -147,13 +147,13 @@ class Placeholder public static function replaceBooking(Booking $booking, $content) { - $dear = $booking->customer->salutation_id == 1 ? 'geehrter' : 'geehrte'; + $dear = $booking->customer->getSalutationDear(); $first_name = $booking->customer->firstname; $last_name = $booking->customer->name; $title = $booking->customer->title; $country = $booking->travel_country_id ? $booking->travel_country->name : "-"; $program = $booking->travelagenda_id ? $booking->travel_agenda->name : "-"; - $salutation = isset($booking->customer->salutation) ? $booking->customer->salutation->name : '-'; + $salutation = isset($booking->customer->salutation) ? $booking->customer->getSalutationName() : '-'; $filekey = $booking->filekey; $flight_info = ""; @@ -174,7 +174,7 @@ class Placeholder $myjack_nr = $booking->merlin_order_number; - $participants = "Teilnehmer:
"; + $participants = "Teilnehmer:in
"; //first if($booking->participant_firstname){ $participants .= $booking->participant_salutation_id ? \App\Services\Model::getSalutationById($booking->participant_salutation_id)." " : ''; @@ -209,12 +209,12 @@ class Placeholder public static function replaceBookingFewo(TravelUserBookingFewo $booking_fewo, $content) { - $dear = $booking_fewo->travel_user->salutation_id == 1 ? 'geehrter' : 'geehrte'; + $dear = $booking_fewo->travel_user->getSalutationDear(); $first_name = $booking_fewo->travel_user->first_name; $last_name = $booking_fewo->travel_user->last_name; $title = $booking_fewo->travel_user->title; $program = $booking_fewo->fewo_lodging_id ? $booking_fewo->fewo_lodging->name : "-"; - $salutation = $booking_fewo->travel_user->salutation_id == 1 ? 'Herr' : 'Frau'; + $salutation = $booking_fewo->travel_user->getSalutationName(); $start_date = $booking_fewo->from_date; $end_date = $booking_fewo->to_date; $booking_date = $booking_fewo->booking_date; @@ -232,19 +232,19 @@ class Placeholder public static function replaceLead(Lead $lead, $content) { - $dear = $lead->customer->salutation_id == 1 ? 'geehrter' : 'geehrte'; + $dear = $lead->customer->getSalutationDear(); $first_name = $lead->customer->firstname; $last_name = $lead->customer->name; $title = $lead->customer->title; $country = $lead->travelcountry_id ? $lead->travel_country->name : "-"; $program = $lead->travelagenda_id ? $lead->travel_agenda->name : "-"; - $salutation = $lead->customer->salutation_id == 1 ? 'Herr' : 'Frau'; + $salutation = $lead->customer->getSalutationName(); $start_date = $lead->travelperiod_start ? _format_date($lead->travelperiod_start) : '-'; $end_date = $lead->travelperiod_end ? _format_date($lead->travelperiod_end) : '-'; $booking_date = $lead->request_date ? _format_date($lead->request_date) : '-'; $participants = ""; if($lead->lead_participants->count()){ - $participants = "Teilnehmer:
"; + $participants = "Teilnehmer:in
"; foreach($lead->lead_participants as $participant){ $participants .= $participant->salutation ? $participant->salutation->name." " : ''; $participants .= $participant->participant_firstname." ".$participant->participant_name; diff --git a/resources/views/lead/_detail_lead.blade.php b/resources/views/lead/_detail_lead.blade.php index 0f17bc5..9be4334 100644 --- a/resources/views/lead/_detail_lead.blade.php +++ b/resources/views/lead/_detail_lead.blade.php @@ -45,12 +45,12 @@
- {{ Form::select('travelcountry_id', \App\Services\Model::getTravelCountryCRMArray(true) , $lead->travelcountry_id, array('class'=>'custom-select')) }} + {{ Form::select('travelcountry_id', \App\Services\Model::getTravelCountryCRMArray(true) , $lead->travelcountry_id, array('class'=>'custom-select', 'id'=>'travelcountry_id')) }}
- {{ Form::select('travelagenda_id', \App\Services\Model::getTravelAgendaArray(true) , $lead->travelagenda_id, array('class'=>'custom-select')) }} + {{ Form::select('travelagenda_id', \App\Services\Model::getTravelAgendaArray(true, $lead->travelcountry_id) , $lead->travelagenda_id, array('class'=>'custom-select', 'id'=>'travelagenda_id')) }}
@@ -76,4 +76,27 @@ @endif
- \ No newline at end of file + + + \ No newline at end of file diff --git a/resources/views/lead/_detail_status.blade.php b/resources/views/lead/_detail_status.blade.php index a63f961..c01bc9f 100644 --- a/resources/views/lead/_detail_status.blade.php +++ b/resources/views/lead/_detail_status.blade.php @@ -28,7 +28,12 @@ {{ Form::select('status[id]', \App\Models\Lead::getStatusArray() , $lead->status_id, array('class'=>'custom-select')) }} - + @if ($lead->bookings->count() === 0) +
+
+ +
+ @endif
{{ Form::textarea('status[remarks]', '', array('placeholder'=>__('Bemerkung'), 'class'=>'form-control autoExpand', 'id'=>'status_remarks', 'rows'=>'1', 'data-min-rows'=>'1')) }} diff --git a/resources/views/lead/modal-new-mail.blade.php b/resources/views/lead/modal-new-mail.blade.php index 32e52cf..15a8a07 100644 --- a/resources/views/lead/modal-new-mail.blade.php +++ b/resources/views/lead/modal-new-mail.blade.php @@ -27,7 +27,7 @@
@if($value->lead->customer) - Kunde:
{{ $value->lead->customer->getSalutation() }} {{ $value->lead->customer->title }} {{ $value->lead->customer->firstname }} {{ $value->lead->customer->name }} + Kunde:
{{ $value->lead->customer->getSalutation(true) }} {{ $value->lead->customer->title }} {{ $value->lead->customer->firstname }} {{ $value->lead->customer->name }} ({{$value->lead->id}}) @endif diff --git a/resources/views/lead/modal-show-mail-inner.blade.php b/resources/views/lead/modal-show-mail-inner.blade.php index 16dfda2..2eb4308 100644 --- a/resources/views/lead/modal-show-mail-inner.blade.php +++ b/resources/views/lead/modal-show-mail-inner.blade.php @@ -44,7 +44,7 @@
@if($lead_mail->customer)

Kunde: - {{ $lead_mail->customer->getSalutation() }} {{ $lead_mail->customer->title }} {{ $lead_mail->customer->firstname }} {{ $lead_mail->customer->name }} + {{ $lead_mail->customer->getSalutation(true) }} {{ $lead_mail->customer->title }} {{ $lead_mail->customer->firstname }} {{ $lead_mail->customer->name }} @if($lead_mail->lead) ({{$lead_mail->lead->id}}) @endif diff --git a/resources/views/travel/program/detail.blade.php b/resources/views/travel/program/detail.blade.php index 76f6c7e..6923796 100755 --- a/resources/views/travel/program/detail.blade.php +++ b/resources/views/travel/program/detail.blade.php @@ -28,24 +28,49 @@ {{ Form::text('title', $program->title, array('placeholder'=>__('Title'), 'class'=>'form-control', 'id'=>'program_title', 'required'=>true)) }}

-
+
{{ Form::text('subtitle', $program->subtitle, array('placeholder'=>__('Subtitle'), 'class'=>'form-control', 'id'=>'program_subtitle', 'required'=>true)) }}
- -
- - {{ Form::text('program_code', $program->program_code, array('placeholder'=>__('Programm Code'), 'class'=>'form-control', 'id'=>'program_code', 'required'=>true)) }} -
+
-
+
+ + {{ Form::text('program_code', $program->program_code, array('class'=>'form-control', 'id'=>'program_code', 'required'=>true)) }} +
+
+ + {{ Form::select('program_type', $program::$programTypeTypes , $program->program_type, array('class'=>'custom-select', 'id'=>'program_type', 'required'=>true)) }} +
+
+ + {{ Form::select('category_id', $program::$travelCategoryTypes , $program->category_id, array('class'=>'custom-select', 'id'=>'category_id', 'required'=>true)) }} +
+
+ + {{ Form::select('travel_country', \App\Services\Model::getSymTravelCountryArray() , $program->travel_country, array('class'=>'custom-select', 'id'=>'travel_country', 'required'=>true)) }} +
+
+ + {{ Form::select('travel_agenda', \App\Services\Model::getTravelAgendaArray(false) , $program->travel_agenda, array('class'=>'custom-select', 'id'=>'travel_agenda', 'required'=>true)) }} +
+
+ + {{ Form::select('travel_category', \App\Services\Model::getTravelCategoryArray() , $program->travel_category, array('class'=>'custom-select', 'id'=>'travel_category', 'required'=>true)) }} +
+
+
+ + {{ Form::select('travel_company', \App\Services\Model::getTravelCompanyArray() , $program->travel_company, array('class'=>'custom-select', 'id'=>'travel_company', 'required'=>true)) }} +
+ {{--
diff --git a/resources/views/travel/user/booking/mail/modal-new-mail.blade.php b/resources/views/travel/user/booking/mail/modal-new-mail.blade.php index 6641bdd..b6f5231 100644 --- a/resources/views/travel/user/booking/mail/modal-new-mail.blade.php +++ b/resources/views/travel/user/booking/mail/modal-new-mail.blade.php @@ -31,7 +31,7 @@
@if($value->booking->customer) - Kunde:
{{ $value->booking->customer->getSalutation() }} {{ $value->booking->customer->title }} {{ $value->booking->customer->first_name }} {{ $value->booking->customer->last_name }} + Kunde:
{{ $value->booking->customer->getSalutation(true) }} {{ $value->booking->customer->title }} {{ $value->booking->customer->first_name }} {{ $value->booking->customer->last_name }} ({{$value->booking->id}}) @endif @if($value->booking) diff --git a/resources/views/travel/user/booking/mail/modal-show-mail-inner.blade.php b/resources/views/travel/user/booking/mail/modal-show-mail-inner.blade.php index 454c026..2f44fec 100644 --- a/resources/views/travel/user/booking/mail/modal-show-mail-inner.blade.php +++ b/resources/views/travel/user/booking/mail/modal-show-mail-inner.blade.php @@ -44,7 +44,7 @@
@if($customer_mail->customer)

Kunde: - {{ $customer_mail->customer->getSalutation() }} {{ $customer_mail->customer->title }} {{ $customer_mail->customer->firstname }} {{ $customer_mail->customer->name }} + {{ $customer_mail->customer->getSalutation(true) }} {{ $customer_mail->customer->title }} {{ $customer_mail->customer->firstname }} {{ $customer_mail->customer->name }} @if($customer_mail->customer) ({{$customer_mail->customer->id}}) @endif