{"version":3,"sources":["Honeywell.ClientModel.PressReleaseController.ts"],"names":["PressReleaseController","this","currentCategory","prototype","loadInfo","renderPressReleaseList","items","totalItemCount","length","$","html","Honeywell_ClientModel_MainHelper_1","MainHelper","userLanguageTerms","PressReleases_NoResultsReturned","toggleClass","show","data","Items","userTerms","Honeywell_ClientModel_TemplateService_1","TemplateService","getTemplate","then","template","document","getElementById","innerHTML","qkv","getallQueryKeyValues","dateQueries","undefined","push","ellipsis","pc","Honeywell_Clientmodel_PaginationController_1","PaginationController","loadPagination","handleError","reason","exports","on","e","validStartDate","validEndDate","datepicker","dateFormat","CalControlDateFormat","monthNames","Months_List","split","changeMonth","changeYear","constrainInput","onClose","valStartDate","formatDate","valEndDate","blur","that","value","PressReleases_SelectDate","focus"],"mappings":"4OAOA,IAAAA,GAAA,WAAA,QAAAA,KAEIC,KAAAC,gBAA0B,GAuF9B,MArFIF,GAAAG,UAAAC,SAAA,aAIAJ,EAAAG,UAAAE,uBAAA,SAAuBC,EAAcC,GAEZ,IAAjBD,EAAME,QACNC,EAAE,uCAAuCC,KAAKC,EAAAC,WAAWC,kBAAkBC,iCAC3EL,EAAE,iCAAiCM,YAAY,WAG/CN,EAAE,oBAAoBO,MAQ1B,IAAIC,IACAC,MAAOZ,EACPa,UAAWR,EAAAC,WAAWC,kBAsC1B,OAnCA,IAAIO,GAAAC,gBAAgB,0BAA0BC,cAAcC,KAAK,SAAUC,GACvEP,EAAKE,UAAYR,EAAAC,WAAWC,kBAC5BY,SAASC,eAAe,mCAAmCC,UAAYH,EAASP,EAChF,IAAIW,GAAMjB,EAAAC,WAAWiB,uBACjBC,SACqBC,KAArBH,EAAe,WACfE,EAAYE,KAAK,aAGfvB,EAAE,gBAAiBwB,eACFF,KAAnBH,EAAa,SACbE,EAAYE,KAAK,eAGFD,IAAfH,EAAU,MACVE,EAAYE,KAAK,QAGjBF,EAAYtB,OAAS,IACrBsB,EAAYE,KAAK,QACjBF,EAAYE,KAAK,OAKrB,IAAIE,EA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KC,OAASjD,EAAAC,WAAWC,kBAAkBgD,2BAC3CF,EAAKC,MAAQ,MAGfnD,EAAE,kBAAmBiD,KAAK,WAC5B,GAAIC,GAAO1D,IACO,KAAd0D,EAAKC,QACLD,EAAKC,MAAQjD,EAAAC,WAAWC,kBAAkBgD,4BAG5CpD,EAAE,kBAAmBqD,MAAM,WAC7B,GAAIH,GAAO1D,IACP0D,GAAKC,OAASjD,EAAAC,WAAWC,kBAAkBgD,2BAC3CF,EAAKC,MAAQ","file":"Honeywell.ClientModel.PressReleaseController.js","sourcesContent":["///<reference path=\"typings/handlebar/handlebars.d.ts\"/>\r\n/// <reference path=\"honeywell.clientmodel.paginationcontroller.ts\" />\r\nimport {DataService} from \"./Honeywell.ClientModel.DataService\";\r\nimport {TemplateService} from \"./Honeywell.ClientModel.TemplateService\";\r\nimport {MainHelper} from \"./Honeywell.ClientModel.MainHelper\";\r\nimport {PaginationController} from \"./Honeywell.Clientmodel.PaginationController\";\r\nimport * as Q from \"q\";\r\nexport class PressReleaseController {\r\n\r\n    currentCategory: string = \"\";\r\n\r\n    loadInfo() {\r\n\r\n    }\r\n\r\n    renderPressReleaseList(items: any[], totalItemCount: number) {\r\n\r\n        if (items.length === 0) {\r\n            $('#js-press-releases-no-content-inner').html(MainHelper.userLanguageTerms.PressReleases_NoResultsReturned);\r\n            $('#js-press-releases-no-content').toggleClass(\"hidden\");\r\n        }\r\n        else {\r\n            $('#js-load-info-li').show();\r\n        }\r\n\r\n        //var data = {\r\n        //    Items: items // ,\r\n        //}\r\n\r\n\r\n        var data = {\r\n            Items: items,\r\n            userTerms: MainHelper.userLanguageTerms\r\n        }\r\n\r\n        new TemplateService(\"tpl_PressReleases.html\").getTemplate().then(function (template: any) {\r\n            data.userTerms = MainHelper.userLanguageTerms;\r\n            document.getElementById('js-press-releases-content-inner').innerHTML = template(data);\r\n            var qkv = MainHelper.getallQueryKeyValues();\r\n            var dateQueries = [];\r\n            if (qkv['startdate'] !== undefined) {\r\n                dateQueries.push('startdate');\r\n            }\r\n\r\n            (<any>$(\".js-ellipsis\")).ellipsis();\r\n            if (qkv['enddate'] !== undefined) {\r\n                dateQueries.push('enddate');\r\n            }\r\n\r\n            if (qkv['sort'] != undefined) {\r\n                dateQueries.push('sort');\r\n            }\r\n\r\n            if (dateQueries.length > 0) {\r\n                dateQueries.push('list');\r\n                dateQueries.push('max');\r\n            }\r\n\r\n            \r\n\r\n            var pc;\r\n            if (this && this.currentCategory != undefined) {\r\n                pc = new PaginationController(totalItemCount, [\"category=\" + this.currentCategory]);\r\n            }\r\n            else {\r\n                pc = new PaginationController(totalItemCount, dateQueries);\r\n            }\r\n            pc.loadPagination('PressReleasesList');\r\n        });\r\n\r\n        return items;\r\n    }\r\n\r\n    handleError(reason: string) {\r\n        $('#js-drawer-content').html(\"<h3>Failed To Load on page\" + reason + \"</h3>\");\r\n    }\r\n\r\n\r\n    //    populateFilterQuery(listname: string, model: string, query: string, queryCount: string) {\r\n\r\n    //        var pageQry = '';\r\n    //        if (MainHelper.configSettings.ShowPaginationOnPressReleases === 'True') {\r\n    //            pageQry = '<RowLimit Paged=\"TRUE\">' + MainHelper.configSettings.PaginationItemsPerPageOnPressReleases + '</RowLimit>';\r\n    //        }\r\n    //        var index = null;\r\n    //        if (parseInt(PaginationController.prototype.getValueFromQueryString('start1')) > 0) {\r\n    //            index = parseInt(PaginationController.prototype.getValueFromQueryString('start1'));\r\n    //        }\r\n\r\n    //        var dataService = new DataService(true, listname, model, \"<View>\" + query + pageQry + \"</View>\", null, index);\r\n    //        var dataPromise = dataService.getListItems().then(dataService.listItemsToArray);\r\n    //        var templatePromise = new TemplateService(\"tpl_PressReleases.html\").getTemplate();\r\n    //        var countDataService = new DataService(true, listname, model, queryCount);\r\n    //        var countPromise = countDataService.getListItems().then(countDataService.getItemCount);\r\n    //        return Q.all<any>([dataPromise, templatePromise, countPromise]).then(PressReleaseController.prototype.renderPressReleaseList).catch(PressReleaseController.prototype.handleError);\r\n    //    }\r\n}\r\n    \r\n$(document).on('SPContextLoaded', function (e) {\r\n    var validStartDate;\r\n    var validEndDate;\r\n    var pressRelease = new PressReleaseController();\r\n    pressRelease.loadInfo();\r\n    (<any>$('#datePickerStart')).datepicker({\r\n        dateFormat:  MainHelper.userLanguageTerms.CalControlDateFormat,\r\n        monthNames: MainHelper.userLanguageTerms.Months_List.split(';'),\r\n        changeMonth: true,\r\n        changeYear: true,\r\n        constrainInput: false,\r\n        onClose: function () {\r\n            validStartDate = (<any>$)(this).datepicker(\"getDate\");\r\n            var valStartDate = (<any>$).datepicker.formatDate(MainHelper.userLanguageTerms.CalControlDateFormat, validStartDate);\r\n            (<any>$('#datePickerStart')).datepicker('setDate', valStartDate);\r\n        }\r\n    });\r\n    (<any>$('#datePickerEnd')).datepicker({\r\n        //dateFormat: 'dd/mm/yy',\r\n        dateFormat: MainHelper.userLanguageTerms.CalControlDateFormat,\r\n        monthNames: MainHelper.userLanguageTerms.Months_List.split(';'),\r\n        changeMonth: true,\r\n        changeYear: true,\r\n        constrainInput: false,\r\n        onClose: function () {\r\n            validEndDate = (<any>$)(this).datepicker(\"getDate\");\r\n            var valEndDate = (<any>$).datepicker.formatDate(MainHelper.userLanguageTerms.CalControlDateFormat, validEndDate);\r\n            (<any>$('#datePickerEnd')).datepicker('setDate', valEndDate);\r\n        }\r\n    });\r\n\r\n\r\n\r\n    (<any>$('#datePickerStart')).blur(function () {\r\n        var that = this;\r\n        if (that.value == '') {\r\n            that.value = MainHelper.userLanguageTerms.PressReleases_SelectDate;\r\n        }\r\n    });\r\n    (<any>$('#datePickerStart')).focus(function () {\r\n        var that = this;\r\n        if (that.value == MainHelper.userLanguageTerms.PressReleases_SelectDate) {\r\n            that.value = \"\";\r\n        }\r\n    });\r\n    (<any>$('#datePickerEnd')).blur(function () {\r\n        var that = this;\r\n        if (that.value == '') {\r\n            that.value = MainHelper.userLanguageTerms.PressReleases_SelectDate;\r\n        }\r\n    });\r\n    (<any>$('#datePickerEnd')).focus(function () {\r\n        var that = this;\r\n        if (that.value == MainHelper.userLanguageTerms.PressReleases_SelectDate) {\r\n            that.value = \"\";\r\n        }\r\n    });\r\n});"]}