1 |
- !function(){angular.module("luticate2Utils",[])}(),function(){"use strict";angular.module("luticate2Utils").factory("luBusiness",[function(){var a={};return a.create=function(){var a={};return a},a}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luBusyBusiness",["$q",function(a){var b={};return b.groups=null,b.initGroups=function(c){"string"==typeof c&&(c=[c]);for(var d=0;d<c.length;++d){var e=b.groups[c[d]];null==e&&(e={count:0,deferred:null,errors:[]},b.groups[c[d]]=e),0==e.count&&(e.deferred=a.defer(),e.errors=[]),++e.count}},b.isRunning=function(a){var c=b.groups[a];return null!=c?c.count>0:!1},b.promise=function(a){var c=b.groups[a];return null!=c&&null!=c.deferred?c.deferred.promise:null},b.hasError=function(a){var c=b.groups[a];return null!=c?0!=c.errors.length:null},b.errors=function(a){var c=b.groups[a];return null!=c?c.errors:null},b.resolve=function(a){"string"==typeof a&&(a=[a]);for(var c=0;c<a.length;++c){var d=b.groups[a[c]];--d.count,0==d.count&&(b.hasError(d)?d.deferred.resolve(null):d.deferred.resolve(null),d.deferred=null)}},b.reject=function(a,c){"string"==typeof a&&(a=[a]);for(var d=0;d<a.length;++d){var e=b.groups[a[d]];--e.count,e.errors.push(c),0==e.count&&(e.deferred.resolve(null),e.deferred=null)}},b.reset=function(){return b.groups={},b},b}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luNotificationsBusiness",["luNotificationsDataAccess",function(a){function b(a){return function(b,d,e,f){var g=c.businesses[d];return null!=g&&null!=g.initDbo&&(e=g.initDbo(e),f=g.initDbo(f)),a(b,d,e,f)}}var c={};return c.EVENT_CREATE="EVENT_CREATE",c.EVENT_UPDATE="EVENT_UPDATE",c.EVENT_DELETE="EVENT_DELETE",c.businesses={},c.init=function(b){c.businesses=b,a.init()},c.addEventCreateCallback=function(d,e){a.addCallback(c.EVENT_CREATE,d,b(e))},c.addEventUpdateCallback=function(d,e){a.addCallback(c.EVENT_UPDATE,d,b(e))},c.addEventDeleteCallback=function(d,e){a.addCallback(c.EVENT_DELETE,d,b(e))},c.addEventCrudCallback=function(a,b){c.addEventCreateCallback(a,b),c.addEventUpdateCallback(a,b),c.addEventDeleteCallback(a,b)},c}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luUtilsBusiness",["luUtilsDataAccess",function(a){var b={};return b.momentDateTimeToString=function(b){return a.momentDateTimeToString(b)},b.stringToMomentDateTime=function(b){return a.stringToMomentDateTime(b)},b.dateTimeToString=function(b){return a.dateTimeToString(b)},b.stringToDateTime=function(b){return a.stringToDateTime(b)},b}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luWebApiCrudBusiness",["luBusiness","$q",function(a,b){var c={};return c.create=function(c){var d=a.create();return d.dataAccess=c,d.dboInitializer=d.dataAccess.dboInitializer,d.initDbo=function(a){return d.dataAccess.dboInitializer.initDbo(a,d.dataAccess.TYPE_DBO)},d.initListDbo=function(a){return d.dataAccess.dboInitializer.initListDbo(a,d.dataAccess.TYPE_DBO)},d.initPaginatedDbo=function(a){return d.dataAccess.dboInitializer.initPaginatedDbo(a,d.dataAccess.TYPE_DBO)},d.thenInitDbo=function(a){return d.dataAccess.dboInitializer.thenInitDbo(a,d.dataAccess.TYPE_DBO)},d.thenInitListDbo=function(a){return d.dataAccess.dboInitializer.thenInitListDbo(a,d.dataAccess.TYPE_DBO)},d.thenInitPaginatedDbo=function(a){return d.dataAccess.dboInitializer.thenInitPaginatedDbo(a,d.dataAccess.TYPE_DBO)},d.getSingleById=function(a,b){return d.dataAccess.getSingleById(a,b)},d.getMultiple=function(a,b,c,e,f){return d.dataAccess.getMultiple(a,b,c,e,f)},d.getMultipleToList=function(a,c,e,f,g){var h=b.defer();return d.getMultiple(a,c,e,f,g).then(function(a){h.resolve(a.data)},h.reject),h.promise},d.addDbo=function(a,b){return d.dataAccess.addDbo(a,b)},d.editSingleByIdDbo=function(a,b,c){return d.dataAccess.editSingleByIdDbo(a,b,c)},d.deleteDbo=function(a,b){return d.dataAccess.deleteDbo(a,b)},d},c}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luDataInitializer",["$q",function(a){var b={};return b.create=function(b){var c={};return c.initData=b,c.initListData=function(a,b){for(var d=[],e=0;e<a.length;++e)d.push(c.initData(a[e],b));return d},c.initPaginatedData=function(a,b){var d={count:a.count,data:c.initListData(a.data,b)};return d},c.thenInitData=function(b,d){var e=a.defer();return b.then(function(a){e.resolve(c.initData(a,d))},e.reject),e.promise},c.thenInitListData=function(b,d){var e=a.defer();return b.then(function(a){e.resolve(c.initListData(a,d))},e.reject),e.promise},c.thenInitPaginatedData=function(b,d){var e=a.defer();return b.then(function(a){e.resolve(c.initPaginatedData(a,d))},e.reject),e.promise},c},b}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luDataAccess",[function(){var a={};return a.create=function(){var a={};return a},a}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luNotificationsDataAccess",["Hub",function(a){var b={};return b.hub=null,b.callbacks={},b.addCallback=function(a,c,d){null==b.callbacks[a]&&(b.callbacks[a]={});var e=b.callbacks[a];null==e[c]&&(e[c]=[]),e[c].push(d)},b.init=function(){b.hub=new a("luNotificationsHub",{listeners:{notify:function(a,c,d,e){var f=b.callbacks[a];if(null!=f){var g=f[c];if(null!=g)for(var h=0;h<g.length;++h)g[h](a,c,d,e)}}},methods:[],queryParams:{},errorHandler:function(a){console.error(a)},stateChanged:function(a){switch(a.newState){case $.signalR.connectionState.connecting:break;case $.signalR.connectionState.connected:break;case $.signalR.connectionState.reconnecting:break;case $.signalR.connectionState.disconnected:}}})},b}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luRequest",["$q","$http","luBusyBusiness",function(a,b,c){function d(a,b,d,e,g,h,i,j){for(var k={data:i,status:j},l=0;l<f.hooks.reject.length;++l)f.hooks.reject[l](a,b,d,e,g,k);h.reject(k),null!=g&&c.reject(g,k)}function e(a,b,d,e,g,h,i){for(var j=0;j<f.hooks.resolve.length;++j)f.hooks.resolve[j](a,b,d,e,g,i);h.resolve(i.data),null!=g&&c.resolve(g)}var f={};return f.hooks={before:[],resolve:[],reject:[]},f.addHook=function(a,b){f.hooks.hasOwnProperty(a)&&f.hooks[a].push(b)},f.get=function(a,b,c){return f.request(a,"GET",b,null,c)},f.post=function(a,b,c,d){return f.request(a,"POST",b,c,d)},f.put=function(a,b,c,d){return f.request(a,"PUT",b,c,d)},f["delete"]=function(a,b,c,d){return f.request(a,"DELETE",b,c,d)},f.request=function(g,h,i,j,k){null!=k&&c.initGroups(k);var l=a.defer();g=g.replace(/\/+$/,"");for(var m={url:g,method:h,params:i,data:JSON.stringify(j),headers:{"Content-Type":"application/json"}},n=0;n<f.hooks.before.length;++n)f.hooks.before[n](g,h,i,j,k);return b(m).then(function(a){var b=a.data,c=a.status;null==b||"object"!=typeof b?d(g,h,i,j,k,l,{message:"Failed to parse response",code:c,version:null,data:null},c):null!=b.message?d(g,h,i,j,k,l,b,c):e(g,h,i,j,k,l,b)},function(a){var b=a.data,c=a.status;null==b||"object"!=typeof b?d(g,h,i,j,k,l,{message:"Failed to parse response",code:c,version:null,data:null},c):d(g,h,i,j,k,l,b,c)}),l.promise},f}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luUtilsDataAccess",[function(){var a={};return a.momentDateTimeToString=function(a){return null==a?null:a.toISOString()},a.stringToMomentDateTime=function(a){return null==a?null:new Date(a)},a.dateTimeToString=function(a){if(null==a)return null;var b=new Date(Date.UTC(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds(),a.getMilliseconds())).toISOString();return b},a.stringToDateTime=function(a){if(null==a)return null;var b=new Date(a),c=new Date(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds(),b.getUTCMilliseconds());return c},a}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luWebApiCrudDataAccess",["luWebApiDataAccess","$q","luUtilsDataAccess","luDataInitializer",function(a,b,c,d){var e={};return e.create=function(b){var e=a.create(b);return e.OP_EDIT="OP_EDIT",e.OP_ADD="OP_ADD",e.TYPE_DBO="TYPE_DBO",e.TYPE_MODEL="TYPE_MODEL",e.defaultDbo={id:null,createdAt:null,updatedAt:null,toString:function(){return this.id}},e.modelInitializer=d.create(function(a,b){return e.initModel(a,b)}),e.dboInitializer=d.create(function(a,b){return e.initDbo(a,b)}),e._initModel=function(a,b){return null==a?null:(a=angular.copy(a),delete a.id,delete a.updatedAt,delete a.createdAt,delete a._itemType,delete a.toString,a)},e.initModel=function(a,b){return e._initModel(a,b)},e._initDbo=function(a,b){if(null==a)return null;var d=e.extendDeep({},e.defaultDbo,a);return d.createdAt=c.stringToMomentDateTime(d.createdAt),d.updatedAt=c.stringToMomentDateTime(d.updatedAt),d},e.initDbo=function(a,b){return e._initDbo(a,b)},e.extendDeep=function f(a){return angular.forEach(arguments,function(b){b!==a&&angular.forEach(b,function(b,c){a[c]&&a[c].constructor&&a[c].constructor===Object?f(a[c],b):a[c]=b})}),a},e.getSingleById=function(a,b){return e.dboInitializer.thenInitData(e.get(a,null,b),e.TYPE_MODEL)},e.getMultiple=function(a,b,c,d,f){return e.dboInitializer.thenInitPaginatedData(e.get("",{orderBy:a,filter:b,page:c,perPage:d},f),e.TYPE_MODEL)},e.addDbo=function(a,b){var c=e.modelInitializer.initData(a,e.OP_ADD);return e.dboInitializer.thenInitData(e.post("",null,c,b),e.TYPE_MODEL)},e.editSingleByIdDbo=function(a,b,c){var d=e.modelInitializer.initData(b,e.OP_EDIT);return e.dboInitializer.thenInitData(e.post(a,null,d,c),e.TYPE_MODEL)},e.deleteDbo=function(a,b){return e.dboInitializer.thenInitData(e["delete"](a,null,null,b),e.TYPE_MODEL)},e},e}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luWebApiDataAccess",["luDataAccess","luRequest",function(a,b){var c={};return c.create=function(c){var d=a.create();return d.entry_point=c,"/"!==d.entry_point.substr(-1)&&(d.entry_point+="/"),d.get=function(a,c,e){return b.get(d.entry_point+a,c,e)},d.post=function(a,c,e,f){return b.post(d.entry_point+a,c,e,f)},d.put=function(a,c,e,f){return b.put(d.entry_point+a,c,e,f)},d["delete"]=function(a,c,e,f){return b["delete"](d.entry_point+a,c,e,f)},d},c}])}();
|