{"version":3,"sources":["webpack:///./LeLab.Gcv.Web/src/atomic/molecule/m-filter-date/m-filter-date.chunk.js","webpack:///./LeLab.Gcv.Web/src/atomic/molecule/m-filter-date/m-filter-date.scss"],"names":["require","Logger","$","pickmeup","currentLang","attr","$document","document","isFrench","moment","locale","defaults","locales","days","daysShort","daysMin","months","monthsShort","BEHAVIOR_AVAILABILITY_CHECK","BEHAVIOR_SELECTION","Calendar","container","Log","calendarInstance","$container","dayInMs","calendar","find","get","dateSelectedEventSuffix","data","$loading","$available","$unavailable","$error","availabilityUrl","adults","parseInt","children","behavior","getNightCount","productId","loading","checkingTime","availabilities","startTime","endTime","getMinDate","dateString","date","toDate","getMaxDate","subtract","setDate","getDate","today","Date","getFullYear","getMonth","destroy","pmu","class_name","flat","first_day","mode","min","format","render","getDateOptions","off","on","minDate","clear","setVisibleDate","onDateChanged","update","addEventListener","ev","detail","findAdjacentAvailabilities","dispatchEvent","formattedDate","get_date","overlay_id","closest","product","nights","selected","disabled","classNames","time","getTime","maxDate","push","dateIsUnavailable","dateIsAvailable","join","trigger","when","checkAvailability","then","response","isAvailable","end","nightCount","showMessage","scrollOverlay","fail","set_date","from","to","setTime","checkAvailabilityRange","dates","item","promise","startAvailabilityRequest","always","ajax","cache","type","productid","startDate","Deferred","datesPromises","d","Promise","all","resultArray","resolve","$element","hide","show","name","createEvent","initEvent","pNbOfNights","nbOfNights","scrollTop","init","each","reset"],"mappings":";;;;;;;;;;;;AAAA,mBAAAA,CAAQ,EAAR;AACA,mBAAAA,CAAQ,GAAR;AACA,IAAIC,SAAS,mBAAAD,CAAQ,EAAR,CAAb;AACA,IAAME,IAAI,mBAAAF,CAAQ,CAAR,CAAV;AAAA,IACIG,WAAW,mBAAAH,CAAQ,EAAR,CADf;AAAA,IAEII,cAAcF,EAAE,MAAF,EAAUG,IAAV,CAAe,MAAf,CAFlB;AAGA,IAAIC,YAAYJ,EAAEK,QAAF,CAAhB;AACA,IAAMC,WAAWJ,gBAAgB,IAAjC;A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AAZ;AACAnE,cAAE,IAAF,EAAQmE,GAAR,CAAY,iBAAZ;AACA,mBAAO,KAAKjD,QAAZ;AACH;AACD,aAAKA,QAAL,GAAgB,IAAIA,QAAJ,CAAa,IAAb,CAAhB;AACH,KAPD;AAQH,CATD;;AAWAuH;;AAEArI,UAAU+D,GAAV,CAAc,oDAAd;AACA/D,UAAUgE,EAAV,CAAa,oDAAb,EAAmEqE,IAAnE,E;;;;;;;ACxYA,yC","file":"m-filter-date.js","sourcesContent":["require(\"pickmeup/css/pickmeup.scss\");\r\nrequire(\"./m-filter-date.scss\");\r\nlet Logger = require(\"utils/log-utils\");\r\nconst $ = require('jquery'),\r\n pickmeup = require(\"pickmeup/dist/pickmeup.min.js\"),\r\n currentLang = $('html').attr('lang');\r\nlet $document = $(document);\r\nconst isFrench = currentLang === \"fr\";\r\nconst moment = require(\"moment\");\r\nmoment.locale(isFrench ? \"fr-ca\" : \"en-ca\");\r\n\r\npickmeup.defaults.locales['fr'] = {\r\n days: ['Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'],\r\n daysShort: ['Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'],\r\n daysMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],\r\n months: ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'],\r\n monthsShort: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Jul', 'Août', 'Sep', 'Oct', 'Nov', 'Déc']\r\n};\r\n\r\npickmeup.defaults.locales['en'] = {\r\n days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\r\n daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\r\n daysMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\r\n months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\r\n monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\r\n};\r\n\r\nconst BEHAVIOR_AVAILABILITY_CHECK = \"AvailabilityCheck\";\r\nconst BEHAVIOR_SELECTION = \"Selection\";\r\n\r\nclass Calendar {\r\n constructor(container) {\r\n\r\n Logger.Log(\"Calendar m-filter-date\", \"Constructor called\");\r\n\r\n var calendarInstance = this;\r\n var $container = this.$container = $(container);\r\n this.dayInMs = 86400000;\r\n\r\n // L'élément contenant le calendrier\r\n const calendar = $container.find(\"[data-calendar]\").get(0);\r\n\r\n this.dateSelectedEventSuffix = $container.data(\"calendar-selected-event-suffix\");\r\n\r\n // Éléments contenant des messages\r\n this.$loading = $container.find(\"[data-calendar-loading]\");\r\n this.$available = $container.find(\"[data-calendar-available]\");\r\n this.$unavailable = $container.find(\"[data-calendar-unavailable]\");\r\n this.$error = $container.find(\"[data-calendar-error]\");\r\n\r\n this.availabilityUrl = $container.data(\"calendar-availability-url\");\r\n this.adults = parseInt($container.data(\"calendar-adults\") || \"0\");\r\n this.children = parseInt($container.data(\"calendar-children\") || \"0\");\r\n\r\n // Est-ce qu'on veut la mécanique de vérification de dispos, ou seulement la sélection de date\r\n this.behavior = $container.data(\"calendar-behavior\");\r\n\r\n // Utilisé pour highlighter le bon nombre de jours après la date choisie\r\n this.getNightCount = function () {\r\n return parseInt($container.data(\"calendar-nights\")) || null;\r\n };\r\n\r\n // Id du produit pour lequel il faut vérifier les disponibilités\r\n this.productId = $container.data(\"calendar-product-id\"); //TODO : use productId for availability check\r\n\r\n // Lorsque true, toutes les dates sont désactivées\r\n this.loading = false;\r\n\r\n // Date pour laquelle on est en train de vérifier la disponibilité\r\n this.checkingTime = null;\r\n\r\n // Liste des dispos connues\r\n this.availabilities = {};\r\n\r\n // Utilisé pour marquer des dates comme sélectionnées\r\n this.startTime = 0;\r\n this.endTime = 0;\r\n\r\n this.getMinDate = function () {\r\n var dateString = $container.attr(\"data-calendar-min-date\");\r\n\r\n if (dateString) {\r\n let date = moment(dateString, \"YYYY-MM-DD\").toDate();\r\n\r\n return date;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n this.getMaxDate = function () {\r\n var dateString = $container.attr(\"data-calendar-max-date\");\r\n\r\n if (dateString) {\r\n let date = moment(dateString, \"YYYY-MM-DD\").toDate();\r\n\r\n // Important, à cause du fait qu'on sélectionne la date de check in\r\n date = moment(date).subtract(1, 'day').toDate();\r\n\r\n // On doit tenir compte du nombre de nuitée, car le max date est en\r\n // fait le max END date. Tandis que dans ce calendrier, on choisit \r\n // une date d'arrivée.\r\n if (calendarInstance.getNightCount() && calendarInstance.getNightCount() > 1) {\r\n date.setDate(date.getDate() - (calendarInstance.getNightCount() - 1));\r\n }\r\n\r\n return date;\r\n }\r\n\r\n return null;\r\n };\r\n\r\n const today = new Date();\r\n this.today = new Date(today.getFullYear(), today.getMonth(), today.getDate());\r\n\r\n pickmeup(calendar).destroy();\r\n this.pmu = pickmeup(calendar, {\r\n class_name: 'm-filter-date__pickmeup',\r\n flat: true,\r\n first_day: 0,\r\n mode: 'single',\r\n min: 'current',\r\n format: 'Y-m-d',\r\n locale: currentLang,\r\n render: date => this.getDateOptions(date)\r\n });\r\n\r\n $container.off('m-filter-date__do-update.m-filter-date__events-regroupment');\r\n $container.on('m-filter-date__do-update.m-filter-date__events-regroupment', function () {\r\n var minDate = calendarInstance.getMinDate();\r\n calendarInstance.pmu.clear();\r\n calendarInstance.setVisibleDate(minDate);\r\n calendarInstance.onDateChanged(minDate);\r\n calendarInstance.pmu.update();\r\n });\r\n calendar.addEventListener('pickmeup-change', ev => this.onDateChanged(ev.detail.date));\r\n this.$unavailable.find(\"button\").off(\"click.m-filter-date__events-regroupment\");\r\n this.$unavailable.find(\"button\").on(\"click.m-filter-date__events-regroupment\", () => this.findAdjacentAvailabilities());\r\n this.$available.find(\"button\").off(\"click.m-filter-date__events-regroupment\");\r\n this.$available.find(\"button\").on(\"click.m-filter-date__events-regroupment\", () => this.dispatchEvent(\"m-filter-date__selected\" + this.dateSelectedEventSuffix, {\r\n formattedDate: this.pmu.get_date(true),\r\n date: this.pmu.get_date(false),\r\n overlay_id: this.$container.closest(\"[data-overlay]\").attr(\"data-overlay\"),\r\n product: this.productId,\r\n nights: this.getNightCount() ? this.getNightCount() : 0\r\n }));\r\n }\r\n\r\n getDateOptions(date) {\r\n\r\n //Logger.Log(\"Calendar\", \"Get Date Options\");\r\n\r\n let selected = false,\r\n disabled = false,\r\n classNames = [];\r\n\r\n var time = date.getTime();\r\n var minDate = this.getMinDate();\r\n var maxDate = this.getMaxDate();\r\n\r\n if (date < this.today ||\r\n this.loading ||\r\n (minDate && minDate > date) ||\r\n (maxDate && maxDate < date)) {\r\n disabled = true;\r\n } else if (this.startTime <= time && this.endTime >= time) {\r\n selected = true;\r\n }\r\n\r\n if (this.checkingTime !== null && time === this.checkingTime) {\r\n classNames.push(\"pmu-checking\");\r\n } else if (this.dateIsUnavailable(date)) {\r\n classNames.push(\"pmu-unavailable\");\r\n } else if (time === this.startTime) {\r\n classNames.push(\"pmu-start\");\r\n } else if (this.dateIsAvailable(date)) {\r\n classNames.push(\"pmu-available\");\r\n }\r\n\r\n return {\r\n class_name: classNames.join(' '),\r\n selected: selected,\r\n disabled: disabled\r\n };\r\n }\r\n\r\n onDateChanged(date) {\r\n if (this.behavior === BEHAVIOR_SELECTION) {\r\n this.dispatchEvent(\"m-filter-date__selected\" + this.dateSelectedEventSuffix,\r\n {\r\n date: this.pmu.get_date(true),\r\n overlay_id: this.$container.closest(\"[data-overlay]\").attr(\"data-overlay\")\r\n });\r\n $document.trigger('overlayCloseAll');\r\n return $.when();\r\n }\r\n\r\n const time = date.getTime();\r\n\r\n this.startTime = 0;\r\n this.endTime = 0;\r\n\r\n return this.checkAvailability(date)\r\n .then(response => {\r\n if (response.isAvailable) {\r\n this.availabilities[time] = true;\r\n\r\n var end = new Date(date);\r\n if (this.nightCount !== null) {\r\n end.setDate(end.getDate() + this.nightCount);\r\n }\r\n\r\n this.startTime = time;\r\n this.endTime = end.getTime();\r\n\r\n this.pmu.update();\r\n this.showMessage(this.$available);\r\n } else {\r\n this.availabilities[time] = false;\r\n\r\n this.pmu.update();\r\n this.showMessage(this.$unavailable);\r\n }\r\n\r\n this.scrollOverlay();\r\n })\r\n .fail(() => {\r\n this.pmu.set_date(null);\r\n this.showMessage(this.$error);\r\n });\r\n }\r\n\r\n findAdjacentAvailabilities() {\r\n const date = this.pmu.get_date();\r\n let from = new Date(date),\r\n to = new Date(date);\r\n\r\n from.setTime(from.getTime() - 5 * this.dayInMs);\r\n to.setTime(to.getTime() + 5 * this.dayInMs);\r\n\r\n if (from < this.today)\r\n from = this.today;\r\n\r\n return this.checkAvailabilityRange(from, to)\r\n .then(response => {\r\n for (let item of response.dates) {\r\n const time = item.date.getTime();\r\n if (item.isAvailable) {\r\n this.availabilities[time] = true;\r\n } else {\r\n this.availabilities[time] = false;\r\n }\r\n }\r\n\r\n this.pmu.update();\r\n\r\n // TODO: message si aucune date?\r\n this.showMessage(null);\r\n })\r\n .fail(() => {\r\n this.pmu.set_date(null);\r\n this.showMessage(this.$error);\r\n });\r\n }\r\n\r\n checkAvailability(date) {\r\n this.checkingTime = date.getTime();\r\n this.loading = true;\r\n this.showMessage(this.$loading);\r\n\r\n let promise = this.startAvailabilityRequest(this.checkingTime);\r\n\r\n return promise.always(() => {\r\n this.checkingTime = null;\r\n this.loading = false;\r\n });\r\n }\r\n\r\n startAvailabilityRequest(date) {\r\n return $.ajax(\"/\" + this.availabilityUrl,\r\n {\r\n cache: false,\r\n type: 'GET',\r\n data: {\r\n productid: this.productId,\r\n startDate: date,\r\n nightCount: this.nightCount || 0,\r\n adults: this.adults || 1,\r\n children: this.children || 0\r\n }\r\n }).then(function (data) {\r\n return {\r\n date: new Date(date),\r\n isAvailable: data\r\n };\r\n });\r\n }\r\n\r\n checkAvailabilityRange(from, to) {\r\n const promise = $.Deferred();\r\n\r\n this.loading = true;\r\n this.showMessage(this.$loading);\r\n\r\n const datesPromises = [];\r\n let d = from.getTime();\r\n while (d <= to.getTime()) {\r\n datesPromises.push(this.startAvailabilityRequest(d));\r\n d = d + this.dayInMs;\r\n }\r\n\r\n Promise.all(datesPromises).then(function (resultArray) {\r\n promise.resolve({\r\n dates: resultArray\r\n });\r\n });\r\n\r\n return promise.always(() => {\r\n this.loading = false;\r\n });\r\n }\r\n\r\n showMessage($element) {\r\n this.$loading.hide();\r\n this.$available.hide();\r\n this.$unavailable.hide();\r\n this.$error.hide();\r\n\r\n $element && $element.show();\r\n }\r\n\r\n dateIsAvailable(date) {\r\n return this.availabilities[date.getTime()] === true;\r\n }\r\n\r\n dateIsUnavailable(date) {\r\n return this.availabilities[date.getTime()] === false;\r\n }\r\n\r\n dispatchEvent(name, data) {\r\n Logger.Log('m-filter-date.chunk.js:dispatchEvent (Event Name)', name);\r\n Logger.Log('m-filter-date.chunk.js:dispatchEvent (Event Data)', data);\r\n\r\n const ev = document.createEvent(\"Event\");\r\n ev.detail = data;\r\n ev.initEvent(name, true, false);\r\n this.$container.get(0).dispatchEvent(ev);\r\n }\r\n\r\n // Est appelé également par le plugin o-ticket-date lorsqu'une date est sélectionnée\r\n setVisibleDate(date, pNbOfNights) {\r\n\r\n Logger.Log(\"Calendar setVisibleDate\", {date: date, nbOfNights: pNbOfNights});\r\n\r\n this.pmu.set_date(date);\r\n\r\n if (pNbOfNights) {\r\n const nbOfNights = parseInt(pNbOfNights);\r\n if (nbOfNights > 0) {\r\n this.$container.data(\"calendar-nights\", nbOfNights);\r\n this.$container.find('[data-calendar-nights-title]').hide();\r\n }\r\n }\r\n\r\n }\r\n\r\n scrollOverlay() {\r\n this.$container.closest(\"[data-overlay-content]\").scrollTop(9999);\r\n }\r\n}\r\n\r\nlet init = function () {\r\n $(\"[data-m-filter-date]\").each(function () {\r\n if (this.Calendar) return;\r\n this.Calendar = new Calendar(this);\r\n });\r\n};\r\n\r\nlet reset = function () {\r\n $(\"[data-m-filter-date]\").each(function () {\r\n if (this.Calendar) {\r\n $(this).off(\"click\");\r\n $(this).off(\"pickmeup-change\");\r\n delete this.Calendar;\r\n }\r\n this.Calendar = new Calendar(this);\r\n });\r\n};\r\n\r\ninit();\r\n\r\n$document.off('jsInitAllScripts.m-filter-date__events-regroupment');\r\n$document.on('jsInitAllScripts.m-filter-date__events-regroupment', init);\r\n\n\n\n// WEBPACK FOOTER //\n// ./LeLab.Gcv.Web/src/atomic/molecule/m-filter-date/m-filter-date.chunk.js","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./LeLab.Gcv.Web/src/atomic/molecule/m-filter-date/m-filter-date.scss\n// module id = 389\n// module chunks = 139"],"sourceRoot":""}