PageSourceSearch

https://flowbymovimientoapp.web.app/site.page-5ZAEZHNY.js

js flowbymovimientoapp.web.app collected 2026-10-03 12:24:30 UTC 11,992 bytes, 318 lines download raw bytes

1import {
2  SitesService
3} from "./chunk-K4G7SUOC.js";
4import {
5  BookingService
6} from "./chunk-XESFXUTT.js";
7import {
8  ScaffoldComponent
9} from "./chunk-742AEXYX.js";
10import {
11  addIcons,
12  chevronDown,
13  location,
14  star
15} from "./chunk-2PEJEB66.js";
16import "./chunk-XS4DIMK5.js";
17import {
18  MarkdownComponent,
19  MarkdownModule
20} from "./chunk-3HSNWQVK.js";
21import "./chunk-UDQ7OTPP.js";
22import "./chunk-AYJG2K33.js";
23import {
24  ActivatedRoute,
25  IonButton,
26  IonIcon,
27  IonLabel,
28  IonSpinner,
29  IonText,
30  Subject,
31  combineLatest,
32  inject,
33  signal,
34  takeUntil,
35  ɵsetClassDebugInfo,
36  ɵɵadvance,
37  ɵɵclassProp,
38  ɵɵconditional,
39  ɵɵdefineComponent,
40  ɵɵelement,
41  ɵɵelementEnd,
42  ɵɵelementStart,
43  ɵɵgetCurrentView,
44  ɵɵlistener,
45  ɵɵnextContext,
46  ɵɵproperty,
47  ɵɵpureFunction0,
48  ɵɵrepeater,
49  ɵɵrepeaterCreate,
50  ɵɵrepeaterTrackByIdentity,
51  ɵɵresetView,
52  ɵɵrestoreView,
53  ɵɵsanitizeUrl,
54  ɵɵtemplate,
55  ɵɵtext,
56  ɵɵtextInterpolate,
57  ɵɵtextInterpolate1
58} from "./chunk-CHORTHTA.js";
59import "./chunk-I6N7KE6Z.js";
60import "./chunk-KQEJHESJ.js";
61import "./chunk-7WY7G26X.js";
62import "./chunk-5JC46ZQ6.js";
63import "./chunk-DDXE25LQ.js";
64import "./chunk-OQQEQ4WG.js";
65import "./chunk-44XVBEDH.js";
66import "./chunk-6WFB2JWY.js";
67import "./chunk-QT4MIBM5.js";
68import "./chunk-LHYYZWFK.js";
69import "./chunk-4WT7J3YM.js";
70import "./chunk-6FFMTLXI.js";
71import "./chunk-XIXT7DF6.js";
72import "./chunk-CC56LK7W.js";
73import "./chunk-K3HSXS64.js";
74import {
75  __async
76} from "./chunk-UQIXM5CJ.js";
77
78// src/app/interfaces/enums/site/type.ts
79var Type;
80(function(Type2) {
81  Type2["restaurant"] = "Restaurante";
82  Type2["bar"] = "Bar";
83  Type2["party"] = "Fiesta";
84  Type2["brunch"] = "Desayuno/Almuerzo/Postres";
85  Type2["hotel"] = "Hotel";
86  Type2["activity"] = "Actividad";
87  Type2["public_place"] = "Lugar p\xFAblico";
88})(Type || (Type = {}));
89
90// src/app/interfaces/enums/booking/rating.ts
91var Rating;
92(function(Rating2) {
93  Rating2["verde"] = "verde";
94  Rating2["amarillo"] = "amarillo";
95  Rating2["rojo"] = "rojo";
96})(Rating || (Rating = {}));
97function starsToRating(stars) {
98  switch (stars) {
99    case 3:
100      return Rating.verde;
101    case 2:
102      return Rating.amarillo;
103    default:
104      return Rating.rojo;
105  }
106}
107function ratingToStars(rating) {
108  if (!rating)
109    return 0;
110  switch (rating) {
111    case Rating.verde:
112      return 3;
113    case Rating.amarillo:
114      return 2;
115    case Rating.rojo:
116      return 1;
117  }
118}
119
120// src/app/pages/destination/sites/site/site.page.ts
121var _c0 = () => [3, 2, 1];
122function SitePage_Conditional_2_Template(rf, ctx) {
123  if (rf & 1) {
124    \u0275\u0275elementStart(0, "div", 2);
125    \u0275\u0275element(1, "ion-spinner", 3);
126    \u0275\u0275elementEnd();
127  }
128}
129function SitePage_Conditional_3_For_20_Template(rf, ctx) {
130  if (rf & 1) {
131    const _r3 = \u0275\u0275getCurrentView();
132    \u0275\u0275elementStart(0, "ion-button", 16);
133    \u0275\u0275listener("click", function SitePage_Conditional_3_For_20_Template_ion_button_click_0_listener() {
134      const rate_r4 = \u0275\u0275restoreView(_r3).$implicit;
135      const ctx_r1 = \u0275\u0275nextContext(2);
136      return \u0275\u0275resetView(ctx_r1.rateSite(rate_r4));
137    });
138    \u0275\u0275element(1, "img", 17);
139    \u0275\u0275elementEnd();
140  }
141  if (rf & 2) {
142    const rate_r4 = ctx.$implicit;
143    const ctx_r1 = \u0275\u0275nextContext(2);
144    \u0275\u0275classProp("selected", ctx_r1.selectedRate() === rate_r4);
145    \u0275\u0275advance();
146    \u0275\u0275property("src", "assets/images/estrella " + rate_r4 + ".svg", \u0275\u0275sanitizeUrl)("alt", "Pulsando en esta opci\xF3n, se valorar\xE1 con " + rate_r4 + " estrellas");
147  }
148}
149function SitePage_Conditional_3_Template(rf, ctx) {
150  if (rf & 1) {
151    const _r1 = \u0275\u0275getCurrentView();
152    \u0275\u0275element(0, "img", 4);
153    \u0275\u0275elementStart(1, "ion-label", 5);
154    \u0275\u0275text(2);
155    \u0275\u0275elementEnd();
156    \u0275\u0275elementStart(3, "ion-label", 6);
157    \u0275\u0275text(4);
158    \u0275\u0275elementEnd();
159    \u0275\u0275elementStart(5, "div", 7);
160    \u0275\u0275element(6, "ion-icon", 8);
161    \u0275\u0275elementStart(7, "ion-text");
162    \u0275\u0275text(8);
163    \u0275\u0275elementEnd()();
164    \u0275\u0275elementStart(9, "div");
165    \u0275\u0275element(10, "markdown", 9);
166    \u0275\u0275elementEnd();
167    \u0275\u0275elementStart(11, "ion-text", 10);
168    \u0275\u0275listener("click", function SitePage_Conditional_3_Template_ion_text_click_11_listener() {
169      \u0275\u0275restoreView(_r1);
170      const ctx_r1 = \u0275\u0275nextContext();
171      return \u0275\u0275resetView(ctx_r1.toggleDescription());
172    });
173    \u0275\u0275text(12);
174    \u0275\u0275element(13, "ion-icon", 11);
175    \u0275\u0275elementEnd();
176    \u0275\u0275elementStart(14, "ion-button", 12);
177    \u0275\u0275text(15, " VER EN GOOGLE MAPS ");
178    \u0275\u0275elementEnd();
179    \u0275\u0275elementStart(16, "ion-label", 13);
180    \u0275\u0275text(17, " Valora este sitio ");
181    \u0275\u0275elementEnd();
182    \u0275\u0275elementStart(18, "div", 14);
183    \u0275\u0275repeaterCreate(19, SitePage_Conditional_3_For_20_Template, 2, 4, "ion-button", 15, \u0275\u0275repeaterTrackByIdentity);
184    \u0275\u0275elementEnd();
185  }
186  if (rf & 2) {
187    const ctx_r1 = \u0275\u0275nextContext();
188    \u0275\u0275property("src", ctx_r1.site().imagen, \u0275\u0275sanitizeUrl)("alt", ctx_r1.site().nombre);
189    \u0275\u0275advance(2);
190    \u0275\u0275textInterpolate1(" ", ctx_r1.getTypeLabel(ctx_r1.site().tipo), " ");
191    \u0275\u0275advance(2);
192    \u0275\u0275textInterpolate(ctx_r1.site().nombre);
193    \u0275\u0275advance(4);
194    \u0275\u0275textInterpolate(ctx_r1.site().direccion);
195    \u0275\u0275advance();
196    \u0275\u0275classProp("line-clamp", !ctx_r1.showFullDescription());
197    \u0275\u0275advance();
198    \u0275\u0275property("data", ctx_r1.site().descripcion);
199    \u0275\u0275advance(2);
200    \u0275\u0275textInterpolate1(" ", ctx_r1.showFullDescription() ? "Mostrar menos" : "Leer m\xE1s", " ");
201    \u0275\u0275advance(2);
202    \u0275\u0275property("href", ctx_r1.site().url);
203    \u0275\u0275advance(5);
204    \u0275\u0275repeater(\u0275\u0275pureFunction0(10, _c0));
205  }
206}
207var _SitePage = class _SitePage {
208  constructor() {
209    this.route = inject(ActivatedRoute);
210    this.sitesService = inject(SitesService);
211    this.bookingService = inject(BookingService);
212    this.destroy$ = new Subject();
213    this.siteName = this.route.snapshot.params["site"];
214    this.backRouter = signal("");
215    this.site = signal(null);
216    this.isLoading = signal(true);
217    this.selectedRate = signal(0);
218    this.showFullDescription = signal(false);
219    addIcons({ location, star, chevronDown });
220  }
221  ngOnInit() {
222    this.route.data.pipe(takeUntil(this.destroy$)).subscribe({
223      next: (data) => {
224        this.backRouter.set(`/destinations/${data["nombre"]}/${data["destino"]}/sites`);
225        const bookingId = data["nombre"];
226        if (!this.siteName || !bookingId) {
227          this.isLoading.set(false);
228          return;
229        }
230        this.loadSiteAndBooking(bookingId);
231      },
232      error: (error) => {
233        console.error("Error loading route data:", error);
234        this.isLoading.set(false);
235      }
236    });
237  }
238  ngOnDestroy() {
239    this.destroy$.next();
240    this.destroy$.complete();
241  }
242  getTypeLabel(type) {
243    return Type[type];
244  }
245  toggleDescription() {
246    this.showFullDescription.update((value) => !value);
247  }
248  rateSite(rate) {
249    return __async(this, null, function* () {
250      try {
251        this.selectedRate.set(rate);
252        const bookingId = this.route.snapshot.data["nombre"];
253        if (!this.site() || !bookingId) {
254          throw new Error("Missing required data for rating");
255        }
256        const ratingValue = starsToRating(rate);
257        yield this.bookingService.updateRecommendedSiteRating(bookingId, this.site().id, ratingValue);
258      } catch (error) {
259        console.error("Error rating site:", error);
260        this.selectedRate.set(0);
261      }
262    });
263  }
264  loadSiteAndBooking(bookingId) {
265    const site$ = this.sitesService.getSiteById(this.siteName);
266    const booking$ = this.bookingService.getBookingById(bookingId);
267    combineLatest([site$, booking$]).pipe(takeUntil(this.destroy$)).subscribe({
268      next: ([site, booking]) => {
269        this.site.set(site);
270        this.isLoading.set(false);
271        if ((booking == null ? void 0 : booking.sitiosRecomendados) && site) {
272          const recommendedSite = booking.sitiosRecomendados.find((r) => r.sitio.id === site.id);
273          if (recommendedSite == null ? void 0 : recommendedSite.valoracion) {
274            this.selectedRate.set(ratingToStars(recommendedSite.valoracion));
275          }
276        }
277      },
278      error: (error) => {
279        console.error("Error loading site and booking:", error);
280        this.isLoading.set(false);
281      }
282    });
283  }
284};
285_SitePage.\u0275fac = function SitePage_Factory(__ngFactoryType__) {
286  return new (__ngFactoryType__ || _SitePage)();
287};
288_SitePage.\u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _SitePage, selectors: [["app-site"]], decls: 4, vars: 4, consts: [[3, "title", "backRouter"], [1, "flex", "flex-col", "gap-4", "text-base", "md:text-xl", "mb-28"], [1, "flex", "justify-center", "items-center"], ["name", "dots", 1, "text-flow-white"], [1, "w-full", "h-52", "lg:h-72", "object-cover", "rounded-3xl", "border-2", "border-flow-white", 3, "src", "alt"], [1, "text-flow-yellow", "mt-4", "lg:mt-2"], [1, "font-bold", "text-lg", "md:text-2xl", "lg:text-3xl"], [1, "flex", "items-center", "gap-2"], ["name", "location", 1, "text-flow-yellow"], [3, "data"], [1, "flex", "items-center", "gap-2", "cursor-pointer", "decoration-1", "underline", "decoration-gray-300", "hover:text-flow-yellow", "hover:decoration-flow-yellow", "transition-all", "duration-150", 3, "click"], ["name", "chevron-down"], ["fill", "clear", "shape", "round", "size", "small", "target", "_blank", 1, "bg-flow-yellow", "text-flow-green", "rounded-full", "font-bold", "text-base", "md:text-xl", "mt-6", "lg:mt-2", "py-2", "lg:py-1", 3, "href"], [1, "font-bold", "mt-8", "lg:mt-2"], [1, "grid", "grid-cols-3", "gap-4", "md:gap-10", "lg:gap-20", "items-center", "justify-between", "mr-1"], ["fill", "clear", "shape", "round", 1, "bg-flow-yellow", "text-flow-green", "rounded-full", "cursor-pointer", "w-full", 3, "selected"], ["fill", "clear", "shape", "round", 1, "bg-flow-yellow", "text-flow-green", "rounded-full", "cursor-pointer", "w-full", 3, "click"], [1, "w-full", "max-w-[30px]", "md:max-w-[40px]", "lg:my-1", 3, "src", "alt"]], template: function SitePage_Template(rf, ctx) {
289  if (rf & 1) {
290    \u0275\u0275elementStart(0, "app-scaffold", 0)(1, "section", 1);
291    \u0275\u0275template(2, SitePage_Conditional_2_Template, 2, 0, "div", 2)(3, SitePage_Conditional_3_Template, 21, 11);
292    \u0275\u0275elementEnd()();
293  }
294  if (rf & 2) {
295    \u0275\u0275property("title", "Sitio recomendado")("backRouter", ctx.backRouter());
296    \u0275\u0275advance(2);
297    \u0275\u0275conditional(ctx.isLoading() ? 2 : -1);
298    \u0275\u0275advance();
299    \u0275\u0275conditional(!ctx.isLoading() && ctx.site() ? 3 : -1);
300  }
301}, dependencies: [
302  ScaffoldComponent,
303  IonLabel,
304  IonText,
305  MarkdownModule,
306  MarkdownComponent,
307  IonButton,
308  IonIcon,
309  IonSpinner
310], styles: ["\n\n.selected[_ngcontent-%COMP%] {\n  border-width: 4px;\n  border-color: var(--flow-white);\n}\n.line-clamp[_ngcontent-%COMP%] {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  -webkit-line-clamp: 3;\n  line-height: 1.5em;\n  max-height: 4.5em;\n}\n/*# sourceMappingURL=site.page.css.map */"] });
311var SitePage = _SitePage;
312(() => {
313  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(SitePage, { className: "SitePage", filePath: "src/app/pages/destination/sites/site/site.page.ts", lineNumber: 132 });
314})();
315export {
316  SitePage as default
317};
318//# sourceMappingURL=site.page-5ZAEZHNY.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.