Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 14x 14x 1x 1x 15x 15x 15x 2x 2x 2x 2x 15x 15x 1x 15x 14x 14x 15x 15x 1x 1x 1x 15x 15x 1x 1x 15x 15x 15x 2x 2x 15x 2x 2x 15x 15x 15x 1x 1x 2x 2x 2x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Component, Input, OnInit } from '@angular/core';
import { RoomClass } from '@classes/room.class';
import { WizardClass } from '@classes/wizard.class';
import { LineElementComponent } from '../line-element/line-element.component';
import * as Sentry from '@sentry/angular';
@Component({
selector: 'grt-accomodation',
templateUrl: './accomodation.component.html',
styleUrls: ['./accomodation.component.scss'],
imports: [LineElementComponent],
})
export class AccomodationComponent implements OnInit {
public rooms_count: number = 1;
public rooms_adult: number = 1;
public rooms_kids: number = 1;
public bedsize: string = 'indifferent';
public kids_age: number = 12;
public rating: number = 4;
daysOfTrip: string = '';
public breakfast: boolean = true;
public refund: boolean = true;
@Input() wizardLocal: WizardClass | any;
public rooms: RoomClass[] | any[] = [];
constructor() {}
ngOnInit() {
this.refreshPage();
}
refreshPage() {
this.daysOfTrip = '';
if (this.wizardLocal) {
if (this.wizardLocal.id === null || this.wizardLocal.id === undefined) {
Sentry.captureMessage('[TransportationAComponent] wizardLocal.id is null or undefined', 'warning');
}
}
if (this.wizardLocal && this.wizardLocal.hotel_occupancy_rooms) {
this.rooms = this.wizardLocal.hotel_occupancy_rooms;
} else {
this.rooms = [];
}
if (this.rooms.length > 0 && this.rooms[0] && this.rooms[0].children > 0) {
if (!this.rooms[0].children_ages) {
this.rooms[0].children_ages = [];
}
if (this.rooms[0].children_ages.length === 0) {
for (let i = 0; i < this.rooms[0].children; i++) {
this.rooms[0].children_ages.push(8);
}
}
}
if (this.wizardLocal && this.wizardLocal.hotel_requested_bed_preference) {
this.bedsize = this.wizardLocal.hotel_requested_bed_preference;
}
this.rating = this.wizardLocal && this.wizardLocal.hotel_requested_stars;
if (this.wizardLocal && this.wizardLocal.hotel_include_breakfast !== null) {
this.breakfast = this.wizardLocal.hotel_include_breakfast;
}
if (this.wizardLocal && this.wizardLocal.hotel_include_non_refundable !== null) {
this.refund = this.wizardLocal.hotel_include_non_refundable;
}
this.daysOfTrip = this.wizardLocal && this.wizardLocal.getDaysString();
}
setRating(newRating: number) {
if (newRating < 3) newRating = 3;
this.rating = newRating;
}
roomsDec(): void {
if (this.rooms?.length !== 1) {
this.rooms.splice(-1, 1);
}
}
roomsInc(): void {
if (this.rooms?.length < 8) {
const newRoom = {
adults: 2,
children: 0,
'children-ages': [],
};
this.rooms.push(new RoomClass(newRoom));
}
}
adultDec(): void {
this.rooms_adult--;
}
adultInc(): void {
this.rooms_adult++;
}
adultDecApi(index: any): void {
if (this.rooms[index].adults !== 1) {
this.rooms[index].adults--;
}
}
adultIncApi(index: any): void {
if (this.rooms[index].children + this.rooms[index].adults < 4) {
this.rooms[index].adults++;
}
}
kidsDecApi(index: any): void {
if (this.rooms[index].children !== 0) {
this.rooms[index].children--;
this.rooms[index].children_ages.splice(-1, 1);
}
}
kidsIncApi(index: any): void {
if (this.rooms[index].children + this.rooms[index].adults < 4) {
this.rooms[index].children++;
this.rooms[index].children_ages.push(12);
}
}
ageDecApi(index: any, k: any): void {
if (this.rooms[index].children_ages[k] !== 0) {
this.rooms[index].children_ages[k]--;
}
}
ageIncApi(index: any, k: any): void {
if (this.rooms[index].children_ages[k] !== 17) {
this.rooms[index].children_ages[k]++;
}
}
kidsDec(): void {
this.rooms_kids--;
}
kidsInc(): void {
this.rooms_kids++;
}
ageDec(): void {
this.kids_age--;
}
ageInc(): void {
this.kids_age++;
}
setBreakfast(value: any): void {
this.breakfast = value;
}
setRefund(value: any): void {
this.refund = value;
}
setBedSize(bedSize: any) {
this.bedsize = bedSize;
}
}
|