{"version":3,"sources":["webpack:///./LeLab.Gcv.Web/src/atomic/molecule/m-lodging-choices/m-lodging-choices.chunk.js","webpack:///./LeLab.Gcv.Web/src/atomic/molecule/m-lodging-choices/m-lodging-choices.scss"],"names":["require","$","$document","document","currentLang","attr","isFrench","dateFormat","moment","locale","Molecule","container","molecule","$container","$startDateButton","find","$endDatebutton","off","on","$calendarContainer","length","trigger","data","updateStartDateButton","updateEndDateButton","dates","startDateBefore","toDate","endDateBefore","startDate","endDate","rangeBetweenDates","getTime","newDate","Date","date","startDateMoment","formattedDate","format","text","endDateMoment","init","each"],"mappings":";;;;;;;;;;;;AAAA,mBAAAA,CAAQ,GAAR;AACA,IAAMC,IAAI,mBAAAD,CAAQ,CAAR,CAAV;AACA,IAAIE,YAAYD,EAAEE,QAAF,CAAhB;AACA,IAAIC,cAAcH,EAAE,MAAF,EAAUI,IAAV,CAAe,MAAf,CAAlB;AACA,IAAMC,WAAWF,gBAAgB,IAAjC;AACA,IAAMG,aAAa,qBAAnB;AACA,IAAMC,SAAS,mBAAAR,CAAQ,CAAR,CAAf;AACA,mBAAAA,CAAQ,EAAR;AACA,mBAAAA,CAAQ,EAAR;AACAQ,OAAOC,MAAP,CAAcH,WAAW,OAAX,GAAqB,OAAnC;;IAEMI,Q;AACF,sBAAYC,SAAZ,EAAuB;AAAA;;AACnB,YAAIC,WAAW,IAAf;;AAEA,YAAMC,aAAaD,SAASC,UAAT,GAAsBZ,EAAEU,SAAF,CAAzC;AACAC,iBAASE,gBAAT,GAA4BD,WAAWE,IAAX,CAAgB,gCAAhB,CAA5B;AACAH,iBAASI,cAAT,GAA0BH,WAAWE,IAAX,CAAgB,8BAAhB,CAA1B;;AAEAH,iBAASE,gBAAT,CAA0BG,GAA1B,CAA8B,wBAA9B;AACAL,iBAASE,gBAAT,CAA0BI,EAA1B,CAA6B,wBAA7B,EAAuD,YAAY;AAC/D,gBAAIC,qBAAqBlB,EAAE,4BAAF,CAAzB;AACA,gBAAIkB,mBAAmBC,M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;;;;AAGL,IAAIG,OAAO,SAAPA,IAAO,GAAY;AACnBxC,MAAE,0BAAF,EAA8ByC,IAA9B,CAAmC,YAAY;AAC3C,YAAI,KAAKhC,QAAT,EACI;AACJ,aAAKA,QAAL,GAAgB,IAAIA,QAAJ,CAAa,IAAb,CAAhB;AACH,KAJD;AAKH,CAND;;AAQA+B;;AAEAvC,UAAUe,GAAV,CAAc,wDAAd;AACAf,UAAUgB,EAAV,CAAa,wDAAb,EAAuEuB,IAAvE,E;;;;;;;AC1FA,yC","file":"m-lodging-choices.js","sourcesContent":["require(\"./m-lodging-choices.scss\");\r\nconst $ = require('jquery');\r\nlet $document = $(document);\r\nlet currentLang = $('html').attr('lang');\r\nconst isFrench = currentLang === \"fr\";\r\nconst dateFormat = \"YYYY-MM-DD HH:mm:ss\";\r\nconst moment = require(\"moment\");\r\nrequire(\"moment/locale/fr-ca\");\r\nrequire(\"moment/locale/en-ca\");\r\nmoment.locale(isFrench ? \"fr-ca\" : \"en-ca\");\r\n\r\nclass Molecule {\r\n constructor(container) {\r\n var molecule = this;\r\n\r\n const $container = molecule.$container = $(container);\r\n molecule.$startDateButton = $container.find(\"[data-start-date-open-overlay]\");\r\n molecule.$endDatebutton = $container.find(\"[data-end-date-open-overlay]\");\r\n\r\n molecule.$startDateButton.off(\"click.m-lodging-choice\");\r\n molecule.$startDateButton.on(\"click.m-lodging-choice\", function () {\r\n let $calendarContainer = $('[data-m-filter-date-range]');\r\n if ($calendarContainer.length === 0) // Au cas, ou... Je ne voulais pas introduire un bug en ajoutant la ligne ci-haut\r\n $calendarContainer = $container.find(\"[data-calendar-container]\");\r\n\r\n $calendarContainer.trigger(\"m-filter-date-range_set-start-date-mode\", [molecule.$startDateButton.data(\"displayed-date\"), molecule.$endDatebutton.data(\"displayed-date\")]);\r\n });\r\n\r\n molecule.$endDatebutton.off(\"click.m-lodging-choice\");\r\n molecule.$endDatebutton.on(\"click.m-lodging-choice\", function () {\r\n let $calendarContainer = $('[data-m-filter-date-range]');\r\n if ($calendarContainer.length === 0) // Au cas, ou... Je ne voulais pas introduire un bug en ajoutant la ligne ci-haut\r\n $calendarContainer = $container.find(\"[data-calendar-container]\");\r\n\r\n $calendarContainer.trigger(\"m-filter-date-range_set-end-date-mode\", [molecule.$startDateButton.data(\"displayed-date\"), molecule.$endDatebutton.data(\"displayed-date\")]);\r\n });\r\n\r\n molecule.updateStartDateButton();\r\n molecule.updateEndDateButton();\r\n }\r\n\r\n updateDates(dates) {\r\n var startDateBefore = moment(this.$startDateButton.data(\"displayed-date\"), dateFormat).toDate();\r\n var endDateBefore = moment(this.$endDatebutton.data(\"displayed-date\"), dateFormat).toDate();\r\n\r\n if (dates.startDate) {\r\n this.updateStartDateButton(dates.startDate);\r\n }\r\n\r\n if (dates.endDate) {\r\n this.updateEndDateButton(dates.endDate);\r\n } else if (dates.startDate) {\r\n var rangeBetweenDates = endDateBefore.getTime() - startDateBefore.getTime();\r\n var newDate = new Date(dates.startDate.getTime() + rangeBetweenDates);\r\n this.updateEndDateButton(newDate);\r\n }\r\n }\r\n\r\n updateStartDateButton(date) {\r\n let startDateMoment = date ? moment(date) : moment(this.$startDateButton.data(\"displayed-date\"), dateFormat);\r\n\r\n let formattedDate = startDateMoment.format(dateFormat);\r\n this.$startDateButton.data(\"displayed-date\", formattedDate);\r\n\r\n this.$startDateButton.find(\"[data-display-day]\").text(startDateMoment.date());\r\n this.$startDateButton.find(\"[data-display-month]\").text(startDateMoment.format(\"MMMM\"));\r\n }\r\n\r\n updateEndDateButton(date) {\r\n let endDateMoment = date ? moment(date) : moment(this.$endDatebutton.data(\"displayed-date\"), dateFormat);\r\n\r\n let formattedDate = endDateMoment.format(dateFormat);\r\n this.$endDatebutton.data(\"displayed-date\", formattedDate);\r\n\r\n this.$endDatebutton.find(\"[data-display-day]\").text(endDateMoment.date());\r\n this.$endDatebutton.find(\"[data-display-month]\").text(endDateMoment.format(\"MMMM\"));\r\n }\r\n}\r\n\r\nlet init = function () {\r\n $(\"[data-m-lodging-choices]\").each(function () {\r\n if (this.Molecule)\r\n return;\r\n this.Molecule = new Molecule(this);\r\n });\r\n}\r\n\r\ninit();\r\n\r\n$document.off('jsInitAllScripts.m-lodging-choices__events-regroupment');\r\n$document.on('jsInitAllScripts.m-lodging-choices__events-regroupment', init);\r\n\n\n\n// WEBPACK FOOTER //\n// ./LeLab.Gcv.Web/src/atomic/molecule/m-lodging-choices/m-lodging-choices.chunk.js","// removed by extract-text-webpack-plugin\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./LeLab.Gcv.Web/src/atomic/molecule/m-lodging-choices/m-lodging-choices.scss\n// module id = 404\n// module chunks = 132"],"sourceRoot":""}