{"version":3,"sources":["webpack:////Users/owenli/Documents/workspace/awi-wlc-fe/src/views/widgets/notificationResultsFilterWidget/js/notificationResultsFilterWidget.js"],"names":["CLS","NotificationResultsFilterWidget","element","_this","this","_classCallCheck","$element","$","notificationsApi","data","nonotifications","notificationDetailApi","$notificationDetailContainer","find","concat","$notifications","notificationAnimationDuration","params","loadNotifications","on","event","currentTarget","filterKey","_","isNil","val","each","index","change","key","value","_this2","url","isEmpty","param","ajax","type","dataType","success","response","notifications","length","toggleNotifications","html","getNotificationItemsMarkup","$notification","$notificationDetail","notificationId","removeClass","loadNotificationDetail","getNotificationDetailEmptyMarkup","_this3","animate","arguments","undefined","getNotificationDetailMarkup","addClass","reveal","callback","setTimeout","notificationsMarkup","forEach","notification","Id","Selected","IsRead","DatePublished","Title","Summary","Content"],"mappings":"84BAAA,IACMA,EAAM,kCAECC,EAA+B,WA4C1C,SA3CD,SAAAA,EAAYC,GAAS,IAAAC,EAAAC,kGAAAC,CAAAD,KAAAH,GACpBG,KAAKF,QAAUA,EACfE,KAAKE,SAAWC,EAAEL,GAClBE,KAAKI,iBAAmBJ,KAAKE,SAASG,KAAK,oBAC3CL,KAAKM,gBAAkBN,KAAKE,SAASG,KAAK,mBAC1CL,KAAKO,sBAAwBP,KAAKE,SAASG,KAAK,yBAEhDL,KAAKQ,6BAA+BR,KAAKE,SAASO,KAAI,IAAAC,OAAKd,EAAG,iCAC9DI,KAAKW,eAAiBX,KAAKE,SAASO,KAAI,IAAAC,OAAKd,EAAG,mBAChDI,KAAKY,8BAAgC,IAErCZ,KAAKa,UACLb,KAAKc,kBAAkBd,KAAKa,QAG5Bb,KAAKE,SAASO,KAAI,UAAAC,OAAWd,EAAG,YAAWmB,GAAG,SAAU,SAACC,GACxD,IAAId,EAAWC,EAAEa,EAAMC,eACnBC,EAAYhB,EAASG,KAAK,cAEzBc,EAAEC,MAAMrB,EAAKc,OAAOK,KAAkC,KAAnBhB,EAASmB,OAE7CtB,EAAKc,OAAOK,KAAehB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,SAACC,GACtBF,GAAmB,sCAAA9C,OACUgD,EAAaC,GAAE,aAAAjD,OAAYd,EAAG,kBAAAc,OAAkBgD,EAAaE,SAAQ,GAAAlD,OAAMd,EAAG,2BAA4B,GAAE,KAAAc,OAAOgD,EAAaG,OAAyC,GAAnC,GAAAnD,OAAMd,EAAG,yBAA4B,gBAAAc,OAEnMgD,EAAaI,cACf,gBAAApD,OAAuBd,EAAG,wBAAAc,OAAuBgD,EAAaI,cAAa,WAErE,GACJ,cAAApD,OAEAgD,EAAaK,MACf,cAAArD,OAAqBd,EAAG,yBAAAc,OAAwBgD,EAAaK,MAAK,SAE5D,GACJ,cAAArD,OAEAgD,EAAaM,QACf,eAAAtD,OAAsBd,EAAG,+BAAAc,OAA8BgD,EAAaM,QAAO,UAErE,GACJ,2BAAAtD,OACWd,EAAG,+CAGb4D,KACP/B,IAAA,8BAAAC,MAED,SAA4BgC,GAC3B,kBAAAhD,OAAmBd,EAAG,gCAAAc,OAA+Bd,EAAG,wBAAAc,OAAuBd,EAAG,wDAAAc,OAAuDgD,EAAaC,GAAE,0BAAAjD,OACzId,EAAG,8EAAAc,OACsBd,EAAG,wCAAAc,OAAuCd,EAAG,yDAAAc,OAE/EgD,EAAaI,cACf,eAAApD,OAAsBd,EAAG,8BAAAc,OAA6BgD,EAAaI,cAAa,UAE1E,GACJ,sCAAApD,OAESd,EAAG,yCAAAc,OAEZgD,EAAaK,MACf,cAAArD,OAAqBd,EAAG,+BAAAc,OAA8BgD,EAAaK,MAAK,SAElE,GACJ,cAAArD,OAEAgD,EAAaO,QACf,eAAAvD,OAAsBd,EAAG,qCAAAc,OAAoCgD,EAAaO,QAAO,UAE3E,GACJ,iCAGNxC,IAAA,mCAAAC,MAED,WACC,OAAO1B,KAAKM,+GAlN8B","file":"widget-6.2f662a3aa586e55a56ca.js","sourcesContent":["const NS = 'NotificationResultsFilterWidget';\nconst CLS = 'notificationResultsFilterWidget';\n\nexport class NotificationResultsFilterWidget {\n\tconstructor(element) {\n\t\tthis.element = element;\n\t\tthis.$element = $(element);\n\t\tthis.notificationsApi = this.$element.data('notificationsApi');\n\t\tthis.nonotifications = this.$element.data(\"nonotifications\");\n\t\tthis.notificationDetailApi = this.$element.data('notificationDetailApi');\n\t\t\n\t\tthis.$notificationDetailContainer = this.$element.find(`.${CLS}-notificationDetailContainer`);\n\t\tthis.$notifications = this.$element.find(`.${CLS}-notifications`);\n\t\tthis.notificationAnimationDuration = 600;\n\n\t\tthis.params = {};\n\t\tthis.loadNotifications(this.params);\n\n\t\t// Filter the notifications using the select filters\n\t\tthis.$element.find(`select.${CLS}-filter`).on('change', (event) => {\n\t\t\tlet $element = $(event.currentTarget);\n\t\t\tlet filterKey = $element.data('filter-key');\n\n\t\t\tif(!(_.isNil(this.params[filterKey]) && $element.val() === '')) {\n\t\t\t\t// Ensure that the filter-key does not match the current select value\n\t\t\t\tif(this.params[filterKey] !== $element.val()) {\n\t\t\t\t\tif(_.isNil($element.val()) || $element.val() === '') {\n\t\t\t\t\t\tdelete this.params[filterKey];\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.params[filterKey] = $element.val();\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.loadNotifications(this.params);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// Clears the filters and loads the notifications\n\t\tthis.$element.find(`.${CLS}-filters--clear`).on('click', () => {\n\t\t\t$(`select.${CLS}-filter`).each((index, element) => {\n\t\t\t\tlet filterKey = $(element).data('filter-key');\n\t\t\t\tdelete this.params[filterKey]; // Empty filter key object\n\t\t\t\t$(element).val('').change();\n\t\t\t});\n\t\t\tthis.loadNotifications(this.params);\n\t\t});\n\t}\n\n\tloadNotifications(params) {\n\t\tlet url = this.notificationsApi;\n\n\t\tif(!_.isEmpty(params)) {\n\t\t\turl += `?${$.param(params)}`;\n\t\t}\n\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: url,\n\t\t\tdataType: 'json',\n\t\t\tsuccess: (response) => {\n\t\t\t\tlet notifications = response;\n\t\t\t\tif(notifications && notifications.length > 0) {\n\t\t\t\t\tthis.toggleNotifications(false, true, () => {\n\t\t\t\t\t\t// Clear notificationDetailContainers\n\t\t\t\t\t\tthis.$notificationDetailContainer.html(null);\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.$notifications.html(this.getNotificationItemsMarkup(notifications));\n\n\t\t\t\t\t// Latch click event to generated notifications markup\n\t\t\t\t\tthis.$element.find(`.${CLS}-notification`).on('click', (event) => {\n\t\t\t\t\t\tlet $notification = $(event.currentTarget);\n\t\t\t\t\t\tlet $notificationDetail = $(`.${CLS}-notificationDetail`);\n\t\t\t\t\t\tlet notificationId = $notification.data('notification-id');\n\n\t\t\t\t\t\tthis.$element.find(`.${CLS}-notification`).removeClass(`${CLS}-notification--selected`);\n\n\t\t\t\t\t\t// If clicking on a notification that is equal to the notificationDetailId\n\t\t\t\t\t\tif($notificationDetail.data('notification-id') === notificationId) {\n\t\t\t\t\t\t\tthis.toggleNotifications(false, true, () => {\n\t\t\t\t\t\t\t\t// Clear notificationDetailContainer\n\t\t\t\t\t\t\t\tthis.$notificationDetailContainer.html(null);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Retreive the notification detail from the API\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis.loadNotificationDetail(notificationId, $notification);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.toggleNotifications(false, true, () => {\n\t\t\t\t\t\tthis.$notificationDetailContainer.html(null);\n\t\t\t\t\t});\n\t\t\t\t\tthis.$notifications.html(this.getNotificationDetailEmptyMarkup());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t// Loads the notification detail and marks it as read\n\tloadNotificationDetail(notificationId, $notification, animate = true) {\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: `${this.notificationDetailApi}/${notificationId}`,\n\t\t\tdataType: 'json',\n\t\t\tsuccess: (response) => {\n\t\t\t\tthis.$notificationDetailContainer.html(this.getNotificationDetailMarkup(response, notificationId));\n\t\t\t\t$notification.addClass(`${CLS}-notification--selected`);\n\n\t\t\t\t// Animates the notificationDetail in by shrinking the width of the notifications list\n\t\t\t\tthis.toggleNotifications(true, animate, () => {\n\t\t\t\t\t// Mark as read\n\t\t\t\t\t$notification.removeClass(`${CLS}-notification--unread`);\n\t\t\t\t});\n\n\t\t\t\t// Attach the close notification event\n\t\t\t\tthis.$element.find(`.${CLS}-notificationDetail-back`).on('click', () => {\n\t\t\t\t\tthis.toggleNotifications(false, animate, () => {\n\t\t\t\t\t\t// Clear notifiationDetailContainer\n\t\t\t\t\t\tthis.$notificationDetailContainer.html(null);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\n\ttoggleNotifications(reveal, animate, callback) {\n\t\tif(animate) {\n\t\t\tthis.$notifications.addClass(`${CLS}-notifications--animate`);\n\t\t}\n\t\telse {\n\t\t\tthis.$notifications.removeClass(`${CLS}-notifications--animate`);\n\t\t}\n\n\t\tif(reveal) {\n\t\t\tthis.$notifications.removeClass(`${CLS}-notifications--conceal`);\n\t\t\tthis.$notifications.addClass(`${CLS}-notifications--reveal`);\n\t\t}\n\t\telse {\n\t\t\tthis.$notifications.addClass(`${CLS}-notifications--conceal`);\n\t\t\tthis.$notifications.removeClass(`${CLS}-notifications--reveal`);\n\t\t}\n\n\t\tif(animate) {\n\t\t\tsetTimeout(() => {\n\t\t\t\tcallback();\n\t\t\t}, this.notificationAnimationDuration);\n\t\t}\n\t\telse {\n\t\t\tcallback();\n\t\t}\n\t}\n\n\tgetNotificationItemsMarkup(notifications) {\n\t\tlet notificationsMarkup = '';\n\t\tnotifications.forEach((notification) => {\n\t\t\tnotificationsMarkup += `\n\t\t\t