This commit is contained in:
Kevin Adametz 2022-06-15 18:05:16 +02:00
parent 34a3d2196b
commit 93d1bea8e3
45 changed files with 1601 additions and 573 deletions

View file

@ -18,7 +18,7 @@ class TravelProgramRepository extends BaseRepository {
public function update($data)
{
if($data['id'] == "new"){
/*if($data['id'] == "new"){
$this->model = TravelProgram::createNew();
}
else{
@ -29,9 +29,88 @@ class TravelProgramRepository extends BaseRepository {
$this->model->fill($data);
$this->model->status = isset($data['status']) ? true : false;
$this->model->save();
return $this->model;*/
}
public function updateGeneral($id, $data){
//weekdays
$this->model = TravelProgram::findOrFail($id);
$this->checkDraftsWeekdays($data['weekdays']);
$data['weekdays'] = $this->model->setWeekdaysFromArray($data['weekdays']);
$fill = [
'title' => $data['title'],
'subtitle' => $data['subtitle'],
'program_code' => $data['program_code'],
'program_type' => $data['program_type'] ? $data['program_type'] : null,
'category_id' => $data['category_id'] ? $data['category_id'] : null,
'travel_country' => $data['travel_country'] ? $data['travel_country'] : null,
'travel_agenda' => $data['travel_agenda'] ? $data['travel_agenda'] : null,
'travel_category' => $data['travel_category'] ? $data['travel_category'] : null,
'travel_company' => $data['travel_company'] ? $data['travel_company'] : null,
'status' => isset($data['status']) ? 1 : 0,
'weekdays' => $data['weekdays'],
];
$this->model->fill($fill);
$this->model->save();
return $this->model;
}
public function updateDetail($id, $data){
//weekdays
$this->model = TravelProgram::findOrFail($id);
$this->checkDraftsWeekdays($data['weekdays']);
$data['weekdays'] = $this->model->setWeekdaysFromArray($data['weekdays']);
$fill = [
'default_flight_price' => $data['default_flight_price'] ? $data['default_flight_price'] : null,
'deposit_percent' => $data['deposit_percent'] ? $data['deposit_percent'] : null,
'discount' => $data['discount'] ? $data['discount'] : null,
'discount_is_percent_value' => $data['discount_is_percent_value'] ? $data['discount_is_percent_value'] : null,
'travel_arrival_point_id' => $data['travel_arrival_point_id'] ? $data['travel_arrival_point_id'] : null,
'max_age_for_children' => $data['max_age_for_children'] ? $data['max_age_for_children'] : null,
'url' => $data['url'] ? $data['url'] : null,
'generalnote' => $data['generalnote'] ? $data['generalnote'] : null,
];
$this->model->fill($fill);
$this->model->save();
return $this->model;
}
/*
'profit_margin',
'program_duration',
'is_seasonal',
'youth',
'slider_info',
'organizer',
'generalnote',
'included',
'class_description',
'excluded',
'advices',
'notes',
'html_description',
'insurance_1',
'insurance_2',
'insurance_3',
'insurance_4',
'in_slider',
'show_map',
'map_html',
'map_image',
'map_image_ext',
'netto_prices_in_euro',
'text_right',
'position',
*/
public function checkDraftsWeekdays($weekdays){
if(isset($weekdays) && is_array($weekdays) && $weekdays[0] === NULL){
$weekdays = range(0, 6);