Natinality, Country, Agenda, search Request. CMS
Magazine Content
This commit is contained in:
parent
30d5ca3b44
commit
aebfb0586a
72 changed files with 4636 additions and 590 deletions
70
app/Http/Controllers/Settings/TravelAgendaController.php
Executable file
70
app/Http/Controllers/Settings/TravelAgendaController.php
Executable file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\TravelAgenda;
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Models\TravelNationalityRequirement;
|
||||
use Carbon\Carbon;
|
||||
use HTMLHelper;
|
||||
use Input;
|
||||
|
||||
class TravelAgendaController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_agenda' => TravelAgenda::all(),
|
||||
];
|
||||
return view('settings.travel_agenda.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['id'] == "new"){
|
||||
$model = TravelAgenda::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
'travelcountry_id' => $data['travelcountry_id'],
|
||||
|
||||
]);
|
||||
}else{
|
||||
$model = TravelAgenda::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
$model->travelcountry_id = $data['travelcountry_id'];
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_program'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
if(Booking::where('travelagenda_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$model = TravelAgenda::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4,6 +4,9 @@ namespace App\Http\Controllers\Settings;
|
|||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Models\TravelNationalityRequirement;
|
||||
use Carbon\Carbon;
|
||||
use HTMLHelper;
|
||||
use Input;
|
||||
|
|
@ -19,47 +22,88 @@ class TravelCountryController extends Controller
|
|||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'drafts' => Draft::all()->sortByDesc("id"),
|
||||
'draft_types' => DraftType::all()->sortByDesc("id"),
|
||||
'step' => $step
|
||||
'travel_countries' => TravelCountry::all(),
|
||||
];
|
||||
return view('drafts.index', $data);
|
||||
return view('settings.travel_country.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function store(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['id'] == "new"){
|
||||
$draft_type = DraftType::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
'color' => $data['color'],
|
||||
]);
|
||||
public function detail($id)
|
||||
{
|
||||
if($id == "new") {
|
||||
$model = new TravelCountry();
|
||||
$id = 'new';
|
||||
$model->active_backend = 1;
|
||||
}else{
|
||||
$draft_type = DraftType::find($data['id']);
|
||||
$draft_type->name = $data['name'];
|
||||
$draft_type->active = isset($data['active']) ? true : false;
|
||||
$draft_type->color = $data['color'];
|
||||
|
||||
$draft_type->save();
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
$id = $model->id;
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('drafts', ['type']));
|
||||
|
||||
$data = [
|
||||
'model' => $model,
|
||||
'id' => $id,
|
||||
'travel_nationalities' => TravelNationality::where('active', true)->get(),
|
||||
];
|
||||
return view('settings.travel_country.detail', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function store(){
|
||||
|
||||
$data = Input::all();
|
||||
$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($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);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO for this thime
|
||||
//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]));
|
||||
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
if(DraftItem::where('draft_type_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect(route('drafts'));
|
||||
$model = TravelCountry::findOrFail($id);
|
||||
if( $model->travel_nationality_requirements){
|
||||
foreach($model->travel_nationality_requirements as $travel_nationality_requirement){
|
||||
$travel_nationality_requirement->delete();
|
||||
}
|
||||
}
|
||||
$draft_type = DraftType::findOrFail($id);
|
||||
$draft_type->delete();
|
||||
$tc = \App\Models\Sym\TravelCountry::find($model->crm_id);
|
||||
if($tc){
|
||||
$tc->delete();
|
||||
}
|
||||
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect(route('drafts', ['type']));
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
65
app/Http/Controllers/Settings/TravelNationalityController.php
Executable file
65
app/Http/Controllers/Settings/TravelNationalityController.php
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use App\Models\TravelCountry;
|
||||
use App\Models\TravelNationality;
|
||||
use App\Models\TravelNationalityRequirement;
|
||||
use Carbon\Carbon;
|
||||
use HTMLHelper;
|
||||
use Input;
|
||||
|
||||
class TravelNationalityController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
}
|
||||
|
||||
public function index($step = false)
|
||||
{
|
||||
$data = [
|
||||
'travel_nationality' => TravelNationality::all(),
|
||||
];
|
||||
return view('settings.travel_nationality.index', $data);
|
||||
}
|
||||
|
||||
|
||||
public function update(){
|
||||
|
||||
$data = Input::all();
|
||||
if($data['id'] == "new"){
|
||||
$model = TravelNationality::create([
|
||||
'name' => $data['name'],
|
||||
'active' => isset($data['active']) ? true : false,
|
||||
]);
|
||||
}else{
|
||||
$model = TravelNationality::find($data['id']);
|
||||
$model->name = $data['name'];
|
||||
$model->active = isset($data['active']) ? true : false;
|
||||
$model->save();
|
||||
}
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('admin_settings_travel_nationality'));
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
|
||||
if(TravelNationalityRequirement::where('travel_nationality_id', $id)->count()){
|
||||
\Session()->flash('alert-error', 'Eintrag wird verwendet');
|
||||
return redirect()->back();
|
||||
}
|
||||
$model = TravelNationality::findOrFail($id);
|
||||
$model->delete();
|
||||
\Session()->flash('alert-success', 'Eintrag gelöscht');
|
||||
return redirect()->back();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue