{"version":3,"sources":["webpack:///./widgets/sourcingGuideItemBlock.js","webpack:///./widgets/sourcingGuideBlock.js","webpack:////Users/owenli/Documents/workspace/awi-woolmark-fe/handlebarsHelpers.js","webpack:///../partials/widgets/sourcingGuideItemBlock.hbs"],"names":["SourcingGuideItemBlock","_createClass","element","_classCallCheck","CLS","SourcingGuideBlock","_this","this","$el","$","$filterKeys","find","$filterDropdown","concat","$filterDropdownMenu","$searchResultsEmpty","$sourcingGuides","$loadingScreen","$loadMoreBtn","$loadMore","$searchInp","$clearFilterBtn","$cateContents","$cateContentsTitle","$cateContentsDescription","$cateCertifiedTitle","$cateCertifiedDescription","$searchBar","$searchBarIcon","$faBars","$faTimes","$locations","$types","$searchBarFilters","getSourcingApi","data","loadingSourcing","allSourcingsLoaded","pageSize","pageNumber","url_string","window","location","href","url","URL","offset","onscroll","scrollY","top","addClass","css","removeClass","$urlkeyword","searchParams","get","length","val","$urllocations","$urltypes","isFilterPopulated","initParams","selectpicker","getItems","handleSearchInput","handleFilterClearBtn","handleScrollLoading","initFilterKeys","key","value","clear","params","count","keyword","locations","types","sourcingGuideItemBlock","require","Handlebars","registerPartial","precompiled","Function","precompile","registerHelper","ifCond","template","loadMoreSourcings","_this2","loadingSourcings","setPageNumber","_","isEmpty","param","updateUrl","ajax","type","success","filters","forEach","item","includes","append","hide","empty","sourcing","$column","getSourcingGuideItemBlockTemplate","last","show","error","complete","_this3","uri","document","pathname","Object","keys","index","utils","updateQueryStringParameter","encodeURIComponent","history","pushState","URLSearchParams","_this4","on","event","keyCode","currentTarget","trim","_this5","scrollTo","$element","filterKey","push","isNil","toString","_this6","handleFilterClick","This","newPageNumber","v1","operator","v2","options","fn","inverse","module","exports","container","depth0","helpers","partials","helper","lookupProperty","parent","propertyName","prototype","hasOwnProperty","call","escapeExpression","hooks","helperMissing","nullContext","stack1","alias1","alias2","alias3","alias4","program","noop"],"mappings":"68BAAA,IAGaA,EAAsBC,GAClC,SAAAD,EAAYE,I,4FAASC,CAAA,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BG,EAASa,KAA2BC,EAASd,EAAOM,KAAKM,EAAO,CAAC,KAAO,WAAW,KAAO,GAAG,KAAOlI,EAAK,IAAM,CAAC,MAAQ,CAAC,KAAO,EAAE,OAAS,IAAI,IAAM,CAAC,KAAO,EAAE,OAAS,OAASsH,GAC5T,UAC6R,OAA3RW,EAASV,EAAeH,EAAQ,MAAMQ,KAAKM,EAAkB,MAAVf,EAAiBI,EAAeJ,EAAO,eAAiBA,EAAQ,CAAC,KAAO,KAAK,KAAO,GAAG,GAAKD,EAAUoB,QAAQ,EAAGtI,EAAM,GAAG,QAAUkH,EAAUqB,KAAK,KAAOvI,EAAK,IAAM,CAAC,MAAQ,CAAC,KAAO,EAAE,OAAS,GAAG,IAAM,CAAC,KAAO,GAAG,OAAS,OAAiBiI,EAAS,IAC7S,8BACJ,SAAU","file":"74.js","sourcesContent":["const NS = 'SourcingGuideItemBlock';\nconst CLS = 'sourcingGuideItemBlock';\n\nexport class SourcingGuideItemBlock {\n\tconstructor(element) {\n\n\t}\n\n}\n","import utils from '../utils';\nimport Handlebars from 'handlebars';\nimport { SourcingGuideItemBlock } from './sourcingGuideItemBlock';\nimport { ifCond } from '../../../handlebarsHelpers';\n\nconst NS = 'SourcingGuideBlock';\nconst CLS = 'sourcingGuideBlock';\n\nexport class SourcingGuideBlock {\n\tconstructor(element) {\n\t\tthis.$el = $(element);\n\t\tthis.$filterKeys = this.$el.find(`[data-filter-key]`);\n\t\tthis.$filterDropdown = this.$el.find(`.${CLS}-filters-dropdown`);\n\t\tthis.$filterDropdownMenu = this.$el.find(`.${CLS}-filters-dropdown-menu`);\n\t\tthis.$searchResultsEmpty = this.$el.find(`.${CLS}-searchResults-empty`);\n\t\tthis.$sourcingGuides = this.$el.find(`.${CLS}-sourcings`);\n\t\tthis.$loadingScreen = this.$el.find(`.${CLS}-searchResults-loadingScreen`);\n\t\tthis.$loadMoreBtn = this.$el.find(`#loadMoreBtn`);\n\t\tthis.$loadMore = this.$el.find(`.${CLS}-searchResults-loadMore`);\n\t\tthis.$searchInp = this.$el.find(`.${CLS}-searchInput`);\n\t\tthis.$clearFilterBtn = this.$el.find(`.${CLS}-filterBtnClear`);\n\t\tthis.$cateContents = this.$el.find(`.${CLS}-cate-contents`);\n\t\tthis.$cateContentsTitle = this.$el.find(`.${CLS}-cate-contents-title`);\n\t\tthis.$cateContentsDescription = this.$el.find(`.${CLS}-cate-contents-description`);\n\t\tthis.$cateCertifiedTitle = this.$el.find(`.${CLS}-certified-contents-title`);\n\t\tthis.$cateCertifiedDescription = this.$el.find(`.${CLS}-certified-contents-description`);\n\t\tthis.$searchBar = this.$el.find(`.${CLS}-searchBar`);\n\t\tthis.$searchBarIcon = this.$el.find(`.${CLS}-searchBar-icon`);\n\t\tthis.$faBars = this.$el.find(`.fa-bars`);\n\t\tthis.$faTimes = this.$el.find(`.fa-times`);\n\t\tthis.$locations = this.$el.find(`#locations`);\n\t\tthis.$types = this.$el.find(`#types`);\n\n\t\tthis.$searchBarFilters = this.$el.find(`.${CLS}-searchBar-refined-filters`);\n\n\t\tthis.getSourcingApi = this.$el.data('sourcingApi');\n\t\tthis.loadingSourcing = false;\n\t\tthis.allSourcingsLoaded = false;\n\t\tthis.pageSize = this.$el.data('pageSize');\n\t\tthis.pageNumber = 1;\n\t\t//----- Retrive the parameter values from the URL for dropdown menu if URL has default value ------//\n\t\tvar url_string = window.location.href; \n\t\tvar url = new URL(url_string);\n\n\t\tvar offset = this.$searchBar.offset();\n\n\t\twindow.onscroll = ()=> {\n\t\t\tif (window.scrollY > offset.top-60) {\n\t\t\t\tthis.$searchBar.addClass(\"sticky\");\n\t\t\t\tthis.$sourcingGuides.css(\"margin-top\", \"100px\");\n\t\t\t} else if(window.scrollY < offset.top+60) {\n\t\t\t\tthis.$searchBar.removeClass(\"sticky\");\n\t\t\t\tthis.$sourcingGuides.css(\"margin-top\", \"0px\");\n\t\t\t}\n\t\t}\n\n\t\tthis.$urlkeyword = url.searchParams.get(\"keyword\");\n\t\tif(this.$urlkeyword != null && this.$urlkeyword.length > 0){\n\t\t\tthis.$searchInp.val(this.$urlkeyword);\n\t\t}\n\t\tthis.$urllocations = url.searchParams.get(\"locations\");\n\t\tthis.$urltypes = url.searchParams.get(\"types\");\n\n\t\tthis.isFilterPopulated = false;\n\t\t//----- End for retrive the parameter values from the URL-----//\n\n\t\tthis.initParams();\n\t\t$('.selectpicker').selectpicker('destroy').selectpicker();\n\t\tthis.getItems(false);\n\t\tthis.handleSearchInput();\n\t\tthis.handleFilterClearBtn();\n\t\tthis.handleScrollLoading();\n\t\tthis.initFilterKeys();\n\t}\n\n\tinitParams(clear){\n\t\t// for clear btn - if user clear the filter everthing needs to be empty\n\t\tif(clear){\n\t\t\tthis.params = {\n\t\t\t\tcount: this.pageSize,\n\t\t\t\toffset: 0,\n\t\t\t\tkeyword: '',\n\t\t\t\tlocations: '',\n\t\t\t\ttypes: '',\n\t\t\t};\n\t\t}\n\t\t// for initial parameter values when page loads\n\t\telse{\n\t\t\tthis.params = {\n\t\t\t\tcount: this.pageSize,\n\t\t\t\toffset: 0,\n\t\t\t\tkeyword: this.$urlkeyword || '',\n\t\t\t\tlocations: this.$urllocations || '',\n\t\t\t\ttypes: this.$urltypes || '',\n\t\t\t};\n\t\t}\n\t}\n\n\t// individual product template\n\tgetSourcingGuideItemBlockTemplate() {\n\t\tlet sourcingGuideItemBlock = require('../../partials/widgets/sourcingGuideItemBlock.hbs');\n\t\tHandlebars.registerPartial('sourcingGuideItemBlock', sourcingGuideItemBlock);\n\n\t\tlet template = `\n\t\t\t{{> sourcingGuideItemBlock\n\t\t\t\twg=\"sourcingGuideItemBlock\"\n\t\t\t\tns=\"SourcingGuideItemBlock\"\n\t\t\t}}\n\t\t`;\n\n\t\tlet precompiled = new Function('return ' + Handlebars.precompile(template))();\n\t\tHandlebars.registerHelper('ifCond', ifCond);\n\t\treturn Handlebars.template(precompiled);\n\n\t}\n\n\t// Get items (reload content)\n\tgetItems(loadMoreSourcings) {\n\t\t// Check if all the products have been loaded\n\t\tif (!this.loadingSourcings && !this.allSourcingsLoaded) {\n\t\t\tthis.loadingSourcings = true;\n\n\t\t\tlet url = this.getSourcingApi;\n\n\t\t\tif (loadMoreSourcings) {\n\t\t\t\tthis.setPageNumber(this.pageNumber + 1);\n\t\t\t\tthis.$loadMore.addClass('active');\n\t\t\t} else {\n\t\t\t\tthis.$loadingScreen.addClass('active');\n\t\t\t}\n\t\t\t// if parameter is not empty, then append to the API url\n\t\t\tif (!_.isEmpty(this.params)) {\n\t\t\t\turl += `?${$.param(this.params)}`;\n\t\t\t}\n\t\t\t\n\t\t\t// End for display the products category\n\n\t\t\tthis.updateUrl();\n\t\t\t// ajax load products data\n\t\t\t$.ajax({\n\t\t\t\ttype: 'GET',\n\t\t\t\turl: url,\n\t\t\t\tsuccess: (data) => {\n\t\t\t\t\tif(!this.isFilterPopulated){\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(this.$urllocations !== null){\n\t\t\t\t\t\t\tdata.filters.locations.forEach((item) => {\n\t\t\t\t\t\t\t\tif(this.$urllocations.includes(item)){\n\t\t\t\t\t\t\t\t\tthis.$locations.append(``);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tthis.$locations.append(``);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tdata.filters.locations.forEach((item) => {\n\t\t\t\t\t\t\t\tthis.$locations.append(``);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(this.$urltypes !== null){\n\t\t\t\t\t\t\tdata.filters.types.forEach((item) => {\n\t\t\t\t\t\t\t\tif(this.$urltypes.includes(item)){\n\t\t\t\t\t\t\t\t\tthis.$types.append(``);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tthis.$types.append(``);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\t\tdata.filters.types.forEach((item) => {\n\t\t\t\t\t\t\t\tthis.$types.append(``);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.isFilterPopulated = true;\n\t\t\t\t\t\tthis.$locations.selectpicker('refresh');\n\t\t\t\t\t\tthis.$types.selectpicker('refresh');\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.$searchResultsEmpty.hide();\n\t\t\t\t\t// Check if this is the new search, if so empty previous products in the products div\n\t\t\t\t\tif (!loadMoreSourcings) {\n\t\t\t\t\t\tthis.$sourcingGuides.empty();\n\t\t\t\t\t}\n\t\t\t\t\t//check if has any data from the API, if so, append the data into the product template.\n\t\t\t\t\tif (data.sourcing.length > 0) {\n\t\t\t\t\t\tdata.sourcing.forEach((item) => {\n\t\t\t\t\t\t\tlet $column = this.$sourcingGuides.append(this.getSourcingGuideItemBlockTemplate()(item));\n\t\t\t\t\t\t\tnew SourcingGuideItemBlock($column.find(`[data-wg=\"SourcingGuideItemBlock\"]`).last()[0], item);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (loadMoreSourcings) {\n\t\t\t\t\t\t\tthis.allSourcingsLoaded = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.$loadMoreBtn.css(\"display\", \"none\");\n\t\t\t\t\t\t\tthis.$searchResultsEmpty.show();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data.sourcing.length < this.pageSize) {\n\t\t\t\t\t\tthis.$loadMoreBtn.css(\"display\", \"none\");\n\t\t\t\t\t}\n\t\t\t\t\tthis.$loadingScreen.removeClass('active');\n\t\t\t\t\tthis.$loadMore.removeClass('active');\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\terror: (error) => {\n\n\t\t\t\t},\n\t\t\t\tcomplete: () => {\n\t\t\t\t\tthis.loadingSourcings = false;\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\t// Update url after filters change\n\tupdateUrl() {\n\t\tlet uri = document.location.pathname;\n\t\tObject.keys(this.params).forEach((key, index) => {\n\t\t\turi = utils.updateQueryStringParameter(uri, key, encodeURIComponent(this.params[key]));\n\t\t});\n\t\t// update url without reload\n\t\twindow.history.pushState('', '', uri);\n\t\tlet urlParams = new URLSearchParams(uri);\n\n\t}\n\n\t// Search text input - on type\n\thandleSearchInput() {\n\t\tthis.$searchInp.on('keyup', (event) => {\n\t\t\tif(event.keyCode === 13) {\n\t\t\t\tthis.params['keyword'] = $(event.currentTarget).val().trim();\n\t\t\t\tthis.setPageNumber(1);\n\t\t\t\tthis.allSourcingsLoaded = false;\n\t\t\t\tthis.getItems(false);\n\t\t\t}\n\t\t});\n\t}\n\n\t// Clear button\n\thandleFilterClearBtn() {\n\t\tthis.$clearFilterBtn.on('click', () => {\n\t\t\t// set 1 to let initParams know it's coming from clear btn\n\t\t\tthis.initParams(1);\n\t\t\tthis.setPageNumber(1);\n\t\t\tthis.allSourcingsLoaded = false;\n\t\t\t// Scroll to top\n\t\t\twindow.scrollTo(0, 0);\n\t\t\tthis.getItems(false);\n\t\t\t$(\".selectpicker\").selectpicker('deselectAll');\n\t\t\tthis.$searchInp.val('');\n\t\t\tthis.$locations.selectpicker('val', '');\n\t\t\tthis.$types.selectpicker('val', '');\n\t\t});\n\t}\n\n\thandleFilterClick($element) {\n\t\tlet filterKey = $element.data('filterKey') || '';\n\t\tlet value = [];\n\t\tvalue.push($element.val());\n\t\tthis.$el.find(`[data-filter-key=\"${filterKey}\"]`).removeClass('active');\n\t\t$element.addClass('active');\n\n\t\tif(!(_.isNil(this.params[filterKey]) && value === '')) {\n\t\t\t// Ensure that the filterKey does not match the current select value\n\t\t\tif(this.params[filterKey] !== value) {\n\t\t\t\tif(_.isNil(value) || value === '') {\n\t\t\t\t\tdelete this.params[filterKey];\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.params[filterKey] = value.toString();\n\t\t\t\t}\n\t\t\t\tthis.setPageNumber(1);\n\t\t\t\tthis.allSourcingsLoaded = false;\n\t\t\t\tthis.getItems(false);\n\t\t\t}\n\t\t}\n\t}\n\n\t// initialise the filter keys\n\tinitFilterKeys() {\n\t\tthis.$filterKeys.on('change', (event) => {\n\t\t\tlet $element = $(event.currentTarget);\n\t\t\tthis.handleFilterClick($element);\n\t\t});\n\n\t}\n\n\thandleScrollLoading() {\n\n\t\t// when scroll to buttom before 200px, page will trigger the load more function.\n\t\tlet offsetFromBottom = 200;\n\t\tconst This = this;\n\t\tthis.$loadMoreBtn.on('click', (event) => {\n\t\t\tThis.getItems(true);\n\t\t});\n\t}\n\n\tsetPageNumber(newPageNumber) {\n\t\tthis.pageNumber = newPageNumber;\n\t\tthis.params.offset = (this.pageNumber - 1) * this.pageSize;\n\t}\n}\n","export let ifCond = (v1, operator, v2, options) => {\n\tswitch (operator) {\n\t\tcase '==':\n\t\t\treturn (v1 == v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '===':\n\t\t\treturn (v1 === v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '!=':\n\t\t\treturn (v1 != v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '!==':\n\t\t\treturn (v1 !== v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '<':\n\t\t\treturn (v1 < v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '<=':\n\t\t\treturn (v1 <= v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '>':\n\t\t\treturn (v1 > v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '>=':\n\t\t\treturn (v1 >= v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '&&':\n\t\t\treturn (v1 && v2) ? options.fn(this) : options.inverse(this);\n\t\tcase '||':\n\t\t\treturn (v1 || v2) ? options.fn(this) : options.inverse(this);\n\t\tdefault:\n\t\t\treturn options.inverse(this);\n\t}\n};\n\nexport let math = (lvalue, operator, rvalue) => {\n\tlvalue = parseFloat(lvalue);\n\trvalue = parseFloat(rvalue);\n\treturn {\n\t\t'+': lvalue + rvalue,\n\t\t'-': lvalue - rvalue,\n\t\t'*': lvalue * rvalue,\n\t\t'/': lvalue / rvalue,\n\t\t'%': lvalue % rvalue\n\t}[operator];\n};\n\nexport let mathAbs = (value) => {\n\tvalue = parseFloat(value);\n\treturn Math.abs(value);\n};\n\nexport let object = ({ hash }) => {\n\treturn hash;\n};\n","var Handlebars = require('/Users/owenli/Documents/workspace/awi-woolmark-fe/node_modules/handlebars/runtime.js');\nmodule.exports = (Handlebars['default'] || Handlebars).template({\"1\":function(container,depth0,helpers,partials,data) {\n var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n };\n\n return \"\t\t\t\t
\\n\";\n},\"compiler\":[8,\">= 4.3.0\"],\"main\":function(container,depth0,helpers,partials,data) {\n var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3=\"function\", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {\n if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {\n return parent[propertyName];\n }\n return undefined\n };\n\n return \"\\n\t\t \"\n + alias4(((helper = (helper = lookupProperty(helpers,\"type\") || (depth0 != null ? lookupProperty(depth0,\"type\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"type\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":6,\"column\":49},\"end\":{\"line\":6,\"column\":57}}}) : helper)))\n + \"
\\n\t\t \"\n + alias4(((helper = (helper = lookupProperty(helpers,\"location\") || (depth0 != null ? lookupProperty(depth0,\"location\") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{\"name\":\"location\",\"hash\":{},\"data\":data,\"loc\":{\"start\":{\"line\":7,\"column\":58},\"end\":{\"line\":7,\"column\":70}}}) : helper)))\n + \"
\\n\"\n + ((stack1 = lookupProperty(helpers,\"if\").call(alias1,(depth0 != null ? lookupProperty(depth0,\"isCertified\") : depth0),{\"name\":\"if\",\"hash\":{},\"fn\":container.program(1, data, 0),\"inverse\":container.noop,\"data\":data,\"loc\":{\"start\":{\"line\":8,\"column\":2},\"end\":{\"line\":10,\"column\":9}}})) != null ? stack1 : \"\")\n + \"\t\t