{"version":3,"sources":["webpack:////Users/owenli/Documents/workspace/awi-wool-fe/src/views/blocks/marketSummaryMonthlyBlock/js/marketSummaryMonthlyBlock.js"],"names":["CLS","MarketSummaryMonthlyBlock","element","_this","this","_classCallCheck","$element","$","$currentMonthContentMicron","find","concat","$currentMonthArrowIcon","$previousMonthContentMicron","on","event","params","monthMicrons","_","isNil","renderError","currentMonth","previousMonth","parseInt","isFinite","update","key","value","html","addClass","removeClass"],"mappings":"u4BAAA,IACMA,EAAM,4BAECC,EAAyB,WAiDpC,SAhDD,SAAAA,EAAYC,GAAS,IAAAC,EAAAC,kGAAAC,CAAAD,KAAAH,GACpBG,KAAKF,QAAUA,EACfE,KAAKE,SAAWC,EAAEL,GAElBE,KAAKI,2BAA6BJ,KAAKE,SAASG,KAAI,IAAAC,OAAKV,EAAG,qBAAAU,OAAoBV,EAAG,0BACnFI,KAAKO,uBAAyBP,KAAKE,SAASG,KAAI,IAAAC,OAAKV,EAAG,qBAAAU,OAAoBV,EAAG,yBAC/EI,KAAKQ,4BAA8BR,KAAKE,SAASG,KAAI,IAAAC,OAAKV,EAAG,sBAAAU,OAAqBV,EAAG,0BAErFI,KAAKE,SAASO,GAAE,GAAAH,OAAIV,EAAG,WAAW,SAACc,EAAOC,GACzC,IAAIC,EAAeD,EAAOC,aAG1B,GAAGC,EAAEC,MAAMF,GAEVb,EAAKgB,mBAIN,GAAGF,EAAEC,MAAMF,EAAaI,cAEvBjB,EAAKgB,mBAIN,GAAGF,EAAEC,MAAMF,EAAaK,eAEvBlB,EAAKgB,kBAFN,CAMA,IAAIC,EAAeE,SAASN,EAAaI,cACrCC,EAAgBC,SAASN,EAAaK,eAGtCJ,EAAEM,SAASH,IAMXH,EAAEM,SAASF,GAMflB,EAAKqB,OAAOJ,EAAcC,GAVzBlB,EAAKgB,uBAYPM,IAAA,SAAAC,MAED,SAAON,EAAcC,GACpBjB,KAAKI,2BAA2BmB,KAAKP,GACrChB,KAAKQ,4BAA4Be,KAAKN,GAEnCD,GAAgBC,EAClBjB,KAAKO,uBAAuBiB,SAAQ,GAAAlB,OAAIV,EAAG,6BAEpCoB,EAAeC,GACtBjB,KAAKO,uBAAuBiB,SAAQ,GAAAlB,OAAIV,EAAG,kCAE5CyB,IAAA,cAAAC,MAED,WACCtB,KAAKI,2BAA2BmB,KAAK,KACrCvB,KAAKQ,4BAA4Be,KAAK,KACtCvB,KAAKO,uBAAuBkB,YAAW,GAAAnB,OAAIV,EAAG,6BAC9CI,KAAKO,uBAAuBkB,YAAW,GAAAnB,OAAIV,EAAG,8HAnEV","file":"block-20.430117f348aedc9992ce.js","sourcesContent":["const NS = 'MarketSummaryMonthlyBlock';\nconst CLS = 'marketSummaryMonthlyBlock';\n\nexport class MarketSummaryMonthlyBlock {\n\tconstructor(element) {\n\t\tthis.element = element;\n\t\tthis.$element = $(element);\n\n\t\tthis.$currentMonthContentMicron = this.$element.find(`.${CLS}-month--current .${CLS}-month-content-micron`);\n\t\tthis.$currentMonthArrowIcon = this.$element.find(`.${CLS}-month--current .${CLS}-month-content-arrow`);\n\t\tthis.$previousMonthContentMicron = this.$element.find(`.${CLS}-month--previous .${CLS}-month-content-micron`);\n\n\t\tthis.$element.on(`${CLS}.update`, (event, params) => {\n\t\t\tlet monthMicrons = params.monthMicrons;\n\n\t\t\t// Handle null values\n\t\t\tif(_.isNil(monthMicrons)) {\n\t\t\t\tconsole.error(`${NS}::Error`, 'Please supply the monthlyMicron object');\n\t\t\t\tthis.renderError();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(_.isNil(monthMicrons.currentMonth)) {\n\t\t\t\tconsole.error(`${NS}::Error`, 'Please supply a currentMonth value');\n\t\t\t\tthis.renderError();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(_.isNil(monthMicrons.previousMonth)) {\n\t\t\t\tconsole.error(`${NS}::Error`, 'Please supply a previousMonth value');\n\t\t\t\tthis.renderError();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet currentMonth = parseInt(monthMicrons.currentMonth);\n\t\t\tlet previousMonth = parseInt(monthMicrons.previousMonth);\n\n\t\t\t// Handle values if they are a valid integer…\n\t\t\tif(!_.isFinite(currentMonth)) {\n\t\t\t\tconsole.error(`${NS}::Error`, 'Please supply a valid currentMonth integer value');\n\t\t\t\tthis.renderError();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(!_.isFinite(previousMonth)) {\n\t\t\t\tconsole.error(`${NS}::Error`, 'Please supply a valid previousMonth integer value');\n\t\t\t\tthis.renderError();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.update(currentMonth, previousMonth);\n\t\t});\n\t}\n\n\tupdate(currentMonth, previousMonth) {\n\t\tthis.$currentMonthContentMicron.html(currentMonth);\n\t\tthis.$previousMonthContentMicron.html(previousMonth);\n\n\t\tif(currentMonth >= previousMonth) {\n\t\t\tthis.$currentMonthArrowIcon.addClass(`${CLS}-month-content-arrow--up`);\n\t\t}\n\t\telse if(currentMonth < previousMonth) {\n\t\t\tthis.$currentMonthArrowIcon.addClass(`${CLS}-month-content-arrow--down`);\n\t\t}\n\t}\n\n\trenderError() {\n\t\tthis.$currentMonthContentMicron.html('-');\n\t\tthis.$previousMonthContentMicron.html('-');\n\t\tthis.$currentMonthArrowIcon.removeClass(`${CLS}-month-content-arrow--up`);\n\t\tthis.$currentMonthArrowIcon.removeClass(`${CLS}-month-content-arrow--down`);\n\t}\n}\n"],"sourceRoot":""}