Mails
This commit is contained in:
parent
68b9d1ff88
commit
b9c26d06d0
75 changed files with 2143 additions and 818 deletions
|
|
@ -43,7 +43,7 @@ class ReportController extends Controller
|
|||
private function prozessBookingSearch()
|
||||
{
|
||||
|
||||
$query = Booking::with( 'customer', 'lead', 'service_provider_entries', 'service_provider_entries.service_provider');
|
||||
$query = Booking::with( 'customer', 'lead', '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");
|
||||
|
|
@ -74,6 +74,9 @@ class ReportController extends Controller
|
|||
->with('price_total_sum', function() use ($query) {
|
||||
return Util::_number_format($query->sum('price'));
|
||||
})
|
||||
->with('price_total_total_sum', function() use ($query) {
|
||||
return Util::_number_format($query->sum('price_total'));
|
||||
})
|
||||
->with('proceed_total_sum', function() use ($query) {
|
||||
if($query->count() > 200){
|
||||
return 'max 200 ';
|
||||
|
|
@ -81,7 +84,7 @@ class ReportController extends Controller
|
|||
$all = $query->get();
|
||||
$proceeds = 0;
|
||||
foreach ($all as $v){
|
||||
$proceeds += $v->proceedsRaw();
|
||||
$proceeds += $v->proceeds(true);
|
||||
}
|
||||
return Util::_number_format($proceeds);
|
||||
})
|
||||
|
|
@ -116,8 +119,7 @@ class ReportController extends Controller
|
|||
return $ret === "" ? "-" : $ret;
|
||||
})
|
||||
->addColumn('lead.status_id', function (Booking $booking) {
|
||||
//umbuchen
|
||||
if($booking->lead->status_id){
|
||||
if($booking->lead && $booking->lead->status_id){
|
||||
$color = $booking->lead->status->color;
|
||||
$icon = "";
|
||||
if($booking->lead->status_id == 14 && $booking->lead->is_rebook){
|
||||
|
|
@ -166,6 +168,7 @@ class ReportController extends Controller
|
|||
'BuchungsID',
|
||||
'Status',
|
||||
'MyJack Nr.',
|
||||
'Organisation',
|
||||
'Reisepreis',
|
||||
'Erlös',
|
||||
'Kunde',
|
||||
|
|
@ -182,6 +185,7 @@ class ReportController extends Controller
|
|||
'abgeschlossen',
|
||||
);
|
||||
$total_price = 0;
|
||||
$total_price_total = 0;
|
||||
$total_proceeds = 0;
|
||||
$total_amount_final = 0;
|
||||
|
||||
|
|
@ -191,14 +195,16 @@ class ReportController extends Controller
|
|||
foreach ($export->service_provider_entries as $service_provider_entry){
|
||||
if($new){
|
||||
$total_price += $export->getPriceRaw();
|
||||
$total_proceeds += $export->proceedsRaw();
|
||||
$total_price_total += $export->getPriceTotalRaw();
|
||||
$total_proceeds += $export->proceeds(true);
|
||||
}
|
||||
$total_amount_final += $service_provider_entry->getAmountFinalEurRaw();
|
||||
$columns[] = array(
|
||||
'BuchungsID' => $new ? $export->id : "",
|
||||
'Status' => $new ? $export->lead->status->name : "",
|
||||
'MyJack Nr.' => $new ? $export->merlin_order_number : "",
|
||||
'Reisepreis' => $new ? $export->price : "",
|
||||
'Organisation' => $new ? $export->price : "",
|
||||
'Reisepreis' => $new ? $export->price_total : "",
|
||||
'Erlös' => $new ? $export->proceeds() : "",
|
||||
'Kunde' => $new ? $export->customer->fullName() : "",
|
||||
'Reisedatum' => $new ? $export->getStartDateFormat() : "",
|
||||
|
|
@ -222,7 +228,8 @@ class ReportController extends Controller
|
|||
'BuchungsID' => $export->id,
|
||||
'Status' => $export->lead->status->name,
|
||||
'MyJack Nr.' => $export->merlin_order_number,
|
||||
'Reisepreis' => $export->price,
|
||||
'Organisation' => $export->price,
|
||||
'Reisepreis' => $export->price_total,
|
||||
'Erlös' => $export->proceeds(),
|
||||
'Kunde' => $export->customer->fullName(),
|
||||
'Reisedatum' => $export->getStartDateFormat(),
|
||||
|
|
@ -244,7 +251,8 @@ class ReportController extends Controller
|
|||
'BuchungsID' => "Total",
|
||||
'Status' => "",
|
||||
'MyJack Nr.' => "",
|
||||
'Reisepreis' => Util::_number_format($total_price),
|
||||
'Organisation' => Util::_number_format($total_price),
|
||||
'Reisepreis' => Util::_number_format($total_price_total),
|
||||
'Erlös' => Util::_number_format($total_proceeds),
|
||||
'Kunde' => "",
|
||||
'Reisedatum' => "",
|
||||
|
|
@ -266,7 +274,7 @@ class ReportController extends Controller
|
|||
private function prozessProvidersSearch(){
|
||||
|
||||
|
||||
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer');
|
||||
$query = ServiceProviderEntry::with('booking', 'service_provider', 'booking.customer')->select('service_provider_entry.*');
|
||||
if(Request::get('filter_is_cleared') != ""){
|
||||
$query->where('is_cleared', '=', Request::get('filter_is_cleared'));
|
||||
}
|
||||
|
|
@ -299,11 +307,24 @@ class ReportController extends Controller
|
|||
if($query->count() > 200){
|
||||
return 'max 200 ';
|
||||
}
|
||||
$all = $query->get();
|
||||
$price = 0;
|
||||
$isset = [];
|
||||
foreach ($all as $v){
|
||||
$price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceRaw();
|
||||
$isset[] = $v->booking->lead_id;
|
||||
}
|
||||
return Util::_number_format($price);
|
||||
})
|
||||
->with('price_total_total_sum', function() use ($query) {
|
||||
if($query->count() > 200){
|
||||
return 'max 200 ';
|
||||
}
|
||||
$all = $query->get();
|
||||
$price = 0;
|
||||
$isset = [];
|
||||
foreach ($all as $v){
|
||||
$price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceRaw();
|
||||
$price += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->getPriceTotalRaw();
|
||||
$isset[] = $v->booking->lead_id;
|
||||
}
|
||||
return Util::_number_format($price);
|
||||
|
|
@ -316,14 +337,14 @@ class ReportController extends Controller
|
|||
$proceeds = 0;
|
||||
$isset = [];
|
||||
foreach ($all as $v){
|
||||
$proceeds += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->proceedsRaw();
|
||||
$proceeds += in_array($v->booking->lead_id, $isset) ? 0 : $v->booking->proceeds(true);
|
||||
$isset[] = $v->booking->lead_id;
|
||||
}
|
||||
return Util::_number_format($proceeds);
|
||||
/*$all = $query->get();
|
||||
$proceeds = 0;
|
||||
foreach ($all as $v){
|
||||
$proceeds += $v->proceedsRaw();
|
||||
$proceeds += $v->proceeds(true);
|
||||
}
|
||||
return Util::_number_format($proceeds);*/
|
||||
})
|
||||
|
|
@ -384,6 +405,7 @@ class ReportController extends Controller
|
|||
'CRM Nr',
|
||||
'Kunde',
|
||||
'Reisedatum',
|
||||
'Organisation',
|
||||
'Gesamtreisepreis',
|
||||
'Reiseland',
|
||||
'Reiseprogramm',
|
||||
|
|
@ -397,13 +419,15 @@ class ReportController extends Controller
|
|||
);
|
||||
$isset = [];
|
||||
$total_price = 0;
|
||||
$total_price_total = 0;
|
||||
$total_amount_final = 0;
|
||||
$total_proceeds = 0;
|
||||
foreach($exports as $export) {
|
||||
$new = in_array($export->booking->lead_id, $isset) ? false : true;
|
||||
if($new){
|
||||
$total_price += $export->booking->getPriceRaw();
|
||||
$total_proceeds += $export->booking->proceedsRaw();
|
||||
$total_price_total += $export->booking->getPriceTotalRaw();
|
||||
$total_proceeds += $export->booking->proceeds(true);
|
||||
}
|
||||
$total_amount_final += $export->getAmountFinalEurRaw();
|
||||
$columns[] = array(
|
||||
|
|
@ -412,7 +436,8 @@ class ReportController extends Controller
|
|||
'CRM Nr' => $new ? $export->booking->lead_id : "",
|
||||
'Kunde' => $new ? $export->booking->customer->name : "",
|
||||
'Reisedatum' => $new ? $export->booking->getStartDateFormat() : "",
|
||||
'Gesamtreisepreis' => $new ? $export->booking->price : "",
|
||||
'Organisation' => $new ? $export->booking->price : "",
|
||||
'Gesamtreisepreis' => $new ? $export->booking->price_total : "",
|
||||
'Reiseland' => $new ? $export->booking->travel_country->name : "",
|
||||
'Reiseprogramm' => $new ? $export->booking->travel_agenda->name : "",
|
||||
'Reiseteilnehmer' => $new ? $export->booking->pax : "",
|
||||
|
|
@ -431,7 +456,8 @@ class ReportController extends Controller
|
|||
'CRM Nr' => "",
|
||||
'Kunde' =>"",
|
||||
'Reisedatum' => "",
|
||||
'Gesamtreisepreis' => Util::_number_format($total_price),
|
||||
'Organisation' => Util::_number_format($total_price),
|
||||
'Gesamtreisepreis' => Util::_number_format($total_price_total),
|
||||
'Reiseland' => "",
|
||||
'Reiseprogramm' => "",
|
||||
'Reiseteilnehmer' => "",
|
||||
|
|
@ -466,7 +492,7 @@ class ReportController extends Controller
|
|||
foreach($exports as $export) {
|
||||
$new = in_array($export->booking->lead_id, $isset) ? false : true;
|
||||
if($new) {
|
||||
$payments_total += $export->booking->getServiceProviderPaymentsTotalRaw();
|
||||
$payments_total += $export->booking->getServiceProviderPaymentsTotal(true);
|
||||
}
|
||||
$total_amount_final += $export->getAmountFinalEurRaw();
|
||||
$columns[] = array(
|
||||
|
|
|
|||
|
|
@ -203,7 +203,6 @@ class BookingController extends Controller
|
|||
$ret = CustomerMailRepository::loadModal($data);
|
||||
}
|
||||
|
||||
|
||||
if($data['action'] === "modal-upload-booking-file") {
|
||||
$ret = view("booking.upload_modal", compact('data'))->render();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\CMS;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CMSContent;
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
class CMSContentCountryController extends Controller
|
||||
{
|
||||
|
||||
/*
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_countries' => TravelCountry::all(),
|
||||
];
|
||||
return view('cms.content.country.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
$id = $model->id;
|
||||
|
||||
$data = [
|
||||
'model' => $model,
|
||||
'id' => $id,
|
||||
'step' => $step,
|
||||
'travel_nationalities' => TravelNationality::where('active', true)->get(),
|
||||
];
|
||||
return view('cms.content.country.detail', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['contact_emails'])){
|
||||
$data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails']));
|
||||
}else{
|
||||
$data['contact_emails'] = null;
|
||||
}
|
||||
if(!isset($data['contact_lands'])){
|
||||
$data['contact_lands'] = null;
|
||||
}
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
|
||||
//travel_nationality_requirement
|
||||
if (isset($data['travel_nationality_requirement'])) {
|
||||
foreach ($data['travel_nationality_requirement'] as $travel_nationality_id => $text) {
|
||||
$model->setNationalityRequirement($travel_nationality_id, $text);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO for this time
|
||||
if ($data['action'] == 'contact') {
|
||||
//we need an update in the old CRM v1 system DB
|
||||
$tc = \App\Models\Sym\TravelCountry::findOrFail($model->crm_id);
|
||||
$tc->fill($data);
|
||||
$tc->save();
|
||||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('cms_content_country_detail', [$model->id, $data['action']]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ class CustomerController extends Controller
|
|||
|
||||
public function getCustomers()
|
||||
{
|
||||
$query = Customer::with('salutation');
|
||||
$query = Customer::with('salutation')->select('customer.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (Customer $customer) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
|||
use App\Models\Customer;
|
||||
use App\Models\CustomerFile;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Models\EmailTemplate;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use App\Repositories\CustomerFileRepository;
|
||||
use App\Services\Util;
|
||||
|
|
@ -136,7 +137,7 @@ class CustomerMailController extends Controller
|
|||
|
||||
public function getCustomerMails()
|
||||
{
|
||||
$query = CustomerMail::with('booking')->with('customer');
|
||||
$query = CustomerMail::with('booking')->with('customer')->select('customer_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (CustomerMail $customer_mail) {
|
||||
|
|
@ -183,6 +184,37 @@ class CustomerMailController extends Controller
|
|||
->make(true);
|
||||
}
|
||||
|
||||
public function getEmailTemplates()
|
||||
{
|
||||
$query = EmailTemplate::where('active', '=', true);
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action', function (EmailTemplate $emailTemplate) {
|
||||
return '<a href="javascript:void(0)" class="btn icon-btn btn-sm btn-primary email-template-action"
|
||||
data-url="'.route('customer_mail_ajax').'" data-id="'.$emailTemplate->id.'" data-action="load_email_template"
|
||||
title="Vorlage laden" data-placement="left" rel="tooltip"><span class="ion ion-ios-arrow-dropup"></span></a>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('subject', 'subject $1')
|
||||
->orderColumn('message', 'message $1')
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('subject', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('subject', 'LIKE', '%'.$keyword.'%');
|
||||
$query->OrWhere('message', 'LIKE', '%'.$keyword.'%');
|
||||
|
||||
}
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function uploadAttachment($id){
|
||||
|
||||
$fileRepo = new CustomerFileRepository(new CustomerFile());
|
||||
|
|
@ -212,6 +244,20 @@ class CustomerMailController extends Controller
|
|||
$customer_mail->save();
|
||||
$status = 'success';
|
||||
}
|
||||
if($data['action'] === 'load_email_template'){
|
||||
$email_template = EmailTemplate::find($data['id']);
|
||||
$ret = $email_template->message;
|
||||
$data['subject'] = $email_template->subject;
|
||||
$status = 'success';
|
||||
}
|
||||
if($data['action'] === 'delete_mail_attachment'){
|
||||
$customer_file = CustomerFile::find($data['id']);
|
||||
$fileRepo = new CustomerFileRepository($customer_file);
|
||||
$fileRepo->_set('disk', 'customer');
|
||||
$ret = $fileRepo->delete();
|
||||
$status = 'success';
|
||||
}
|
||||
|
||||
if($data['action'] === 'add_attachment'){
|
||||
$arrContextOptions=array(
|
||||
"ssl"=>array(
|
||||
|
|
@ -219,10 +265,7 @@ class CustomerMailController extends Controller
|
|||
"verify_peer_name"=>false,
|
||||
),
|
||||
);
|
||||
|
||||
$contents = file_get_contents($data['target'], false, stream_context_create($arrContextOptions));
|
||||
|
||||
|
||||
$mine = Util::getMimeFromHeader($http_response_header);
|
||||
$extension = Util::getExtensionFromMime($mine);
|
||||
$fileRepo = new CustomerFileRepository(new CustomerFile());
|
||||
|
|
@ -234,7 +277,6 @@ class CustomerMailController extends Controller
|
|||
$fileRepo->_set('originalName', $data['name']);
|
||||
$fileRepo->_set('mine', $mine);
|
||||
$fileRepo->_set('extension', $extension);
|
||||
|
||||
return $fileRepo->storeFile($contents);
|
||||
}
|
||||
}
|
||||
|
|
@ -246,7 +288,6 @@ class CustomerMailController extends Controller
|
|||
if (!Request::get('booking_id')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$query = CustomerMail::where('booking_id', '=', Request::get('booking_id'));
|
||||
if (Request::get('customer_mail_dir') == 11) { //draft
|
||||
$query->where('draft', '=', true);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class LeadController extends Controller
|
|||
|
||||
public function getLeads()
|
||||
{
|
||||
$query = Lead::with('customer')->with('sf_guard_user')->with('status');
|
||||
$query = Lead::with('customer')->with('sf_guard_user')->with('status')->select('lead.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (Lead $lead) {
|
||||
|
|
|
|||
|
|
@ -79,16 +79,17 @@ class RequestController extends Controller
|
|||
*/
|
||||
private function getSearchRequests(){
|
||||
|
||||
$query = Booking::with('lead')->with('customer_mails')->where('lead_id', '!=', NULL);
|
||||
$query = Booking::with('lead')->with('customer')->with('customer_mails')->select('booking.*')->where('lead_id', '!=', NULL);
|
||||
|
||||
if(Request::get('full_firstname_search') != ""){
|
||||
$query->where('participant_firstname', 'LIKE', '%'.Request::get('full_firstname_search').'%');
|
||||
}
|
||||
|
||||
$query->whereHas('customer', function ($q) {
|
||||
$q->where('firstname', 'LIKE', '%'.Request::get('full_firstname_search').'%');
|
||||
}); }
|
||||
if(Request::get('full_lastname_search') != ""){
|
||||
$query->where('participant_name', 'LIKE', '%'.Request::get('full_lastname_search').'%');
|
||||
$query->whereHas('customer', function ($q) {
|
||||
$q->where('name', 'LIKE', '%'.Request::get('full_lastname_search').'%');
|
||||
});
|
||||
}
|
||||
|
||||
if(Request::get('travel_option_country_id') != ""){
|
||||
$country_ids = TravelCountry::where('contact_lands', 'LIKE', '%"'.Request::get('travel_option_country_id').'"%')->get()->pluck('id');
|
||||
$country_ids[] = Request::get('travel_option_country_id');
|
||||
|
|
@ -261,12 +262,12 @@ class RequestController extends Controller
|
|||
->addColumn('lead_id', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->lead_id.'" href="'.make_old_url('leads/'.$booking->lead_id.'/edit').'" data-id="'.$booking->lead_id.'">'.$booking->lead_id.'</a>';
|
||||
})
|
||||
->addColumn('participant_firstname', function (Booking $booking) {
|
||||
/*->addColumn('participant_firstname', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->participant_firstname.'" href="'.make_old_url('customer/'.$booking->customer_id.'/edit').'" data-id="'.$booking->customer_id.'">'.$booking->participant_firstname.'</a>';
|
||||
})
|
||||
->addColumn('participant_name', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->participant_name.'" href="'.make_old_url('customer/'.$booking->customer_id.'/edit').'" data-id="'.$booking->customer_id.'">'.$booking->participant_name.'</a>';
|
||||
})
|
||||
})*/
|
||||
->addColumn('id', function (Booking $booking) {
|
||||
return '<a data-order="'.$booking->id.'" href="'.make_old_url('booking/'.$booking->id.'/edit').'" data-id="'.$booking->id.'">'.$booking->id.'</a>';
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
|||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Booking;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class AirlineController extends Controller
|
||||
|
|
@ -28,11 +29,10 @@ class AirlineController extends Controller
|
|||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
if(isset($data['contact_emails'])){
|
||||
$data['contact_emails'] = explode('#', str_replace(array("\r\n", "\r", "\n"),"#",$data['contact_emails']));
|
||||
}else{
|
||||
$data['contact_emails'] = null;
|
||||
}
|
||||
|
||||
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
|
||||
if($data['id'] === "new"){
|
||||
$model = Airline::create($data);
|
||||
}else{
|
||||
|
|
|
|||
75
app/Http/Controllers/Settings/EmailTemplateController.php
Executable file
75
app/Http/Controllers/Settings/EmailTemplateController.php
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\EmailTemplate;
|
||||
use Request;
|
||||
|
||||
class EmailTemplateController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'email_template' => EmailTemplate::all(),
|
||||
];
|
||||
return view('settings.email_template.index', $data);
|
||||
}
|
||||
|
||||
public function load(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if(Request::ajax()) {
|
||||
|
||||
if($data['action'] === "modal-email-template") {
|
||||
if($data['id'] === 'new'){
|
||||
$value = new EmailTemplate();
|
||||
$value->id = 0;
|
||||
$value->active = 1;
|
||||
|
||||
}else{
|
||||
$value = EmailTemplate::find($data['id']);
|
||||
|
||||
}
|
||||
$ret = view("settings.email_template.modal", compact('value'))->render();
|
||||
}
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
}
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
|
||||
if($data['id'] === "new" || $data['id'] == 0){
|
||||
$model = EmailTemplate::create($data);
|
||||
}else{
|
||||
$model = EmailTemplate::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_email_template'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
$model = EmailTemplate::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
55
app/Http/Controllers/Settings/InsuranceController.php
Executable file
55
app/Http/Controllers/Settings/InsuranceController.php
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Insurance;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class InsuranceController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'insurance' => Insurance::all(),
|
||||
];
|
||||
return view('settings.insurance.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
|
||||
if($data['id'] === "new"){
|
||||
$model = Insurance::create($data);
|
||||
}else{
|
||||
$model = Insurance::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_insurance'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = Insurance::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
57
app/Http/Controllers/Settings/ServiceProviderController.php
Executable file
57
app/Http/Controllers/Settings/ServiceProviderController.php
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\ServiceProvider;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class ServiceProviderController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'service_provider' => ServiceProvider::all(),
|
||||
];
|
||||
return view('settings.service_provider.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
|
||||
if($data['id'] === "new"){
|
||||
$model = ServiceProvider::create($data);
|
||||
}else{
|
||||
$model = ServiceProvider::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_service_provider'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
abort(404, 'Noch keine Funktion');
|
||||
$model = ServiceProvider::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
58
app/Http/Controllers/Settings/TravelCompanyController.php
Executable file
58
app/Http/Controllers/Settings/TravelCompanyController.php
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\TravelCompany;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class TravelCompanyController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_company' => TravelCompany::all(),
|
||||
];
|
||||
return view('settings.travel_company.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
$data['active'] = isset($data['active']) ? true : false;
|
||||
$data['is_allowed_edit_commission'] = isset($data['is_allowed_edit_commission']) ? true : false;
|
||||
$data['is_inhouse'] = isset($data['is_inhouse']) ? true : false;
|
||||
if($data['id'] === "new"){
|
||||
$model = TravelCompany::create($data);
|
||||
}else{
|
||||
$model = TravelCompany::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_company'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
abort(404, 'Noch keine Funktion');
|
||||
$model = TravelCompany::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6,13 +6,21 @@ use App\Http\Controllers\Controller;
|
|||
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Services\Util;
|
||||
use Request;
|
||||
|
||||
class TravelCountryController extends Controller
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -24,9 +32,9 @@ class TravelCountryController extends Controller
|
|||
return view('settings.travel_country.index', $data);
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
public function detail($id, $step = false)
|
||||
{
|
||||
if($id == "new") {
|
||||
if($id === "new") {
|
||||
$model = new TravelCountry();
|
||||
$id = 'new';
|
||||
$model->active_backend = 1;
|
||||
|
|
@ -34,9 +42,11 @@ class TravelCountryController extends Controller
|
|||
$model = TravelCountry::findOrFail($id);
|
||||
$id = $model->id;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'model' => $model,
|
||||
'id' => $id,
|
||||
'step' => $step,
|
||||
'travel_nationalities' => TravelNationality::where('active', true)->get(),
|
||||
];
|
||||
return view('settings.travel_country.detail', $data);
|
||||
|
|
@ -44,45 +54,53 @@ class TravelCountryController extends Controller
|
|||
|
||||
|
||||
|
||||
public function store(){
|
||||
public function update($id)
|
||||
{
|
||||
|
||||
$data = Request::all();
|
||||
$data['is_customer_country'] = isset($data['is_customer_country']) ? true : false;
|
||||
$data = Request::all();
|
||||
$data['contact_emails'] = isset($data['contact_emails']) ? Util::_explodeLines($data['contact_emails']) : null;
|
||||
if(!isset($data['contact_lands'])){
|
||||
$data['contact_lands'] = null;
|
||||
}
|
||||
/*
|
||||
* $data['is_customer_country'] = isset($data['is_customer_country']) ? true : false;
|
||||
$data['active_frontend'] = isset($data['active_frontend']) ? true : false;
|
||||
$data['active_backend'] = isset($data['active_backend']) ? true : false;
|
||||
*/
|
||||
if($id === "new"){
|
||||
$data['crm_id'] = 0;
|
||||
$model = TravelCountry::create($data);
|
||||
}else{
|
||||
$model = TravelCountry::find($id);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
|
||||
if($data['id'] == "new"){
|
||||
$data['crm_id'] = 0;
|
||||
$model = TravelCountry::create($data);
|
||||
}else{
|
||||
$model = TravelCountry::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
//travel_nationality_requirement
|
||||
if (isset($data['travel_nationality_requirement'])) {
|
||||
foreach ($data['travel_nationality_requirement'] as $travel_nationality_id => $text) {
|
||||
$model->setNationalityRequirement($travel_nationality_id, $text);
|
||||
}
|
||||
}
|
||||
|
||||
//travel_nationality_requirement
|
||||
if(isset($data['travel_nationality_requirement'])){
|
||||
foreach ($data['travel_nationality_requirement'] as $travel_nationality_id => $text){
|
||||
$model->setNationalityRequirement($travel_nationality_id, $text);
|
||||
}
|
||||
}
|
||||
//TODO for this time
|
||||
if ($data['action'] === 'contact') {
|
||||
//we need an update in the old CRM v1 system DB
|
||||
$tc = \App\Models\Sym\TravelCountry::findOrFail($model->crm_id);
|
||||
if(!$tc){
|
||||
$tc = \App\Models\Sym\TravelCountry::create($data);
|
||||
$model->crm_id = $tc->id;
|
||||
$model->save();
|
||||
}else{
|
||||
$tc->fill($data);
|
||||
$tc->save();
|
||||
}
|
||||
|
||||
//TODO for this time
|
||||
//we need an update in the old CRM v1 system DB
|
||||
$tc = \App\Models\Sym\TravelCountry::find($model->crm_id);
|
||||
if(!$tc){
|
||||
$tc = \App\Models\Sym\TravelCountry::create($data);
|
||||
$model->crm_id = $tc->id;
|
||||
$model->save();
|
||||
}else{
|
||||
$tc->fill($data);
|
||||
$tc->save();
|
||||
}
|
||||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_country_detail', [$model->id]));
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_country_detail', [$model->id]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
|
|
@ -100,7 +118,6 @@ class TravelCountryController extends Controller
|
|||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class TravelNationalityController extends Controller
|
|||
public function update(){
|
||||
|
||||
$data = Request::all();
|
||||
if($data['id'] == "new"){
|
||||
if($data['id'] === "new"){
|
||||
$model = TravelNationality::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue