angular.module('ui.calendar',[]).constant('uiCalendarConfig',{calendars:{}}).controller('uiCalendarCtrl',['$scope','$locale',function($scope,$locale){var sources=$scope.eventSources;var extraEventSignature=$scope.calendarWatchEvent?$scope.calendarWatchEvent:angular.noop;var wrapFunctionWithScopeApply=function(functionToWrap){return function(){if($scope.$root.$$phase){return functionToWrap.apply(this,arguments);} var args=arguments;var that=this;return $scope.$root.$apply(function(){return functionToWrap.apply(that,args);});};};var eventSerialId=1;this.eventFingerprint=function(e){if(!e._id){e._id=eventSerialId++;} var extraSignature=extraEventSignature({event:e})||'';var start=moment.isMoment(e.start)?e.start.unix():(e.start?moment(e.start).unix():'');var end=moment.isMoment(e.end)?e.end.unix():(e.end?moment(e.end).unix():'');return[e._id,e.id||'',e.title||'',e.url||'',start,end,e.allDay||'',e.className||'',extraSignature].join('');};var sourceSerialId=1;var sourceEventsSerialId=1;this.sourceFingerprint=function(source){var fp=''+(source.__id||(source.__id=sourceSerialId++));var events=angular.isObject(source)&&source.events;if(events){fp=fp+'-'+(events.__id||(events.__id=sourceEventsSerialId++));} return fp;};this.allEvents=function(){return Array.prototype.concat.apply([],(sources||[]).reduce(function(previous,source){if(angular.isArray(source)){previous.push(source);}else if(angular.isObject(source)&&angular.isArray(source.events)){var extEvent=Object.keys(source).filter(function(key){return(key!=='_id'&&key!=='events');});source.events.forEach(function(event){angular.extend(event,extEvent);});previous.push(source.events);} return previous;},[]));};this.changeWatcher=function(arraySource,tokenFn){var self;var getTokens=function(){return((angular.isFunction(arraySource)?arraySource():arraySource)||[]).reduce(function(rslt,el){var token=tokenFn(el);map[token]=el;rslt.push(token);return rslt;},[]);};var subtractAsSets=function(a,b){var obj=(b||[]).reduce(function(rslt,val){rslt[val]=true;return rslt;},Object.create(null));return(a||[]).filter(function(val){return!obj[val];});};var map={};var applyChanges=function(newTokens,oldTokens){var i;var token;var replacedTokens={};var removedTokens=subtractAsSets(oldTokens,newTokens);for(i=0;i");}};}]);dndLists.directive('dndNodrag',function(){return function(scope,element,attr){element.attr("draggable","true");element.on('dragstart',function(event){event=event.originalEvent||event;if(!event._dndHandle){if(!(event.dataTransfer.types&&event.dataTransfer.types.length)){event.preventDefault();} event.stopPropagation();}});element.on('dragend',function(event){event=event.originalEvent||event;if(!event._dndHandle){event.stopPropagation();}});};});dndLists.directive('dndHandle',function(){return function(scope,element,attr){element.attr("draggable","true");element.on('dragstart dragend',function(event){event=event.originalEvent||event;event._dndHandle=true;});};});function filterEffects(effects,effectAllowed){if(effectAllowed=='all')return effects;return effects.filter(function(effect){return effectAllowed.toLowerCase().indexOf(effect)!=-1;});} var dndState={};})(angular.module('dndLists',[]));'use strict';var module=angular.module('angularModalService',[]);module.factory('ModalService',['$animate','$document','$compile','$controller','$http','$rootScope','$q','$templateRequest','$timeout',function($animate,$document,$compile,$controller,$http,$rootScope,$q,$templateRequest,$timeout){function ModalService(){var self=this;self.openModals=[];var getTemplate=function(template,templateUrl){var deferred=$q.defer();if(template){deferred.resolve(template);}else if(templateUrl){$templateRequest(templateUrl,true).then(function(template){deferred.resolve(template);},function(error){deferred.reject(error);});}else{deferred.reject("No template or templateUrl has been specified.");} return deferred.promise;};var appendChild=function(parent,child){var children=parent.children();if(children.length>0){return $animate.enter(child,parent,children[children.length-1]);} return $animate.enter(child,parent);};self.closeModals=function(result,delay){while(self.openModals.length){self.openModals[0].close(result,delay);self.openModals.splice(0,1);}};self.showModal=function(options){var body=angular.element($document[0].body);var deferred=$q.defer();var controllerName=options.controller;if(!controllerName){deferred.reject("No controller has been specified.");return deferred.promise;} getTemplate(options.template,options.templateUrl).then(function(template){var modal={};var modalScope=(options.scope||$rootScope).$new(),rootScopeOnClose=null,locationChangeSuccess=options.locationChangeSuccess;if(locationChangeSuccess===false){rootScopeOnClose=angular.noop;} else if(angular.isNumber(locationChangeSuccess)&&locationChangeSuccess>=0){$timeout(function(){rootScopeOnClose=$rootScope.$on('$locationChangeSuccess',cleanUpClose);},locationChangeSuccess);} else{rootScopeOnClose=$rootScope.$on('$locationChangeSuccess',cleanUpClose);} var closeDeferred=$q.defer();var closedDeferred=$q.defer();var inputs={$scope:modalScope,close:function(result,delay){if(typeof options.preClose==='function')options.preClose(modal,result,delay);if(delay===undefined||delay===null)delay=0;$timeout(function(){cleanUpClose(result);},delay);}};if(options.inputs)angular.extend(inputs,options.inputs);var linkFn=$compile(template);var modalElement=linkFn(modalScope);inputs.$element=modalElement;var controllerObjBefore=modalScope[options.controllerAs];var modalController=$controller(options.controller,inputs,false,options.controllerAs);if(options.controllerAs&&controllerObjBefore){angular.extend(modalController,controllerObjBefore);} if(options.appendElement){appendChild(options.appendElement,modalElement);}else{appendChild(body,modalElement);} if(options.bodyClass){body[0].classList.add(options.bodyClass);} modal.controller=modalController;modal.scope=modalScope;modal.element=modalElement;modal.close=closeDeferred.promise;modal.closed=closedDeferred.promise;deferred.resolve(modal);document.activeElement.blur();self.openModals.push({modal:modal,close:inputs.close});function cleanUpClose(result){closeDeferred.resolve(result);if(options.bodyClass){body[0].classList.remove(options.bodyClass);} $animate.leave(modalElement).then(function(){closedDeferred.resolve(result);modalScope.$destroy();for(var i=0;i\
\
\ \

\
\
\ ';if(!validacontenido(attr.popoverWitdh)){template='
\
\
\ \

\
\
\
';} if(angular.isDefined(scope.myPopover)&&angular.isObject(scope.myPopover)){options=$popover(scope.myPopover).options;element.popoverClosable(options);} else{if(validacontenido(attr.popoverContentElement)){options={title:attr.popoverTitle||"",content:attr.popoverContent||"",template:template,trigger:attr.popoverTrigger||"click",placement:attr.popoverPlacement||"right",html:attr.popoverHtml||false,container:'body'};element.popoverClosable($popover(options).options);}else{options={title:attr.popoverTitle||"",content:function(){return $('#'+attr.popoverContentElement).html();},template:template,trigger:attr.popoverTrigger||"click",placement:attr.popoverPlacement||"right",html:attr.popoverHtml||false,container:'body'};element.popoverClosable($popover(options).options);}} $compile(element.contents())(scope);}};}]);(function(){var moduleName='angularUtils.directives.dirPagination';var DEFAULT_ID='__default';var module;try{module=angular.module(moduleName);}catch(err){module=angular.module(moduleName,[]);} module.directive('dirPaginate',['$compile','$parse','paginationService',dirPaginateDirective]).directive('dirPaginateNoCompile',noCompileDirective).directive('dirPaginationControls',['paginationService','paginationTemplate',dirPaginationControlsDirective]).filter('itemsPerPage',['paginationService',itemsPerPageFilter]).service('paginationService',paginationService).provider('paginationTemplate',paginationTemplateProvider);function dirPaginateDirective($compile,$parse,paginationService){return{terminal:true,multiElement:true,compile:dirPaginationCompileFn};function dirPaginationCompileFn(tElement,tAttrs){var expression=tAttrs.dirPaginate;var match=expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);var filterPattern=/\|\s*itemsPerPage\s*:[^|]*/;if(match[2].match(filterPattern)===null){throw'pagination directive: the \'itemsPerPage\' filter must be set.';} var itemsPerPageFilterRemoved=match[2].replace(filterPattern,'');var collectionGetter=$parse(itemsPerPageFilterRemoved);addNoCompileAttributes(tElement);var rawId=tAttrs.paginationId||DEFAULT_ID;paginationService.registerInstance(rawId);return function dirPaginationLinkFn(scope,element,attrs){var paginationId=$parse(attrs.paginationId)(scope)||attrs.paginationId||DEFAULT_ID;paginationService.registerInstance(paginationId);var repeatExpression=getRepeatExpression(expression,paginationId);addNgRepeatToElement(element,attrs,repeatExpression);removeTemporaryAttributes(element);var compiled=$compile(element);var currentPageGetter=makeCurrentPageGetterFn(scope,attrs,paginationId);paginationService.setCurrentPageParser(paginationId,currentPageGetter,scope);if(typeof attrs.totalItems!=='undefined'){paginationService.setAsyncModeTrue(paginationId);scope.$watch(function(){return $parse(attrs.totalItems)(scope);},function(result){if(0<=result){paginationService.setCollectionLength(paginationId,result);}});}else{scope.$watchCollection(function(){return collectionGetter(scope);},function(collection){if(collection){paginationService.setCollectionLength(paginationId,collection.length);}});} compiled(scope);};} function getRepeatExpression(expression,paginationId){var repeatExpression,idDefinedInFilter=!!expression.match(/(\|\s*itemsPerPage\s*:[^|]*:[^|]*)/);if(paginationId!==DEFAULT_ID&&!idDefinedInFilter){repeatExpression=expression.replace(/(\|\s*itemsPerPage\s*:[^|]*)/,"$1 : '"+paginationId+"'");}else{repeatExpression=expression;} return repeatExpression;} function addNgRepeatToElement(element,attrs,repeatExpression){if(element[0].hasAttribute('dir-paginate-start')||element[0].hasAttribute('data-dir-paginate-start')){attrs.$set('ngRepeatStart',repeatExpression);element.eq(element.length-1).attr('ng-repeat-end',true);}else{attrs.$set('ngRepeat',repeatExpression);}} function addNoCompileAttributes(tElement){angular.forEach(tElement,function(el){if(el.nodeType===Node.ELEMENT_NODE){angular.element(el).attr('dir-paginate-no-compile',true);}});} function removeTemporaryAttributes(element){angular.forEach(element,function(el){if(el.nodeType===Node.ELEMENT_NODE){angular.element(el).removeAttr('dir-paginate-no-compile');}});element.eq(0).removeAttr('dir-paginate-start').removeAttr('dir-paginate').removeAttr('data-dir-paginate-start').removeAttr('data-dir-paginate');element.eq(element.length-1).removeAttr('dir-paginate-end').removeAttr('data-dir-paginate-end');} function makeCurrentPageGetterFn(scope,attrs,paginationId){var currentPageGetter;if(attrs.currentPage){currentPageGetter=$parse(attrs.currentPage);}else{var defaultCurrentPage=paginationId+'__currentPage';scope[defaultCurrentPage]=1;currentPageGetter=$parse(defaultCurrentPage);} return currentPageGetter;}} function noCompileDirective(){return{priority:5000,terminal:true};} function dirPaginationControlsDirective(paginationService,paginationTemplate){var numberRegex=/^\d+$/;return{restrict:'AE',templateUrl:function(elem,attrs){return attrs.templateUrl||paginationTemplate.getPath();},scope:{maxSize:'=?',onPageChange:'&?',paginationId:'=?'},link:dirPaginationControlsLinkFn};function dirPaginationControlsLinkFn(scope,element,attrs){var rawId=attrs.paginationId||DEFAULT_ID;var paginationId=scope.paginationId||attrs.paginationId||DEFAULT_ID;if(!paginationService.isRegistered(paginationId)&&!paginationService.isRegistered(rawId)){var idMessage=(paginationId!==DEFAULT_ID)?' (id: '+paginationId+') ':' ';throw'pagination directive: the pagination controls'+idMessage+'cannot be used without the corresponding pagination directive.';} if(!scope.maxSize){scope.maxSize=9;} scope.directionLinks=angular.isDefined(attrs.directionLinks)?scope.$parent.$eval(attrs.directionLinks):true;scope.boundaryLinks=angular.isDefined(attrs.boundaryLinks)?scope.$parent.$eval(attrs.boundaryLinks):false;var paginationRange=Math.max(scope.maxSize,5);scope.pages=[];scope.pagination={last:1,current:1};scope.range={lower:1,upper:1,total:1};scope.$watch(function(){return(paginationService.getCollectionLength(paginationId)+1)*paginationService.getItemsPerPage(paginationId);},function(length){if(0'].join('\n')};}]);angular.module('ivh.treeview').directive('ivhTreeviewCheckbox',[function(){'use strict';return{restrict:'AE',require:'^ivhTreeview',template:''};}]);angular.module('ivh.treeview').directive('ivhTreeviewChildren',function(){'use strict';return{restrict:'AE',require:'^ivhTreeviewNode',template:['
    ','
  • ','
  • ','
'].join('\n')};});angular.module('ivh.treeview').directive('ivhTreeviewNode',['ivhTreeviewCompiler',function(ivhTreeviewCompiler){'use strict';return{restrict:'A',scope:{node:'=ivhTreeviewNode',depth:'=ivhTreeviewDepth'},require:'^ivhTreeview',compile:function(tElement){return ivhTreeviewCompiler.compile(tElement,function(scope,element,attrs,trvw){var node=scope.node;var getChildren=scope.getChildren=function(){return trvw.children(node);};scope.trvw=trvw;scope.childDepth=scope.depth+1;if(!trvw.isExpanded(node)){trvw.expand(node,trvw.isInitiallyExpanded(scope.depth));} scope.$watch(function(){return getChildren().length>0;},function(newVal){if(newVal){element.removeClass('ivh-treeview-node-leaf');}else{element.addClass('ivh-treeview-node-leaf');}});});}};}]);angular.module('ivh.treeview').directive('ivhTreeviewToggle',[function(){'use strict';return{restrict:'A',require:'^ivhTreeview',link:function(scope,element,attrs,trvw){var node=scope.node;element.addClass('ivh-treeview-toggle');element.bind('click',function(){if(!trvw.isLeaf(node)){scope.$apply(function(){trvw.toggleExpanded(node);trvw.onToggle(node);});}});}};}]);angular.module('ivh.treeview').directive('ivhTreeviewTwistie',['$compile','ivhTreeviewOptions',function($compile,ivhTreeviewOptions){'use strict';var globalOpts=ivhTreeviewOptions();return{restrict:'A',require:'^ivhTreeview',template:['','',globalOpts.twistieCollapsedTpl,'','',globalOpts.twistieExpandedTpl,'','',globalOpts.twistieLeafTpl,'',''].join('\n'),link:function(scope,element,attrs,trvw){if(!trvw.hasLocalTwistieTpls){return;} var opts=trvw.opts(),$twistieContainers=element.children().eq(0).children();angular.forEach(['twistieCollapsedTpl','twistieExpandedTpl','twistieLeafTpl'],function(tplKey,ix){var tpl=opts[tplKey],tplGlobal=globalOpts[tplKey];if(!tpl||tpl===tplGlobal){return;} if(tpl.substr(0,1)!=='<'||tpl.substr(-1,1)!=='>'){tpl=''+tpl+'';} var $el=$compile(tpl)(scope),$container=$twistieContainers.eq(ix);$container.html('').append($el);});}};}]);angular.module('ivh.treeview').directive('ivhTreeview',['ivhTreeviewMgr',function(ivhTreeviewMgr){'use strict';return{restrict:'A',transclude:true,scope:{root:'=ivhTreeview',childrenAttribute:'=ivhTreeviewChildrenAttribute',defaultSelectedState:'=ivhTreeviewDefaultSelectedState',disableCheckboxSelectionPropagation:'=ivhTreeviewDisableCheckboxSelectionPropagation',expandToDepth:'=ivhTreeviewExpandToDepth',idAttribute:'=ivhTreeviewIdAttribute',indeterminateAttribute:'=ivhTreeviewIndeterminateAttribute',expandedAttribute:'=ivhTreeviewExpandedAttribute',labelAttribute:'=ivhTreeviewLabelAttribute',nodeTpl:'=ivhTreeviewNodeTpl',selectedAttribute:'=ivhTreeviewSelectedAttribute',onCbChange:'&ivhTreeviewOnCbChange',onToggle:'&ivhTreeviewOnToggle',twistieCollapsedTpl:'=ivhTreeviewTwistieCollapsedTpl',twistieExpandedTpl:'=ivhTreeviewTwistieExpandedTpl',twistieLeafTpl:'=ivhTreeviewTwistieLeafTpl',useCheckboxes:'=ivhTreeviewUseCheckboxes',validate:'=ivhTreeviewValidate',visibleAttribute:'=ivhTreeviewVisibleAttribute',userOptions:'=ivhTreeviewOptions',filter:'=ivhTreeviewFilter'},controllerAs:'trvw',controller:['$scope','$element','$attrs','$transclude','ivhTreeviewOptions','filterFilter',function($scope,$element,$attrs,$transclude,ivhTreeviewOptions,filterFilter){var ng=angular,trvw=this;var localOpts=ng.extend({},ivhTreeviewOptions(),$scope.userOptions);ng.forEach(['childrenAttribute','defaultSelectedState','disableCheckboxSelectionPropagation','expandToDepth','idAttribute','indeterminateAttribute','expandedAttribute','labelAttribute','nodeTpl','selectedAttribute','twistieCollapsedTpl','twistieExpandedTpl','twistieLeafTpl','useCheckboxes','validate','visibleAttribute'],function(attr){if(ng.isDefined($scope[attr])){localOpts[attr]=$scope[attr];}});var normedAttr=function(attrKey){return'ivhTreeview'+ attrKey.charAt(0).toUpperCase()+ attrKey.slice(1);};ng.forEach(['onCbChange','onToggle'],function(attr){if($attrs[normedAttr(attr)]){localOpts[attr]=$scope[attr];}});var transcludedScope;$transclude(function(clone,scope){var transcludedNodeTpl='';angular.forEach(clone,function(c){transcludedNodeTpl+=(c.innerHTML||'').trim();});if(transcludedNodeTpl.length){transcludedScope=scope;localOpts.nodeTpl=transcludedNodeTpl;}});trvw.opts=function(){return localOpts;};var userOpts=$scope.userOptions||{};trvw.hasLocalTwistieTpls=!!(userOpts.twistieCollapsedTpl||userOpts.twistieExpandedTpl||userOpts.twistieLeafTpl||$scope.twistieCollapsedTpl||$scope.twistieExpandedTpl||$scope.twistieLeafTpl);trvw.children=function(node){var children=node[localOpts.childrenAttribute];return ng.isArray(children)?children:[];};trvw.label=function(node){return node[localOpts.labelAttribute];};trvw.hasFilter=function(){return ng.isDefined($scope.filter);};trvw.getFilter=function(){return $scope.filter||'';};trvw.isVisible=function(node){var filter=trvw.getFilter();if(!filter||filterFilter([node],filter).length){return true;} if(typeof filter==='object'||typeof filter==='function'){var children=trvw.children(node);for(var ix=children.length;ix--;){if(trvw.isVisible(children[ix])){return true;}}} return false;};trvw.useCheckboxes=function(){return localOpts.useCheckboxes;};trvw.select=function(node,isSelected){ivhTreeviewMgr.select($scope.root,node,localOpts,isSelected);trvw.onCbChange(node,isSelected);};trvw.isSelected=function(node){return node[localOpts.selectedAttribute];};trvw.toggleSelected=function(node){var isSelected=!node[localOpts.selectedAttribute];trvw.select(node,isSelected);};trvw.expand=function(node,isExpanded){ivhTreeviewMgr.expand($scope.root,node,localOpts,isExpanded);};trvw.isExpanded=function(node){return node[localOpts.expandedAttribute];};trvw.toggleExpanded=function(node){trvw.expand(node,!trvw.isExpanded(node));};trvw.isInitiallyExpanded=function(depth){var expandTo=localOpts.expandToDepth===-1?Infinity:localOpts.expandToDepth;return depth','
  • ','
  • ',''].join('\n')};}]);angular.module('ivh.treeview').filter('ivhTreeviewAsArray',function(){'use strict';return function(arr){if(!angular.isArray(arr)&&angular.isObject(arr)){return[arr];} return arr;};});angular.module('ivh.treeview').factory('ivhTreeviewBfs',['ivhTreeviewOptions',function(ivhTreeviewOptions){'use strict';var ng=angular;return function(tree,opts,cb){if(arguments.length===2&&ng.isFunction(opts)){cb=opts;opts={};} opts=angular.extend({},ivhTreeviewOptions(),opts);cb=cb||ng.noop;var queue=[],childAttr=opts.childrenAttribute,next,node,parents,ix,numChildren;if(ng.isArray(tree)){ng.forEach(tree,function(n){queue.push([n,[]]);});next=queue.shift();}else{next=[tree,[]];} while(next){node=next[0];parents=next[1];if(cb(node,parents)!==false){if(node[childAttr]&&ng.isArray(node[childAttr])){numChildren=node[childAttr].length;for(ix=0;ix2){if(typeof opts==='boolean'){isSelected=opts;opts={};}} opts=ng.extend({},options,opts);isSelected=ng.isDefined(isSelected)?isSelected:true;var useId=isId(node),proceed=true,idAttr=opts.idAttribute;ivhTreeviewBfs(tree,opts,function(n,p){var isNode=proceed&&(useId?node===n[idAttr]:node===n);if(isNode){proceed=false;var cb=isSelected?makeSelected.bind(opts):makeDeselected.bind(opts);if(opts.disableCheckboxSelectionPropagation){cb(n);}else{ivhTreeviewBfs(n,opts,cb);ng.forEach(p,validateParent.bind(opts));}} return proceed;});return exports;};exports.selectAll=function(tree,opts,isSelected){if(arguments.length>1){if(typeof opts==='boolean'){isSelected=opts;opts={};}} opts=ng.extend({},options,opts);isSelected=ng.isDefined(isSelected)?isSelected:true;var selectedAttr=opts.selectedAttribute,indeterminateAttr=opts.indeterminateAttribute;ivhTreeviewBfs(tree,opts,function(node){node[selectedAttr]=isSelected;node[indeterminateAttr]=false;});return exports;};exports.selectEach=function(tree,nodes,opts,isSelected){ng.forEach(nodes,function(node){exports.select(tree,node,opts,isSelected);});return exports;};exports.deselect=function(tree,node,opts){return exports.select(tree,node,opts,false);};exports.deselectAll=function(tree,opts){return exports.selectAll(tree,opts,false);};exports.deselectEach=function(tree,nodes,opts){return exports.selectEach(tree,nodes,opts,false);};exports.validate=function(tree,opts,bias){if(!tree){return exports;} if(arguments.length>1){if(typeof opts==='boolean'){bias=opts;opts={};}} opts=ng.extend({},options,opts);bias=ng.isDefined(bias)?bias:opts.defaultSelectedState;var selectedAttr=opts.selectedAttribute,indeterminateAttr=opts.indeterminateAttribute;ivhTreeviewBfs(tree,opts,function(node,parents){if(ng.isDefined(node[selectedAttr])&&node[selectedAttr]!==bias){exports.select(tree,node,opts,!bias);return false;}else{node[selectedAttr]=bias;node[indeterminateAttr]=false;}});return exports;};exports.expand=function(tree,node,opts,isExpanded){if(arguments.length>2){if(typeof opts==='boolean'){isExpanded=opts;opts={};}} opts=ng.extend({},options,opts);isExpanded=ng.isDefined(isExpanded)?isExpanded:true;var useId=isId(node),expandedAttr=opts.expandedAttribute;if(!useId){node[expandedAttr]=isExpanded;return exports;} return findNode(tree,node,opts,function(n,p){n[expandedAttr]=isExpanded;return exports;});};exports.expandRecursive=function(tree,node,opts,isExpanded){if(arguments.length>2){if(typeof opts==='boolean'){isExpanded=opts;opts={};}} node=ng.isDefined(node)?node:tree;opts=ng.extend({},options,opts);isExpanded=ng.isDefined(isExpanded)?isExpanded:true;var useId=isId(node),expandedAttr=opts.expandedAttribute,branch;if(useId){findNode(tree,node,opts,function(n,p){branch=n;});}else{branch=node;} if(branch){ivhTreeviewBfs(branch,opts,function(n,p){n[expandedAttr]=isExpanded;});} return exports;};exports.collapse=function(tree,node,opts){return exports.expand(tree,node,opts,false);};exports.collapseRecursive=function(tree,node,opts,isExpanded){return exports.expandRecursive(tree,node,opts,false);};exports.expandTo=function(tree,node,opts,isExpanded){if(arguments.length>2){if(typeof opts==='boolean'){isExpanded=opts;opts={};}} opts=ng.extend({},options,opts);isExpanded=ng.isDefined(isExpanded)?isExpanded:true;var expandedAttr=opts.expandedAttribute;var expandCollapseNode=function(n){n[expandedAttr]=isExpanded;};return findNode(tree,node,opts,function(n,p){ng.forEach(p,expandCollapseNode);return exports;});};exports.collapseParents=function(tree,node,opts){return exports.expandTo(tree,node,opts,false);};return exports;}]);angular.module('ivh.treeview').provider('ivhTreeviewOptions',['ivhTreeviewInterpolateStartSymbol','ivhTreeviewInterpolateEndSymbol',function(ivhTreeviewInterpolateStartSymbol,ivhTreeviewInterpolateEndSymbol){'use strict';var symbolStart=ivhTreeviewInterpolateStartSymbol,symbolEnd=ivhTreeviewInterpolateEndSymbol;var options={idAttribute:'id',labelAttribute:'label',childrenAttribute:'children',selectedAttribute:'selected',expandToDepth:0,useCheckboxes:true,disableCheckboxSelectionPropagation:false,validate:true,indeterminateAttribute:'__ivhTreeviewIndeterminate',expandedAttribute:'__ivhTreeviewExpanded',defaultSelectedState:true,twistieExpandedTpl:'(-)',twistieCollapsedTpl:'(+)',twistieLeafTpl:'o',nodeTpl:['
    ','','','','','','','{{trvw.label(node)}}','','
    ','
    '].join('\n').replace(new RegExp('{{','g'),symbolStart).replace(new RegExp('}}','g'),symbolEnd)};this.set=function(opts){angular.extend(options,opts);};this.$get=function(){return function(){return angular.copy(options);};};}]); var basePath='app_partials/';var baseURL='../'+(validacontenido(NOMBREWEB)?'':NOMBREWEB+'/');(function(){'use strict';angular.module('appPrincipal',['ngRoute','ngSanitize','valida.rut','angularUtils.directives.dirPagination','angularModalService','angularjs-dropdown-multiselect','ivh.treeview','dndLists','my.popover','colorpicker.module','ui.calendar','angularFileUpload']).run(run).filter('trustedhtml',filter).controller('accesoError',accesoError);run.$inject=['$rootScope','$sce','seguridad','$location','Manager','$locale','userService'];function run($rootScope,$sce,seguridad,$location,Manager,$locale,userService){var CHECKLOGIN=function(){var currentUser=userService.GetCurrentUser();if(currentUser===null||currentUser===undefined){$rootScope.USERCONECTADO=null;$location.path('/login');}};$rootScope.$on('$routeChangeStart',function(event,next,current){LOG($location.url()) if($location.url()!=="/recuperar"&&$location.url()!=="/change"&&$location.url()!=="/home"){CHECKLOGIN();$rootScope.SITIO_URL=$location.url();if(next&&next['data']&&next['data']!==undefined){if(!$rootScope.vON("S",next.data.code)){$location.path('/erroracceso');}}}});$rootScope.vON=function(t,op){var currentUser=userService.GetCurrentUserData();if(currentUser!==undefined&¤tUser.data.OPACC!==undefined){var OPACC=currentUser.data.OPACC;if(t==='M'){return Object.keys(_.filter(OPACC,function(item){return item.codigo.substring(0,op.length)===op;})).length>0;} else if(t==='S'){return Object.keys(_.filter(OPACC,function(item){return item.codigo===op;})).length>0;} else{return false;}}else{return false;}};$rootScope.traslate={checkAll:'Seleccionar Todos',uncheckAll:'Deseleccionar Todos',searchPlaceholder:'Buscar',buttonDefaultText:'Seleccione',selectionCount:'Seleccionados',dynamicButtonTextSuffix:'Seleccionados'};$locale.NUMBER_FORMATS.GROUP_SEP=".";$locale.NUMBER_FORMATS.DECIMAL_SEP=",";$rootScope.seguridad=seguridad;$rootScope.htmlRenderValido=function(value){return $sce.trustAsHtml(value);};$rootScope.NUMDECIMAL=/^\d{0,9}([\,]{1}\d{0,4})?$/;$rootScope.NUMDECIMAL2=/^\d{0,9}([\,.]{1}\d{0,4})?$/;$rootScope.NUMDECIMAL_AND_NEG=/^\-?\d{0,9}([\,]{1}\d{0,4})?$/;$rootScope.NUMBERS=/^\d{1,9}?$/;$rootScope.NUMBERS_AND_NEG=/^\-?\d{1,9}?$/;$rootScope.NUMBERS_GREATEN_ONE=/^([1-9][0-9]+|[1-9])$/;$rootScope.TIME=/^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/;$rootScope.DATE=/^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/;$rootScope.EMAIL_VALIDA=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;} filter.$inject=['$sce'];function filter($sce){return $sce.trustAsHtml;} accesoError.$inject=['$scope'];function accesoError($scope){$scope.$emit("UNLOAD");LOG("ERROR UNLOAD");}})();(function(){'use strict';angular.module('appPrincipal').controller('principalCtrl',['$scope','$rootScope','accountService','Manager','$filter','Excel','$timeout','ServiceURL','userService',function($scope,$rootScope,accountService,Manager,$filter,Excel,$timeout,ServiceURL,userService){$scope.LOGO_2=LOGO_2;$scope.NEGOCIO_NAME=NEGOCIO_NAME;$scope.SITE_NAME_VERSION=SITE_NAME_VERSION;$scope.closeModalLoading=function(){$scope.$emit("UNLOAD");};$scope.$on('LOAD',function(){$scope.loading=true;$('.loader').addClass('is-active');});$scope.$on('UNLOAD',function(){$scope.loading=false;$('.loader').removeClass('is-active');});$rootScope.UBICACION='Mesas';$rootScope.detallePedidosMesas={};var MODAL_PREV=null;var MODAL_NEXT=null;$scope.closeModal=function(modal){$(modal).modal('hide');LOG("principalCtrl HIDE");};$scope.openModal=function(modal){$(modal).modal('show');LOG("principalCtrl SHOW");};$scope.apirest=ServiceURL;$scope.exportToExcel=function(tableId){console.log(tableId);$scope.exportHref=Excel.tableToExcel(tableId,'DATA');$timeout(function(){location.href=$scope.exportHref;},100);};$scope.$on('LOAD2',function(){$('#div_carga_proceso').modal('show');});$scope.$on('UNLOAD2',function(){$('#div_carga_proceso').modal('hide');$('body').removeClass().removeAttr('style');$('.modal-backdrop').remove();});$scope.MODOUSER='ROOT';$scope.SelectedMenu=function(iguala){if($scope.SITIO_URL!==undefined){if($scope.SITIO_URL.indexOf(iguala)!==-1){return"active";} else{return"";}}};$scope.salirApp=function(){delete $rootScope.USERCONECTADO;$rootScope.estadoLog=0;accountService.logout();};$rootScope.changedate=function(op,modo){if(modo===0){return $filter('date')(op,"dd/MM/yyyy");} return $filter('date')(op,"dd/MM/yyyy HH:mm");};$scope.txt="Pagina de inicio";$scope.CONSOLE=function(val1,val2){if(val2!==undefined) console.warn(val1,val2);else console.warn(val1);};$rootScope.USERCONECTADO=userService.GetCurrentUserData();}]);})();(function(){'use strict';angular.module('appPrincipal').controller('loginController',['$scope','$rootScope','accountService','userService','$location','Manager',function($scope,$rootScope,accountService,userService,$location,Manager){$scope.account={username:'',password:'',puntoventa:null};Manager.getall('controllerexcepcion.php').then(function(d){$scope.PUNTOS_ALL=d.data;},function(errResponse){});$scope.message="";$scope.login=function(){accountService.login($scope.account).then(function(data){$scope.data=data;Manager.getall('validate_token.php').then(function(d){$rootScope.USERCONECTADO=d;userService.SetCurrentUserData(d);LOG(d.data) if(d.data.recuperar*1===1){$location.path('/change');}else{$location.path('/pv/pos');}},function(errResponse){});},function(error){$scope.message=error;});};}]).controller('RecuperarController',['$scope','$rootScope','accountService','$location','Manager',function($scope,$rootScope,accountService,$location,Manager){$scope.sendRecuperar=function(){$scope.$emit("LOAD");var modelo={dataForm:null,id:$scope.account.codigo,id2:$scope.account.mail};Manager.post('recuperar.php',modelo).then(function(d){alert(d.message);$location.path('/login');$scope.$emit("UNLOAD");},function(errResponse){alert(errResponse.message);$scope.$emit("UNLOAD");});};}]).controller('ChangeController',['$scope','$rootScope','accountService','$location','Manager',function($scope,$rootScope,accountService,$location,Manager){$scope.sendCambiarClave=function(a){$scope.$emit("LOAD");var accountChange=cloneJson(a);accountChange.password=$.md5(accountChange.password);accountChange.password_2=$.md5(accountChange.password_2);var modelo={dataForm:null,id:accountChange.password,id2:accountChange.password_2};Manager.post('change.php',modelo).then(function(d){alert(d.message);delete $rootScope.USERCONECTADO;$rootScope.estadoLog=0;accountService.logout();},function(errResponse){$scope.$emit("UNLOAD");});};}]).controller('refreshtoken',['$scope','$rootScope','accountService','$location','Manager','$routeParams',function($scope,$rootScope,accountService,$location,Manager,$routeParams){LOG("REFRESH TOKEN CONTROLLER",$routeParams.path);accountService.refresfhToken($routeParams.path);}]);})(); (function(){'use strict';angular.module('appPrincipal').config(['ivhTreeviewOptionsProvider','$httpProvider','$popoverProvider',function(ivhTreeviewOptionsProvider,$httpProvider,$popoverProvider){ivhTreeviewOptionsProvider.set({defaultSelectedState:false,validate:true});angular.extend($popoverProvider.defaults,{html:true,animation:true});var interceptor=function(userService,$q,$location){return{request:function(config){config.url=getTimeVersionedUrl(config.url);var currentUser=userService.GetCurrentUser();if(currentUser!==null&¤tUser!==undefined){config.headers['jwt']=currentUser.jwt;} return config;},responseError:function(rejection){if(rejection.status===401){var path=$location.path();path=path.replace(/\//g,"-");$location.path('/refresh/'+path);return $q.reject(rejection);} if(rejection.status===403){$location.path('/accesoError');return $q.reject(rejection);} return $q.reject(rejection);}};};var params=['userService','$q','$location'];interceptor.$inject=params;$httpProvider.interceptors.push(interceptor);}]);})(); (function(){'use strict';angular.module('appPrincipal').config(['$routeProvider',function($routeProvider){$routeProvider.otherwise({redirectTo:'/pv/pos'});$routeProvider.when('/erroracceso',{templateUrl:basePath+'error_locate.html',controller:'accesoError'});$routeProvider.when('/login',{templateUrl:basePath+'login.html',controller:'loginController'});$routeProvider.when('/refresh/:path?',{templateUrl:basePath+'refresh.html',controller:'refreshtoken'});$routeProvider.when('/recuperar',{templateUrl:basePath+'recuperar.html',controller:'RecuperarController'});$routeProvider.when('/change',{templateUrl:basePath+'cambiarPassword.html',controller:'ChangeController'});$routeProvider.when('/pv/pos',{templateUrl:basePath+'puntoventa/pos.html',controller:'pv-pos',data:{code:'pv_00'}});$routeProvider.when('/pv/arqueo/pv',{templateUrl:basePath+'puntoventa/arqueopv.html',controller:'pv-arqueopv',data:{code:'pv_00'}});$routeProvider.when('/pv/arqueo/admin',{templateUrl:basePath+'puntoventa/arqueoall.html',controller:'pv-arqueoall',data:{code:'pv_00'}});$routeProvider.when('/conf',{templateUrl:basePath+'configurar-admin.html',controller:'configurar-admin',data:{code:'mant_00'}});}]);})();(function(){'use strict';angular.module('appPrincipal').factory('userService',userService);function userService(){var fac={};fac.CurrentUser=null;fac.CurrentUserData=null;fac.SetCurrentUser=function(user){fac.CurrentUser=user;sessionStorage.user=angular.toJson(user);};fac.SetCurrentUserData=function(user){fac.CurrentUserData=user;sessionStorage.userData=angular.toJson(user);};fac.GetCurrentUser=function(){fac.CurrentUser=angular.fromJson(sessionStorage.user);return fac.CurrentUser;};fac.GetCurrentUserData=function(){fac.CurrentUserData=angular.fromJson(sessionStorage.userData);return fac.CurrentUserData;};return fac;};})(); (function(){'use strict';angular.module('appPrincipal').factory('accountService',accountService);accountService.$inject=['$http','$q','ServiceURL','userService','$location'];function accountService($http,$q,ServiceURL,userService,$location){var fac={};fac.login=function(user){var obj={dataForm:{'codigo':user.username,'puntoventa':user.puntoventa,'password':$.md5(user.password)}};var defer=$q.defer();$http.post(ServiceURL+"/api/login.php",obj).then(function(response){var data_conectado=response.data;userService.SetCurrentUser(data_conectado);defer.resolve(response.data);},function(error){bootbox.alert("Revise los datos, no pudo ingresar");fac.logout();defer.reject(error.data);});return defer.promise;};fac.refresfhToken=function(path){var currentUser=userService.GetCurrentUser();LOG("REFRESH TOKEN") if(currentUser){userService.CurrentUser=null;userService.SetCurrentUser(userService.CurrentUser);var deferred=$q.defer();var data="grant_type=refresh_token&refresh_token="+currentUser.refresh_token;$http.post(ServiceURL+"/api/token",data,{headers:{'Content-Type':'application/x-www-form-urlencoded'}}).then(function(response){LOG("REFRESH TOKEN OK") userService.SetCurrentUser(response.data);deferred.resolve(response.data);LOG("PATH",path);if(!validacontenido(path)){path=path.replace(/-/g,"/") $location.path(path);}},function(err,status){LOG("REFRESH TOKEN NOK",err) fac.logout();deferred.reject(err.data);});return deferred.promise;}};fac.logout=function(){userService.CurrentUser=null;userService.CurrentUserData=null;userService.SetCurrentUser(userService.CurrentUser);userService.SetCurrentUserData(userService.CurrentUserData);$location.path('/login');};return fac;}})(); (function(){'use strict';angular.module('appPrincipal').factory('seguridad',function(){return{passchange:'GDDM2016',keychange:'mono,kior;',_e:function(valor){if(valor==null||valor==undefined) return'';return this.Encrypt(valor,this.passchange,this.keychange);},_d:function(valor){if(valor==null||valor==undefined) return'';return this.Decrypt(valor,this.passchange,this.keychange);},Encrypt:function(Strg,passchange,keychange){Strg=keychange+Strg;var i;var P='',N='',Password=passchange;for(var i=0;i<=Password.length-1;i++){N=Password.substring(i,i+1);P=P+N.charCodeAt(0);};var j=0;var A1,N2,A2,A3,b;var S='';for(var i=0;i<=Strg.length-1;i++){N=P.substring(j,j+1);A1=N.charCodeAt(0);j++;if(j>P.length){j=1;} N2=Strg.substring(i,i+1);A2=N2.charCodeAt(0);A3=A1^A2;b=this.decToHex(A3);if(b.length<2){b="0"+b} S=S+b;};return S;},Decrypt:function(Strg,passchange,keychange){var i;var P='',N='',Password=passchange;for(var i=0;i<=Password.length-1;i++){N=Password.substring(i,i+1);P=P+N.charCodeAt(0);};var j=0;var A1,N2,A2,A3,b;var S='';for(var i=0;i<=Strg.length-1;i+=2){N2=P.substring(j,j+1);A1=N2.charCodeAt(0);j++;if(j>P.length){j=1;} b=Strg.substring(i,i+2);A3=parseInt(b,16);A2=A1^A3;S=S+String.fromCharCode(A2);};return S.replace(keychange,'');},decToHex:function(dec){var hexStr="0123456789ABCDEF";var low=dec%16;var high=(dec-low)/16;var hex=""+hexStr.charAt(high)+hexStr.charAt(low);return hex;}};});})();(function(){'use strict';angular.module('appPrincipal').factory('Excel',['$window',function($window){var uri='data:application/vnd.ms-excel;base64,',template='{table}
    ',base64=function(s){return $window.btoa(unescape(encodeURIComponent(s)));},format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p];})};return{tableToExcel:function(tableId,worksheetName){var table=$(tableId),ctx={worksheet:worksheetName,table:table.html()},href=uri+base64(format(template,ctx));return href;}};}]);})();(function(){'use strict';angular.module('appPrincipal').directive('datepicker',function(){return{restrict:'A',require:'ngModel',link:function(scope,element,attrs,ctrl){$(element).datepicker({showButtonPanel:true,changeMonth:true,changeYear:true,language:'es',todayHighlight:true,dateFormat:'dd/MM/yy',useCurrent:false,yearRange:"-100:+10",forceParse:false,beforeShow:function(){setTimeout(function(){$('.ui-datepicker').css('z-index',99999999999999);},0);}}).on('changeDate',function(selected){scope.$apply(function(){ctrl.$setViewValue(selected.date);});});try{if(!validacontenido(ctrl.$viewValue)) $(element).datepicker('update',ctrl.$viewValue);}catch(e){LOG("ERROR","ASIGNA FECHA PICKER"+e)}}};}).directive('timepicker',function(){return{restrict:'A',require:'ngModel',link:function(scope,element,attrs,ctrl){$(element).timepicker();}};}).directive('datepickermonth',function(){return{restrict:'A',require:'ngModel',link:function(scope,element,attrs,ctrl){$(element).datepicker({autoclose:true,minViewMode:1,format:'mm/yyyy',language:'es',}).on('changeDate',function(selected){scope.$apply(function(){ctrl.$setViewValue('01/'+moment(selected.date).format('MM/YYYY'));});});}};}).directive('datepickeryear',function(){return{restrict:'A',require:'ngModel',link:function(scope,element,attrs,ctrl){$(element).datepicker({autoclose:true,minViewMode:1,format:'yyyy',language:'es',}).on('changeDate',function(selected){scope.$apply(function(){ctrl.$setViewValue(selected.date);});});}};})})();(function(){'use strict';angular.module('appPrincipal').directive('tooltip',function(){return{restrict:'A',link:function(scope,element,attrs){$(element).hover(function(){$(element).tooltip('show');},function(){$(element).tooltip('hide');});}};}).directive('sidebarProgramacion',function(){return{restrict:'A',link:function(scope,element,attrs){$(element).click(function(){if($('.sidebar-offcanvas').css('background-color')==='rgb(255, 255, 255)'){$('.list-group-item').attr('tabindex','-1');}else{$('.list-group-item').attr('tabindex','');} $('.row-offcanvas').toggleClass('active');});}};}).directive('numberFormat',['$filter','$parse',function($filter,$parse){return{require:'ngModel',link:function(scope,element,attrs,ngModelController){var decimals=$parse(attrs.decimals)(scope);ngModelController.$parsers.push(function(data){if(data!==undefined&&data!==null){var parsed=parseFloat(data.replace(/\./g,''));return!isNaN(parsed)?parsed:undefined;} else{var parsed=parseFloat(data);return!isNaN(parsed)?parsed:undefined;}});ngModelController.$formatters.push(function(data){return $filter('number')(data,decimals);});element.bind('focus',function(){element.val(ngModelController.$modelValue);});element.bind('blur',function(){var formatted=$filter('number')(ngModelController.$modelValue,decimals);element.val(formatted);});}}}]);})();(function(){'use strict';angular.module('appPrincipal').directive('toNum',function(){return{require:'ngModel',link:function(scope,element,attrs,ngModel){ngModel.$parsers.push(function(val){return parseInt(val,10);});ngModel.$formatters.push(function(val){return''+val;});}};});})();(function(){'use strict';angular.module('appPrincipal').directive('toStrNum',function(){return{require:'ngModel',link:function(scope,element,attrs,ngModel){ngModel.$parsers.push(function(val){return val!==undefined?val.toString().replace(/\./gi,','):val;});ngModel.$formatters.push(function(val){return val!==undefined?val.toString().replace(/\./gi,','):val;});}};});})();(function(){'use strict';angular.module('appPrincipal').directive('dragprogramacion',function(){return{restrict:'A',link:function(scope,element,attrs,ctrl){var MODELO=scope.$parent.r;$(element).data('event',{id_usuario:MODELO.id_usuario,title:MODELO.nombre+' '+MODELO.apellid_p,stick:true});$(element).draggable({zIndex:999,revert:true,revertDuration:0,snap:true});}};})})();(function(){'use strict';angular.module('appPrincipal').directive('price',['$filter',function($filter){return{restrict:'A',require:'ngModel',link:function(scope,element,attrs,ngModelController){ngModelController.$parsers.push(function(data){data=$filter('comma2decimal')(data);return data;});ngModelController.$formatters.push(function(data){data=$filter('decimal2comma')(data);return data;});}};}]).directive('printPedido',['$filter',function($filter){return{restrict:'A',link:function(scope,element,attrs,ngModelController){$(".btnPrintPedido").printPage({attr:"href",message:"Imprimir Pedido"});}};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('inArray',['$filter',function($filter){return function(list,arrayFilter,element){if(arrayFilter){return $filter("filter")(list,function(listItem){return _.pluck(arrayFilter,element).indexOf(listItem[element])!=-1;});}};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('cut',['$filter',function($filter){return function(value,wordwise,max,tail){if(!value)return'';max=parseInt(max,10);if(!max)return value;if(value.length<=max)return value;value=value.substr(0,max);if(wordwise){var lastspace=value.lastIndexOf(' ');if(lastspace!==-1){if(value.charAt(lastspace-1)==='.'||value.charAt(lastspace-1)===','){lastspace=lastspace-1;} value=value.substr(0,lastspace);}} return value+(tail||' …');};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('concat',['$filter',function($filter){return function(value,item1,item2,sep1,sep2){if(!value)return'';var salida='';angular.forEach(value,function(i,idx){if(item1) salida+=i[item1] if(sep1) salida+=sep1 if(item2) salida+=i[item2] if(idx!==value.length-1){if(sep2) salida+=sep2}});return salida};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('inArray2',['$filter',function($filter){return function(list,value,element){if(value){return $filter("filter")(list,function(listItem){return value==listItem[element];});}};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('dot2comma',[function(){return function(value){return value.toString().replace(/\./g,',');};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('percentage',['$filter',function($filter){return function(input,decimals){return $filter('number')(input*100,decimals)+'%';};}]);})();(function(){'use strict';angular.module('appPrincipal').filter("unique",function(){return function(collection,keyname){var output=[],keys=[];angular.forEach(collection,function(item){var key=item[keyname];if(keys.indexOf(key)===-1){keys.push(key);output.push(item);}});return output;};});})();(function(){'use strict';angular.module('appPrincipal').filter('comma2decimal',[function(){return function(input){var ret=input!==null&&input!==undefined?input.toString().trim().replace(",","."):null;return parseFloat(ret);};}]);})();(function(){'use strict';angular.module('appPrincipal').filter('decimal2comma',[function(){return function(input){var ret=input!==null&&input!==undefined?input.toString().replace(".",","):null;if(ret){var decArr=ret.split(",");if(decArr.length>1){var dec=decArr[1].length;if(dec===1){ret+="0";}}} return ret;};}]);})(); (function(){'use strict';angular.module('appPrincipal').constant('ServiceURL',RUTAAPI).factory('Manager',['$http','$q','ServiceURL','seguridadEncript',function($http,$q,ServiceURL,seguridadEncript){return{promise:null,search:function(_Ctrl){if(this.promise!==null){this.promise.resolve();this.promise=null;} var abort=$q.defer();var $promise=$http.get(ServiceURL+'/api/'+_Ctrl,{timeout:abort.promise}).then(function(response){return response.data;},function(errResponse){console.warn('Problema',_Ctrl);return $q.reject(errResponse.data);});this.promise=abort;return $promise;},getall:function(_Ctrl){return $http.get(ServiceURL+'/api/'+_Ctrl).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',_Ctrl);return $q.reject(errResponse.data);});},get:function(_Ctrl,id){return $http.get(ServiceURL+'/api/'+_Ctrl+'/'+id).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',_Ctrl);return $q.reject(errResponse.data);});},getP:function(_Ctrl){return $http.get(ServiceURL+'/api/'+_Ctrl).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',_Ctrl);return $q.reject(errResponse.data);});},post:function(_Ctrl,_Obj){return $http.post(ServiceURL+'/api/'+_Ctrl+'/',_Obj).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',_Ctrl);return $q.reject(errResponse.data);});},postR:function(_eldestino,_accion,_dataForm,_id,_id2,_estado){var json={destino:seguridadEncript.encrypt(_eldestino,SESSION_ID),accion:seguridadEncript.encrypt(_accion,SESSION_ID),dataForm:_dataForm,id:_id,id2:_id2,estado:validacontenido(_estado)?'T':_estado};return $http.post(ServiceURL+'/api/controller.php',json).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',errResponse);return $q.reject(errResponse.data);});},postUpload:function(_eldestino,_accion,_dataForm,fd){var json={destino:seguridadEncript.encrypt(_eldestino,SESSION_ID),accion:seguridadEncript.encrypt(_accion,SESSION_ID),dataForm:_dataForm,fd:fd};return $http.post(ServiceURL+'/api/controller.php',json,{withCredentials:true,headers:{'Content-Type':undefined},transformRequest:angular.identity}).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',errResponse);return $q.reject(errResponse.data);});},put:function(_Ctrl,_Obj,id){return $http.put(ServiceURL+'/api/'+_Ctrl+'/'+id,_Obj).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',_Ctrl);return $q.reject(errResponse.data);});},del:function(_Ctrl,id){return $http.delete(ServiceURL+'/api/'+_Ctrl+'/'+id).then(function(response){return response.data;},function(errResponse){console.error('ERROR:',_Ctrl);return $q.reject(errResponse.data);});}};}]);})(); (function(){'use strict';angular.module('appPrincipal').factory('seguridadEncript',function(){return{encode64:function(text){if(/([^\u0000-\u00ff])/.test(text)){throw new Error("Can't base64 encode non-ASCII characters.");} var digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,cur,prev,byteNum,result=[];while(i>2));break;case 1:result.push(digits.charAt((prev&3)<<4|(cur>>4)));break;case 2:result.push(digits.charAt((prev&0x0f)<<2|(cur>>6)));result.push(digits.charAt(cur&0x3f));break;} prev=cur;i++;} if(byteNum==0){result.push(digits.charAt((prev&3)<<4));result.push("==");}else if(byteNum==1){result.push(digits.charAt((prev&0x0f)<<2));result.push("=");} return result.join("");},decode64:function(text){text=text.replace(/\s/g,"");if(!(/^[a-z0-9\+\/\s]+\={0,2}$/i.test(text))||text.length%4>0){throw new Error("Not a base64-encoded string.");} var digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cur,prev,digitNum,i=0,result=[];text=text.replace(/=/g,"");while(i>4));break;case 2:result.push(String.fromCharCode((prev&0x0f)<<4|cur>>2));break;case 3:result.push(String.fromCharCode((prev&3)<<6|cur));break;} prev=cur;i++;} return result.join("");},ord:function(string){var str=string+'',code=str.charCodeAt(0);if(0xD800<=code&&code<=0xDBFF){var hi=code;if(str.length===1){return code;} var low=str.charCodeAt(1);return((hi-0xD800)*0x400)+(low-0xDC00)+0x10000;} if(0xDC00<=code&&code<=0xDFFF){return code;} return code;},decrypt:function(sData,sKey){if(ACBMODE==='ACB')return sData;var sResult="";sData=this.decode64(sData);var i=0;for(i=0;imax*1){ctrl.$setValidity('ngMax',false);return undefined;}else{ctrl.$setValidity('ngMax',true);return value;}};ctrl.$parsers.push(maxValidator);ctrl.$formatters.push(maxValidator);}};});})();(function(){'use strict';angular.module('appPrincipal').directive('ngMin',function(){return{restrict:'A',require:'ngModel',link:function(scope,elem,attr,ctrl){scope.$watch(attr.ngMin,function(){ctrl.$setViewValue(ctrl.$viewValue);});var minValidator=function(value){var min=scope.$eval(attr.ngMin)*1||0;console.log(!isEmpty(value));console.log(value*10){s=(s+t%10*(9-m++%6))%11;t=Math.floor(t/10);} var v=(s>0)?(s-1)+'':'K';return(v===_value.slice(-1));} function addValidatorToNgModel(ngModel){var validate=function(value){var valid=validateRut(value);if(value===''||value===undefined||value===null) ngModel.$setValidity('rut',true);else ngModel.$setValidity('rut',valid);return valid;};var validateAndFilter=function(_value){_value=cleanRut(_value);return validate(_value)?_value:null;};var validateAndFormat=function(_value){_value=cleanRut(_value);validate(_value);return formatRut(_value);};ngModel.$parsers.unshift(validateAndFilter);ngModel.$formatters.unshift(validateAndFormat);} function formatRutOnWatch($scope,ngModel){$scope.$watch(function(){return ngModel.$viewValue;},function(){ngModel.$setViewValue(formatRut(ngModel.$viewValue));ngModel.$render();});} function formatRutOnBlur($element,ngModel){$element.on('blur',function(){ngModel.$setViewValue(formatRut(ngModel.$viewValue));ngModel.$render();});} angular.module('valida.rut',[]).directive('ngRut',function(){return{restrict:'A',require:'ngModel',link:function($scope,$element,$attrs,ngModel){if(typeof $attrs.rutFormat==='undefined'){$attrs.rutFormat='live';} addValidatorToNgModel(ngModel);switch($attrs.rutFormat){case'live':formatRutOnWatch($scope,ngModel);break;case'blur':formatRutOnBlur($element,ngModel);break;}}};}).filter('rut',function(){return formatRut;}).constant('RutHelper',{format:formatRut,clean:cleanRut,validate:function(value){return validateRut(cleanRut(value));}});})(angular);(function(){'use strict';angular.module('appPrincipal').directive('tabVertical',function(){return{link:function(scope,element,attrs,ngModel){$(document).ready(function(){$(".bhoechie-tab-menu>div.list-group>a").click(function(e){$(this).siblings('a.active').removeClass("active");$(this).addClass("active");$("div.bhoechie-tab>div.bhoechie-tab-content").removeClass("active");$($(this).attr("data-target")).addClass("active");});});}};});})(); (function(){'use strict';angular.module('appPrincipal').controller('configurar-admin',['$scope','Manager','$location','ModalService','ServiceURL',function($scope,Manager,$location,ModalService,ServiceURL){$scope.UBICACION="Configuraciones";Manager.postR('menuadmin','getallgroup',{}).then(function(d){$scope.CATEGORIAS_ALL=d.data;Manager.postR('menuadmin','getall',{},null,null,'B').then(function(d){$scope.nav_route=d.data;},function(errResponse){});},function(errResponse){});$scope.openEdit=function(route){LOG(route) ModalService.showModal({templateUrl:ServiceURL+'/app_partials/'+route.html,controller:route.controller,preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){});});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-mesas',['$scope','Manager','ModalService','$rootScope','$location',function($scope,Manager,ModalService,$rootScope,$location){var UBICACION_CONTROL=$location.path()==='/pv/caja'?true:false;$rootScope.UBICACION="Mesas";$scope.refrescarMesas=function(){$scope.$emit("LOAD");Manager.postR('multiconsultas','infoMesas',{}).then(function(d){$scope.MESA_PEDIDO_ALL=d.data['mesaopen'];$scope.ORIGEN_ALL=d.data['origen'];$scope.$emit("UNLOAD");},function(errResponse){LOG(errResponse);$scope.$emit("UNLOAD");});};$scope.refrescarMesas();var minMesas=20;$scope.Mesas=[];for(var x=1;x<=minMesas;x++){$scope.Mesas.push({mesa:x});} $scope.OpenMesa=function(mesaID,pedidoID){var path='';if(!validacontenido(pedidoID)) path='/'+pedidoID;if(!validacontenido(mesaID)){if(validacontenido(path)) path='//'+mesaID;else path+='/'+mesaID;} $location.path('/pv/pedido'+path);};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-pagar',['$scope','Manager','mesaID','pedidoID','close',function($scope,Manager,mesaID,pedidoID,close){$scope.close=function(){close(true,200);};$scope.mesaID=mesaID;$scope.$emit("LOAD");Manager.postR('multiconsultas','infopedido',{},mesaID,pedidoID).then(function(d){$scope.MESA_PEDIDO_OPEN=d.data['mesaopen'];$scope.CATEGORIA_ALL=d.data['categoria'];$scope.PRODUCTOS_ALL=d.data['productos'];$scope.ORIGEN_ALL=d.data['origen'];$scope.MEDIOPAGO_ALL=d.data['mediopago'];$scope.EL_PEDIDO=d.data['cabpedido'];$scope.DETALLE_PEDIDO=d.data['detpedido'];$scope.$emit("UNLOAD");},function(errResponse){LOG(errResponse);$scope.$emit("UNLOAD");});$scope.sumaTotal=function(){return _.reduce($scope.DETALLE_PEDIDO,function(memo,num){return memo+(num.valor*1+num.agregado_valor*1);},0);};$scope.sumaTotalPropina=function(){return $scope.sumaTotal()*10/100;};$scope.sumaTotalFinal=function(){if($scope.EL_PEDIDO.incluirpropina*1===1){$scope.EL_PEDIDO.montopago=$scope.sumaTotal()+$scope.sumaTotalPropina();$scope.EL_PEDIDO.montopropina=$scope.sumaTotalPropina();} else{$scope.EL_PEDIDO.montopago=$scope.sumaTotal();$scope.EL_PEDIDO.montopropina=0;}};$scope.$watch('EL_PEDIDO.incluirpropina',function(val,old){if(val!==old){$scope.sumaTotalFinal();}});$scope.pagarPedidoMesa=function(){bootbox.confirm({message:"Esta pagando el pedido, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','pagarPedidoMesa',$scope.EL_PEDIDO,pedidoID).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-detalle',['$scope','Manager','$routeParams','$rootScope','ModalService','$location','$filter','focus',function($scope,Manager,$routeParams,$rootScope,ModalService,$location,$filter,focus){var pedidoID=$routeParams.pedidoID;$scope.pedidoID=$routeParams.pedidoID;$scope.close=function(){$location.path('/pv/mesas');};focus('focusMe');var mesaID=$routeParams.mesaID;$scope.mesaID=$routeParams.mesaID;$scope.UBICACION="Mesas - Pedido";$scope.obtenerDatos=function(){$scope.$emit("LOAD");Manager.postR('multiconsultas','infopedido',{},$scope.mesaID,$scope.pedidoID).then(function(d){$scope.MESA_PEDIDO_OPEN=d.data['mesaopen'];$scope.CATEGORIA_ALL=d.data['categoria'];$scope.PRODUCTOS_ALL=d.data['productos'];$scope.ORIGEN_ALL=d.data['origen'];$scope.EL_PEDIDO=d.data['cabpedido'];$scope.DETALLE_PEDIDO=d.data['detpedido'];focus('focusMe');$scope.$emit("UNLOAD");},function(errResponse){LOG(errResponse);$scope.$emit("UNLOAD");});};$scope.RefreshDetallePedido=function(){if(!validacontenido($scope.pedidoID)){Manager.postR('pedido','getDetallePedido',{},$scope.pedidoID).then(function(d){$scope.DETALLE_PEDIDO=d.data;$scope.$emit("UNLOAD");focus('focusMe');Manager.postR('productos','getall',{}).then(function(d){$scope.PRODUCTOS_ALL=d.data;},function(errResponse){});},function(errResponse){$scope.$emit("UNLOAD");});}};$scope.obtenerDatos();$scope.openPedidoMesa=function(){var modelo=angular.copy($scope.abrirpedido);if(validacontenido(modelo)||validacontenido(modelo.idorigen)){bootbox.alert("Debe indicar origen del pedido");return;} modelo['codigomesa']=validacontenido($scope.mesaID)?"SM":$scope.mesaID;modelo['quienpide']=validacontenido(modelo.quienpide)?'':modelo.quienpide;modelo['datospedido']=validacontenido(modelo.datospedido)?'':modelo.datospedido;Manager.postR('pedido','add',modelo).then(function(d){$location.path('/pv/pedido/'+d.data.idpedido);},function(errResponse){$scope.$emit("UNLOAD");});};$scope.filtraCategoria=function(laCategoria){$scope.laCategoria=laCategoria;};$scope.filtraCategoriaClean=function(){$scope.laCategoria=undefined;};$scope.aplicar_pagar=true;var id_item=0;$scope.agregaItemPedidoMesaSearch=function(keyEvent){if(keyEvent.keyCode===13){LOG($filter('filter')($scope.PRODUCTOS_ALL,{codigo:$scope.filtroproductos})[0]);if(Object.keys($filter('filter')($scope.PRODUCTOS_ALL,{codigo:$scope.filtroproductos})).length>0){$scope.agregaItemPedidoMesa($filter('filter')($scope.PRODUCTOS_ALL,{codigo:$scope.filtroproductos})[0]);}else if(Object.keys($filter('filter')($scope.PRODUCTOS_ALL,{nombre:$scope.filtroproductos})).length>0){$scope.agregaItemPedidoMesa($filter('filter')($scope.PRODUCTOS_ALL,{nombre:$scope.filtroproductos})[0]);}}};$scope.addAgregados=function(idpedidodetalle){if($scope.EL_PEDIDO.estadomesa!=='O')return;ModalService.showModal({templateUrl:'app_partials/puntoventa/agregados.html',controller:'pv-agregados',inputs:{idpedidodetalle:idpedidodetalle,agregados:$scope.PRODUCTOS_ALL},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.obtenerDatos();});});};$scope.delAgregados=function(idagregados){bootbox.confirm({message:"Esta eliminando un agregado, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','delAgregados',{},idagregados).then(function(d){$scope.RefreshDetallePedido();},function(errResponse){$scope.$emit("UNLOAD");});}}});};$scope.agregaItemPedidoMesa=function(elProducto){if($scope.EL_PEDIDO.estadomesa!=='O')return;$scope.$emit("LOAD");var elProductoCopy=angular.copy(elProducto);Manager.postR('pedido','agregaItemPedidoMesa',elProductoCopy,$scope.pedidoID).then(function(d){$scope.RefreshDetallePedido();},function(errResponse){$scope.$emit("UNLOAD");});};$scope.confirmaItemPedidoMesa=function(elItem){if($scope.EL_PEDIDO.estadomesa!=='O')return;$scope.$emit("LOAD");var elItemCopy=angular.copy(elItem);Manager.postR('pedido','confirmaItemPedidoMesa',elItemCopy,elItemCopy.iddetallepedido).then(function(d){$scope.RefreshDetallePedido();},function(errResponse){$scope.$emit("UNLOAD");});};$scope.confirmaItemPedidoMesaALL=function(){if($scope.EL_PEDIDO.estadomesa!=='O')return;bootbox.confirm({message:"Confirmara todos los item pendientes, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','confirmaItemPedidoMesaALL',{},$scope.pedidoID).then(function(d){$scope.pedidoIDC=$scope.MESA_PEDIDO_OPEN.idpedido;$scope.pedidoGUIDC=d.data;$(".btnPrintConfirmado").printPage({attr:"href",message:"Imprimir Comanda"});$(".btnPrintConfirmado").click();$scope.RefreshDetallePedido();},function(errResponse){$scope.$emit("UNLOAD");});}}});};$scope.eliminaItemPedidoMesa=function(elItem){if($scope.EL_PEDIDO.estadomesa!=='O')return;var elItemCopy=angular.copy(elItem);bootbox.confirm({message:"Eliminará item, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','eliminaItemPedidoMesa',elItemCopy,elItemCopy.iddetallepedido).then(function(d){$scope.RefreshDetallePedido();},function(errResponse){$scope.$emit("UNLOAD");});}}});};$scope.eliminaItemPedidoMesaSinConfirmar=function(){if($scope.EL_PEDIDO.estadomesa!=='O')return;bootbox.confirm({message:"Eliminará items sin confirmar, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','eliminaItemPedidoMesaSinConfirmar',{},$scope.pedidoID).then(function(d){$scope.RefreshDetallePedido();},function(errResponse){$scope.$emit("UNLOAD");});}}});};$scope.sumaTotal=function(){return _.reduce($scope.DETALLE_PEDIDO,function(memo,num){return memo+(num.valor*1+num.agregado_valor*1);},0);};$scope.sumaTotalPropina=function(){return $scope.sumaTotal()*10/100;};$scope.sumaTotalFinal=function(){return $scope.sumaTotal()+$scope.sumaTotalPropina();};$scope.pagarMesa=function(){if($scope.EL_PEDIDO.estadomesa!=='O')return;ModalService.showModal({templateUrl:'app_partials/puntoventa/pagar.html',controller:'pv-pagar',inputs:{pedidoID:$scope.pedidoID,mesaID:$scope.mesaID},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.obtenerDatos();});});};$scope.liberarPedidoMesa=function(){bootbox.confirm({message:"Esta cerrando la mesa, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','liberarPedidoMesa',{},$scope.pedidoID).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-cocina',['$scope','Manager','ModalService','$rootScope',function($scope,Manager,ModalService,$rootScope){$scope.UBICACION="Cocina";$scope.refrescarCocina=function(){Manager.postR('pedido','getPedidosCocina',{}).then(function(d){$scope.PEDIDO_ITEMS_COCINA=d.data;},function(errResponse){$scope.$emit("UNLOAD");});};$scope.refrescarCocina();$scope.confirmarPreparacion=function(elItem){var elItemCopy=angular.copy(elItem);bootbox.confirm({message:"Esta confirmando el item como términado, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','confirmaItemCocina',elItemCopy,elItemCopy.iddetallepedido).then(function(d){$scope.refrescarCocina();},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-agregados',['$scope','Manager','agregados','idpedidodetalle','close',function($scope,Manager,agregados,idpedidodetalle,close){$scope.agregados=agregados;$scope.close=function(){close(true,200);};$scope.addAgregados=function(idproductos){$scope.$emit("LOAD");Manager.postR('pedido','addAgregados',{},idproductos,idpedidodetalle).then(function(d){$scope.close();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-opera',['$scope','Manager','OPERADOR_INGRESOS','close',function($scope,Manager,OPERADOR_INGRESOS,close){$scope.OPERADOR_INGRESOS=OPERADOR_INGRESOS;$scope.close=function(modo){var salida={estado:modo,OPERADOR_INGRESOS:$scope.OPERADOR_INGRESOS};close(salida,200);};}]);})();(function(){'use strict';angular.module('appPrincipal').directive('detalleStockaprox',['Manager',function(Manager){return{restrict:'A',scope:{detalleStockaprox:'='},replace:true,templateUrl:'app_partials/puntoventa/detallestockaprox.html',link:function(scope,element,attrs,ngModelController){Manager.postR('informes','getStockCriticoIDProducto',{},scope.detalleStockaprox).then(function(d){scope.detallestock=d.data;},function(errResponse){});}};}]);})();(function(){'use strict';angular.module('appPrincipal').directive('detalleAgregados',['Manager',function(Manager){return{restrict:'A',scope:{detalleAgregados:'='},replace:true,templateUrl:'app_partials/puntoventa/detalleagregados.html',link:function(scope,element,attrs,ngModelController){Manager.postR('pedido','getAgregados',{},scope.detalleAgregados).then(function(d){scope.detalleAgregado=d.data;},function(errResponse){});}};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hoperador',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('usuario','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='operadores/add.html';var controller='Aoperador';if(modo==='U'){html='operadores/add.html';controller='Uoperador';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el usuario, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('usuario','updateestado',item,item.idusuario).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Aoperador',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};Manager.postR('perfil','getall',{}).then(function(d){$scope.PERFILES_ALL=d.data;},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);if(!validacontenido(MODELO.password)){MODELO.password=$.md5(MODELO.password);} Manager.postR('usuario','codigoExists',MODELO).then(function(d){console.log(d.data);if(d===true){bootbox.alert("El código de usuario ya esta asignado.");}else{bootbox.confirm({message:"Agregará un nuevo usuario, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('usuario','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});}},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Uoperador',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('perfil','getall',{}).then(function(d){$scope.PERFILES_ALL=d.data;Manager.postR('usuario','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará usuario, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);if(!validacontenido(MODELO.password)){MODELO.password=$.md5(MODELO.password);} Manager.postR('usuario','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hinsumos',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('insumos','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='insumos/add.html';var controller='Ainsumos';if(modo==='U'){html='insumos/add.html';controller='Uinsumos';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('insumos','updateestado',item,item.idinsumos).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Ainsumos',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.close=function(){close(true,200);};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('insumos','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Uinsumos',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('insumos','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('insumos','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Horigen',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('origen','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='origen/add.html';var controller='Aorigen';if(modo==='U'){html='origen/add.html';controller='Uorigen';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('origen','updateestado',item,item.idorigen).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Aorigen',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.lista_iconos=[{value:'mdi mdi-library',show:'mdi mdi-library mdi-24px'},{value:'mdi mdi-transit-transfer',show:'mdi mdi-transit-transfer mdi-24px'},{value:'mdi mdi-truck-delivery',show:'mdi mdi-truck-delivery mdi-24px'}];$scope.modelo={icono:''};$scope.setIcono=function(val){$scope.modelo.icono=val;};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('origen','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Uorigen',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.lista_iconos=[{value:'mdi mdi-library',show:'mdi mdi-library mdi-24px'},{value:'mdi mdi-transit-transfer',show:'mdi mdi-transit-transfer mdi-24px'},{value:'mdi mdi-truck-delivery',show:'mdi mdi-truck-delivery mdi-24px'}];$scope.setIcono=function(val){$scope.modelo.icono=val;};$scope.$emit("LOAD");Manager.postR('origen','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('origen','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hmediopago',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('mediopago','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='mediopago/add.html';var controller='Amediopago';if(modo==='U'){html='mediopago/add.html';controller='Umediopago';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('mediopago','updateestado',item,item.idmediopago).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Amediopago',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('mediopago','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Umediopago',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('mediopago','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('mediopago','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hmenudia',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('menudia','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='menudia/add.html';var controller='Amenudia';if(modo==='U'){html='menudia/add.html';controller='Umenudia';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('menudia','updateestado',item,item.idorigen).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Amenudia',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('menudia','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Umenudia',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('menudia','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('menudia','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hproductos',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};Manager.postR('categoria','getall',{}).then(function(d){$scope.CATEGORIA_ALL=d.data;},function(errResponse){$scope.$emit("UNLOAD");});$scope.LISTA_TABLA=function(){Manager.postR('productos','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='productos/add.html';var controller='Aproductos';if(modo==='U'){html='productos/add.html';controller='Uproductos';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('productos','updateestado',item,item.idproductos).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Aproductos',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.close=function(){close(true,200);};$scope.modelo={productoinsumo:[],detallemenu:[]};$scope.$emit("LOAD");Manager.postR('categoria','getall',{}).then(function(d){$scope.CATEGORIA_ALL=d.data;Manager.postR('insumos','getall',{}).then(function(d){$scope.INSUMOS_ALL=d.data;Manager.postR('productos','getall',{}).then(function(d){$scope.PRODUCTOS_ALL=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});$scope.setting_productoinsumo={idProperty:'idinsumos',displayProp:'nombre',enableSearch:true};$scope.setting_detallemenu={idProperty:'idproductos',displayProp:'nombre',enableSearch:true};$scope.deleteitemMenu=function(r){$scope.modelo.detallemenu=_.filter($scope.modelo.detallemenu,function(i){return r!==i;});};$scope.deleteitemInsumo=function(r){$scope.modelo.productoinsumo=_.filter($scope.modelo.productoinsumo,function(i){return r!==i;});};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('productos','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Uproductos',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('multiconsultas','productoedit',{},id).then(function(d){$scope.CATEGORIA_ALL=d.data['categoria'];$scope.INSUMOS_ALL=d.data['insumos'];$scope.PRODUCTOS_ALL=d.data['productos'];$scope.modelo=d.data['elproducto'];$scope.modelo['detallemenu']=d.data['elproductoMenu'];$scope.modelo['productoinsumo']=d.data['elproductoInsumos'];$scope.$emit("UNLOAD");},function(errResponse){LOG(errResponse);$scope.$emit("UNLOAD");});$scope.setting_productoinsumo={idProperty:'idinsumos',displayProp:'nombre',enableSearch:true};$scope.setting_detallemenu={idProperty:'idproductos',displayProp:'nombre',enableSearch:true};$scope.deleteitemMenu=function(r){$scope.modelo.detallemenu=_.filter($scope.modelo.detallemenu,function(i){return r!==i;});};$scope.deleteitemInsumo=function(r){$scope.modelo.productoinsumo=_.filter($scope.modelo.productoinsumo,function(i){return r!==i;});};$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('productos','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hinsumos',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('insumos','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='insumos/add.html';var controller='Ainsumos';if(modo==='U'){html='insumos/add.html';controller='Uinsumos';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('insumos','updateestado',item,item.idinsumos).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Ainsumos',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.close=function(){close(true,200);};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('insumos','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Uinsumos',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('insumos','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('insumos','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hcategoria',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('categoria','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};Manager.postR('categoria','getalliconos',{}).then(function(d){$scope.ICONOS_ALL=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='categoria/add.html';var controller='Acategoria';if(modo==='U'){html='categoria/add.html';controller='Ucategoria';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('categoria','updateestado',item,item.idcategoria).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};$scope.actualziarColor=function(item){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('categoria','update',item,item.idcategoria).then(function(d){notyConfig('Registro actualizado','success','bottomRight');},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Acategoria',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.modelo={esagregado:0,color:null,icono:null};$scope.estado_ejecucion=false;Manager.postR('categoria','getalliconos',{}).then(function(d){$scope.ICONOS_ALL=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('categoria','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Ucategoria',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('categoria','getid',{},id).then(function(d){d.data.esagregado=d.data.esagregado*1;$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});Manager.postR('categoria','getalliconos',{}).then(function(d){$scope.ICONOS_ALL=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('categoria','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hroles',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('perfil','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='roles/add.html';var controller='Aroles';ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Aroles',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.$emit("LOAD");$scope.modeloMenus=[];Manager.postR('perfil','getid',{},id).then(function(d){$scope.modelo=d.data;Manager.postR('menuadmin','getall',{},null,null,'T').then(function(d){var MENUS_ALL=d.data;Manager.postR('menuadmin','getallgroup',{}).then(function(d){$scope.CATEGORIAS_ALL=d.data;Manager.postR('perfil','getMenus',{},id).then(function(d){angular.forEach(MENUS_ALL,function(i){if(Object.keys(_.filter(d.data,function(ii){return i.idmenuadmin===ii.idmenuadmin;})).length>0){i['check']=1;} $scope.MENUS_ALL=MENUS_ALL;});},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});$scope.guardar=function(){var MODELO=cloneJson($scope.MENUS_ALL);MODELO=_.filter(MODELO,function(i){return i.check===1;});bootbox.confirm({message:"Actulizara permisos, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('perfil','addPermisos',MODELO,id).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').directive('detallePromocion',['Manager',function(Manager){return{restrict:'A',scope:{detallePromocion:'=',modoLista:'@'},replace:true,templateUrl:'app_partials/puntoventa/detallepromocion.html',link:function(scope,element,attrs,ngModelController){Manager.postR('productos','getIdCompuestoMenu',{},scope.detallePromocion,null,attrs.modoLista).then(function(d){scope.detallepromocion=d.data;},function(errResponse){});}};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-app',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.modo_panatalla="NEW";$scope.close=function(){close(true,200);};$scope.refrescaDatos=function(){$scope.$emit("LOAD");Manager.postR('negocio','get',{}).then(function(d){$scope.modelo=d.data;Manager.postR('negocio','getLogos',{}).then(function(d){$scope.losLogos=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});},function(errResponse){$scope.$emit("UNLOAD");});};var obtieneDocumentos=function(){$scope.$emit("LOAD");Manager.postR('negocio','getLogos',{}).then(function(d){$scope.losLogos=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});};$scope.refrescaDatos();$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Actualizará su información, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('negocio','update',MODELO).then(function(d){$scope.refrescaDatos();},function(errResponse){$scope.$emit("UNLOAD");});}}});};$scope.openAddDocumento=function(elDocumento){ModalService.showModal({templateUrl:'app_partials/miapp/adjunta-documentos.html',controller:'adjunta-documentos',inputs:{elDocumento:elDocumento},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){obtieneDocumentos();});});};$scope.getRandom=function(imageUrl){var random=(new Date()).toString();return imageUrl+"?cb="+random;};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('adjunta-documentos',['$scope','Manager','ServiceURL','elDocumento','close','FileUploader','userService',function($scope,Manager,ServiceURL,elDocumento,close,FileUploader,userService){var currentUser=userService.GetCurrentUser();LOG('adjunta-documentos');$scope.close=function(){close(true,200);};var uploader=$scope.uploader=new FileUploader({url:ServiceURL+'/api/upload.php',formData:[{elDocumento:elDocumento}],headers:{jwt:currentUser.jwt},removeAfterUpload:true,autoUpload:true,queueLimit:1});uploader.filters.push({name:'syncFilter',fn:function(item,options){return this.queue.length<10;}});uploader.filters.push({name:'docsFilter',fn:function(item,options){var allowedExtensions=['jpg','jpeg','png','JPG','JPEG','PNG'];var ext=item.name.split('.').pop();return allowedExtensions.indexOf(ext)!==-1;}});uploader.filters.push({name:'asyncFilter',fn:function(item,options,deferred){setTimeout(deferred.resolve,1e3);}});uploader.onWhenAddingFileFailed=function(item,filter,options){console.info('onWhenAddingFileFailed',item,filter,options);if(filter.name==="docsFilter"){bootbox.alert("La extención no es admitida ("+item.name+")");}else{bootbox.alert("Ocurrio un problema al intentar subir el archivo ("+item.name+")");}};uploader.onBeforeUploadItem=function(item){console.info('onBeforeUploadItem',item);};uploader.onCompleteAll=function(){$scope.close();};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hinformes1',['$scope','Manager','close','ModalService','ServiceURL',function($scope,Manager,close,ModalService,ServiceURL){$scope.urlsbaseDownload=ServiceURL+'/api/excel/outArqueoAdmin.php';$scope.close=function(){close(true,200);};Manager.postR('punto','getall',{}).then(function(d){$scope.PUNTOS=d.data;Manager.postR('informes','arqueodiarioall',{}).then(function(d){$scope.ARQUEO=d.data;},function(errResponse){});},function(errResponse){});$scope.sumaventaPV=function(pv){return _.reduce(_.filter($scope.ARQUEO,function(i){return i.ubicacion_des==pv&&i.mediopago!=='PAGA DESPUES';}),function(memo,num){return memo+num.total*1;},0);} $scope.sumaventaPDPV=function(pv){return _.reduce(_.filter($scope.ARQUEO,function(i){return i.ubicacion_des==pv&&i.mediopago==='PAGA DESPUES';}),function(memo,num){return memo+num.total*1;},0);}}]);})();(function(){'use strict';angular.module('appPrincipal').controller('AinsumosStock',['$scope','Manager','close','$rootScope',function($scope,Manager,close,$rootScope){$scope.modo_panatalla="NEW";$rootScope.$emit("LOAD");Manager.postR('insumos','getall',{}).then(function(d){$scope.LOS_INSUMOS=d.data;$rootScope.$emit("UNLOAD");},function(errResponse){$rootScope.$emit("UNLOAD");});$scope.close=function(){close(true,200);};$scope.StockRefresh=function(){Manager.postR('insumos','StockAll',{},$scope.elInsumoSelect).then(function(d){$scope.elStock=d.data;$rootScope.$emit("UNLOAD");},function(errResponse){$rootScope.$emit("UNLOAD");});};$scope.guardar=function(){if(validacontenido($scope.StockIngreso)){bootbox.alert("Debe ingresar cantidad");return;}else if(validacontenido($scope.elInsumoSelect)){bootbox.alert("Debe seleccionar insumo");return;}else if(validacontenido($scope.StockValor)){bootbox.alert("Debe ingresar valor");return;} var MODELO={cantidad:$scope.StockIngreso,valor:$scope.StockValor};bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$rootScope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('insumos','StockADD',MODELO,$scope.elInsumoSelect).then(function(d){$scope.StockRefresh();$rootScope.$emit("UNLOAD");},function(errResponse){$rootScope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hinformes3',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};Manager.postR('informes','getStockCritico',{}).then(function(d){$scope.filas2=d.data;},function(errResponse){});}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hinformes4',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('informes','getPedidosALL',{},$scope.ini,$scope.fin).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.sumaTotal1=function(){return _.reduce($scope.filas,function(memo,num){return memo+num.montopago*1;},0);};$scope.sumaTotal2=function(){return _.reduce($scope.filas,function(memo,num){return memo+num.montopropina*1;},0);};}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hinformes2',['$scope','Manager','close','ModalService','ServiceURL',function($scope,Manager,close,ModalService,ServiceURL){$scope.urlsbaseDownload=ServiceURL+'/api/excel/outArqueoFiltro.php';$scope.close=function(){close(true,200);};$scope.ini=new Date();$scope.fin=new Date();Manager.postR('punto','getall',{}).then(function(d){$scope.PUNTOS=d.data;},function(errResponse){});$scope.LISTA_TABLA=function(){Manager.postR('informes','arqueodiarioallfiltro',{},$scope.ini,$scope.fin).then(function(d){$scope.ARQUEO=d.data;},function(errResponse){});};$scope.sumaventaPV=function(pv){return _.reduce(_.filter($scope.ARQUEO,function(i){return i.ubicacion_des==pv&&i.mediopago!=='PAGA DESPUES';}),function(memo,num){return memo+num.total*1;},0);} $scope.sumaventaPDPV=function(pv){return _.reduce(_.filter($scope.ARQUEO,function(i){return i.ubicacion_des==pv&&i.mediopago==='PAGA DESPUES';}),function(memo,num){return memo+num.total*1;},0);}}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hcliente',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('cliente','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='cliente/add.html';var controller='Acliente';if(modo==='U'){html='cliente/add.html';controller='Ucliente';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('cliente','updateestado',item,item.idclientes).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Acliente',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('cliente','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Ucliente',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('cliente','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('cliente','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-pos',['$scope','Manager','$interval','userService',function($scope,Manager,$interval,userService){Manager.postR('punto','getid',{},userService.CurrentUserData.data.codsucursalorigen).then(function(d){$scope.PUNTO=d.data;},function(errResponse){});$scope.laCategoria=null;$scope.setFiltroCategoria=function(item){if(!validacontenido(item)){$scope.laCategoria=item.idcategoria;}else{$scope.laCategoria=null;}};Manager.postR('multiconsultas','dataPOS',{}).then(function(d){$scope.CATEGORIA_ALL=d.data['categoria'];$scope.PRODUCTOS_ALL=d.data['productos'];$scope.MEDIOPAGO_ALL=d.data['mediopago'];$scope.CLIENTES_ALL=d.data['clientes'];$scope.showProductos=$scope.PRODUCTOS_ALL;$scope.$emit("UNLOAD");},function(errResponse){LOG(errResponse);$scope.$emit("UNLOAD");});$scope.pedido=[];$scope.addItem=function(item){if(Object.keys(_.filter($scope.pedido,function(i){return i.producto.idproductos===item.idproductos;})).length>0){_.filter($scope.pedido,function(i){return i.producto.idproductos===item.idproductos;})[0].cantidad++;} else{$scope.pedido.push({producto:item,cantidad:1});} $scope.modelo={modopaga:null,mediopago:null,cliente:null};notyConfig('Se ha agregado 1 ('+item.nombre+')','success','bottomRight');};$scope.delItem=function(item){var LISTADO=angular.copy($scope.pedido);_.filter(LISTADO,function(i){return i.producto.idproductos===item.idproductos;})[0].cantidad--;$scope.pedido=_.filter(LISTADO,function(i){return i.cantidad>0;});$scope.modelo={modopaga:null,mediopago:null,cliente:null};notyConfig('Se ha quitado 1 ('+item.nombre+')','warning','bottomRight');};$scope.sumaPedido=function(){return _.reduce($scope.pedido,function(memo,num){return memo+(num.producto.valor*num.cantidad);},0);};$scope.modelo={modopaga:null,mediopago:null,cliente:null} $scope.searchCode=null;$scope.BuscarPorCodigo=function(){if(Object.keys(_.filter($scope.PRODUCTOS_ALL,function(i){return i.codigo===$scope.searchCode;})).length>0){$scope.addItem(_.filter($scope.PRODUCTOS_ALL,function(i){return i.codigo===$scope.searchCode;})[0])} $scope.searchCode=null;};$scope.registrarPedido=function(){$scope.stopFOcus();var DETALLE=angular.copy($scope.pedido);var MODELO={detalle:[],totalpedido:$scope.sumaPedido(),idclientes:$scope.modelo.cliente,idmediopago:$scope.modelo.mediopago} angular.forEach(DETALLE,function(i){MODELO.detalle.push({idproductos:i.producto.idproductos,precioventa:i.producto.valor,cantidad:i.cantidad,totallinea:i.cantidad*i.producto.valor});});if($scope.modelo.modopaga===1){bootbox.confirm({message:"Esta registrando un PAGO, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','addPOS',MODELO).then(function(d){$scope.modelo={modopaga:null,mediopago:null,cliente:null};notyConfig('Pago registrado','success','topCenter');$scope.pedido=[];$scope.laCategoria=null;$scope.$emit("UNLOAD");$scope.runFocus();},function(errResponse){$scope.$emit("UNLOAD");$scope.runFocus();});}else{$scope.runFocus();}}});}else{bootbox.confirm({message:"Esta registrando un PAGA DESPUÉS, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('pedido','addPOSPD',MODELO).then(function(d){$scope.modelo={modopaga:null,mediopago:null,cliente:null};$scope.pedido=[];$scope.laCategoria=null;notyConfig('*Paga después registrado','info','topCenter');$scope.$emit("UNLOAD");$scope.runFocus();},function(errResponse){$scope.$emit("UNLOAD");$scope.runFocus();});}else{$scope.runFocus();}}});}};var stop;$scope.runFocus=function(){if(angular.isDefined(stop))return;stop=$interval(function(){var dummyEl=document.getElementById('searchCode');var isFocused=(document.activeElement===dummyEl);if(!isFocused) $('#searchCode').focus();},5000);};$scope.runFocus();$scope.stopFOcus=function(){if(angular.isDefined(stop)){$interval.cancel(stop);stop=undefined;}};$scope.$on('$destroy',function(){$scope.stopFOcus();});}]);})();(function(){'use strict';angular.module('appPrincipal').controller('pv-arqueopv',['$scope','Manager','userService',function($scope,Manager,userService){Manager.postR('punto','getid',{},userService.CurrentUserData.data.codsucursalorigen).then(function(d){$scope.PUNTO=d.data;},function(errResponse){});Manager.postR('informes','arqueodiarioubicacion',{}).then(function(d){$scope.ARQUEO=d.data;$scope.totalventa=_.reduce(_.filter(d.data,function(i){return i.mediopago!=='PAGA DESPUES';}),function(memo,num){return memo+num.total*1;},0);$scope.totalventaPD=_.reduce(_.filter(d.data,function(i){return i.mediopago==='PAGA DESPUES';}),function(memo,num){return memo+num.total*1;},0);$scope.$emit("UNLOAD");},function(errResponse){LOG(errResponse);$scope.$emit("UNLOAD");});}]);})(); (function(){'use strict';angular.module('appPrincipal').controller('Hpunto',['$scope','Manager','close','ModalService',function($scope,Manager,close,ModalService){$scope.close=function(){close(true,200);};$scope.LISTA_TABLA=function(){Manager.postR('punto','getall',{}).then(function(d){$scope.filas=d.data;},function(errResponse){});};$scope.LISTA_TABLA();$scope.openEdit=function(id,modo){var html='punto/add.html';var controller='Apunto';if(modo==='U'){html='punto/add.html';controller='Upunto';} ModalService.showModal({templateUrl:'app_partials/'+html,controller:controller,inputs:{id:id},preClose:(modal)=>{modal.element.modal('hide');}}).then(function(modal){modal.element.modal();modal.close.then(function(result){$scope.LISTA_TABLA();});});};$scope.Baja=function(item){bootbox.confirm({message:"Esta"+(item.estado!=='V'?' Activando ':' Desactivando ')+"el registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");Manager.postR('punto','updateestado',item,item.idclientes).then(function(){$scope.LISTA_TABLA();$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Apunto',['$scope','Manager','close',function($scope,Manager,close){$scope.modo_panatalla="NEW";$scope.$emit("LOAD");$scope.close=function(){close(true,200);};$scope.estado_ejecucion=false;$scope.guardar=function(){var MODELO=cloneJson($scope.modelo);bootbox.confirm({message:"Agregará un registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;Manager.postR('punto','add',MODELO).then(function(d){$scope.close();},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();(function(){'use strict';angular.module('appPrincipal').controller('Upunto',['$scope','Manager','close','id',function($scope,Manager,close,id){$scope.modo_panatalla="EDIT";$scope.close=function(){close(true,200);};$scope.$emit("LOAD");Manager.postR('punto','getid',{},id).then(function(d){$scope.modelo=d.data;$scope.$emit("UNLOAD");},function(errResponse){$scope.$emit("UNLOAD");});$scope.estado_ejecucion=false;$scope.guardar=function(){bootbox.confirm({message:"Actualizará registro, ¿desea continuar?",buttons:{confirm:{label:'Aceptar',className:'btn-primary'},cancel:{label:'Cancelar',className:'btn-default'}},callback:function(result){if(result===true){$scope.$emit("LOAD");$scope.estado_ejecucion=true;var MODELO=cloneJson($scope.modelo);Manager.postR('punto','update',MODELO,id).then(function(d){$scope.close(true,200);},function(errResponse){$scope.$emit("UNLOAD");$scope.estado_ejecucion=false;});}}});};}]);})();