{"version":3,"sources":["Honeywell.ClientModel.SimpleGenericContent.ts"],"names":["SimpleGenericContent","this","currentCategory","prototype","loadInfo","$","each","id","attr","lang","Honeywell_ClientModel_MainHelper_1","MainHelper","undefined","values","split","rowLimit","parseInt","listname","templateName","query","model","length","dataService","Honeywell_ClientModel_DataService_1","DataService","dataPromise","getListItems","then","listItemsToArray","templatePromise","Honeywell_ClientModel_TemplateService_1","TemplateService","getTemplate","countDataService","countPromise","getItemCount","Q","all","items","data","Items","initializeVideosPop","template","document","getElementById","innerHTML","console","log","handleLoadSimpleGenericError","reason","exports","on","e"],"mappings":"yOAMA,IAAAA,GAAA,WAAA,QAAAA,KAEIC,KAAAC,gBAA0B,GAqD9B,MAnDIF,GAAAG,UAAAC,SAAA,WACIC,EAAE,mCAAmCC,KAAK,WAEtC,GAAIC,GAAKF,EAAEJ,MAAMO,KAAK,MAClBC,EAAOC,EAAAC,WAAWF,IACtB,QAA8CG,KAA1CP,EAAE,IAAME,GAAIC,KAAK,qBAArB,CAIA,GAAIK,GAASR,EAAE,IAAME,GAAIC,KAAK,qBAAqBM,MAAM,KACrDC,EAAWC,SAASH,EAAO,QACfD,IAAZG,IACAA,EAAW,EAGf,IAAIE,GAAWZ,EAAE,IAAME,GAAIC,KAAK,mBAC5BU,EAAeb,EAAE,IAAME,GAAIC,KAAK,qBAChCW,EAAQ,2EAA6EV,EAAO,wKAG5FW,EAAQ,mBACRP,GAAOQ,OAAS,IAChBD,EAAQP,EAAO,GAEnB,IAAIS,GAAc,GAAIC,GAAAC,aAAY,EAAMP,EAAUG,EAAO,gBAAkBD,EAAQ,qBAAuBJ,EAAW,qBAAsB,KAN/H,MAORU,EAAcH,EAAYI,eAAeC,KAAKL,EAAYM,kBAC1DC,EAAkB,GAAIC,GAAAC,gBAAgBb,GAAcc,cACpDC,EAAmB,GAAIV,GAAAC,aAAY,EAAMP,EAAUG,EARtC,MASbc,EAAeD,EAAiBP,eAAeC,KAAKM,EAAiBE,aACzE,OAAOC,GAAEC,KAAUZ,EAAaI,EAAiBK,IAAeP,KAAK,SAAUW,GAC3E,GAAIA,EAAMjB,OAAS,GAAKiB,EAAM,GAAGjB,OAAS,EAAG,CACzC,GACIkB,IADUlC,EAAE,IAAME,GAAIC,KAAK,iBAE3BgC,MAAOF,EAAM,IAGjB5B,GAAAC,WAAW8B,sBACX,GAAIX,GAAAC,gBAAgBb,GAAcc,cAAcL,KAAK,SAAUe,GAC3DC,SAASC,eAAerC,GAAIsC,UAAYH,EAASH,SAIrDO,SAAQC,IAAI,2DAM5B/C,EAAAG,UAAA6C,6BAAA,SAA6BC,GACzBH,QAAQC,IAAI,mDAEpB/C,IAvDakD,GAAAlD,qBAAAA,EAyDbK,EAAEsC,UAAUQ,GAAG,kBAAmB,SAAUC,IACb,GAAIpD,IACVI","file":"Honeywell.ClientModel.SimpleGenericContent.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 * as Q from \"q\";\r\nexport class SimpleGenericContent {\r\n\r\n    currentCategory: string = \"\";\r\n\r\n    loadInfo() {\r\n        $('*[data-genericsimplexsl=\"true\"]').each(function () {\r\n\r\n            var id = $(this).attr('id');\r\n            var lang = MainHelper.lang;\r\n            if ($('#' + id).attr('data-splistitemid') === undefined) {\r\n                return;\r\n            }\r\n\r\n            var values = $('#' + id).attr('data-splistitemid').split('|');\r\n            var rowLimit = parseInt(values[0]);\r\n            if (rowLimit == undefined) {\r\n                rowLimit = 2;\r\n            }\r\n\r\n            var listname = $('#' + id).attr('data-splistname');\r\n            var templateName = $('#' + id).attr('data-templatename');\r\n            var query = \"<Where><Or><Eq><FieldRef Name='Language_x0020_Code'/><Value Type='Text'>\" + lang + \"</Value></Eq><Eq><FieldRef Name='Language_x0020_Code' /><Value Type='Text' >All</Value></Eq></Or></Where><OrderBy><FieldRef Name='ID' Ascending= 'False' /></OrderBy>\";\r\n            var index = null;\r\n            var queryCount = null;\r\n            var model = 'FieldValuesObject';\r\n            if (values.length > 0) {\r\n                model = values[1];\r\n            }\r\n            var dataService = new DataService(true, listname, model, \"<View><Query>\" + query + \"</Query><RowLimit>\" + rowLimit + \"</RowLimit></View>\", null, index);\r\n            var dataPromise = dataService.getListItems().then(dataService.listItemsToArray);\r\n            var templatePromise = new TemplateService(templateName).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(function (items: any) {\r\n                if (items.length > 0 && items[0].length > 0) {\r\n                    var divname = $('#' + id).attr('data-divname');\r\n                    var data = {\r\n                        Items: items[0] // ,\r\n                    }\r\n\r\n                    MainHelper.initializeVideosPop();\r\n                    new TemplateService(templateName).getTemplate().then(function (template: any) {\r\n                        document.getElementById(id).innerHTML = template(data);\r\n                    });\r\n                }\r\n                else {\r\n                    console.log(\"failed to load SimpleGenericContent from response\");\r\n                }\r\n            });\r\n        });\r\n    }\r\n\r\n    handleLoadSimpleGenericError(reason: string) {\r\n        console.log(\"error:failed to load SimpleGenericContent list\");\r\n    }\r\n}\r\n\r\n$(document).on('SPContextLoaded', function (e) {\r\n    var simpleGenericContent = new SimpleGenericContent();\r\n    simpleGenericContent.loadInfo();\r\n});\r\n\r\n"]}