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",[function(){var a={};return a.promises={},a.loaders=[],a.errors=[],a.STATUS_RUNNING=0,a.STATUS_RESOLVED=1,a.STATUS_REJECTED=2,a.build=function(b){a[b]={};for(var c in a.promises)if(a.promises.hasOwnProperty(c)){var d=a.promises[c];d[b].forEach(function(c){null==a[b][c]&&(a[b][c]=[]),a[b][c].push(d)})}},a.newPromise=function(a,b,c,d){return{id:a,groups:b,loaderGroups:c,errorGroups:d}},a.initLuBusy=function(b){var c={loaders:[],errors:[],status:a.STATUS_RUNNING,id:b.id};b.groups instanceof Array?b.groups.forEach(function(a){c.loaders.push(a),c.errors.push(a)}):"string"==typeof b.groups&&(c.loaders.push(b.groups),c.errors.push(b.groups)),b.loaderGroups instanceof Array?b.loaderGroups.forEach(function(a){c.loaders.push(a)}):"string"==typeof b.loaderGroups&&c.loaders.push(b.loaderGroups),b.errorGroups instanceof Array?b.errorGroups.forEach(function(a){c.errors.push(a)}):"string"==typeof b.errorGroups&&c.errors.push(b.errorGroups),a.promises[b.id]=c,a.build("loaders"),a.build("errors")},a.getLoadersGroup=function(b){return null==a.loaders[b]?null:a.loaders[b]},a.getErrorsGroup=function(b){return null==a.errors[b]?null:a.errors[b]},a.reject=function(b,c){a.promises[b.id].status=a.STATUS_REJECTED,a.promises[b.id].value=c},a.resolve=function(b){a.promises[b.id].status=a.STATUS_RESOLVED,a.promises[b.id].value=null},a}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luWebApiCrudBusiness",["luBusiness","luWebApiDataAccess",function(a,b){var c={};return c.create=function(b){var c=a.create();return c.dataAccess=b,c.getSingleById=function(a,b){return c.dataAccess.getSingleById(a,b)},c.getMultiple=function(a,b,d,e,f){return c.dataAccess.getMultiple(a,b,d,e,f)},c.addDbo=function(a,b){return c.dataAccess.addDbo(a,b)},c.editSingleByIdDbo=function(a,b,d){return c.dataAccess.editSingleByIdDbo(a,b,d)},c.deleteDbo=function(a,b){return c.dataAccess.deleteDbo(a,b)},c},c}])}(),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("luRequest",["$q","$http","luBusyBusiness",function(a,b,c){function d(a,b,d,e){var f={data:b,status:d};a.reject(f),null!=e&&c.reject(e,f)}function e(a,b,d){a.resolve(b),null!=d&&c.resolve(d)}var f={};return 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(f,g,h,i,j){null!=j&&c.initLuBusy(j);var k=a.defer();f=f.replace(/\/+$/,"");var l={url:f,method:g,params:h,data:JSON.stringify(i),headers:{"Content-Type":"application/json"}};return b(l).then(function(a){var b=a.data,c=a.status;null==b||"object"!=typeof b?d(k,{message:"Failed to parse response",code:c},c,j):null!=b.message?d(k,b,c,j):e(k,b.data,j)},function(a){var b=a.data,c=a.status;null==b||"object"!=typeof b?d(k,{message:"Failed to parse response",code:c},c,j):d(k,b,c,j)}),k.promise},f}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luWebApiCrudDataAccess",["luWebApiDataAccess",function(a){var b={};return b.create=function(b){var c=a.create(b);return c.getSingleById=function(a,b){return c.get(a,null,b)},c.getMultiple=function(a,b,d,e,f){return c.get("",{orderBy:a,filter:b,page:d,perPage:e},f)},c.addDbo=function(a,b){return c.post("",null,a,b)},c.editSingleByIdDbo=function(a,b,d){return c.post(a,null,b,d)},c.deleteDbo=function(a,b){return c["delete"](a,null,null,b)},c},b}])}(),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}])}();
|
|
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("luWebApiCrudBusiness",["luBusiness","luWebApiDataAccess",function(a,b){var c={};return c.create=function(b){var c=a.create();return c.dataAccess=b,c.getSingleById=function(a,b){return c.dataAccess.getSingleById(a,b)},c.getMultiple=function(a,b,d,e,f){return c.dataAccess.getMultiple(a,b,d,e,f)},c.addDbo=function(a,b){return c.dataAccess.addDbo(a,b)},c.editSingleByIdDbo=function(a,b,d){return c.dataAccess.editSingleByIdDbo(a,b,d)},c.deleteDbo=function(a,b){return c.dataAccess.deleteDbo(a,b)},c},c}])}(),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("luRequest",["$q","$http","luBusyBusiness",function(a,b,c){function d(a,b,d,e){var f={data:b,status:d};a.reject(f),null!=e&&c.reject(e,f)}function e(a,b,d){a.resolve(b),null!=d&&c.resolve(d)}var f={};return 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(f,g,h,i,j){null!=j&&c.initGroups(j);var k=a.defer();f=f.replace(/\/+$/,"");var l={url:f,method:g,params:h,data:JSON.stringify(i),headers:{"Content-Type":"application/json"}};return b(l).then(function(a){var b=a.data,c=a.status;null==b||"object"!=typeof b?d(k,{message:"Failed to parse response",code:c},c,j):null!=b.message?d(k,b,c,j):e(k,b.data,j)},function(a){var b=a.data,c=a.status;null==b||"object"!=typeof b?d(k,{message:"Failed to parse response",code:c},c,j):d(k,b,c,j)}),k.promise},f}])}(),function(){"use strict";angular.module("luticate2Utils").factory("luWebApiCrudDataAccess",["luWebApiDataAccess",function(a){var b={};return b.create=function(b){var c=a.create(b);return c.getSingleById=function(a,b){return c.get(a,null,b)},c.getMultiple=function(a,b,d,e,f){return c.get("",{orderBy:a,filter:b,page:d,perPage:e},f)},c.addDbo=function(a,b){return c.post("",null,a,b)},c.editSingleByIdDbo=function(a,b,d){return c.post(a,null,b,d)},c.deleteDbo=function(a,b){return c["delete"](a,null,null,b)},c},b}])}(),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}])}();
|