Passolution, Mails, Tickets,

This commit is contained in:
Kevin Adametz 2020-09-15 17:47:52 +02:00
parent 0857a34766
commit f79806ffe8
46 changed files with 556 additions and 831 deletions

View file

@ -193,7 +193,7 @@ class TravelUserBookingFewoRepository extends BaseRepository {
$data['is_calendar_stern_tours'] = isset($data['is_calendar_stern_tours']) ? true : false;
if($id == "new") {
if($id === "new") {
$model = TravelUserBookingFewo::create($data);
}else{
$model = TravelUserBookingFewo::findOrFail($id);
@ -206,42 +206,45 @@ class TravelUserBookingFewoRepository extends BaseRepository {
$model->save();
$res = $this->calculatePriceNew($model);
$model->daily_prices = $res['season'];
if(isset($data['calculate_price_new'])){
$model->price_travel = $res['price_travel'];
$model->price_service = $res['price_service'];
$model->price_deposit = $res['price_deposit'];
$model->calculate_price();
$model->save();
if($res['season_find'] && $res['price_find']){
$model->daily_prices = $res['season'];
if($fewo_reservation = $model->fewo_reservation){
$model->fewo_reservation->from_date = $model->getFromDateRaw();
$model->fewo_reservation->to_date = $model->getToDateRaw();
$model->fewo_reservation->save();
}
}
if($fewo_reservation = $model->fewo_reservation){
if($model->is_calendar_stern_tours){
$model->fewo_reservation->from_date = $model->getFromDateRaw();
$model->fewo_reservation->to_date = $model->getToDateRaw();
}else{
$model->fewo_reservation->from_date = null;
$model->fewo_reservation->to_date = null;
}
$model->fewo_reservation->save();
}else{
if($model->is_calendar_stern_tours){
$res = FewoReservation::create([
'lodging_id' => $model->fewo_lodging_id,
'from_date' => $model->getFromDateRaw(),
'to_date' => $model->getToDateRaw(),
'status' => 0,
'type' => 0]);
$model->fewo_reservation_id = $res->id;
if (isset($data['calculate_price_new'])) {
$model->price_travel = $res['price_travel'];
$model->price_service = $res['price_service'];
$model->price_deposit = $res['price_deposit'];
$model->calculate_price();
$model->save();
if ($fewo_reservation = $model->fewo_reservation) {
$model->fewo_reservation->from_date = $model->getFromDateRaw();
$model->fewo_reservation->to_date = $model->getToDateRaw();
$model->fewo_reservation->save();
}
}
if ($fewo_reservation = $model->fewo_reservation) {
if ($model->is_calendar_stern_tours) {
$model->fewo_reservation->from_date = $model->getFromDateRaw();
$model->fewo_reservation->to_date = $model->getToDateRaw();
} else {
$model->fewo_reservation->from_date = null;
$model->fewo_reservation->to_date = null;
}
$model->fewo_reservation->save();
} else {
if ($model->is_calendar_stern_tours) {
$res = FewoReservation::create([
'lodging_id' => $model->fewo_lodging_id,
'from_date' => $model->getFromDateRaw(),
'to_date' => $model->getToDateRaw(),
'status' => 0,
'type' => 0]);
$model->fewo_reservation_id = $res->id;
$model->save();
}
}
}
$model->save();
@ -288,31 +291,37 @@ class TravelUserBookingFewoRepository extends BaseRepository {
$result['season'] = [];
$frist_day = false;
$result['season_find'] = false;
$result['price_find'] = false;
//days
foreach ($period as $dt) {
foreach ($seasons as $season) {
if($dt->format("Y-m-d") >= $season['fromDay'] && $dt->format("Y-m-d") <= $season['toDay']){
$check_days[] = $dt->format("d.m.Y");
$price = $season['price'];
if(isset($price->per_night)){
$result['price_find'] = true;
}
$name = $season['name'];
$result['season_find'] = true;
if(!isset($result['season'][$name])){
$result['season'][$name]['fromDay'] = $dt->format("d.m.Y");
$result['price_service'] = $price->flat_price;
$result['price_service'] = isset($price->flat_price) ? $price->flat_price : 0;
$result['season'][$name]['price'] = 0;
$result['season'][$name]['numberDays'] = 0;
$result['season'][$name]['perNight'] = $price->per_night;
$result['season'][$name]['perNight'] = isset($price->per_night) ? $price->per_night : 0;
$result['season'][$name]['minimumStay'] = $season['minimum_stay'];
}
if(!$frist_day){
$result['season'][$name]['price'] += $price->per_night;
$result['season'][$name]['price'] += isset($price->per_night) ? $price->per_night : 0;
$result['season'][$name]['numberDays'] ++;
$result['season'][$name]['toDay'] = $dt->format("d.m.Y");
$result['price_travel'] += $price->per_night;
$result['price_travel'] += isset($price->per_night) ? $price->per_night : 0;
$result['days'] ++;
$result['season_find'] = true;
}else{
$frist_day = true;
@ -327,7 +336,4 @@ class TravelUserBookingFewoRepository extends BaseRepository {
}
}