First Commit
This commit is contained in:
commit
0c9a118281
633 changed files with 76612 additions and 0 deletions
45
app/Http/Controllers/API/DraftController.php
Executable file
45
app/Http/Controllers/API/DraftController.php
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Draft;
|
||||
use App\Models\TravelProgram;
|
||||
use HTMLHelper;
|
||||
|
||||
|
||||
class DraftController extends Controller
|
||||
{
|
||||
public $successStatus = 200;
|
||||
|
||||
|
||||
public function draft($action)
|
||||
{
|
||||
if($action == "get_draft_list"){
|
||||
$drafts = Draft::where('active', true)->get()->sortByDesc("id");
|
||||
return response()->json(['success' => $drafts], $this->successStatus);
|
||||
}
|
||||
|
||||
if($action == "get_draft_list_for_table"){
|
||||
$ret = [];
|
||||
if(request('program_id') && request('program_id') > 0){
|
||||
$travel_program = TravelProgram::find(request('program_id'));
|
||||
if(count($travel_program->travel_program_drafts)){
|
||||
foreach ($travel_program->travel_program_drafts as $travel_program_draft){
|
||||
$key = $travel_program_draft->id;
|
||||
$ret[$key]['name'] = $travel_program_draft->draft->name;
|
||||
if($travel_program_draft->travel_class){
|
||||
$ret[$key]['travel_class'] = $travel_program_draft->travel_class->name;
|
||||
}else{
|
||||
$ret[$key]['travel_class'] = "alle Kategorien";
|
||||
}
|
||||
$ret[$key]['weekdays'] = HTMLHelper::getWeekdaysString($travel_program_draft->weekdays);
|
||||
}
|
||||
}
|
||||
}
|
||||
return response()->json(['success' => $ret], $this->successStatus);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue