Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. (function(){/*!
  3.  * FooTable - Awesome Responsive Tables
  4.  * Version : 2.0.3
  5.  * http://fooplugins.com/plugins/footable-jquery/
  6.  *
  7.  * Requires jQuery - http://jquery.com/
  8.  *
  9.  * Copyright 2014 Steven Usher & Brad Vincent
  10.  * Released under the MIT license
  11.  * You are free to use FooTable in commercial projects as long as this copyright header is left intact.
  12.  *
  13.  * Date: 11 Nov 2014
  14.  */
  15. (function(e,t){function a(){var e=this;e.id=null,e.busy=!1,e.start=function(t,a){e.busy||(e.stop(),e.id=setTimeout(function(){t(),e.id=null,e.busy=!1},a),e.busy=!0)},e.stop=function(){null!==e.id&&(clearTimeout(e.id),e.id=null,e.busy=!1)}}function i(i,o,n){var r=this;r.id=n,r.table=i,r.options=o,r.breakpoints=[],r.breakpointNames="",r.columns={},r.plugins=t.footable.plugins.load(r);var l=r.options,d=l.classes,s=l.events,u=l.triggers,f=0;return r.timers={resize:new a,register:function(e){return r.timers[e]=new a,r.timers[e]}},r.init=function(){var a=e(t),i=e(r.table);if(t.footable.plugins.init(r),i.hasClass(d.loaded))return r.raise(s.alreadyInitialized),undefined;r.raise(s.initializing),i.addClass(d.loading),i.find(l.columnDataSelector).each(function(){var e=r.getColumnData(this);r.columns[e.index]=e});for(var o in l.breakpoints)r.breakpoints.push({name:o,width:l.breakpoints[o]}),r.breakpointNames+=o+" ";r.breakpoints.sort(function(e,t){return e.width-t.width}),i.unbind(u.initialize).bind(u.initialize,function(){i.removeData("footable_info"),i.data("breakpoint",""),i.trigger(u.resize),i.removeClass(d.loading),i.addClass(d.loaded).addClass(d.main),r.raise(s.initialized)}).unbind(u.redraw).bind(u.redraw,function(){r.redraw()}).unbind(u.resize).bind(u.resize,function(){r.resize()}).unbind(u.expandFirstRow).bind(u.expandFirstRow,function(){i.find(l.toggleSelector).first().not("."+d.detailShow).trigger(u.toggleRow)}).unbind(u.expandAll).bind(u.expandAll,function(){i.find(l.toggleSelector).not("."+d.detailShow).trigger(u.toggleRow)}).unbind(u.collapseAll).bind(u.collapseAll,function(){i.find("."+d.detailShow).trigger(u.toggleRow)}),i.trigger(u.initialize),a.bind("resize.footable",function(){r.timers.resize.stop(),r.timers.resize.start(function(){r.raise(u.resize)},l.delay)})},r.addRowToggle=function(){if(l.addRowToggle){var t=e(r.table),a=!1;t.find("span."+d.toggle).remove();for(var i in r.columns){var o=r.columns[i];if(o.toggle){a=!0;var n="> tbody > tr:not(."+d.detail+",."+d.disabled+") > td:nth-child("+(parseInt(o.index,10)+1)+"),"+"> tbody > tr:not(."+d.detail+",."+d.disabled+") > th:nth-child("+(parseInt(o.index,10)+1)+")";return t.find(n).not("."+d.detailCell).prepend(e(l.toggleHTMLElement).addClass(d.toggle)),undefined}}a||t.find("> tbody > tr:not(."+d.detail+",."+d.disabled+") > td:first-child").add("> tbody > tr:not(."+d.detail+",."+d.disabled+") > th:first-child").not("."+d.detailCell).prepend(e(l.toggleHTMLElement).addClass(d.toggle))}},r.setColumnClasses=function(){var t=e(r.table);for(var a in r.columns){var i=r.columns[a];if(null!==i.className){var o="",n=!0;e.each(i.matches,function(e,t){n||(o+=", "),o+="> tbody > tr:not(."+d.detail+") > td:nth-child("+(parseInt(t,10)+1)+")",n=!1}),t.find(o).not("."+d.detailCell).addClass(i.className)}}},r.bindToggleSelectors=function(){var t=e(r.table);r.hasAnyBreakpointColumn()&&(t.find(l.toggleSelector).unbind(u.toggleRow).bind(u.toggleRow,function(){var t=e(this).is("tr")?e(this):e(this).parents("tr:first");r.toggleDetail(t)}),t.find(l.toggleSelector).unbind("click.footable").bind("click.footable",function(a){t.is(".breakpoint")&&e(a.target).is("td,th,."+d.toggle)&&e(this).trigger(u.toggleRow)}))},r.parse=function(e,t){var a=l.parsers[t.type]||l.parsers.alpha;return a(e)},r.getColumnData=function(t){var a=e(t),i=a.data("hide"),o=a.index();i=i||"",i=jQuery.map(i.split(","),function(e){return jQuery.trim(e)});var n={index:o,hide:{},type:a.data("type")||"alpha",name:a.data("name")||e.trim(a.text()),ignore:a.data("ignore")||!1,toggle:a.data("toggle")||!1,className:a.data("class")||null,matches:[],names:{},group:a.data("group")||null,groupName:null,isEditable:a.data("editable")};if(null!==n.group){var d=e(r.table).find('> thead > tr.footable-group-row > th[data-group="'+n.group+'"], > thead > tr.footable-group-row > td[data-group="'+n.group+'"]').first();n.groupName=r.parse(d,{type:"alpha"})}var u=parseInt(a.prev().attr("colspan")||0,10);f+=u>1?u-1:0;var p=parseInt(a.attr("colspan")||0,10),c=n.index+f;if(p>1){var b=a.data("names");b=b||"",b=b.split(",");for(var g=0;p>g;g++)n.matches.push(g+c),b.length>g&&(n.names[g+c]=b[g])}else n.matches.push(c);n.hide["default"]="all"===a.data("hide")||e.inArray("default",i)>=0;var h=!1;for(var m in l.breakpoints)n.hide[m]="all"===a.data("hide")||e.inArray(m,i)>=0,h=h||n.hide[m];n.hasBreakpoint=h;var v=r.raise(s.columnData,{column:{data:n,th:t}});return v.column.data},r.getViewportWidth=function(){return window.innerWidth||(document.body?document.body.offsetWidth:0)},r.calculateWidth=function(e,t){return jQuery.isFunction(l.calculateWidthOverride)?l.calculateWidthOverride(e,t):(t.viewportWidth<t.width&&(t.width=t.viewportWidth),t.parentWidth<t.width&&(t.width=t.parentWidth),t)},r.hasBreakpointColumn=function(e){for(var t in r.columns)if(r.columns[t].hide[e]){if(r.columns[t].ignore)continue;return!0}return!1},r.hasAnyBreakpointColumn=function(){for(var e in r.columns)if(r.columns[e].hasBreakpoint)return!0;return!1},r.resize=function(){var t=e(r.table);if(t.is(":visible")){if(!r.hasAnyBreakpointColumn())return t.trigger(u.redraw),undefined;var a={width:t.width(),viewportWidth:r.getViewportWidth(),parentWidth:t.parent().width()};a=r.calculateWidth(t,a);var i=t.data("footable_info");if(t.data("footable_info",a),r.raise(s.resizing,{old:i,info:a}),!i||i&&i.width&&i.width!==a.width){for(var o,n=null,l=0;r.breakpoints.length>l;l++)if(o=r.breakpoints[l],o&&o.width&&a.width<=o.width){n=o;break}var d=null===n?"default":n.name,f=r.hasBreakpointColumn(d),p=t.data("breakpoint");t.data("breakpoint",d).removeClass("default breakpoint").removeClass(r.breakpointNames).addClass(d+(f?" breakpoint":"")),d!==p&&(t.trigger(u.redraw),r.raise(s.breakpoint,{breakpoint:d,info:a}))}r.raise(s.resized,{old:i,info:a})}},r.redraw=function(){r.addRowToggle(),r.bindToggleSelectors(),r.setColumnClasses();var t=e(r.table),a=t.data("breakpoint"),i=r.hasBreakpointColumn(a);t.find("> tbody > tr:not(."+d.detail+")").data("detail_created",!1).end().find("> thead > tr:last-child > th").each(function(){var i=r.columns[e(this).index()],o="",n=!0;e.each(i.matches,function(e,t){n||(o+=", ");var a=t+1;o+="> tbody > tr:not(."+d.detail+") > td:nth-child("+a+")",o+=", > tfoot > tr:not(."+d.detail+") > td:nth-child("+a+")",o+=", > colgroup > col:nth-child("+a+")",n=!1}),o+=', > thead > tr[data-group-row="true"] > th[data-group="'+i.group+'"]';var l=t.find(o).add(this);if(""!==a&&(i.hide[a]===!1?l.addClass("footable-visible").show():l.removeClass("footable-visible").hide()),1===t.find("> thead > tr.footable-group-row").length){var s=t.find('> thead > tr:last-child > th[data-group="'+i.group+'"]:visible, > thead > tr:last-child > th[data-group="'+i.group+'"]:visible'),u=t.find('> thead > tr.footable-group-row > th[data-group="'+i.group+'"], > thead > tr.footable-group-row > td[data-group="'+i.group+'"]'),f=0;e.each(s,function(){f+=parseInt(e(this).attr("colspan")||1,10)}),f>0?u.attr("colspan",f).show():u.hide()}}).end().find("> tbody > tr."+d.detailShow).each(function(){r.createOrUpdateDetailRow(this)}),t.find("[data-bind-name]").each(function(){r.toggleInput(this)}),t.find("> tbody > tr."+d.detailShow+":visible").each(function(){var t=e(this).next();t.hasClass(d.detail)&&(i?t.show():t.hide())}),t.find("> thead > tr > th.footable-last-column, > tbody > tr > td.footable-last-column").removeClass("footable-last-column"),t.find("> thead > tr > th.footable-first-column, > tbody > tr > td.footable-first-column").removeClass("footable-first-column"),t.find("> thead > tr, > tbody > tr").find("> th.footable-visible:last, > td.footable-visible:last").addClass("footable-last-column").end().find("> th.footable-visible:first, > td.footable-visible:first").addClass("footable-first-column"),r.raise(s.redrawn)},r.toggleDetail=function(t){var a=t.jquery?t:e(t),i=a.next();a.hasClass(d.detailShow)?(a.removeClass(d.detailShow),i.hasClass(d.detail)&&i.hide(),r.raise(s.rowCollapsed,{row:a[0]})):(r.createOrUpdateDetailRow(a[0]),a.addClass(d.detailShow).next().show(),r.raise(s.rowExpanded,{row:a[0]}))},r.removeRow=function(t){var a=t.jquery?t:e(t);a.hasClass(d.detail)&&(a=a.prev());var i=a.next();a.data("detail_created")===!0&&i.remove(),a.remove(),r.raise(s.rowRemoved)},r.appendRow=function(t){var a=t.jquery?t:e(t);e(r.table).find("tbody").append(a),r.redraw()},r.getColumnFromTdIndex=function(t){var a=null;for(var i in r.columns)if(e.inArray(t,r.columns[i].matches)>=0){a=r.columns[i];break}return a},r.createOrUpdateDetailRow=function(t){var a,i=e(t),o=i.next(),n=[];if(i.data("detail_created")===!0)return!0;if(i.is(":hidden"))return!1;if(r.raise(s.rowDetailUpdating,{row:i,detail:o}),i.find("> td:hidden").each(function(){var t=e(this).index(),a=r.getColumnFromTdIndex(t),i=a.name;if(a.ignore===!0)return!0;t in a.names&&(i=a.names[t]);var o=e(this).attr("data-bind-name");if(null!=o&&e(this).is(":empty")){var l=e("."+d.detailInnerValue+"["+'data-bind-value="'+o+'"]');e(this).html(e(l).contents().detach())}var s;return a.isEditable!==!1&&(a.isEditable||e(this).find(":input").length>0)&&(null==o&&(o="bind-"+e.now()+"-"+t,e(this).attr("data-bind-name",o)),s=e(this).contents().detach()),s||(s=e(this).contents().clone(!0,!0)),n.push({name:i,value:r.parse(this,a),display:s,group:a.group,groupName:a.groupName,bindName:o}),!0}),0===n.length)return!1;var u=i.find("> td:visible").length,f=o.hasClass(d.detail);return f||(o=e('<tr class="'+d.detail+'"><td class="'+d.detailCell+'"><div class="'+d.detailInner+'"></div></td></tr>'),i.after(o)),o.find("> td:first").attr("colspan",u),a=o.find("."+d.detailInner).empty(),l.createDetail(a,n,l.createGroupedDetail,l.detailSeparator,d),i.data("detail_created",!0),r.raise(s.rowDetailUpdated,{row:i,detail:o}),!f},r.raise=function(t,a){r.options.debug===!0&&e.isFunction(r.options.log)&&r.options.log(t,"event"),a=a||{};var i={ft:r};e.extend(!0,i,a);var o=e.Event(t,i);return o.ft||e.extend(!0,o,i),e(r.table).trigger(o),o},r.reset=function(){var t=e(r.table);t.removeData("footable_info").data("breakpoint","").removeClass(d.loading).removeClass(d.loaded),t.find(l.toggleSelector).unbind(u.toggleRow).unbind("click.footable"),t.find("> tbody > tr").removeClass(d.detailShow),t.find("> tbody > tr."+d.detail).remove(),r.raise(s.reset)},r.toggleInput=function(t){var a=e(t).attr("data-bind-name");if(null!=a){var i=e("."+d.detailInnerValue+"["+'data-bind-value="'+a+'"]');null!=i&&(e(t).is(":visible")?e(i).is(":empty")||e(t).html(e(i).contents().detach()):e(t).is(":empty")||e(i).html(e(t).contents().detach()))}},r.init(),r}t.footable={options:{delay:100,breakpoints:{phone:480,tablet:1024},parsers:{alpha:function(t){return e(t).data("value")||e.trim(e(t).text())},numeric:function(t){var a=e(t).data("value")||e(t).text().replace(/[^0-9.\-]/g,"");return a=parseFloat(a),isNaN(a)&&(a=0),a}},addRowToggle:!0,calculateWidthOverride:null,toggleSelector:" > tbody > tr:not(.footable-row-detail)",columnDataSelector:"> thead > tr:last-child > th, > thead > tr:last-child > td",detailSeparator:":",toggleHTMLElement:"<span />",createGroupedDetail:function(e){for(var t={_none:{name:null,data:[]}},a=0;e.length>a;a++){var i=e[a].group;null!==i?(i in t||(t[i]={name:e[a].groupName||e[a].group,data:[]}),t[i].data.push(e[a])):t._none.data.push(e[a])}return t},createDetail:function(t,a,i,o,n){var r=i(a);for(var l in r)if(0!==r[l].data.length){"_none"!==l&&t.append('<div class="'+n.detailInnerGroup+'">'+r[l].name+"</div>");for(var d=0;r[l].data.length>d;d++){var s=r[l].data[d].name?o:"";t.append(e("<div></div>").addClass(n.detailInnerRow).append(e("<div></div>").addClass(n.detailInnerName).append(r[l].data[d].name+s)).append(e("<div></div>").addClass(n.detailInnerValue).attr("data-bind-value",r[l].data[d].bindName).append(r[l].data[d].display)))}}},classes:{main:"footable",loading:"footable-loading",loaded:"footable-loaded",toggle:"footable-toggle",disabled:"footable-disabled",detail:"footable-row-detail",detailCell:"footable-row-detail-cell",detailInner:"footable-row-detail-inner",detailInnerRow:"footable-row-detail-row",detailInnerGroup:"footable-row-detail-group",detailInnerName:"footable-row-detail-name",detailInnerValue:"footable-row-detail-value",detailShow:"footable-detail-show"},triggers:{initialize:"footable_initialize",resize:"footable_resize",redraw:"footable_redraw",toggleRow:"footable_toggle_row",expandFirstRow:"footable_expand_first_row",expandAll:"footable_expand_all",collapseAll:"footable_collapse_all"},events:{alreadyInitialized:"footable_already_initialized",initializing:"footable_initializing",initialized:"footable_initialized",resizing:"footable_resizing",resized:"footable_resized",redrawn:"footable_redrawn",breakpoint:"footable_breakpoint",columnData:"footable_column_data",rowDetailUpdating:"footable_row_detail_updating",rowDetailUpdated:"footable_row_detail_updated",rowCollapsed:"footable_row_collapsed",rowExpanded:"footable_row_expanded",rowRemoved:"footable_row_removed",reset:"footable_reset"},debug:!1,log:null},version:{major:0,minor:5,toString:function(){return t.footable.version.major+"."+t.footable.version.minor},parse:function(e){var t=/(\d+)\.?(\d+)?\.?(\d+)?/.exec(e);return{major:parseInt(t[1],10)||0,minor:parseInt(t[2],10)||0,patch:parseInt(t[3],10)||0}}},plugins:{_validate:function(a){if(!e.isFunction(a))return t.footable.options.debug===!0&&console.error('Validation failed, expected type "function", received type "{0}".',typeof a),!1;var i=new a;return"string"!=typeof i.name?(t.footable.options.debug===!0&&console.error('Validation failed, plugin does not implement a string property called "name".',i),!1):e.isFunction(i.init)?(t.footable.options.debug===!0&&console.log('Validation succeeded for plugin "'+i.name+'".',i),!0):(t.footable.options.debug===!0&&console.error('Validation failed, plugin "'+i.name+'" does not implement a function called "init".',i),!1)},registered:[],register:function(a,i){t.footable.plugins._validate(a)&&(t.footable.plugins.registered.push(a),"object"==typeof i&&e.extend(!0,t.footable.options,i))},load:function(e){var a,i,o=[];for(i=0;t.footable.plugins.registered.length>i;i++)try{a=t.footable.plugins.registered[i],o.push(new a(e))}catch(n){t.footable.options.debug===!0&&console.error(n)}return o},init:function(e){for(var a=0;e.plugins.length>a;a++)try{e.plugins[a].init(e)}catch(i){t.footable.options.debug===!0&&console.error(i)}}}};var o=0;e.fn.footable=function(a){a=a||{};var n=e.extend(!0,{},t.footable.options,a);return this.each(function(){o++;var t=new i(this,n,o);e(this).data("footable",t)})}})(jQuery,window);})();
  16. (function(){(function(t,e,undefined){function a(){var e=this;e.name="Footable Sortable",e.init=function(a){e.footable=a,a.options.sort===!0&&t(a.table).unbind(".sorting").bind({"footable_initialized.sorting":function(){var i,o,n=t(a.table),r=(n.find("> tbody"),a.options.classes.sort);if(n.data("sort")!==!1){n.find("> thead > tr:last-child > th, > thead > tr:last-child > td").each(function(){var e=t(this),i=a.columns[e.index()];i.sort.ignore===!0||e.hasClass(r.sortable)||(e.addClass(r.sortable),t("<span />").addClass(r.indicator).appendTo(e))}),n.find("> thead > tr:last-child > th."+r.sortable+", > thead > tr:last-child > td."+r.sortable).unbind("click.footable").bind("click.footable",function(a){a.preventDefault(),o=t(this);var i=!o.hasClass(r.sorted);return e.doSort(o.index(),i),!1});var l=!1;for(var s in a.columns)if(i=a.columns[s],i.sort.initial){var d="descending"!==i.sort.initial;e.doSort(i.index,d);break}l&&a.bindToggleSelectors()}},"footable_redrawn.sorting":function(){var i=t(a.table),o=a.options.classes.sort;i.data("sorted")>=0&&i.find("> thead > tr:last-child > th").each(function(a){var i=t(this);return i.hasClass(o.sorted)||i.hasClass(o.descending)?(e.doSort(a),undefined):undefined})},"footable_column_data.sorting":function(e){var a=t(e.column.th);e.column.data.sort=e.column.data.sort||{},e.column.data.sort.initial=a.data("sort-initial")||!1,e.column.data.sort.ignore=a.data("sort-ignore")||!1,e.column.data.sort.selector=a.data("sort-selector")||null;var i=a.data("sort-match")||0;i>=e.column.data.matches.length&&(i=0),e.column.data.sort.match=e.column.data.matches[i]}}).data("footable-sort",e)},e.doSort=function(a,i){var o=e.footable;if(t(o.table).data("sort")!==!1){var n=t(o.table),r=n.find("> tbody"),l=o.columns[a],s=n.find("> thead > tr:last-child > th:eq("+a+")"),d=o.options.classes.sort,f=o.options.events.sort;if(i=i===undefined?s.hasClass(d.sorted):"toggle"===i?!s.hasClass(d.sorted):i,l.sort.ignore===!0)return!0;var u=o.raise(f.sorting,{column:l,direction:i?"ASC":"DESC"});u&&u.result===!1||(n.data("sorted",l.index),n.find("> thead > tr:last-child > th, > thead > tr:last-child > td").not(s).removeClass(d.sorted+" "+d.descending),i===undefined&&(i=s.hasClass(d.sorted)),i?s.removeClass(d.descending).addClass(d.sorted):s.removeClass(d.sorted).addClass(d.descending),e.sort(o,r,l,i),o.bindToggleSelectors(),o.raise(f.sorted,{column:l,direction:i?"ASC":"DESC"}))}},e.rows=function(e,a,i){var o=[];return a.find("> tr").each(function(){var a=t(this),n=null;if(a.hasClass(e.options.classes.detail))return!0;a.next().hasClass(e.options.classes.detail)&&(n=a.next().get(0));var r={row:a,detail:n};return i!==undefined&&(r.value=e.parse(this.cells[i.sort.match],i)),o.push(r),!0}).detach(),o},e.sort=function(t,a,i,o){var n=e.rows(t,a,i),r=t.options.sorters[i.type]||t.options.sorters.alpha;n.sort(function(t,e){return o?r(t.value,e.value):r(e.value,t.value)});for(var l=0;n.length>l;l++)a.append(n[l].row),null!==n[l].detail&&a.append(n[l].detail)}}if(e.footable===undefined||null===e.footable)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var i={sort:!0,sorters:{alpha:function(t,e){return"string"==typeof t&&(t=t.toLowerCase()),"string"==typeof e&&(e=e.toLowerCase()),t===e?0:e>t?-1:1},numeric:function(t,e){return t-e}},classes:{sort:{sortable:"footable-sortable",sorted:"footable-sorted",descending:"footable-sorted-desc",indicator:"footable-sort-indicator"}},events:{sort:{sorting:"footable_sorting",sorted:"footable_sorted"}}};e.footable.plugins.register(a,i)})(jQuery,window);})();
  17.  
  18.  
  19. (function(){(function(t,e,undefined){function a(){var e=this;e.name="Footable Filter",e.init=function(a){if(e.footable=a,a.options.filter.enabled===!0){if(t(a.table).data("filter")===!1)return;a.timers.register("filter"),t(a.table).unbind(".filtering").bind({"footable_initialized.filtering":function(){var i=t(a.table),o={input:i.data("filter")||a.options.filter.input,timeout:i.data("filter-timeout")||a.options.filter.timeout,minimum:i.data("filter-minimum")||a.options.filter.minimum,disableEnter:i.data("filter-disable-enter")||a.options.filter.disableEnter};o.disableEnter&&t(o.input).keypress(function(t){return window.event?13!==window.event.keyCode:13!==t.which}),i.bind("footable_clear_filter",function(){t(o.input).val(""),e.clearFilter()}),i.bind("footable_filter",function(t,a){e.filter(a.filter)}),t(o.input).keyup(function(i){a.timers.filter.stop(),27===i.which&&t(o.input).val(""),a.timers.filter.start(function(){var a=t(o.input).val()||"";e.filter(a)},o.timeout)})},"footable_redrawn.filtering":function(){var i=t(a.table),o=i.data("filter-string");o&&e.filter(o)}}).data("footable-filter",e)}},e.filter=function(a){var i=e.footable,o=t(i.table),n=o.data("filter-minimum")||i.options.filter.minimum,r=!a,l=i.raise("footable_filtering",{filter:a,clear:r});if(!(l&&l.result===!1||l.filter&&n>l.filter.length))if(l.clear)e.clearFilter();else{var d=l.filter.split(" ");o.find("> tbody > tr").hide().addClass("footable-filtered");var s=o.find("> tbody > tr:not(.footable-row-detail)");t.each(d,function(t,e){e&&e.length>0&&(o.data("current-filter",e),s=s.filter(i.options.filter.filterFunction))}),s.each(function(){e.showRow(this,i),t(this).removeClass("footable-filtered")}),o.data("filter-string",l.filter),i.raise("footable_filtered",{filter:l.filter,clear:!1})}},e.clearFilter=function(){var a=e.footable,i=t(a.table);i.find("> tbody > tr:not(.footable-row-detail)").removeClass("footable-filtered").each(function(){e.showRow(this,a)}),i.removeData("filter-string"),a.raise("footable_filtered",{clear:!0})},e.showRow=function(e,a){var i=t(e),o=i.next(),n=t(a.table);i.is(":visible")||(n.hasClass("breakpoint")&&i.hasClass("footable-detail-show")&&o.hasClass("footable-row-detail")?(i.add(o).show(),a.createOrUpdateDetailRow(e)):i.show())}}if(e.footable===undefined||null===e.footable)throw Error("Please check and make sure footable.js is included in the page and is loaded prior to this script.");var i={filter:{enabled:!0,input:".footable-filter",timeout:300,minimum:2,disableEnter:!1,filterFunction:function(){var e=t(this),a=e.parents("table:first"),i=a.data("current-filter").toUpperCase(),o=e.find("td").text();return a.data("filter-text-only")||e.find("td[data-value]").each(function(){o+=t(this).data("value")}),o.toUpperCase().indexOf(i)>=0}}};e.footable.plugins.register(a,i)})(jQuery,window);})();
  20.  
  21. /*!
  22.  * ZeroClipboard
  23.  * The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
  24.  * Copyright (c) 2014 Jon Rohan, James M. Greene
  25.  * Licensed MIT
  26.  * http://zeroclipboard.org/
  27.  * v2.1.6
  28.  */
  29. !function(a,b){"use strict";var c,d,e=a,f=e.document,g=e.navigator,h=e.setTimeout,i=e.encodeURIComponent,j=e.ActiveXObject,k=e.Error,l=e.Number.parseInt||e.parseInt,m=e.Number.parseFloat||e.parseFloat,n=e.Number.isNaN||e.isNaN,o=e.Math.round,p=e.Date.now,q=e.Object.keys,r=e.Object.defineProperty,s=e.Object.prototype.hasOwnProperty,t=e.Array.prototype.slice,u=function(){var a=function(a){return a};if("function"==typeof e.wrap&&"function"==typeof e.unwrap)try{var b=f.createElement("div"),c=e.unwrap(b);1===b.nodeType&&c&&1===c.nodeType&&(a=e.unwrap)}catch(d){}return a}(),v=function(a){return t.call(a,0)},w=function(){var a,c,d,e,f,g,h=v(arguments),i=h[0]||{};for(a=1,c=h.length;c>a;a++)if(null!=(d=h[a]))for(e in d)s.call(d,e)&&(f=i[e],g=d[e],i!==g&&g!==b&&(i[e]=g));return i},x=function(a){var b,c,d,e;if("object"!=typeof a||null==a)b=a;else if("number"==typeof a.length)for(b=[],c=0,d=a.length;d>c;c++)s.call(a,c)&&(b[c]=x(a[c]));else{b={};for(e in a)s.call(a,e)&&(b[e]=x(a[e]))}return b},y=function(a,b){for(var c={},d=0,e=b.length;e>d;d++)b[d]in a&&(c[b[d]]=a[b[d]]);return c},z=function(a,b){var c={};for(var d in a)-1===b.indexOf(d)&&(c[d]=a[d]);return c},A=function(a){if(a)for(var b in a)s.call(a,b)&&delete a[b];return a},B=function(a,b){if(a&&1===a.nodeType&&a.ownerDocument&&b&&(1===b.nodeType&&b.ownerDocument&&b.ownerDocument===a.ownerDocument||9===b.nodeType&&!b.ownerDocument&&b===a.ownerDocument))do{if(a===b)return!0;a=a.parentNode}while(a);return!1},C=function(a){var b;return"string"==typeof a&&a&&(b=a.split("#")[0].split("?")[0],b=a.slice(0,a.lastIndexOf("/")+1)),b},D=function(a){var b,c;return"string"==typeof a&&a&&(c=a.match(/^(?:|[^:@]*@|.+\)@(?=http[s]?|file)|.+?\s+(?: at |@)(?:[^:\(]+ )*[\(]?)((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]?b=c[1]:(c=a.match(/\)@((?:http[s]?|file):\/\/[\/]?.+?\/[^:\)]*?)(?::\d+)(?::\d+)?/),c&&c[1]&&(b=c[1]))),b},E=function(){var a,b;try{throw new k}catch(c){b=c}return b&&(a=b.sourceURL||b.fileName||D(b.stack)),a},F=function(){var a,c,d;if(f.currentScript&&(a=f.currentScript.src))return a;if(c=f.getElementsByTagName("script"),1===c.length)return c[0].src||b;if("readyState"in c[0])for(d=c.length;d--;)if("interactive"===c[d].readyState&&(a=c[d].src))return a;return"loading"===f.readyState&&(a=c[c.length-1].src)?a:(a=E())?a:b},G=function(){var a,c,d,e=f.getElementsByTagName("script");for(a=e.length;a--;){if(!(d=e[a].src)){c=null;break}if(d=C(d),null==c)c=d;else if(c!==d){c=null;break}}return c||b},H=function(){var a=C(F())||G()||"";return a+"ZeroClipboard.swf"},I={bridge:null,version:"0.0.0",pluginType:"unknown",disabled:null,outdated:null,unavailable:null,deactivated:null,overdue:null,ready:null},J="11.0.0",K={},L={},M=null,N={ready:"Flash communication is established",error:{"flash-disabled":"Flash is disabled or not installed","flash-outdated":"Flash is too outdated to support ZeroClipboard","flash-unavailable":"Flash is unable to communicate bidirectionally with JavaScript","flash-deactivated":"Flash is too outdated for your browser and/or is configured as click-to-activate","flash-overdue":"Flash communication was established but NOT within the acceptable time limit"}},O={swfPath:H(),trustedDomains:a.location.host?[a.location.host]:[],cacheBust:!0,forceEnhancedClipboard:!1,flashLoadTimeout:3e4,autoActivate:!0,bubbleEvents:!0,containerId:"global-zeroclipboard-html-bridge",containerClass:"global-zeroclipboard-container",swfObjectId:"global-zeroclipboard-flash-bridge",hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active",forceHandCursor:!1,title:null,zIndex:999999999},P=function(a){if("object"==typeof a&&null!==a)for(var b in a)if(s.call(a,b))if(/^(?:forceHandCursor|title|zIndex|bubbleEvents)$/.test(b))O[b]=a[b];else if(null==I.bridge)if("containerId"===b||"swfObjectId"===b){if(!cb(a[b]))throw new Error("The specified `"+b+"` value is not valid as an HTML4 Element ID");O[b]=a[b]}else O[b]=a[b];{if("string"!=typeof a||!a)return x(O);if(s.call(O,a))return O[a]}},Q=function(){return{browser:y(g,["userAgent","platform","appName"]),flash:z(I,["bridge"]),zeroclipboard:{version:Fb.version,config:Fb.config()}}},R=function(){return!!(I.disabled||I.outdated||I.unavailable||I.deactivated)},S=function(a,b){var c,d,e,f={};if("string"==typeof a&&a)e=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&Fb.on(c,a[c]);if(e&&e.length){for(c=0,d=e.length;d>c;c++)a=e[c].replace(/^on/,""),f[a]=!0,K[a]||(K[a]=[]),K[a].push(b);if(f.ready&&I.ready&&Fb.emit({type:"ready"}),f.error){var g=["disabled","outdated","unavailable","deactivated","overdue"];for(c=0,d=g.length;d>c;c++)if(I[g[c]]===!0){Fb.emit({type:"error",name:"flash-"+g[c]});break}}}return Fb},T=function(a,b){var c,d,e,f,g;if(0===arguments.length)f=q(K);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&Fb.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=K[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return Fb},U=function(a){var b;return b="string"==typeof a&&a?x(K[a])||null:x(K)},V=function(a){var b,c,d;return a=db(a),a&&!jb(a)?"ready"===a.type&&I.overdue===!0?Fb.emit({type:"error",name:"flash-overdue"}):(b=w({},a),ib.call(this,b),"copy"===a.type&&(d=pb(L),c=d.data,M=d.formatMap),c):void 0},W=function(){if("boolean"!=typeof I.ready&&(I.ready=!1),!Fb.isFlashUnusable()&&null===I.bridge){var a=O.flashLoadTimeout;"number"==typeof a&&a>=0&&h(function(){"boolean"!=typeof I.deactivated&&(I.deactivated=!0),I.deactivated===!0&&Fb.emit({type:"error",name:"flash-deactivated"})},a),I.overdue=!1,nb()}},X=function(){Fb.clearData(),Fb.blur(),Fb.emit("destroy"),ob(),Fb.off()},Y=function(a,b){var c;if("object"==typeof a&&a&&"undefined"==typeof b)c=a,Fb.clearData();else{if("string"!=typeof a||!a)return;c={},c[a]=b}for(var d in c)"string"==typeof d&&d&&s.call(c,d)&&"string"==typeof c[d]&&c[d]&&(L[d]=c[d])},Z=function(a){"undefined"==typeof a?(A(L),M=null):"string"==typeof a&&s.call(L,a)&&delete L[a]},$=function(a){return"undefined"==typeof a?x(L):"string"==typeof a&&s.call(L,a)?L[a]:void 0},_=function(a){if(a&&1===a.nodeType){c&&(xb(c,O.activeClass),c!==a&&xb(c,O.hoverClass)),c=a,wb(a,O.hoverClass);var b=a.getAttribute("title")||O.title;if("string"==typeof b&&b){var d=mb(I.bridge);d&&d.setAttribute("title",b)}var e=O.forceHandCursor===!0||"pointer"===yb(a,"cursor");Cb(e),Bb()}},ab=function(){var a=mb(I.bridge);a&&(a.removeAttribute("title"),a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.top="1px"),c&&(xb(c,O.hoverClass),xb(c,O.activeClass),c=null)},bb=function(){return c||null},cb=function(a){return"string"==typeof a&&a&&/^[A-Za-z][A-Za-z0-9_:\-\.]*$/.test(a)},db=function(a){var b;if("string"==typeof a&&a?(b=a,a={}):"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(b=a.type),b){!a.target&&/^(copy|aftercopy|_click)$/.test(b.toLowerCase())&&(a.target=d),w(a,{type:b.toLowerCase(),target:a.target||c||null,relatedTarget:a.relatedTarget||null,currentTarget:I&&I.bridge||null,timeStamp:a.timeStamp||p()||null});var e=N[a.type];return"error"===a.type&&a.name&&e&&(e=e[a.name]),e&&(a.message=e),"ready"===a.type&&w(a,{target:null,version:I.version}),"error"===a.type&&(/^flash-(disabled|outdated|unavailable|deactivated|overdue)$/.test(a.name)&&w(a,{target:null,minimumVersion:J}),/^flash-(outdated|unavailable|deactivated|overdue)$/.test(a.name)&&w(a,{version:I.version})),"copy"===a.type&&(a.clipboardData={setData:Fb.setData,clearData:Fb.clearData}),"aftercopy"===a.type&&(a=qb(a,M)),a.target&&!a.relatedTarget&&(a.relatedTarget=eb(a.target)),a=fb(a)}},eb=function(a){var b=a&&a.getAttribute&&a.getAttribute("data-clipboard-target");return b?f.getElementById(b):null},fb=function(a){if(a&&/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)){var c=a.target,d="_mouseover"===a.type&&a.relatedTarget?a.relatedTarget:b,g="_mouseout"===a.type&&a.relatedTarget?a.relatedTarget:b,h=Ab(c),i=e.screenLeft||e.screenX||0,j=e.screenTop||e.screenY||0,k=f.body.scrollLeft+f.documentElement.scrollLeft,l=f.body.scrollTop+f.documentElement.scrollTop,m=h.left+("number"==typeof a._stageX?a._stageX:0),n=h.top+("number"==typeof a._stageY?a._stageY:0),o=m-k,p=n-l,q=i+o,r=j+p,s="number"==typeof a.movementX?a.movementX:0,t="number"==typeof a.movementY?a.movementY:0;delete a._stageX,delete a._stageY,w(a,{srcElement:c,fromElement:d,toElement:g,screenX:q,screenY:r,pageX:m,pageY:n,clientX:o,clientY:p,x:o,y:p,movementX:s,movementY:t,offsetX:0,offsetY:0,layerX:0,layerY:0})}return a},gb=function(a){var b=a&&"string"==typeof a.type&&a.type||"";return!/^(?:(?:before)?copy|destroy)$/.test(b)},hb=function(a,b,c,d){d?h(function(){a.apply(b,c)},0):a.apply(b,c)},ib=function(a){if("object"==typeof a&&a&&a.type){var b=gb(a),c=K["*"]||[],d=K[a.type]||[],f=c.concat(d);if(f&&f.length){var g,h,i,j,k,l=this;for(g=0,h=f.length;h>g;g++)i=f[g],j=l,"string"==typeof i&&"function"==typeof e[i]&&(i=e[i]),"object"==typeof i&&i&&"function"==typeof i.handleEvent&&(j=i,i=i.handleEvent),"function"==typeof i&&(k=w({},a),hb(i,j,[k],b))}return this}},jb=function(a){var b=a.target||c||null,e="swf"===a._source;delete a._source;var f=["flash-disabled","flash-outdated","flash-unavailable","flash-deactivated","flash-overdue"];switch(a.type){case"error":-1!==f.indexOf(a.name)&&w(I,{disabled:"flash-disabled"===a.name,outdated:"flash-outdated"===a.name,unavailable:"flash-unavailable"===a.name,deactivated:"flash-deactivated"===a.name,overdue:"flash-overdue"===a.name,ready:!1});break;case"ready":var g=I.deactivated===!0;w(I,{disabled:!1,outdated:!1,unavailable:!1,deactivated:!1,overdue:g,ready:!g});break;case"beforecopy":d=b;break;case"copy":var h,i,j=a.relatedTarget;!L["text/html"]&&!L["text/plain"]&&j&&(i=j.value||j.outerHTML||j.innerHTML)&&(h=j.value||j.textContent||j.innerText)?(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",h),i!==h&&a.clipboardData.setData("text/html",i)):!L["text/plain"]&&a.target&&(h=a.target.getAttribute("data-clipboard-text"))&&(a.clipboardData.clearData(),a.clipboardData.setData("text/plain",h));break;case"aftercopy":Fb.clearData(),b&&b!==vb()&&b.focus&&b.focus();break;case"_mouseover":Fb.focus(b),O.bubbleEvents===!0&&e&&(b&&b!==a.relatedTarget&&!B(a.relatedTarget,b)&&kb(w({},a,{type:"mouseenter",bubbles:!1,cancelable:!1})),kb(w({},a,{type:"mouseover"})));break;case"_mouseout":Fb.blur(),O.bubbleEvents===!0&&e&&(b&&b!==a.relatedTarget&&!B(a.relatedTarget,b)&&kb(w({},a,{type:"mouseleave",bubbles:!1,cancelable:!1})),kb(w({},a,{type:"mouseout"})));break;case"_mousedown":wb(b,O.activeClass),O.bubbleEvents===!0&&e&&kb(w({},a,{type:a.type.slice(1)}));break;case"_mouseup":xb(b,O.activeClass),O.bubbleEvents===!0&&e&&kb(w({},a,{type:a.type.slice(1)}));break;case"_click":d=null,O.bubbleEvents===!0&&e&&kb(w({},a,{type:a.type.slice(1)}));break;case"_mousemove":O.bubbleEvents===!0&&e&&kb(w({},a,{type:a.type.slice(1)}))}return/^_(?:click|mouse(?:over|out|down|up|move))$/.test(a.type)?!0:void 0},kb=function(a){if(a&&"string"==typeof a.type&&a){var b,c=a.target||null,d=c&&c.ownerDocument||f,g={view:d.defaultView||e,canBubble:!0,cancelable:!0,detail:"click"===a.type?1:0,button:"number"==typeof a.which?a.which-1:"number"==typeof a.button?a.button:d.createEvent?0:1},h=w(g,a);c&&d.createEvent&&c.dispatchEvent&&(h=[h.type,h.canBubble,h.cancelable,h.view,h.detail,h.screenX,h.screenY,h.clientX,h.clientY,h.ctrlKey,h.altKey,h.shiftKey,h.metaKey,h.button,h.relatedTarget],b=d.createEvent("MouseEvents"),b.initMouseEvent&&(b.initMouseEvent.apply(b,h),b._source="js",c.dispatchEvent(b)))}},lb=function(){var a=f.createElement("div");return a.id=O.containerId,a.className=O.containerClass,a.style.position="absolute",a.style.left="0px",a.style.top="-9999px",a.style.width="1px",a.style.height="1px",a.style.zIndex=""+Db(O.zIndex),a},mb=function(a){for(var b=a&&a.parentNode;b&&"OBJECT"===b.nodeName&&b.parentNode;)b=b.parentNode;return b||null},nb=function(){var a,b=I.bridge,c=mb(b);if(!b){var d=ub(e.location.host,O),g="never"===d?"none":"all",h=sb(O),i=O.swfPath+rb(O.swfPath,O);c=lb();var j=f.createElement("div");c.appendChild(j),f.body.appendChild(c);var k=f.createElement("div"),l="activex"===I.pluginType;k.innerHTML='<object id="'+O.swfObjectId+'" name="'+O.swfObjectId+'" width="100%" height="100%" '+(l?'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"':'type="application/x-shockwave-flash" data="'+i+'"')+">"+(l?'<param name="movie" value="'+i+'"/>':"")+'<param name="allowScriptAccess" value="'+d+'"/><param name="allowNetworking" value="'+g+'"/><param name="menu" value="false"/><param name="wmode" value="transparent"/><param name="flashvars" value="'+h+'"/></object>',b=k.firstChild,k=null,u(b).ZeroClipboard=Fb,c.replaceChild(b,j)}return b||(b=f[O.swfObjectId],b&&(a=b.length)&&(b=b[a-1]),!b&&c&&(b=c.firstChild)),I.bridge=b||null,b},ob=function(){var a=I.bridge;if(a){var b=mb(a);b&&("activex"===I.pluginType&&"readyState"in a?(a.style.display="none",function c(){if(4===a.readyState){for(var d in a)"function"==typeof a[d]&&(a[d]=null);a.parentNode&&a.parentNode.removeChild(a),b.parentNode&&b.parentNode.removeChild(b)}else h(c,10)}()):(a.parentNode&&a.parentNode.removeChild(a),b.parentNode&&b.parentNode.removeChild(b))),I.ready=null,I.bridge=null,I.deactivated=null}},pb=function(a){var b={},c={};if("object"==typeof a&&a){for(var d in a)if(d&&s.call(a,d)&&"string"==typeof a[d]&&a[d])switch(d.toLowerCase()){case"text/plain":case"text":case"air:text":case"flash:text":b.text=a[d],c.text=d;break;case"text/html":case"html":case"air:html":case"flash:html":b.html=a[d],c.html=d;break;case"application/rtf":case"text/rtf":case"rtf":case"richtext":case"air:rtf":case"flash:rtf":b.rtf=a[d],c.rtf=d}return{data:b,formatMap:c}}},qb=function(a,b){if("object"!=typeof a||!a||"object"!=typeof b||!b)return a;var c={};for(var d in a)if(s.call(a,d)){if("success"!==d&&"data"!==d){c[d]=a[d];continue}c[d]={};var e=a[d];for(var f in e)f&&s.call(e,f)&&s.call(b,f)&&(c[d][b[f]]=e[f])}return c},rb=function(a,b){var c=null==b||b&&b.cacheBust===!0;return c?(-1===a.indexOf("?")?"?":"&")+"noCache="+p():""},sb=function(a){var b,c,d,f,g="",h=[];if(a.trustedDomains&&("string"==typeof a.trustedDomains?f=[a.trustedDomains]:"object"==typeof a.trustedDomains&&"length"in a.trustedDomains&&(f=a.trustedDomains)),f&&f.length)for(b=0,c=f.length;c>b;b++)if(s.call(f,b)&&f[b]&&"string"==typeof f[b]){if(d=tb(f[b]),!d)continue;if("*"===d){h.length=0,h.push(d);break}h.push.apply(h,[d,"//"+d,e.location.protocol+"//"+d])}return h.length&&(g+="trustedOrigins="+i(h.join(","))),a.forceEnhancedClipboard===!0&&(g+=(g?"&":"")+"forceEnhancedClipboard=true"),"string"==typeof a.swfObjectId&&a.swfObjectId&&(g+=(g?"&":"")+"swfObjectId="+i(a.swfObjectId)),g},tb=function(a){if(null==a||""===a)return null;if(a=a.replace(/^\s+|\s+$/g,""),""===a)return null;var b=a.indexOf("//");a=-1===b?a:a.slice(b+2);var c=a.indexOf("/");return a=-1===c?a:-1===b||0===c?null:a.slice(0,c),a&&".swf"===a.slice(-4).toLowerCase()?null:a||null},ub=function(){var a=function(a){var b,c,d,e=[];if("string"==typeof a&&(a=[a]),"object"!=typeof a||!a||"number"!=typeof a.length)return e;for(b=0,c=a.length;c>b;b++)if(s.call(a,b)&&(d=tb(a[b]))){if("*"===d){e.length=0,e.push("*");break}-1===e.indexOf(d)&&e.push(d)}return e};return function(b,c){var d=tb(c.swfPath);null===d&&(d=b);var e=a(c.trustedDomains),f=e.length;if(f>0){if(1===f&&"*"===e[0])return"always";if(-1!==e.indexOf(b))return 1===f&&b===d?"sameDomain":"always"}return"never"}}(),vb=function(){try{return f.activeElement}catch(a){return null}},wb=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)||a.classList.add(b),a;if(b&&"string"==typeof b){var c=(b||"").split(/\s+/);if(1===a.nodeType)if(a.className){for(var d=" "+a.className+" ",e=a.className,f=0,g=c.length;g>f;f++)d.indexOf(" "+c[f]+" ")<0&&(e+=" "+c[f]);a.className=e.replace(/^\s+|\s+$/g,"")}else a.className=b}return a},xb=function(a,b){if(!a||1!==a.nodeType)return a;if(a.classList)return a.classList.contains(b)&&a.classList.remove(b),a;if("string"==typeof b&&b){var c=b.split(/\s+/);if(1===a.nodeType&&a.className){for(var d=(" "+a.className+" ").replace(/[\n\t]/g," "),e=0,f=c.length;f>e;e++)d=d.replace(" "+c[e]+" "," ");a.className=d.replace(/^\s+|\s+$/g,"")}}return a},yb=function(a,b){var c=e.getComputedStyle(a,null).getPropertyValue(b);return"cursor"!==b||c&&"auto"!==c||"A"!==a.nodeName?c:"pointer"},zb=function(){var a,b,c,d=1;return"function"==typeof f.body.getBoundingClientRect&&(a=f.body.getBoundingClientRect(),b=a.right-a.left,c=f.body.offsetWidth,d=o(b/c*100)/100),d},Ab=function(a){var b={left:0,top:0,width:0,height:0};if(a.getBoundingClientRect){var c,d,g,h=a.getBoundingClientRect();"pageXOffset"in e&&"pageYOffset"in e?(c=e.pageXOffset,d=e.pageYOffset):(g=zb(),c=o(f.documentElement.scrollLeft/g),d=o(f.documentElement.scrollTop/g));var i=f.documentElement.clientLeft||0,j=f.documentElement.clientTop||0;b.left=h.left+c-i,b.top=h.top+d-j,b.width="width"in h?h.width:h.right-h.left,b.height="height"in h?h.height:h.bottom-h.top}return b},Bb=function(){var a;if(c&&(a=mb(I.bridge))){var b=Ab(c);w(a.style,{width:b.width+"px",height:b.height+"px",top:b.top+"px",left:b.left+"px",zIndex:""+Db(O.zIndex)})}},Cb=function(a){I.ready===!0&&(I.bridge&&"function"==typeof I.bridge.setHandCursor?I.bridge.setHandCursor(a):I.ready=!1)},Db=function(a){if(/^(?:auto|inherit)$/.test(a))return a;var b;return"number"!=typeof a||n(a)?"string"==typeof a&&(b=Db(l(a,10))):b=a,"number"==typeof b?b:"auto"},Eb=function(a){function b(a){var b=a.match(/[\d]+/g);return b.length=3,b.join(".")}function c(a){return!!a&&(a=a.toLowerCase())&&(/^(pepflashplayer\.dll|libpepflashplayer\.so|pepperflashplayer\.plugin)$/.test(a)||"chrome.plugin"===a.slice(-13))}function d(a){a&&(i=!0,a.version&&(l=b(a.version)),!l&&a.description&&(l=b(a.description)),a.filename&&(k=c(a.filename)))}var e,f,h,i=!1,j=!1,k=!1,l="";if(g.plugins&&g.plugins.length)e=g.plugins["Shockwave Flash"],d(e),g.plugins["Shockwave Flash 2.0"]&&(i=!0,l="2.0.0.11");else if(g.mimeTypes&&g.mimeTypes.length)h=g.mimeTypes["application/x-shockwave-flash"],e=h&&h.enabledPlugin,d(e);else if("undefined"!=typeof a){j=!0;try{f=new a("ShockwaveFlash.ShockwaveFlash.7"),i=!0,l=b(f.GetVariable("$version"))}catch(n){try{f=new a("ShockwaveFlash.ShockwaveFlash.6"),i=!0,l="6.0.21"}catch(o){try{f=new a("ShockwaveFlash.ShockwaveFlash"),i=!0,l=b(f.GetVariable("$version"))}catch(p){j=!1}}}}I.disabled=i!==!0,I.outdated=l&&m(l)<m(J),I.version=l||"0.0.0",I.pluginType=k?"pepper":j?"activex":i?"netscape":"unknown"};Eb(j);var Fb=function(){return this instanceof Fb?void("function"==typeof Fb._createClient&&Fb._createClient.apply(this,v(arguments))):new Fb};r(Fb,"version",{value:"2.1.6",writable:!1,configurable:!0,enumerable:!0}),Fb.config=function(){return P.apply(this,v(arguments))},Fb.state=function(){return Q.apply(this,v(arguments))},Fb.isFlashUnusable=function(){return R.apply(this,v(arguments))},Fb.on=function(){return S.apply(this,v(arguments))},Fb.off=function(){return T.apply(this,v(arguments))},Fb.handlers=function(){return U.apply(this,v(arguments))},Fb.emit=function(){return V.apply(this,v(arguments))},Fb.create=function(){return W.apply(this,v(arguments))},Fb.destroy=function(){return X.apply(this,v(arguments))},Fb.setData=function(){return Y.apply(this,v(arguments))},Fb.clearData=function(){return Z.apply(this,v(arguments))},Fb.getData=function(){return $.apply(this,v(arguments))},Fb.focus=Fb.activate=function(){return _.apply(this,v(arguments))},Fb.blur=Fb.deactivate=function(){return ab.apply(this,v(arguments))},Fb.activeElement=function(){return bb.apply(this,v(arguments))};var Gb=0,Hb={},Ib=0,Jb={},Kb={};w(O,{autoActivate:!0});var Lb=function(a){var b=this;b.id=""+Gb++,Hb[b.id]={instance:b,elements:[],handlers:{}},a&&b.clip(a),Fb.on("*",function(a){return b.emit(a)}),Fb.on("destroy",function(){b.destroy()}),Fb.create()},Mb=function(a,b){var c,d,e,f={},g=Hb[this.id]&&Hb[this.id].handlers;if("string"==typeof a&&a)e=a.toLowerCase().split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.on(c,a[c]);if(e&&e.length){for(c=0,d=e.length;d>c;c++)a=e[c].replace(/^on/,""),f[a]=!0,g[a]||(g[a]=[]),g[a].push(b);if(f.ready&&I.ready&&this.emit({type:"ready",client:this}),f.error){var h=["disabled","outdated","unavailable","deactivated","overdue"];for(c=0,d=h.length;d>c;c++)if(I[h[c]]){this.emit({type:"error",name:"flash-"+h[c],client:this});break}}}return this},Nb=function(a,b){var c,d,e,f,g,h=Hb[this.id]&&Hb[this.id].handlers;if(0===arguments.length)f=q(h);else if("string"==typeof a&&a)f=a.split(/\s+/);else if("object"==typeof a&&a&&"undefined"==typeof b)for(c in a)s.call(a,c)&&"string"==typeof c&&c&&"function"==typeof a[c]&&this.off(c,a[c]);if(f&&f.length)for(c=0,d=f.length;d>c;c++)if(a=f[c].toLowerCase().replace(/^on/,""),g=h[a],g&&g.length)if(b)for(e=g.indexOf(b);-1!==e;)g.splice(e,1),e=g.indexOf(b,e);else g.length=0;return this},Ob=function(a){var b=null,c=Hb[this.id]&&Hb[this.id].handlers;return c&&(b="string"==typeof a&&a?c[a]?c[a].slice(0):[]:x(c)),b},Pb=function(a){if(Ub.call(this,a)){"object"==typeof a&&a&&"string"==typeof a.type&&a.type&&(a=w({},a));var b=w({},db(a),{client:this});Vb.call(this,b)}return this},Qb=function(a){a=Wb(a);for(var b=0;b<a.length;b++)if(s.call(a,b)&&a[b]&&1===a[b].nodeType){a[b].zcClippingId?-1===Jb[a[b].zcClippingId].indexOf(this.id)&&Jb[a[b].zcClippingId].push(this.id):(a[b].zcClippingId="zcClippingId_"+Ib++,Jb[a[b].zcClippingId]=[this.id],O.autoActivate===!0&&Xb(a[b]));var c=Hb[this.id]&&Hb[this.id].elements;-1===c.indexOf(a[b])&&c.push(a[b])}return this},Rb=function(a){var b=Hb[this.id];if(!b)return this;var c,d=b.elements;a="undefined"==typeof a?d.slice(0):Wb(a);for(var e=a.length;e--;)if(s.call(a,e)&&a[e]&&1===a[e].nodeType){for(c=0;-1!==(c=d.indexOf(a[e],c));)d.splice(c,1);var f=Jb[a[e].zcClippingId];if(f){for(c=0;-1!==(c=f.indexOf(this.id,c));)f.splice(c,1);0===f.length&&(O.autoActivate===!0&&Yb(a[e]),delete a[e].zcClippingId)}}return this},Sb=function(){var a=Hb[this.id];return a&&a.elements?a.elements.slice(0):[]},Tb=function(){this.unclip(),this.off(),delete Hb[this.id]},Ub=function(a){if(!a||!a.type)return!1;if(a.client&&a.client!==this)return!1;var b=Hb[this.id]&&Hb[this.id].elements,c=!!b&&b.length>0,d=!a.target||c&&-1!==b.indexOf(a.target),e=a.relatedTarget&&c&&-1!==b.indexOf(a.relatedTarget),f=a.client&&a.client===this;return d||e||f?!0:!1},Vb=function(a){if("object"==typeof a&&a&&a.type){var b=gb(a),c=Hb[this.id]&&Hb[this.id].handlers["*"]||[],d=Hb[this.id]&&Hb[this.id].handlers[a.type]||[],f=c.concat(d);if(f&&f.length){var g,h,i,j,k,l=this;for(g=0,h=f.length;h>g;g++)i=f[g],j=l,"string"==typeof i&&"function"==typeof e[i]&&(i=e[i]),"object"==typeof i&&i&&"function"==typeof i.handleEvent&&(j=i,i=i.handleEvent),"function"==typeof i&&(k=w({},a),hb(i,j,[k],b))}return this}},Wb=function(a){return"string"==typeof a&&(a=[]),"number"!=typeof a.length?[a]:a},Xb=function(a){if(a&&1===a.nodeType){var b=function(a){(a||(a=e.event))&&("js"!==a._source&&(a.stopImmediatePropagation(),a.preventDefault()),delete a._source)},c=function(c){(c||(c=e.event))&&(b(c),Fb.focus(a))};a.addEventListener("mouseover",c,!1),a.addEventListener("mouseout",b,!1),a.addEventListener("mouseenter",b,!1),a.addEventListener("mouseleave",b,!1),a.addEventListener("mousemove",b,!1),Kb[a.zcClippingId]={mouseover:c,mouseout:b,mouseenter:b,mouseleave:b,mousemove:b}}},Yb=function(a){if(a&&1===a.nodeType){var b=Kb[a.zcClippingId];if("object"==typeof b&&b){for(var c,d,e=["move","leave","enter","out","over"],f=0,g=e.length;g>f;f++)c="mouse"+e[f],d=b[c],"function"==typeof d&&a.removeEventListener(c,d,!1);delete Kb[a.zcClippingId]}}};Fb._createClient=function(){Lb.apply(this,v(arguments))},Fb.prototype.on=function(){return Mb.apply(this,v(arguments))},Fb.prototype.off=function(){return Nb.apply(this,v(arguments))},Fb.prototype.handlers=function(){return Ob.apply(this,v(arguments))},Fb.prototype.emit=function(){return Pb.apply(this,v(arguments))},Fb.prototype.clip=function(){return Qb.apply(this,v(arguments))},Fb.prototype.unclip=function(){return Rb.apply(this,v(arguments))},Fb.prototype.elements=function(){return Sb.apply(this,v(arguments))},Fb.prototype.destroy=function(){return Tb.apply(this,v(arguments))},Fb.prototype.setText=function(a){return Fb.setData("text/plain",a),this},Fb.prototype.setHtml=function(a){return Fb.setData("text/html",a),this},Fb.prototype.setRichText=function(a){return Fb.setData("application/rtf",a),this},Fb.prototype.setData=function(){return Fb.setData.apply(this,v(arguments)),this},Fb.prototype.clearData=function(){return Fb.clearData.apply(this,v(arguments)),this},Fb.prototype.getData=function(){return Fb.getData.apply(this,v(arguments))},"function"==typeof define&&define.amd?define(function(){return Fb}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?module.exports=Fb:a.ZeroClipboard=Fb}(function(){return this||window}());
  30. //# sourceMappingURL=ZeroClipboard.min.map
  31.  
  32. /*jslint node: true */
  33. /*global ZeroClipboard */
  34.  
  35. (function(window, angular, undefined) {
  36.   'use strict';
  37.  
  38.   angular.module('ngClipboard', []).
  39.     provider('ngClip', function() {
  40.       var self = this;
  41.       this.path = '//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.1.6/ZeroClipboard.swf';
  42.       return {
  43.         setPath: function(newPath) {
  44.          self.path = newPath;
  45.         },
  46.         setConfig: function(config) {
  47.           self.config = config;
  48.         },
  49.         $get: function() {
  50.           return {
  51.             path: self.path,
  52.             config: self.config
  53.           };
  54.         }
  55.       };
  56.     }).
  57.     run(['ngClip', function(ngClip) {
  58.       var config = {
  59.         swfPath: ngClip.path,
  60.         trustedDomains: ["*"],
  61.         allowScriptAccess: "always",
  62.         forceHandCursor: true,
  63.       };
  64.       ZeroClipboard.config(angular.extend(config,ngClip.config || {}));
  65.     }]).
  66.     directive('clipCopy', ['ngClip', function (ngClip) {
  67.       return {
  68.         scope: {
  69.           clipCopy: '&',
  70.           clipClick: '&',
  71.           clipClickFallback: '&'
  72.         },
  73.         restrict: 'A',
  74.         link: function (scope, element, attrs) {
  75.           // Bind a fallback function if flash is unavailable
  76.           if (ZeroClipboard.isFlashUnusable()) {
  77.             element.bind('click', function($event) {
  78.               // Execute the expression with local variables `$event` and `copy`
  79.               scope.$apply(scope.clipClickFallback({
  80.                 $event: $event,
  81.                 copy: scope.$eval(scope.clipCopy)
  82.               }));
  83.             });
  84.  
  85.             return;
  86.           }
  87.  
  88.           // Create the client object
  89.           var client = new ZeroClipboard(element);
  90.           if (attrs.clipCopy === "") {
  91.             scope.clipCopy = function(scope) {
  92.               return element[0].previousElementSibling.innerText;
  93.             };
  94.           }
  95.           client.on( 'ready', function(readyEvent) {
  96.  
  97.             client.on('copy', function (event) {
  98.               var clipboard = event.clipboardData;
  99.               clipboard.setData('text/plain', scope.$eval(scope.clipCopy));
  100.             });
  101.  
  102.             client.on( 'aftercopy', function(event) {
  103.               if (angular.isDefined(attrs.clipClick)) {
  104.                 scope.$apply(scope.clipClick);
  105.               }
  106.             });
  107.  
  108.             scope.$on('$destroy', function() {
  109.               client.destroy();
  110.             });
  111.           });
  112.         }
  113.       };
  114.     }]);
  115. })(window, window.angular);
  116.  
  117.  
  118. (function(){//! moment.js
  119. //! version : 2.8.4
  120. //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
  121. //! license : MIT
  122. //! momentjs.com
  123. (function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return zb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){tb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return m(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){qc[a]||(e(b),qc[a]=!0)}function h(a,b){return function(c){return p(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(){}function k(a,b){b!==!1&&F(a),n(this,a),this._d=new Date(+a._d)}function l(a){var b=y(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=tb.localeData(),this._bubble()}function m(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function n(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Ib.length>0)for(c in Ib)d=Ib[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function o(a){return 0>a?Math.ceil(a):Math.floor(a)}function p(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function q(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function r(a,b){var c;return b=K(b,a),a.isBefore(b)?c=q(a,b):(c=q(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function s(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(g(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=tb.duration(c,d),t(this,e,a),this}}function t(a,b,c,d){var e=b._milliseconds,f=b._days,g=b._months;d=null==d?!0:d,e&&a._d.setTime(+a._d+e*c),f&&nb(a,"Date",mb(a,"Date")+f*c),g&&lb(a,mb(a,"Month")+g*c),d&&tb.updateOffset(a,f||g)}function u(a){return"[object Array]"===Object.prototype.toString.call(a)}function v(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function w(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&A(a[d])!==A(b[d]))&&g++;return g+f}function x(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=jc[a]||kc[b]||b}return a}function y(a){var b,d,e={};for(d in a)c(a,d)&&(b=x(d),b&&(e[b]=a[d]));return e}function z(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}tb[b]=function(e,f){var g,h,i=tb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=tb().utc().set(d,a);return i.call(tb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function A(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function B(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function C(a,b,c){return hb(tb([a,11,31+b-c]),b,c).week}function D(a){return E(a)?366:365}function E(a){return a%4===0&&a%100!==0||a%400===0}function F(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Bb]<0||a._a[Bb]>11?Bb:a._a[Cb]<1||a._a[Cb]>B(a._a[Ab],a._a[Bb])?Cb:a._a[Db]<0||a._a[Db]>24||24===a._a[Db]&&(0!==a._a[Eb]||0!==a._a[Fb]||0!==a._a[Gb])?Db:a._a[Eb]<0||a._a[Eb]>59?Eb:a._a[Fb]<0||a._a[Fb]>59?Fb:a._a[Gb]<0||a._a[Gb]>999?Gb:-1,a._pf._overflowDayOfYear&&(Ab>b||b>Cb)&&(b=Cb),a._pf.overflow=b)}function G(b){return null==b._isValid&&(b._isValid=!isNaN(b._d.getTime())&&b._pf.overflow<0&&!b._pf.empty&&!b._pf.invalidMonth&&!b._pf.nullInput&&!b._pf.invalidFormat&&!b._pf.userInvalidated,b._strict&&(b._isValid=b._isValid&&0===b._pf.charsLeftOver&&0===b._pf.unusedTokens.length&&b._pf.bigHour===a)),b._isValid}function H(a){return a?a.toLowerCase().replace("_","-"):a}function I(a){for(var b,c,d,e,f=0;f<a.length;){for(e=H(a[f]).split("-"),b=e.length,c=H(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=J(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&w(e,c,!0)>=b-1)break;b--}f++}return null}function J(a){var b=null;if(!Hb[a]&&Jb)try{b=tb.locale(),require("./locale/"+a),tb.locale(b)}catch(c){}return Hb[a]}function K(a,b){var c,d;return b._isUTC?(c=b.clone(),d=(tb.isMoment(a)||v(a)?+a:+tb(a))-+c,c._d.setTime(+c._d+d),tb.updateOffset(c,!1),c):tb(a).local()}function L(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function M(a){var b,c,d=a.match(Nb);for(b=0,c=d.length;c>b;b++)d[b]=pc[d[b]]?pc[d[b]]:L(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function N(a,b){return a.isValid()?(b=O(b,a.localeData()),lc[b]||(lc[b]=M(b)),lc[b](a)):a.localeData().invalidDate()}function O(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Ob.lastIndex=0;d>=0&&Ob.test(a);)a=a.replace(Ob,c),Ob.lastIndex=0,d-=1;return a}function P(a,b){var c,d=b._strict;switch(a){case"Q":return Zb;case"DDDD":return _b;case"YYYY":case"GGGG":case"gggg":return d?ac:Rb;case"Y":case"G":case"g":return cc;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?bc:Sb;case"S":if(d)return Zb;case"SS":if(d)return $b;case"SSS":if(d)return _b;case"DDD":return Qb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ub;case"a":case"A":return b._locale._meridiemParse;case"x":return Xb;case"X":return Yb;case"Z":case"ZZ":return Vb;case"T":return Wb;case"SSSS":return Tb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?$b:Pb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Pb;case"Do":return d?b._locale._ordinalParse:b._locale._ordinalParseLenient;default:return c=new RegExp(Y(X(a.replace("\\","")),"i"))}}function Q(a){a=a||"";var b=a.match(Vb)||[],c=b[b.length-1]||[],d=(c+"").match(hc)||["-",0,0],e=+(60*d[1])+A(d[2]);return"+"===d[0]?-e:e}function R(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Bb]=3*(A(b)-1));break;case"M":case"MM":null!=b&&(e[Bb]=A(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b,a,c._strict),null!=d?e[Bb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Cb]=A(b));break;case"Do":null!=b&&(e[Cb]=A(parseInt(b.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=A(b));break;case"YY":e[Ab]=tb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Ab]=A(b);break;case"a":case"A":c._isPm=c._locale.isPM(b);break;case"h":case"hh":c._pf.bigHour=!0;case"H":case"HH":e[Db]=A(b);break;case"m":case"mm":e[Eb]=A(b);break;case"s":case"ss":e[Fb]=A(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Gb]=A(1e3*("0."+b));break;case"x":c._d=new Date(A(b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=Q(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=A(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=tb.parseTwoDigitYear(b)}}function S(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Ab],hb(tb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Ab],hb(tb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=ib(d,e,f,h,g),a._a[Ab]=i.year,a._dayOfYear=i.dayOfYear}function T(a){var c,d,e,f,g=[];if(!a._d){for(e=V(a),a._w&&null==a._a[Cb]&&null==a._a[Bb]&&S(a),a._dayOfYear&&(f=b(a._a[Ab],e[Ab]),a._dayOfYear>D(f)&&(a._pf._overflowDayOfYear=!0),d=db(f,0,a._dayOfYear),a._a[Bb]=d.getUTCMonth(),a._a[Cb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];24===a._a[Db]&&0===a._a[Eb]&&0===a._a[Fb]&&0===a._a[Gb]&&(a._nextDay=!0,a._a[Db]=0),a._d=(a._useUTC?db:cb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()+a._tzm),a._nextDay&&(a._a[Db]=24)}}function U(a){var b;a._d||(b=y(a._i),a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],T(a))}function V(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function W(b){if(b._f===tb.ISO_8601)return void $(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=O(b._f,b._locale).match(Nb)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(P(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),pc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),R(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[Db]<=12&&(b._pf.bigHour=a),b._isPm&&b._a[Db]<12&&(b._a[Db]+=12),b._isPm===!1&&12===b._a[Db]&&(b._a[Db]=0),T(b),F(b)}function X(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function Y(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function Z(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;f<a._f.length;f++)g=0,b=n({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._pf=d(),b._f=a._f[f],W(b),G(b)&&(g+=b._pf.charsLeftOver,g+=10*b._pf.unusedTokens.length,b._pf.score=g,(null==e||e>g)&&(e=g,c=b));m(a,c||b)}function $(a){var b,c,d=a._i,e=dc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=fc.length;c>b;b++)if(fc[b][1].exec(d)){a._f=fc[b][0]+(e[6]||" ");break}for(b=0,c=gc.length;c>b;b++)if(gc[b][1].exec(d)){a._f+=gc[b][0];break}d.match(Vb)&&(a._f+="Z"),W(a)}else a._isValid=!1}function _(a){$(a),a._isValid===!1&&(delete a._isValid,tb.createFromInputFallback(a))}function ab(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function bb(b){var c,d=b._i;d===a?b._d=new Date:v(d)?b._d=new Date(+d):null!==(c=Kb.exec(d))?b._d=new Date(+c[1]):"string"==typeof d?_(b):u(d)?(b._a=ab(d.slice(0),function(a){return parseInt(a,10)}),T(b)):"object"==typeof d?U(b):"number"==typeof d?b._d=new Date(d):tb.createFromInputFallback(b)}function cb(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function db(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function eb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function fb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function gb(a,b,c){var d=tb.duration(a).abs(),e=yb(d.as("s")),f=yb(d.as("m")),g=yb(d.as("h")),h=yb(d.as("d")),i=yb(d.as("M")),j=yb(d.as("y")),k=e<mc.s&&["s",e]||1===f&&["m"]||f<mc.m&&["mm",f]||1===g&&["h"]||g<mc.h&&["hh",g]||1===h&&["d"]||h<mc.d&&["dd",h]||1===i&&["M"]||i<mc.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,fb.apply({},k)}function hb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=tb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ib(a,b,c,d,e){var f,g,h=db(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:D(a-1)+g}}function jb(b){var c,d=b._i,e=b._f;return b._locale=b._locale||tb.localeData(b._l),null===d||e===a&&""===d?tb.invalid({nullInput:!0}):("string"==typeof d&&(b._i=d=b._locale.preparse(d)),tb.isMoment(d)?new k(d,!0):(e?u(e)?Z(b):W(b):bb(b),c=new k(b),c._nextDay&&(c.add(1,"d"),c._nextDay=a),c))}function kb(a,b){var c,d;if(1===b.length&&u(b[0])&&(b=b[0]),!b.length)return tb();for(c=b[0],d=1;d<b.length;++d)b[d][a](c)&&(c=b[d]);return c}function lb(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),B(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function mb(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function nb(a,b,c){return"Month"===b?lb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function ob(a,b){return function(c){return null!=c?(nb(this,a,c),tb.updateOffset(this,b),this):mb(this,a)}}function pb(a){return 400*a/146097}function qb(a){return 146097*a/400}function rb(a){tb.duration.fn[a]=function(){return this._data[a]}}function sb(a){"undefined"==typeof ender&&(ub=xb.moment,xb.moment=a?f("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",tb):tb)}for(var tb,ub,vb,wb="2.8.4",xb="undefined"!=typeof global?global:this,yb=Math.round,zb=Object.prototype.hasOwnProperty,Ab=0,Bb=1,Cb=2,Db=3,Eb=4,Fb=5,Gb=6,Hb={},Ib=[],Jb="undefined"!=typeof module&&module&&module.exports,Kb=/^\/?Date\((\-?\d+)/i,Lb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Mb=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Nb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Ob=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Pb=/\d\d?/,Qb=/\d{1,3}/,Rb=/\d{1,4}/,Sb=/[+\-]?\d{1,6}/,Tb=/\d+/,Ub=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Vb=/Z|[\+\-]\d\d:?\d\d/gi,Wb=/T/i,Xb=/[\+\-]?\d+/,Yb=/[\+\-]?\d+(\.\d{1,3})?/,Zb=/\d/,$b=/\d\d/,_b=/\d{3}/,ac=/\d{4}/,bc=/[+-]?\d{6}/,cc=/[+-]?\d+/,dc=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ec="YYYY-MM-DDTHH:mm:ssZ",fc=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],gc=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],hc=/([\+\-]|\d\d)/gi,ic=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),jc={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},kc={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},lc={},mc={s:45,m:45,h:22,d:26,M:11},nc="DDD w W M D d".split(" "),oc="M D H h m s w W".split(" "),pc={M:function(){return this.month()+1},MMM:function(a){return this.localeData().monthsShort(this,a)},MMMM:function(a){return this.localeData().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.localeData().weekdaysMin(this,a)},ddd:function(a){return this.localeData().weekdaysShort(this,a)},dddd:function(a){return this.localeData().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return p(this.year()%100,2)},YYYY:function(){return p(this.year(),4)},YYYYY:function(){return p(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+p(Math.abs(a),6)},gg:function(){return p(this.weekYear()%100,2)},gggg:function(){return p(this.weekYear(),4)},ggggg:function(){return p(this.weekYear(),5)},GG:function(){return p(this.isoWeekYear()%100,2)},GGGG:function(){return p(this.isoWeekYear(),4)},GGGGG:function(){return p(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return A(this.milliseconds()/100)},SS:function(){return p(A(this.milliseconds()/10),2)},SSS:function(){return p(this.milliseconds(),3)},SSSS:function(){return p(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+":"+p(A(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+p(A(a/60),2)+p(A(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},qc={},rc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];nc.length;)vb=nc.pop(),pc[vb+"o"]=i(pc[vb],vb);for(;oc.length;)vb=oc.pop(),pc[vb+vb]=h(pc[vb],2);pc.DDDD=h(pc.DDD,3),m(j.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=tb.utc([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=tb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.apply(b,[c]):d},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(a){return a},postformat:function(a){return a},week:function(a){return hb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),tb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),jb(g)},tb.suppressDeprecationWarnings=!1,tb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),tb.min=function(){var a=[].slice.call(arguments,0);return kb("isBefore",a)},tb.max=function(){var a=[].slice.call(arguments,0);return kb("isAfter",a)},tb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),jb(g).utc()},tb.unix=function(a){return tb(1e3*a)},tb.duration=function(a,b){var d,e,f,g,h=a,i=null;return tb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Lb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:A(i[Cb])*d,h:A(i[Db])*d,m:A(i[Eb])*d,s:A(i[Fb])*d,ms:A(i[Gb])*d}):(i=Mb.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):"object"==typeof h&&("from"in h||"to"in h)&&(g=r(tb(h.from),tb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new l(h),tb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},tb.version=wb,tb.defaultFormat=ec,tb.ISO_8601=function(){},tb.momentProperties=Ib,tb.updateOffset=function(){},tb.relativeTimeThreshold=function(b,c){return mc[b]===a?!1:c===a?mc[b]:(mc[b]=c,!0)},tb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return tb.locale(a,b)}),tb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?tb.defineLocale(a,b):tb.localeData(a),c&&(tb.duration._locale=tb._locale=c)),tb._locale._abbr},tb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Hb[a]||(Hb[a]=new j),Hb[a].set(b),tb.locale(a),Hb[a]):(delete Hb[a],null)},tb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return tb.localeData(a)}),tb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return tb._locale;if(!u(a)){if(b=J(a))return b;a=[a]}return I(a)},tb.isMoment=function(a){return a instanceof k||null!=a&&c(a,"_isAMomentObject")},tb.isDuration=function(a){return a instanceof l};for(vb=rc.length-1;vb>=0;--vb)z(rc[vb]);tb.normalizeUnits=function(a){return x(a)},tb.invalid=function(a){var b=tb.utc(0/0);return null!=a?m(b._pf,a):b._pf.userInvalidated=!0,b},tb.parseZone=function(){return tb.apply(null,arguments).parseZone()},tb.parseTwoDigitYear=function(a){return A(a)+(A(a)>68?1900:2e3)},m(tb.fn=k.prototype,{clone:function(){return tb(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=tb(this).utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():N(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):N(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return G(this)},isDSTShifted:function(){return this._a?this.isValid()&&w(this._a,(this._isUTC?tb.utc(this._a):tb(this._a)).toArray())>0:!1},parsingFlags:function(){return m({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.zone(0,a)},local:function(a){return this._isUTC&&(this.zone(0,a),this._isUTC=!1,a&&this.add(this._dateTzOffset(),"m")),this},format:function(a){var b=N(this,a||tb.defaultFormat);return this.localeData().postformat(b)},add:s(1,"add"),subtract:s(-1,"subtract"),diff:function(a,b,c){var d,e,f,g=K(a,this),h=6e4*(this.zone()-g.zone());return b=x(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+g.daysInMonth()),e=12*(this.year()-g.year())+(this.month()-g.month()),f=this-tb(this).startOf("month")-(g-tb(g).startOf("month")),f-=6e4*(this.zone()-tb(this).startOf("month").zone()-(g.zone()-tb(g).startOf("month").zone())),e+=f/d,"year"===b&&(e/=12)):(d=this-g,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-h)/864e5:"week"===b?(d-h)/6048e5:d),c?e:o(e)},from:function(a,b){return tb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(tb(),a)},calendar:function(a){var b=a||tb(),c=K(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,tb(b)))},isLeapYear:function(){return E(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=eb(a,this.localeData()),this.add(a-b,"d")):b},month:ob("Month",!0),startOf:function(a){switch(a=x(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(b){return b=x(b),b===a||"millisecond"===b?this:this.startOf(b).add(1,"isoWeek"===b?"week":b).subtract(1,"ms")},isAfter:function(a,b){var c;return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this>+a):(c=tb.isMoment(a)?+a:+tb(a),c<+this.clone().startOf(b))},isBefore:function(a,b){var c;return b=x("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+a>+this):(c=tb.isMoment(a)?+a:+tb(a),+this.clone().endOf(b)<c)},isSame:function(a,b){var c;return b=x(b||"millisecond"),"millisecond"===b?(a=tb.isMoment(a)?a:tb(a),+this===+a):(c=+tb(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))},min:f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),this>a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=tb.apply(null,arguments),a>this?this:a}),zone:function(a,b){var c,d=this._offset||0;return null==a?this._isUTC?d:this._dateTzOffset():("string"==typeof a&&(a=Q(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateTzOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.subtract(c,"m"),d!==a&&(!b||this._changeInProgress?t(this,tb.duration(d-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,tb.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?tb(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return B(this.year(),this.month())},dayOfYear:function(a){var b=yb((tb(this).startOf("day")-tb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=hb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=hb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=hb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return C(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return C(this.year(),a.dow,a.doy)},get:function(a){return a=x(a),this[a]()},set:function(a,b){return a=x(a),"function"==typeof this[a]&&this[a](b),this},locale:function(b){var c;return b===a?this._locale._abbr:(c=tb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateTzOffset:function(){return 15*Math.round(this._d.getTimezoneOffset()/15)}}),tb.fn.millisecond=tb.fn.milliseconds=ob("Milliseconds",!1),tb.fn.second=tb.fn.seconds=ob("Seconds",!1),tb.fn.minute=tb.fn.minutes=ob("Minutes",!1),tb.fn.hour=tb.fn.hours=ob("Hours",!0),tb.fn.date=ob("Date",!0),tb.fn.dates=f("dates accessor is deprecated. Use date instead.",ob("Date",!0)),tb.fn.year=ob("FullYear",!0),tb.fn.years=f("years accessor is deprecated. Use year instead.",ob("FullYear",!0)),tb.fn.days=tb.fn.day,tb.fn.months=tb.fn.month,tb.fn.weeks=tb.fn.week,tb.fn.isoWeeks=tb.fn.isoWeek,tb.fn.quarters=tb.fn.quarter,tb.fn.toJSON=tb.fn.toISOString,m(tb.duration.fn=l.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=o(d/1e3),g.seconds=a%60,b=o(a/60),g.minutes=b%60,c=o(b/60),g.hours=c%24,e+=o(c/24),h=o(pb(e)),e-=o(qb(h)),f+=o(e/30),e%=30,h+=o(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return o(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*A(this._months/12)},humanize:function(a){var b=gb(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=tb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=tb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=x(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=x(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*pb(b),"month"===a?c:c/12;switch(b=this._days+Math.round(qb(this._months/12)),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;
  124. case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:tb.fn.lang,locale:tb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale}}),tb.duration.fn.toString=tb.duration.fn.toISOString;for(vb in ic)c(ic,vb)&&rb(vb.toLowerCase());tb.duration.fn.asMilliseconds=function(){return this.as("ms")},tb.duration.fn.asSeconds=function(){return this.as("s")},tb.duration.fn.asMinutes=function(){return this.as("m")},tb.duration.fn.asHours=function(){return this.as("h")},tb.duration.fn.asDays=function(){return this.as("d")},tb.duration.fn.asWeeks=function(){return this.as("weeks")},tb.duration.fn.asMonths=function(){return this.as("M")},tb.duration.fn.asYears=function(){return this.as("y")},tb.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===A(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Jb?module.exports=tb:"function"==typeof define&&define.amd?(define("moment",function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(xb.moment=ub),tb}),sb(!0)):sb()}).call(this);})();
  125. (function(){// moment.js locale configuration
  126. // locale : spanish (es)
  127. // author : Julio Napurí : https://github.com/julionc
  128.  
  129. (function (factory) {
  130.     if (typeof define === 'function' && define.amd) {
  131.         define(['moment'], factory); // AMD
  132.     } else if (typeof exports === 'object') {
  133.         module.exports = factory(require('../moment')); // Node
  134.     } else {
  135.         factory((typeof global !== 'undefined' ? global : this).moment); // node or other global
  136.     }
  137. }(function (moment) {
  138.     var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
  139.         monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
  140.  
  141.     return moment.defineLocale('es', {
  142.         months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
  143.         monthsShort : function (m, format) {
  144.             if (/-MMM-/.test(format)) {
  145.                 return monthsShort[m.month()];
  146.             } else {
  147.                 return monthsShortDot[m.month()];
  148.             }
  149.         },
  150.         weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
  151.         weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
  152.         weekdaysMin : 'Do_Lu_Ma_Mi_Ju_Vi_Sá'.split('_'),
  153.         longDateFormat : {
  154.             LT : 'H:mm',
  155.             LTS : 'LT:ss',
  156.             L : 'DD/MM/YYYY',
  157.             LL : 'D [de] MMMM [de] YYYY',
  158.             LLL : 'D [de] MMMM [de] YYYY LT',
  159.             LLLL : 'dddd, D [de] MMMM [de] YYYY LT'
  160.         },
  161.         calendar : {
  162.             sameDay : function () {
  163.                 return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  164.             },
  165.             nextDay : function () {
  166.                 return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  167.             },
  168.             nextWeek : function () {
  169.                 return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  170.             },
  171.             lastDay : function () {
  172.                 return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  173.             },
  174.             lastWeek : function () {
  175.                 return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
  176.             },
  177.             sameElse : 'L'
  178.         },
  179.         relativeTime : {
  180.             future : 'en %s',
  181.             past : 'hace %s',
  182.             s : 'unos segundos',
  183.             m : 'un minuto',
  184.             mm : '%d minutos',
  185.             h : 'una hora',
  186.             hh : '%d horas',
  187.             d : 'un día',
  188.             dd : '%d días',
  189.             M : 'un mes',
  190.             MM : '%d meses',
  191.             y : 'un año',
  192.             yy : '%d años'
  193.         },
  194.         ordinalParse : /\d{1,2}º/,
  195.         ordinal : '%dº',
  196.         week : {
  197.             dow : 1, // Monday is the first day of the week.
  198.             doy : 4  // The week that contains Jan 4th is the first week of the year.
  199.         }
  200.     });
  201. }));
  202. })();
  203. (function(){!function(a,b){"use strict";if("function"==typeof define&&define.amd)define(["jquery","moment"],b);else if("object"==typeof exports)b(require("jquery"),require("moment"));else{if(!jQuery)throw new Error("bootstrap-datetimepicker requires jQuery to be loaded first");if(!moment)throw new Error("bootstrap-datetimepicker requires moment.js to be loaded first");b(a.jQuery,moment)}}(this,function(a,b){"use strict";if("undefined"==typeof b)throw new Error("momentjs is required");var c=0,d=function(d,e){var f,g=a.fn.datetimepicker.defaults,h={time:"glyphicon glyphicon-time",date:"glyphicon glyphicon-calendar",up:"glyphicon glyphicon-chevron-up",down:"glyphicon glyphicon-chevron-down"},i=this,j=!1,k=function(){var f,j,k=!1;if(i.options=a.extend({},g,e),i.options.icons=a.extend({},h,i.options.icons),i.element=a(d),m(),!i.options.pickTime&&!i.options.pickDate)throw new Error("Must choose at least one picker");if(i.id=c++,b.locale(i.options.language),i.date=b(),i.unset=!1,i.isInput=i.element.is("input"),i.component=!1,i.element.hasClass("input-group")&&(i.component=i.element.find(0===i.element.find(".datepickerbutton").size()?'[class^="input-group-"]':".datepickerbutton")),i.format=i.options.format,f=b().localeData(),i.format||(i.format=i.options.pickDate?f.longDateFormat("L"):"",i.options.pickDate&&i.options.pickTime&&(i.format+=" "),i.format+=i.options.pickTime?f.longDateFormat("LT"):"",i.options.useSeconds&&(-1!==f.longDateFormat("LT").indexOf(" A")?i.format=i.format.split(" A")[0]+":ss A":i.format+=":ss")),i.use24hours=i.format.toLowerCase().indexOf("a")<0&&i.format.indexOf("h")<0,i.component&&(k=i.component.find("span")),i.options.pickTime&&k&&k.addClass(i.options.icons.time),i.options.pickDate&&k&&(k.removeClass(i.options.icons.time),k.addClass(i.options.icons.date)),i.options.widgetParent="string"==typeof i.options.widgetParent&&i.options.widgetParent||i.element.parents().filter(function(){return"scroll"===a(this).css("overflow-y")}).get(0)||"body",i.widget=a(Q()).appendTo(i.options.widgetParent),i.minViewMode=i.options.minViewMode||0,"string"==typeof i.minViewMode)switch(i.minViewMode){case"months":i.minViewMode=1;break;case"years":i.minViewMode=2;break;default:i.minViewMode=0}if(i.viewMode=i.options.viewMode||0,"string"==typeof i.viewMode)switch(i.viewMode){case"months":i.viewMode=1;break;case"years":i.viewMode=2;break;default:i.viewMode=0}i.viewMode=Math.max(i.viewMode,i.minViewMode),i.options.disabledDates=O(i.options.disabledDates),i.options.enabledDates=O(i.options.enabledDates),i.startViewMode=i.viewMode,i.setMinDate(i.options.minDate),i.setMaxDate(i.options.maxDate),r(),s(),u(),v(),w(),q(),E(),l().prop("disabled")||F(),""!==i.options.defaultDate&&""===l().val()&&i.setValue(i.options.defaultDate),1!==i.options.minuteStepping&&(j=i.options.minuteStepping,i.date.minutes(Math.round(i.date.minutes()/j)*j%60).seconds(0))},l=function(){var a;if(i.isInput)return i.element;if(a=i.element.find(".datepickerinput"),0===a.size())a=i.element.find("input");else if(!a.is("input"))throw new Error('CSS class "datepickerinput" cannot be applied to non input element');return a},m=function(){var a;a=i.element.is("input")?i.element.data():i.element.find("input").data(),void 0!==a.dateFormat&&(i.options.format=a.dateFormat),void 0!==a.datePickdate&&(i.options.pickDate=a.datePickdate),void 0!==a.datePicktime&&(i.options.pickTime=a.datePicktime),void 0!==a.dateUseminutes&&(i.options.useMinutes=a.dateUseminutes),void 0!==a.dateUseseconds&&(i.options.useSeconds=a.dateUseseconds),void 0!==a.dateUsecurrent&&(i.options.useCurrent=a.dateUsecurrent),void 0!==a.calendarWeeks&&(i.options.calendarWeeks=a.calendarWeeks),void 0!==a.dateMinutestepping&&(i.options.minuteStepping=a.dateMinutestepping),void 0!==a.dateMindate&&(i.options.minDate=a.dateMindate),void 0!==a.dateMaxdate&&(i.options.maxDate=a.dateMaxdate),void 0!==a.dateShowtoday&&(i.options.showToday=a.dateShowtoday),void 0!==a.dateCollapse&&(i.options.collapse=a.dateCollapse),void 0!==a.dateLanguage&&(i.options.language=a.dateLanguage),void 0!==a.dateDefaultdate&&(i.options.defaultDate=a.dateDefaultdate),void 0!==a.dateDisableddates&&(i.options.disabledDates=a.dateDisableddates),void 0!==a.dateEnableddates&&(i.options.enabledDates=a.dateEnableddates),void 0!==a.dateIcons&&(i.options.icons=a.dateIcons),void 0!==a.dateUsestrict&&(i.options.useStrict=a.dateUsestrict),void 0!==a.dateDirection&&(i.options.direction=a.dateDirection),void 0!==a.dateSidebyside&&(i.options.sideBySide=a.dateSidebyside),void 0!==a.dateDaysofweekdisabled&&(i.options.daysOfWeekDisabled=a.dateDaysofweekdisabled)},n=function(){var b,c="absolute",d=i.component?i.component.offset():i.element.offset(),e=a(window);i.width=i.component?i.component.outerWidth():i.element.outerWidth(),d.top=d.top+i.element.outerHeight(),"up"===i.options.direction?b="top":"bottom"===i.options.direction?b="bottom":"auto"===i.options.direction&&(b=d.top+i.widget.height()>e.height()+e.scrollTop()&&i.widget.height()+i.element.outerHeight()<d.top?"top":"bottom"),"top"===b?(d.bottom=e.height()-d.top+i.element.outerHeight()+3,i.widget.addClass("top").removeClass("bottom")):(d.top+=1,i.widget.addClass("bottom").removeClass("top")),void 0!==i.options.width&&i.widget.width(i.options.width),"left"===i.options.orientation&&(i.widget.addClass("left-oriented"),d.left=d.left-i.widget.width()+20),J()&&(c="fixed",d.top-=e.scrollTop(),d.left-=e.scrollLeft()),e.width()<d.left+i.widget.outerWidth()?(d.right=e.width()-d.left-i.width,d.left="auto",i.widget.addClass("pull-right")):(d.right="auto",i.widget.removeClass("pull-right")),i.widget.css("top"===b?{position:c,bottom:d.bottom,top:"auto",left:d.left,right:d.right}:{position:c,top:d.top,bottom:"auto",left:d.left,right:d.right})},o=function(a,c){(!b(i.date).isSame(b(a))||j)&&(j=!1,i.element.trigger({type:"dp.change",date:b(i.date),oldDate:b(a)}),"change"!==c&&i.element.change())},p=function(a){j=!0,i.element.trigger({type:"dp.error",date:b(a,i.format,i.options.useStrict)})},q=function(a){b.locale(i.options.language);var c=a;c||(c=l().val(),c&&(i.date=b(c,i.format,i.options.useStrict)),i.date||(i.date=b())),i.viewDate=b(i.date).startOf("month"),t(),x()},r=function(){b.locale(i.options.language);var c,d=a("<tr>"),e=b.weekdaysMin();if(i.options.calendarWeeks===!0&&d.append('<th class="cw">#</th>'),0===b().localeData()._week.dow)for(c=0;7>c;c++)d.append('<th class="dow">'+e[c]+"</th>");else for(c=1;8>c;c++)d.append(7===c?'<th class="dow">'+e[0]+"</th>":'<th class="dow">'+e[c]+"</th>");i.widget.find(".datepicker-days thead").append(d)},s=function(){b.locale(i.options.language);var a,c="",d=b.monthsShort();for(a=0;12>a;a++)c+='<span class="month">'+d[a]+"</span>";i.widget.find(".datepicker-months td").append(c)},t=function(){if(i.options.pickDate){b.locale(i.options.language);var c,d,e,f,g,h,j,k,l,m=i.viewDate.year(),n=i.viewDate.month(),o=i.options.minDate.year(),p=i.options.minDate.month(),q=i.options.maxDate.year(),r=i.options.maxDate.month(),s=[],t=b.months();for(i.widget.find(".datepicker-days").find(".disabled").removeClass("disabled"),i.widget.find(".datepicker-months").find(".disabled").removeClass("disabled"),i.widget.find(".datepicker-years").find(".disabled").removeClass("disabled"),i.widget.find(".datepicker-days th:eq(1)").text(t[n]+" "+m),d=b(i.viewDate,i.format,i.options.useStrict).subtract(1,"months"),j=d.daysInMonth(),d.date(j).startOf("week"),(m===o&&p>=n||o>m)&&i.widget.find(".datepicker-days th:eq(0)").addClass("disabled"),(m===q&&n>=r||m>q)&&i.widget.find(".datepicker-days th:eq(2)").addClass("disabled"),e=b(d).add(42,"d");d.isBefore(e);){if(d.weekday()===b().startOf("week").weekday()&&(f=a("<tr>"),s.push(f),i.options.calendarWeeks===!0&&f.append('<td class="cw">'+d.week()+"</td>")),g="",d.year()<m||d.year()===m&&d.month()<n?g+=" old":(d.year()>m||d.year()===m&&d.month()>n)&&(g+=" new"),d.isSame(b({y:i.date.year(),M:i.date.month(),d:i.date.date()}))&&(g+=" active"),(M(d,"day")||!N(d))&&(g+=" disabled"),i.options.showToday===!0&&d.isSame(b(),"day")&&(g+=" today"),i.options.daysOfWeekDisabled)for(h=0;h<i.options.daysOfWeekDisabled.length;h++)if(d.day()===i.options.daysOfWeekDisabled[h]){g+=" disabled";break}f.append('<td class="day'+g+'">'+d.date()+"</td>"),c=d.date(),d.add(1,"d"),c===d.date()&&d.add(1,"d")}for(i.widget.find(".datepicker-days tbody").empty().append(s),l=i.date.year(),t=i.widget.find(".datepicker-months").find("th:eq(1)").text(m).end().find("span").removeClass("active"),l===m&&t.eq(i.date.month()).addClass("active"),o>m-1&&i.widget.find(".datepicker-months th:eq(0)").addClass("disabled"),m+1>q&&i.widget.find(".datepicker-months th:eq(2)").addClass("disabled"),h=0;12>h;h++)m===o&&p>h||o>m?a(t[h]).addClass("disabled"):(m===q&&h>r||m>q)&&a(t[h]).addClass("disabled");for(s="",m=10*parseInt(m/10,10),k=i.widget.find(".datepicker-years").find("th:eq(1)").text(m+"-"+(m+9)).parents("table").find("td"),i.widget.find(".datepicker-years").find("th").removeClass("disabled"),o>m&&i.widget.find(".datepicker-years").find("th:eq(0)").addClass("disabled"),m+9>q&&i.widget.find(".datepicker-years").find("th:eq(2)").addClass("disabled"),m-=1,h=-1;11>h;h++)s+='<span class="year'+(-1===h||10===h?" old":"")+(l===m?" active":"")+(o>m||m>q?" disabled":"")+'">'+m+"</span>",m+=1;k.html(s)}},u=function(){b.locale(i.options.language);var a,c,d,e=i.widget.find(".timepicker .timepicker-hours table"),f="";if(e.parent().hide(),i.use24hours)for(a=0,c=0;6>c;c+=1){for(f+="<tr>",d=0;4>d;d+=1)f+='<td class="hour">'+P(a.toString())+"</td>",a++;f+="</tr>"}else for(a=1,c=0;3>c;c+=1){for(f+="<tr>",d=0;4>d;d+=1)f+='<td class="hour">'+P(a.toString())+"</td>",a++;f+="</tr>"}e.html(f)},v=function(){var a,b,c=i.widget.find(".timepicker .timepicker-minutes table"),d="",e=0,f=i.options.minuteStepping;for(c.parent().hide(),1===f&&(f=5),a=0;a<Math.ceil(60/f/4);a++){for(d+="<tr>",b=0;4>b;b+=1)60>e?(d+='<td class="minute">'+P(e.toString())+"</td>",e+=f):d+="<td></td>";d+="</tr>"}c.html(d)},w=function(){var a,b,c=i.widget.find(".timepicker .timepicker-seconds table"),d="",e=0;for(c.parent().hide(),a=0;3>a;a++){for(d+="<tr>",b=0;4>b;b+=1)d+='<td class="second">'+P(e.toString())+"</td>",e+=5;d+="</tr>"}c.html(d)},x=function(){if(i.date){var a=i.widget.find(".timepicker span[data-time-component]"),b=i.date.hours(),c=i.date.format("A");i.use24hours||(0===b?b=12:12!==b&&(b%=12),i.widget.find(".timepicker [data-action=togglePeriod]").text(c)),a.filter("[data-time-component=hours]").text(P(b)),a.filter("[data-time-component=minutes]").text(P(i.date.minutes())),a.filter("[data-time-component=seconds]").text(P(i.date.second()))}},y=function(c){c.stopPropagation(),c.preventDefault(),i.unset=!1;var d,e,f,g,h=a(c.target).closest("span, td, th"),j=b(i.date);if(1===h.length&&!h.is(".disabled"))switch(h[0].nodeName.toLowerCase()){case"th":switch(h[0].className){case"picker-switch":E(1);break;case"prev":case"next":f=R.modes[i.viewMode].navStep,"prev"===h[0].className&&(f=-1*f),i.viewDate.add(f,R.modes[i.viewMode].navFnc),t()}break;case"span":h.is(".month")?(d=h.parent().find("span").index(h),i.viewDate.month(d)):(e=parseInt(h.text(),10)||0,i.viewDate.year(e)),i.viewMode===i.minViewMode&&(i.date=b({y:i.viewDate.year(),M:i.viewDate.month(),d:i.viewDate.date(),h:i.date.hours(),m:i.date.minutes(),s:i.date.seconds()}),K(),o(j,c.type)),E(-1),t();break;case"td":h.is(".day")&&(g=parseInt(h.text(),10)||1,d=i.viewDate.month(),e=i.viewDate.year(),h.is(".old")?0===d?(d=11,e-=1):d-=1:h.is(".new")&&(11===d?(d=0,e+=1):d+=1),i.date=b({y:e,M:d,d:g,h:i.date.hours(),m:i.date.minutes(),s:i.date.seconds()}),i.viewDate=b({y:e,M:d,d:Math.min(28,g)}),t(),K(),o(j,c.type))}},z={incrementHours:function(){L("add","hours",1)},incrementMinutes:function(){L("add","minutes",i.options.minuteStepping)},incrementSeconds:function(){L("add","seconds",1)},decrementHours:function(){L("subtract","hours",1)},decrementMinutes:function(){L("subtract","minutes",i.options.minuteStepping)},decrementSeconds:function(){L("subtract","seconds",1)},togglePeriod:function(){var a=i.date.hours();a>=12?a-=12:a+=12,i.date.hours(a)},showPicker:function(){i.widget.find(".timepicker > div:not(.timepicker-picker)").hide(),i.widget.find(".timepicker .timepicker-picker").show()},showHours:function(){i.widget.find(".timepicker .timepicker-picker").hide(),i.widget.find(".timepicker .timepicker-hours").show()},showMinutes:function(){i.widget.find(".timepicker .timepicker-picker").hide(),i.widget.find(".timepicker .timepicker-minutes").show()},showSeconds:function(){i.widget.find(".timepicker .timepicker-picker").hide(),i.widget.find(".timepicker .timepicker-seconds").show()},selectHour:function(b){var c=parseInt(a(b.target).text(),10);i.use24hours||(i.date.hours()>=12?12!==c&&(c+=12):12===c&&(c=0)),i.date.hours(c),z.showPicker.call(i)},selectMinute:function(b){i.date.minutes(parseInt(a(b.target).text(),10)),z.showPicker.call(i)},selectSecond:function(b){i.date.seconds(parseInt(a(b.target).text(),10)),z.showPicker.call(i)}},A=function(c){var d=b(i.date),e=a(c.currentTarget).data("action"),f=z[e].apply(i,arguments);return B(c),i.date||(i.date=b({y:1970})),K(),x(),o(d,c.type),f},B=function(a){a.stopPropagation(),a.preventDefault()},C=function(a){27===a.keyCode&&i.hide()},D=function(c){b.locale(i.options.language);var d=a(c.target),e=b(i.date),f=b(d.val(),i.format,i.options.useStrict);f.isValid()&&!M(f)&&N(f)?(q(),i.setValue(f),o(e,c.type),K()):(i.viewDate=e,i.unset=!0,o(e,c.type),p(f))},E=function(a){a&&(i.viewMode=Math.max(i.minViewMode,Math.min(2,i.viewMode+a))),i.widget.find(".datepicker > div").hide().filter(".datepicker-"+R.modes[i.viewMode].clsName).show()},F=function(){var b,c,d,e,f;i.widget.on("click",".datepicker *",a.proxy(y,this)),i.widget.on("click","[data-action]",a.proxy(A,this)),i.widget.on("mousedown",a.proxy(B,this)),i.element.on("keydown",a.proxy(C,this)),i.options.pickDate&&i.options.pickTime&&i.widget.on("click.togglePicker",".accordion-toggle",function(g){if(g.stopPropagation(),b=a(this),c=b.closest("ul"),d=c.find(".in"),e=c.find(".collapse:not(.in)"),d&&d.length){if(f=d.data("collapse"),f&&f.transitioning)return;d.collapse("hide"),e.collapse("show"),b.find("span").toggleClass(i.options.icons.time+" "+i.options.icons.date),i.component&&i.component.find("span").toggleClass(i.options.icons.time+" "+i.options.icons.date)}}),i.isInput?i.element.on({click:a.proxy(i.show,this),focus:a.proxy(i.show,this),change:a.proxy(D,this),blur:a.proxy(i.hide,this)}):(i.element.on({change:a.proxy(D,this)},"input"),i.component?(i.component.on("click",a.proxy(i.show,this)),i.component.on("mousedown",a.proxy(B,this))):i.element.on("click",a.proxy(i.show,this)))},G=function(){a(window).on("resize.datetimepicker"+i.id,a.proxy(n,this)),i.isInput||a(document).on("mousedown.datetimepicker"+i.id,a.proxy(i.hide,this))},H=function(){i.widget.off("click",".datepicker *",i.click),i.widget.off("click","[data-action]"),i.widget.off("mousedown",i.stopEvent),i.options.pickDate&&i.options.pickTime&&i.widget.off("click.togglePicker"),i.isInput?i.element.off({focus:i.show,change:D,click:i.show,blur:i.hide}):(i.element.off({change:D},"input"),i.component?(i.component.off("click",i.show),i.component.off("mousedown",i.stopEvent)):i.element.off("click",i.show))},I=function(){a(window).off("resize.datetimepicker"+i.id),i.isInput||a(document).off("mousedown.datetimepicker"+i.id)},J=function(){if(i.element){var b,c=i.element.parents(),d=!1;for(b=0;b<c.length;b++)if("fixed"===a(c[b]).css("position")){d=!0;break}return d}return!1},K=function(){b.locale(i.options.language);var a="";i.unset||(a=b(i.date).format(i.format)),l().val(a),i.element.data("date",a),i.options.pickTime||i.hide()},L=function(a,c,d){b.locale(i.options.language);var e;return"add"===a?(e=b(i.date),23===e.hours()&&e.add(d,c),e.add(d,c)):e=b(i.date).subtract(d,c),M(b(e.subtract(d,c)))||M(e)?void p(e.format(i.format)):("add"===a?i.date.add(d,c):i.date.subtract(d,c),void(i.unset=!1))},M=function(a,c){b.locale(i.options.language);var d=b(i.options.maxDate,i.format,i.options.useStrict),e=b(i.options.minDate,i.format,i.options.useStrict);return c&&(d=d.endOf(c),e=e.startOf(c)),a.isAfter(d)||a.isBefore(e)?!0:i.options.disabledDates===!1?!1:i.options.disabledDates[a.format("YYYY-MM-DD")]===!0},N=function(a){return b.locale(i.options.language),i.options.enabledDates===!1?!0:i.options.enabledDates[a.format("YYYY-MM-DD")]===!0},O=function(a){var c,d={},e=0;for(c=0;c<a.length;c++)f=b.isMoment(a[c])||a[c]instanceof Date?b(a[c]):b(a[c],i.format,i.options.useStrict),f.isValid()&&(d[f.format("YYYY-MM-DD")]=!0,e++);return e>0?d:!1},P=function(a){return a=a.toString(),a.length>=2?a:"0"+a},Q=function(){var a='<thead><tr><th class="prev">&lsaquo;</th><th colspan="'+(i.options.calendarWeeks?"6":"5")+'" class="picker-switch"></th><th class="next">&rsaquo;</th></tr></thead>',b='<tbody><tr><td colspan="'+(i.options.calendarWeeks?"8":"7")+'"></td></tr></tbody>',c='<div class="datepicker-days"><table class="table-condensed">'+a+'<tbody></tbody></table></div><div class="datepicker-months"><table class="table-condensed">'+a+b+'</table></div><div class="datepicker-years"><table class="table-condensed">'+a+b+"</table></div>",d="";return i.options.pickDate&&i.options.pickTime?(d='<div class="bootstrap-datetimepicker-widget'+(i.options.sideBySide?" timepicker-sbs":"")+(i.use24hours?" usetwentyfour":"")+' dropdown-menu" style="z-index:9999 !important;">',d+=i.options.sideBySide?'<div class="row"><div class="col-sm-6 datepicker">'+c+'</div><div class="col-sm-6 timepicker">'+S.getTemplate()+"</div></div>":'<ul class="list-unstyled"><li'+(i.options.collapse?' class="collapse in"':"")+'><div class="datepicker">'+c+'</div></li><li class="picker-switch accordion-toggle"><a class="btn" style="width:100%"><span class="'+i.options.icons.time+'"></span></a></li><li'+(i.options.collapse?' class="collapse"':"")+'><div class="timepicker">'+S.getTemplate()+"</div></li></ul>",d+="</div>"):i.options.pickTime?'<div class="bootstrap-datetimepicker-widget dropdown-menu"><div class="timepicker">'+S.getTemplate()+"</div></div>":'<div class="bootstrap-datetimepicker-widget dropdown-menu"><div class="datepicker">'+c+"</div></div>"},R={modes:[{clsName:"days",navFnc:"month",navStep:1},{clsName:"months",navFnc:"year",navStep:1},{clsName:"years",navFnc:"year",navStep:10}]},S={hourTemplate:'<span data-action="showHours"   data-time-component="hours"   class="timepicker-hour"></span>',minuteTemplate:'<span data-action="showMinutes" data-time-component="minutes" class="timepicker-minute"></span>',secondTemplate:'<span data-action="showSeconds"  data-time-component="seconds" class="timepicker-second"></span>'};S.getTemplate=function(){return'<div class="timepicker-picker"><table class="table-condensed"><tr><td><a href="#" class="btn" data-action="incrementHours"><span class="'+i.options.icons.up+'"></span></a></td><td class="separator"></td><td>'+(i.options.useMinutes?'<a href="#" class="btn" data-action="incrementMinutes"><span class="'+i.options.icons.up+'"></span></a>':"")+"</td>"+(i.options.useSeconds?'<td class="separator"></td><td><a href="#" class="btn" data-action="incrementSeconds"><span class="'+i.options.icons.up+'"></span></a></td>':"")+(i.use24hours?"":'<td class="separator"></td>')+"</tr><tr><td>"+S.hourTemplate+'</td> <td class="separator">:</td><td>'+(i.options.useMinutes?S.minuteTemplate:'<span class="timepicker-minute">00</span>')+"</td> "+(i.options.useSeconds?'<td class="separator">:</td><td>'+S.secondTemplate+"</td>":"")+(i.use24hours?"":'<td class="separator"></td><td><button type="button" class="btn btn-primary" data-action="togglePeriod"></button></td>')+'</tr><tr><td><a href="#" class="btn" data-action="decrementHours"><span class="'+i.options.icons.down+'"></span></a></td><td class="separator"></td><td>'+(i.options.useMinutes?'<a href="#" class="btn" data-action="decrementMinutes"><span class="'+i.options.icons.down+'"></span></a>':"")+"</td>"+(i.options.useSeconds?'<td class="separator"></td><td><a href="#" class="btn" data-action="decrementSeconds"><span class="'+i.options.icons.down+'"></span></a></td>':"")+(i.use24hours?"":'<td class="separator"></td>')+'</tr></table></div><div class="timepicker-hours" data-action="selectHour"><table class="table-condensed"></table></div><div class="timepicker-minutes" data-action="selectMinute"><table class="table-condensed"></table></div>'+(i.options.useSeconds?'<div class="timepicker-seconds" data-action="selectSecond"><table class="table-condensed"></table></div>':"")},i.destroy=function(){H(),I(),i.widget.remove(),i.element.removeData("DateTimePicker"),i.component&&i.component.removeData("DateTimePicker")},i.show=function(a){if(!l().prop("disabled")){if(i.options.useCurrent&&""===l().val()){if(1!==i.options.minuteStepping){var c=b(),d=i.options.minuteStepping;c.minutes(Math.round(c.minutes()/d)*d%60).seconds(0),i.setValue(c.format(i.format))}else i.setValue(b().format(i.format));o("",a.type)}a&&"click"===a.type&&i.isInput&&i.widget.hasClass("picker-open")||(i.widget.hasClass("picker-open")?(i.widget.hide(),i.widget.removeClass("picker-open")):(i.widget.show(),i.widget.addClass("picker-open")),i.height=i.component?i.component.outerHeight():i.element.outerHeight(),n(),i.element.trigger({type:"dp.show",date:b(i.date)}),G(),a&&B(a))}},i.disable=function(){var a=l();a.prop("disabled")||(a.prop("disabled",!0),H())},i.enable=function(){var a=l();a.prop("disabled")&&(a.prop("disabled",!1),F())},i.hide=function(){var a,c,d=i.widget.find(".collapse");for(a=0;a<d.length;a++)if(c=d.eq(a).data("collapse"),c&&c.transitioning)return;i.widget.hide(),i.widget.removeClass("picker-open"),i.viewMode=i.startViewMode,E(),i.element.trigger({type:"dp.hide",date:b(i.date)}),I()},i.setValue=function(a){b.locale(i.options.language),a?i.unset=!1:(i.unset=!0,K()),a=b.isMoment(a)?a.locale(i.options.language):a instanceof Date?b(a):b(a,i.format,i.options.useStrict),a.isValid()?(i.date=a,K(),i.viewDate=b({y:i.date.year(),M:i.date.month()}),t(),x()):p(a)},i.getDate=function(){return i.unset?null:b(i.date)},i.setDate=function(a){var c=b(i.date);i.setValue(a?a:null),o(c,"function")},i.setDisabledDates=function(a){i.options.disabledDates=O(a),i.viewDate&&q()},i.setEnabledDates=function(a){i.options.enabledDates=O(a),i.viewDate&&q()},i.setMaxDate=function(a){void 0!==a&&(i.options.maxDate=b.isMoment(a)||a instanceof Date?b(a):b(a,i.format,i.options.useStrict),i.viewDate&&q())},i.setMinDate=function(a){void 0!==a&&(i.options.minDate=b.isMoment(a)||a instanceof Date?b(a):b(a,i.format,i.options.useStrict),i.viewDate&&q())},k()};a.fn.datetimepicker=function(b){return this.each(function(){var c=a(this),e=c.data("DateTimePicker");e||c.data("DateTimePicker",new d(this,b))})},a.fn.datetimepicker.defaults={format:!1,pickDate:!0,pickTime:!0,useMinutes:!0,useSeconds:!1,useCurrent:!0,calendarWeeks:!1,minuteStepping:1,minDate:b({y:1900}),maxDate:b().add(100,"y"),showToday:!0,collapse:!0,language:b.locale(),defaultDate:"",disabledDates:!1,enabledDates:!1,icons:{},useStrict:!1,direction:"auto",sideBySide:!1,daysOfWeekDisabled:[],widgetParent:!1}});})();
  204. (function(){
  205. /*
  206.  * Fuel UX Checkbox
  207.  * https://github.com/ExactTarget/fuelux
  208.  *
  209.  * Copyright (c) 2012 ExactTarget
  210.  * Licensed under the MIT license.
  211.  */
  212.  
  213. +function ($) { "use strict";
  214.  
  215.  
  216.     // CHECKBOX CONSTRUCTOR AND PROTOTYPE
  217.  
  218.     var Checkbox = function (element, options) {
  219.  
  220.         this.$element = $(element);
  221.         this.options = $.extend({}, $.fn.checkbox.defaults, options);
  222.  
  223.         // cache elements
  224.         this.$label = this.$element.parent();
  225.         this.$icon = this.$label.find('i');
  226.         this.$chk = this.$label.find('input[type=checkbox]');
  227.  
  228.         // set default state
  229.         this.setState(this.$chk);
  230.  
  231.         // handle events
  232.         this.$chk.on('change', $.proxy(this.itemchecked, this));
  233.     };
  234.  
  235.     Checkbox.prototype = {
  236.  
  237.         constructor: Checkbox,
  238.  
  239.         setState: function ($chk) {
  240.             var checked = $chk.is(':checked');
  241.             var disabled = $chk.is(':disabled');
  242.  
  243.             // reset classes
  244.             this.$icon.removeClass('checked').removeClass('disabled');
  245.  
  246.             // set state of checkbox
  247.             if (checked === true) {
  248.                 this.$icon.addClass('checked');
  249.             }
  250.             if (disabled === true) {
  251.                 this.$icon.addClass('disabled');
  252.             }
  253.         },
  254.  
  255.         enable: function () {
  256.             this.$chk.attr('disabled', false);
  257.             this.$icon.removeClass('disabled');
  258.         },
  259.  
  260.         disable: function () {
  261.             this.$chk.attr('disabled', true);
  262.             this.$icon.addClass('disabled');
  263.         },
  264.  
  265.         toggle: function () {
  266.             this.$chk.click();
  267.         },
  268.  
  269.         itemchecked: function (e) {
  270.             var chk = $(e.target);
  271.             this.setState(chk);
  272.         }
  273.     };
  274.  
  275.  
  276.     // CHECKBOX PLUGIN DEFINITION
  277.  
  278.     $.fn.checkbox = function (option, value) {
  279.         var methodReturn;
  280.  
  281.         var $set = this.each(function () {
  282.             var $this = $(this);
  283.             var data = $this.data('checkbox');
  284.             var options = typeof option === 'object' && option;
  285.  
  286.             if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
  287.             if (typeof option === 'string') methodReturn = data[option](value);
  288.         });
  289.  
  290.         return (methodReturn === undefined) ? $set : methodReturn;
  291.     };
  292.  
  293.     $.fn.checkbox.defaults = {};
  294.  
  295.     $.fn.checkbox.Constructor = Checkbox;
  296.  
  297.  
  298.     // CHECKBOX DATA-API
  299.  
  300.     $(function () {
  301.         $(window).on('load', function () {
  302.             //$('i.checkbox').each(function () {
  303.             $('.checkbox-custom > input[type=checkbox]').each(function () {
  304.                 var $this = $(this);
  305.                 if ($this.data('checkbox')) return;
  306.                 $this.checkbox($this.data());
  307.             });
  308.         });
  309.     });
  310.  
  311. }(window.jQuery);
  312.  
  313. /*
  314.  * Fuel UX Utilities
  315.  * https://github.com/ExactTarget/fuelux
  316.  *
  317.  * Copyright (c) 2012 ExactTarget
  318.  * Licensed under the MIT license.
  319.  */
  320.  
  321. +function ($) { "use strict";
  322.  
  323.     // custom case-insensitive match expression
  324.     function fuelTextExactCI(elem, text) {
  325.         return (elem.textContent || elem.innerText || $(elem).text() || '').toLowerCase() === (text || '').toLowerCase();
  326.     }
  327.  
  328.     $.expr[':'].fuelTextExactCI = $.expr.createPseudo ?
  329.         $.expr.createPseudo(function (text) {
  330.             return function (elem) {
  331.                 return fuelTextExactCI(elem, text);
  332.             };
  333.         }) :
  334.         function (elem, i, match) {
  335.             return fuelTextExactCI(elem, match[3]);
  336.         };
  337.  
  338. }(window.jQuery);
  339. /*
  340.  * Fuel UX Combobox
  341.  * https://github.com/ExactTarget/fuelux
  342.  *
  343.  * Copyright (c) 2012 ExactTarget
  344.  * Licensed under the MIT license.
  345.  */
  346.  
  347. +function ($) { "use strict";
  348.  
  349.     // COMBOBOX CONSTRUCTOR AND PROTOTYPE
  350.  
  351.     var Combobox = function (element, options) {
  352.         this.$element = $(element);
  353.         this.options = $.extend({}, $.fn.combobox.defaults, options);
  354.         this.$element.on('click', 'a', $.proxy(this.itemclicked, this));
  355.         this.$element.on('change', 'input', $.proxy(this.inputchanged, this));
  356.         this.$input = this.$element.find('input');
  357.         this.$button = this.$element.find('.btn');
  358.  
  359.         // set default selection
  360.         this.setDefaultSelection();
  361.     };
  362.  
  363.     Combobox.prototype = {
  364.  
  365.         constructor: Combobox,
  366.  
  367.         selectedItem: function () {
  368.             var item = this.$selectedItem;
  369.             var data = {};
  370.  
  371.             if (item) {
  372.                 var txt = this.$selectedItem.text();
  373.                 data = $.extend({ text: txt }, this.$selectedItem.data());
  374.             }
  375.             else {
  376.                 data = { text: this.$input.val()};
  377.             }
  378.  
  379.             return data;
  380.         },
  381.  
  382.         selectByText: function (text) {
  383.             var selector = 'li:fuelTextExactCI(' + text + ')';
  384.             this.selectBySelector(selector);
  385.         },
  386.  
  387.         selectByValue: function (value) {
  388.             var selector = 'li[data-value="' + value + '"]';
  389.             this.selectBySelector(selector);
  390.         },
  391.  
  392.         selectByIndex: function (index) {
  393.             // zero-based index
  394.             var selector = 'li:eq(' + index + ')';
  395.             this.selectBySelector(selector);
  396.         },
  397.  
  398.         selectBySelector: function (selector) {
  399.             var $item = this.$element.find(selector);
  400.  
  401.             if (typeof $item[0] !== 'undefined') {
  402.                 this.$selectedItem = $item;
  403.                 this.$input.val(this.$selectedItem.text());
  404.             }
  405.             else {
  406.                 this.$selectedItem = null;
  407.             }
  408.         },
  409.  
  410.         setDefaultSelection: function () {
  411.             var selector = 'li[data-selected=true]:first';
  412.             var item = this.$element.find(selector);
  413.  
  414.             if (item.length > 0) {
  415.                 // select by data-attribute
  416.                 this.selectBySelector(selector);
  417.                 item.removeData('selected');
  418.                 item.removeAttr('data-selected');
  419.             }
  420.         },
  421.  
  422.         enable: function () {
  423.             this.$input.removeAttr('disabled');
  424.             this.$button.removeClass('disabled');
  425.         },
  426.  
  427.         disable: function () {
  428.             this.$input.attr('disabled', true);
  429.             this.$button.addClass('disabled');
  430.         },
  431.  
  432.         itemclicked: function (e) {
  433.             this.$selectedItem = $(e.target).parent();
  434.  
  435.             // set input text and trigger input change event marked as synthetic
  436.             this.$input.val(this.$selectedItem.text()).trigger('change', { synthetic: true });
  437.  
  438.             // pass object including text and any data-attributes
  439.             // to onchange event
  440.             var data = this.selectedItem();
  441.  
  442.             // trigger changed event
  443.             this.$element.trigger('changed', data);
  444.  
  445.             e.preventDefault();
  446.         },
  447.  
  448.         inputchanged: function (e, extra) {
  449.  
  450.             // skip processing for internally-generated synthetic event
  451.             // to avoid double processing
  452.             if (extra && extra.synthetic) return;
  453.  
  454.             var val = $(e.target).val();
  455.             this.selectByText(val);
  456.  
  457.             // find match based on input
  458.             // if no match, pass the input value
  459.             var data = this.selectedItem();
  460.             if (data.text.length === 0) {
  461.                 data = { text: val };
  462.             }
  463.  
  464.             // trigger changed event
  465.             this.$element.trigger('changed', data);
  466.  
  467.         }
  468.  
  469.     };
  470.  
  471.  
  472.     // COMBOBOX PLUGIN DEFINITION
  473.  
  474.     $.fn.combobox = function (option, value) {
  475.         var methodReturn;
  476.  
  477.         var $set = this.each(function () {
  478.             var $this = $(this);
  479.             var data = $this.data('combobox');
  480.             var options = typeof option === 'object' && option;
  481.  
  482.             if (!data) $this.data('combobox', (data = new Combobox(this, options)));
  483.             if (typeof option === 'string') methodReturn = data[option](value);
  484.         });
  485.  
  486.         return (methodReturn === undefined) ? $set : methodReturn;
  487.     };
  488.  
  489.     $.fn.combobox.defaults = {};
  490.  
  491.     $.fn.combobox.Constructor = Combobox;
  492.  
  493.  
  494.     // COMBOBOX DATA-API
  495.  
  496.     $(function () {
  497.  
  498.         $(window).on('load', function () {
  499.             $('.combobox').each(function () {
  500.                 var $this = $(this);
  501.                 if ($this.data('combobox')) return;
  502.                 $this.combobox($this.data());
  503.             });
  504.         });
  505.  
  506.         $('body').on('mousedown.combobox.data-api', '.combobox', function (e) {
  507.             var $this = $(this);
  508.             if ($this.data('combobox')) return;
  509.             $this.combobox($this.data());
  510.         });
  511.     });
  512.  
  513. }(window.jQuery);
  514.  
  515. /*
  516.  * Fuel UX Datagrid
  517.  * https://github.com/ExactTarget/fuelux
  518.  *
  519.  * Copyright (c) 2012 ExactTarget
  520.  * Licensed under the MIT license.
  521.  */
  522.  
  523. +function ($) { "use strict";
  524.  
  525.     // Relates to thead .sorted styles in datagrid.less
  526.     var SORTED_HEADER_OFFSET = 22;
  527.  
  528.     // DATAGRID CONSTRUCTOR AND PROTOTYPE
  529.  
  530.     var Datagrid = function (element, options) {
  531.         this.$element = $(element);
  532.         this.$thead = this.$element.find('thead');
  533.         this.$tfoot = this.$element.find('tfoot');
  534.         this.$footer = this.$element.find('tfoot th');
  535.         this.$footerchildren = this.$footer.children().show().css('visibility', 'hidden');
  536.         this.$topheader = this.$element.find('thead th');
  537.         this.$searchcontrol = this.$element.find('.datagrid-search');
  538.         this.$filtercontrol = this.$element.find('.filter');
  539.         this.$pagesize = this.$element.find('.grid-pagesize');
  540.         this.$pageinput = this.$element.find('.grid-pager input');
  541.         this.$pagedropdown = this.$element.find('.grid-pager .dropdown-menu');
  542.         this.$prevpagebtn = this.$element.find('.grid-prevpage');
  543.         this.$nextpagebtn = this.$element.find('.grid-nextpage');
  544.         this.$pageslabel = this.$element.find('.grid-pages');
  545.         this.$countlabel = this.$element.find('.grid-count');
  546.         this.$startlabel = this.$element.find('.grid-start');
  547.         this.$endlabel = this.$element.find('.grid-end');
  548.  
  549.         this.$tbody = $('<tbody>').insertAfter(this.$thead);
  550.         this.$colheader = $('<tr>').appendTo(this.$thead);
  551.  
  552.         this.options = $.extend(true, {}, $.fn.datagrid.defaults, options);
  553.  
  554.         // Shim until v3 -- account for FuelUX select or native select for page size:
  555.         if (this.$pagesize.hasClass('select')) {
  556.             this.options.dataOptions.pageSize = parseInt(this.$pagesize.select('selectedItem').value, 10);
  557.         } else {
  558.             this.options.dataOptions.pageSize = parseInt(this.$pagesize.val(), 10);
  559.         }
  560.  
  561.         // Shim until v3 -- account for older search class:
  562.         if (this.$searchcontrol.length <= 0) {
  563.             this.$searchcontrol = this.$element.find('.search');
  564.         }
  565.  
  566.         this.columns = this.options.dataSource.columns();
  567.  
  568.         this.$nextpagebtn.on('click', $.proxy(this.next, this));
  569.         this.$prevpagebtn.on('click', $.proxy(this.previous, this));
  570.         this.$searchcontrol.on('searched cleared', $.proxy(this.searchChanged, this));
  571.         this.$filtercontrol.on('changed', $.proxy(this.filterChanged, this));
  572.         this.$colheader.on('click', 'th', $.proxy(this.headerClicked, this));
  573.  
  574.         if(this.$pagesize.hasClass('select')) {
  575.             this.$pagesize.on('changed', $.proxy(this.pagesizeChanged, this));
  576.         } else {
  577.             this.$pagesize.on('change', $.proxy(this.pagesizeChanged, this));
  578.         }
  579.  
  580.         this.$pageinput.on('change', $.proxy(this.pageChanged, this));
  581.  
  582.         this.renderColumns();
  583.  
  584.         if (this.options.stretchHeight) this.initStretchHeight();
  585.  
  586.         this.renderData();
  587.     };
  588.  
  589.     Datagrid.prototype = {
  590.  
  591.         constructor: Datagrid,
  592.  
  593.         renderColumns: function () {
  594.             var self = this;
  595.  
  596.             this.$footer.attr('colspan', this.columns.length);
  597.             this.$topheader.attr('colspan', this.columns.length);
  598.  
  599.             var colHTML = '';
  600.  
  601.             $.each(this.columns, function (index, column) {
  602.                 colHTML += '<th data-property="' + column.property + '"';
  603.                 if (column.sortable) colHTML += ' class="sortable"';
  604.                 colHTML += '>' + column.label + '</th>';
  605.             });
  606.  
  607.             self.$colheader.append(colHTML);
  608.         },
  609.  
  610.         updateColumns: function ($target, direction) {
  611.             this._updateColumns(this.$colheader, $target, direction);
  612.  
  613.             if (this.$sizingHeader) {
  614.                 this._updateColumns(this.$sizingHeader, this.$sizingHeader.find('th').eq($target.index()), direction);
  615.             }
  616.         },
  617.  
  618.         _updateColumns: function ($header, $target, direction) {
  619.             var className = (direction === 'asc') ? 'fa fa-caret-up' : 'fa fa-caret-down';
  620.             $header.find('i.datagrid-sort').remove();
  621.             $header.find('th').removeClass('sorted');
  622.             $('<i>').addClass(className + ' datagrid-sort').appendTo($target);
  623.             $target.addClass('sorted');
  624.         },
  625.  
  626.         updatePageDropdown: function (data) {
  627.             var pageHTML = '';
  628.  
  629.             for (var i = 1; i <= data.pages; i++) {
  630.                 pageHTML += '<li><a>' + i + '</a></li>';
  631.             }
  632.  
  633.             this.$pagedropdown.html(pageHTML);
  634.         },
  635.  
  636.         updatePageButtons: function (data) {
  637.             if (data.page === 1) {
  638.                 this.$prevpagebtn.attr('disabled', 'disabled');
  639.             } else {
  640.                 this.$prevpagebtn.removeAttr('disabled');
  641.             }
  642.  
  643.             if (data.page === data.pages) {
  644.                 this.$nextpagebtn.attr('disabled', 'disabled');
  645.             } else {
  646.                 this.$nextpagebtn.removeAttr('disabled');
  647.             }
  648.         },
  649.  
  650.         renderData: function () {
  651.             var self = this;
  652.  
  653.             this.$tbody.html(this.placeholderRowHTML(this.options.loadingHTML));
  654.  
  655.             this.options.dataSource.data(this.options.dataOptions, function (data) {
  656.                 var itemdesc = (data.count === 1) ? self.options.itemText : self.options.itemsText;
  657.                 var rowHTML = '';
  658.  
  659.                 self.$footerchildren.css('visibility', function () {
  660.                     return (data.count > 0) ? 'visible' : 'hidden';
  661.                 });
  662.  
  663.                 self.$pageinput.val(data.page);
  664.                 self.$pageslabel.text(data.pages);
  665.                 self.$countlabel.text(data.count + ' ' + itemdesc);
  666.                 self.$startlabel.text(data.start);
  667.                 self.$endlabel.text(data.end);
  668.  
  669.                 self.updatePageDropdown(data);
  670.                 self.updatePageButtons(data);
  671.  
  672.                 $.each(data.data, function (index, row) {
  673.                     rowHTML += '<tr>';
  674.                     $.each(self.columns, function (index, column) {
  675.                         rowHTML += '<td>' + row[column.property] + '</td>';
  676.                     });
  677.                     rowHTML += '</tr>';
  678.                 });
  679.  
  680.                 if (!rowHTML) rowHTML = self.placeholderRowHTML('0 ' + self.options.itemsText);
  681.  
  682.                 self.$tbody.html(rowHTML);
  683.                 self.stretchHeight();
  684.  
  685.                 self.$element.trigger('loaded');
  686.             });
  687.  
  688.         },
  689.  
  690.         placeholderRowHTML: function (content) {
  691.             return '<tr><td style="text-align:center;padding:20px;border-bottom:none;" colspan="' +
  692.                 this.columns.length + '">' + content + '</td></tr>';
  693.         },
  694.  
  695.         headerClicked: function (e) {
  696.             var $target = $(e.target);
  697.             if (!$target.hasClass('sortable')) return;
  698.  
  699.             var direction = this.options.dataOptions.sortDirection;
  700.             var sort = this.options.dataOptions.sortProperty;
  701.             var property = $target.data('property');
  702.  
  703.             if (sort === property) {
  704.                 this.options.dataOptions.sortDirection = (direction === 'asc') ? 'desc' : 'asc';
  705.             } else {
  706.                 this.options.dataOptions.sortDirection = 'asc';
  707.                 this.options.dataOptions.sortProperty = property;
  708.             }
  709.  
  710.             this.options.dataOptions.pageIndex = 0;
  711.             this.updateColumns($target, this.options.dataOptions.sortDirection);
  712.             this.renderData();
  713.         },
  714.  
  715.         pagesizeChanged: function (e, pageSize) {
  716.             if(pageSize) {
  717.                 this.options.dataOptions.pageSize = parseInt(pageSize.value, 10);
  718.             } else {
  719.                 this.options.dataOptions.pageSize = parseInt($(e.target).val(), 10);
  720.             }
  721.  
  722.             this.options.dataOptions.pageIndex = 0;
  723.             this.renderData();
  724.         },
  725.  
  726.         pageChanged: function (e) {
  727.             var pageRequested = parseInt($(e.target).val(), 10);
  728.             pageRequested = (isNaN(pageRequested)) ? 1 : pageRequested;
  729.             var maxPages = this.$pageslabel.text();
  730.        
  731.             this.options.dataOptions.pageIndex =
  732.                 (pageRequested > maxPages) ? maxPages - 1 : pageRequested - 1;
  733.  
  734.             this.renderData();
  735.         },
  736.  
  737.         searchChanged: function (e, search) {
  738.             this.options.dataOptions.search = search;
  739.             this.options.dataOptions.pageIndex = 0;
  740.             this.renderData();
  741.         },
  742.  
  743.         filterChanged: function (e, filter) {
  744.             this.options.dataOptions.filter = filter;
  745.             this.options.dataOptions.pageIndex = 0;
  746.             this.renderData();
  747.         },
  748.  
  749.         previous: function () {
  750.             this.options.dataOptions.pageIndex--;
  751.             this.renderData();
  752.         },
  753.  
  754.         next: function () {
  755.             this.options.dataOptions.pageIndex++;
  756.             this.renderData();
  757.         },
  758.  
  759.         reload: function () {
  760.             this.options.dataOptions.pageIndex = 0;
  761.             this.renderData();
  762.         },
  763.  
  764.         initStretchHeight: function () {
  765.             this.$gridContainer = this.$element.parent();
  766.  
  767.             this.$element.wrap('<div class="datagrid-stretch-wrapper">');
  768.             this.$stretchWrapper = this.$element.parent();
  769.  
  770.             this.$headerTable = $('<table>').attr('class', this.$element.attr('class'));
  771.             this.$footerTable = this.$headerTable.clone();
  772.  
  773.             this.$headerTable.prependTo(this.$gridContainer).addClass('datagrid-stretch-header');
  774.             this.$thead.detach().appendTo(this.$headerTable);
  775.  
  776.             this.$sizingHeader = this.$thead.clone();
  777.             this.$sizingHeader.find('tr:first').remove();
  778.  
  779.             this.$footerTable.appendTo(this.$gridContainer).addClass('datagrid-stretch-footer');
  780.             this.$tfoot.detach().appendTo(this.$footerTable);
  781.         },
  782.  
  783.         stretchHeight: function () {
  784.             if (!this.$gridContainer) return;
  785.  
  786.             this.setColumnWidths();
  787.  
  788.             var targetHeight = this.$gridContainer.height();
  789.             var headerHeight = this.$headerTable.outerHeight();
  790.             var footerHeight = this.$footerTable.outerHeight();
  791.             var overhead = headerHeight + footerHeight;
  792.  
  793.             this.$stretchWrapper.height(targetHeight - overhead);
  794.         },
  795.  
  796.         setColumnWidths: function () {
  797.             if (!this.$sizingHeader) return;
  798.  
  799.             this.$element.prepend(this.$sizingHeader);
  800.  
  801.             var $sizingCells = this.$sizingHeader.find('th');
  802.             var columnCount = $sizingCells.length;
  803.  
  804.             function matchSizingCellWidth(i, el) {
  805.                 if (i === columnCount - 1) return;
  806.  
  807.                 var $el = $(el);
  808.                 var $sourceCell = $sizingCells.eq(i);
  809.                 var width = $sourceCell.width();
  810.  
  811.                 // TD needs extra width to match sorted column header
  812.                 if ($sourceCell.hasClass('sorted') && $el.prop('tagName') === 'TD') width = width + SORTED_HEADER_OFFSET;
  813.  
  814.                 $el.width(width);
  815.             }
  816.  
  817.             this.$colheader.find('th').each(matchSizingCellWidth);
  818.             this.$tbody.find('tr:first > td').each(matchSizingCellWidth);
  819.  
  820.             this.$sizingHeader.detach();
  821.         }
  822.     };
  823.  
  824.  
  825.     // DATAGRID PLUGIN DEFINITION
  826.  
  827.     $.fn.datagrid = function (option) {
  828.         return this.each(function () {
  829.             var $this = $(this);
  830.             var data = $this.data('datagrid');
  831.             var options = typeof option === 'object' && option;
  832.  
  833.             if (!data) $this.data('datagrid', (data = new Datagrid(this, options)));
  834.             if (typeof option === 'string') data[option]();
  835.         });
  836.     };
  837.  
  838.     $.fn.datagrid.defaults = {
  839.         dataOptions: { pageIndex: 0, pageSize: 10 },
  840.         loadingHTML: '<div class="progress progress-striped active" style="width:50%;margin:auto;"><div class="bar" style="width:100%;"></div></div>',
  841.         itemsText: 'items',
  842.         itemText: 'item'
  843.     };
  844.  
  845.     $.fn.datagrid.Constructor = Datagrid;
  846.  
  847. }(window.jQuery);
  848.  
  849. /*
  850.  * Fuel UX Pillbox
  851.  * https://github.com/ExactTarget/fuelux
  852.  *
  853.  * Copyright (c) 2012 ExactTarget
  854.  * Licensed under the MIT license.
  855.  */
  856.  
  857. +function ($) { "use strict";
  858.    
  859.     // PILLBOX CONSTRUCTOR AND PROTOTYPE
  860.  
  861.     var Pillbox = function (element, options) {
  862.         this.$element = $(element);
  863.         this.options = $.extend({}, $.fn.pillbox.defaults, options);
  864.         this.$element.on('click', 'li', $.proxy(this.itemclicked, this));
  865.     };
  866.  
  867.     Pillbox.prototype = {
  868.         constructor: Pillbox,
  869.  
  870.         items: function() {
  871.             return this.$element.find('li').map(function() {
  872.                 var $this = $(this);
  873.                 return $.extend({ text: $this.text() }, $this.data());
  874.             }).get();
  875.         },
  876.  
  877.         itemclicked: function (e) {
  878.             $(e.currentTarget).remove();
  879.             e.preventDefault();
  880.         }
  881.     };
  882.  
  883.  
  884.     // PILLBOX PLUGIN DEFINITION
  885.  
  886.     $.fn.pillbox = function (option) {
  887.         var methodReturn;
  888.  
  889.         var $set = this.each(function () {
  890.             var $this = $(this);
  891.             var data = $this.data('pillbox');
  892.             var options = typeof option === 'object' && option;
  893.  
  894.             if (!data) $this.data('pillbox', (data = new Pillbox(this, options)));
  895.             if (typeof option === 'string') methodReturn = data[option]();
  896.         });
  897.  
  898.         return (methodReturn === undefined) ? $set : methodReturn;
  899.     };
  900.  
  901.     $.fn.pillbox.defaults = {};
  902.  
  903.     $.fn.pillbox.Constructor = Pillbox;
  904.  
  905.  
  906.     // PILLBOX DATA-API
  907.  
  908.     $(function () {
  909.         $('body').on('mousedown.pillbox.data-api', '.pillbox', function (e) {
  910.             var $this = $(this);
  911.             if ($this.data('pillbox')) return;
  912.             $this.pillbox($this.data());
  913.         });
  914.     });
  915.    
  916. }(window.jQuery);
  917.  
  918.  
  919. /*
  920.  * Fuel UX Radio
  921.  * https://github.com/ExactTarget/fuelux
  922.  *
  923.  * Copyright (c) 2012 ExactTarget
  924.  * Licensed under the MIT license.
  925.  */
  926.  
  927. +function ($) { "use strict";
  928.  
  929.     // RADIO CONSTRUCTOR AND PROTOTYPE
  930.  
  931.     var Radio = function (element, options) {
  932.         this.$element = $(element);
  933.         this.options = $.extend({}, $.fn.radio.defaults, options);
  934.  
  935.         // cache elements
  936.         this.$label = this.$element.parent();
  937.         this.$icon = this.$label.find('i');
  938.         this.$radio = this.$label.find('input[type=radio]');
  939.         this.groupName = this.$radio.attr('name');
  940.  
  941.         // set default state
  942.         this.setState(this.$radio);
  943.  
  944.         // handle events
  945.         this.$radio.on('change', $.proxy(this.itemchecked, this));
  946.     };
  947.  
  948.     Radio.prototype = {
  949.  
  950.         constructor: Radio,
  951.  
  952.         setState: function ($radio, resetGroupState) {
  953.             var checked = $radio.is(':checked');
  954.             var disabled = $radio.is(':disabled');
  955.  
  956.             // set state of radio
  957.             if (checked === true) {
  958.                 this.$icon.addClass('checked');
  959.             }
  960.             if (disabled === true) {
  961.                 this.$icon.addClass('disabled');
  962.             }
  963.         },
  964.  
  965.         resetGroup: function () {
  966.             // reset all radio buttons in group
  967.             $('input[name=' + this.groupName + ']').next().removeClass('checked');
  968.         },
  969.  
  970.         enable: function () {
  971.             this.$radio.attr('disabled', false);
  972.             this.$icon.removeClass('disabled');
  973.         },
  974.  
  975.         disable: function () {
  976.             this.$radio.attr('disabled', true);
  977.             this.$icon.addClass('disabled');
  978.         },
  979.  
  980.         itemchecked: function (e) {
  981.             var radio = $(e.target);
  982.  
  983.             this.resetGroup();
  984.             this.setState(radio);
  985.         }
  986.     };
  987.  
  988.  
  989.     // RADIO PLUGIN DEFINITION
  990.  
  991.     $.fn.radio = function (option, value) {
  992.         var methodReturn;
  993.  
  994.         var $set = this.each(function () {
  995.             var $this = $(this);
  996.             var data = $this.data('radio');
  997.             var options = typeof option === 'object' && option;
  998.  
  999.             if (!data) $this.data('radio', (data = new Radio(this, options)));
  1000.             if (typeof option === 'string') methodReturn = data[option](value);
  1001.         });
  1002.  
  1003.         return (methodReturn === undefined) ? $set : methodReturn;
  1004.     };
  1005.  
  1006.     $.fn.radio.defaults = {};
  1007.  
  1008.     $.fn.radio.Constructor = Radio;
  1009.  
  1010.  
  1011.     // RADIO DATA-API
  1012.  
  1013.     $(function () {
  1014.         $(window).on('load', function () {
  1015.             //$('i.radio').each(function () {
  1016.             $('.radio-custom > input[type=radio]').each(function () {
  1017.                 var $this = $(this);
  1018.                 if ($this.data('radio')) return;
  1019.                 $this.radio($this.data());
  1020.             });
  1021.         });
  1022.     });
  1023.  
  1024. }(window.jQuery);
  1025.  
  1026. /*
  1027.  * Fuel UX Search
  1028.  * https://github.com/ExactTarget/fuelux
  1029.  *
  1030.  * Copyright (c) 2012 ExactTarget
  1031.  * Licensed under the MIT license.
  1032.  */
  1033.  
  1034. +function ($) { "use strict";
  1035.  
  1036.     // SEARCH CONSTRUCTOR AND PROTOTYPE
  1037.  
  1038.     var Search = function (element, options) {
  1039.         this.$element = $(element);
  1040.         this.options = $.extend({}, $.fn.search.defaults, options);
  1041.  
  1042.         this.$button = this.$element.find('button')
  1043.             .on('click', $.proxy(this.buttonclicked, this));
  1044.  
  1045.         this.$input = this.$element.find('input')
  1046.             .on('keydown', $.proxy(this.keypress, this))
  1047.             .on('keyup', $.proxy(this.keypressed, this));
  1048.  
  1049.         this.$icon = this.$element.find('i');
  1050.         this.activeSearch = '';
  1051.     };
  1052.  
  1053.     Search.prototype = {
  1054.  
  1055.         constructor: Search,
  1056.  
  1057.         search: function (searchText) {
  1058.             this.$icon.attr('class', 'icon-remove');
  1059.             this.activeSearch = searchText;
  1060.             this.$element.trigger('searched', searchText);
  1061.         },
  1062.  
  1063.         clear: function () {
  1064.             this.$icon.attr('class', 'icon-search');
  1065.             this.activeSearch = '';
  1066.             this.$input.val('');
  1067.             this.$element.trigger('cleared');
  1068.         },
  1069.  
  1070.         action: function () {
  1071.             var val = this.$input.val();
  1072.             var inputEmptyOrUnchanged = val === '' || val === this.activeSearch;
  1073.  
  1074.             if (this.activeSearch && inputEmptyOrUnchanged) {
  1075.                 this.clear();
  1076.             } else if (val) {
  1077.                 this.search(val);
  1078.             }
  1079.         },
  1080.  
  1081.         buttonclicked: function (e) {
  1082.             e.preventDefault();
  1083.             if ($(e.currentTarget).is('.disabled, :disabled')) return;
  1084.             this.action();
  1085.         },
  1086.  
  1087.         keypress: function (e) {
  1088.             if (e.which === 13) {
  1089.                 e.preventDefault();
  1090.             }
  1091.         },
  1092.  
  1093.         keypressed: function (e) {
  1094.             var val, inputPresentAndUnchanged;
  1095.  
  1096.             if (e.which === 13) {
  1097.                 e.preventDefault();
  1098.                 this.action();
  1099.             } else {
  1100.                 val = this.$input.val();
  1101.                 inputPresentAndUnchanged = val && (val === this.activeSearch);
  1102.                 this.$icon.attr('class', inputPresentAndUnchanged ? 'icon-remove' : 'icon-search');
  1103.             }
  1104.         },
  1105.  
  1106.         disable: function () {
  1107.             this.$input.attr('disabled', 'disabled');
  1108.             this.$button.addClass('disabled');
  1109.         },
  1110.  
  1111.         enable: function () {
  1112.             this.$input.removeAttr('disabled');
  1113.             this.$button.removeClass('disabled');
  1114.         }
  1115.  
  1116.     };
  1117.  
  1118.  
  1119.     // SEARCH PLUGIN DEFINITION
  1120.  
  1121.     $.fn.search = function (option) {
  1122.         return this.each(function () {
  1123.             var $this = $(this);
  1124.             var data = $this.data('search');
  1125.             var options = typeof option === 'object' && option;
  1126.  
  1127.             if (!data) $this.data('search', (data = new Search(this, options)));
  1128.             if (typeof option === 'string') data[option]();
  1129.         });
  1130.     };
  1131.  
  1132.     $.fn.search.defaults = {};
  1133.  
  1134.     $.fn.search.Constructor = Search;
  1135.  
  1136.  
  1137.     // SEARCH DATA-API
  1138.  
  1139.     $(function () {
  1140.         $('body').on('mousedown.search.data-api', '.search', function () {
  1141.             var $this = $(this);
  1142.             if ($this.data('search')) return;
  1143.             $this.search($this.data());
  1144.         });
  1145.     });
  1146.  
  1147. }(window.jQuery);
  1148.  
  1149. /*
  1150.  * Fuel UX Spinner
  1151.  * https://github.com/ExactTarget/fuelux
  1152.  *
  1153.  * Copyright (c) 2012 ExactTarget
  1154.  * Licensed under the MIT license.
  1155.  */
  1156.  
  1157. +function ($) { "use strict";
  1158.  
  1159.     // SPINNER CONSTRUCTOR AND PROTOTYPE
  1160.  
  1161.     var Spinner = function (element, options) {
  1162.         this.$element = $(element);
  1163.         this.options = $.extend({}, $.fn.spinner.defaults, options);
  1164.         this.$input = this.$element.find('.spinner-input');
  1165.         this.$element.on('keyup', this.$input, $.proxy(this.change, this));
  1166.  
  1167.         if (this.options.hold) {
  1168.             this.$element.on('mousedown', '.spinner-up', $.proxy(function() { this.startSpin(true); } , this));
  1169.             this.$element.on('mouseup', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));
  1170.             this.$element.on('mouseout', '.spinner-up, .spinner-down', $.proxy(this.stopSpin, this));
  1171.             this.$element.on('mousedown', '.spinner-down', $.proxy(function() {this.startSpin(false);} , this));
  1172.         } else {
  1173.             this.$element.on('click', '.spinner-up', $.proxy(function() { this.step(true); } , this));
  1174.             this.$element.on('click', '.spinner-down', $.proxy(function() { this.step(false); }, this));
  1175.         }
  1176.  
  1177.         this.switches = {
  1178.             count: 1,
  1179.             enabled: true
  1180.         };
  1181.  
  1182.         if (this.options.speed === 'medium') {
  1183.             this.switches.speed = 300;
  1184.         } else if (this.options.speed === 'fast') {
  1185.             this.switches.speed = 100;
  1186.         } else {
  1187.             this.switches.speed = 500;
  1188.         }
  1189.  
  1190.         this.lastValue = null;
  1191.  
  1192.         this.render();
  1193.  
  1194.         if (this.options.disabled) {
  1195.             this.disable();
  1196.         }
  1197.     };
  1198.  
  1199.     Spinner.prototype = {
  1200.         constructor: Spinner,
  1201.  
  1202.         render: function () {
  1203.             this.$input.val(this.options.value);
  1204.             this.$input.attr('maxlength',(this.options.max + '').split('').length);
  1205.         },
  1206.  
  1207.         change: function () {
  1208.             var newVal = this.$input.val();
  1209.  
  1210.             if(newVal/1){
  1211.                 this.options.value = newVal/1;
  1212.             }else{
  1213.                 newVal = newVal.replace(/[^0-9]/g,'');
  1214.                 this.$input.val(newVal);
  1215.                 this.options.value = newVal/1;
  1216.             }
  1217.  
  1218.             this.triggerChangedEvent();
  1219.         },
  1220.  
  1221.         stopSpin: function () {
  1222.             clearTimeout(this.switches.timeout);
  1223.             this.switches.count = 1;
  1224.             this.triggerChangedEvent();
  1225.         },
  1226.  
  1227.         triggerChangedEvent: function () {
  1228.             var currentValue = this.value();
  1229.             if (currentValue === this.lastValue) return;
  1230.  
  1231.             this.lastValue = currentValue;
  1232.  
  1233.             // Primary changed event
  1234.             this.$element.trigger('changed', currentValue);
  1235.  
  1236.             // Undocumented, kept for backward compatibility
  1237.             this.$element.trigger('change');
  1238.         },
  1239.  
  1240.         startSpin: function (type) {
  1241.  
  1242.             if (!this.options.disabled) {
  1243.                 var divisor = this.switches.count;
  1244.  
  1245.                 if (divisor === 1) {
  1246.                     this.step(type);
  1247.                     divisor = 1;
  1248.                 } else if (divisor < 3){
  1249.                     divisor = 1.5;
  1250.                 } else if (divisor < 8){
  1251.                     divisor = 2.5;
  1252.                 } else {
  1253.                     divisor = 4;
  1254.                 }
  1255.  
  1256.                 this.switches.timeout = setTimeout($.proxy(function() {this.iterator(type);} ,this),this.switches.speed/divisor);
  1257.                 this.switches.count++;
  1258.             }
  1259.         },
  1260.  
  1261.         iterator: function (type) {
  1262.             this.step(type);
  1263.             this.startSpin(type);
  1264.         },
  1265.  
  1266.         step: function (dir) {
  1267.             var curValue = this.options.value;
  1268.             var limValue = dir ? this.options.max : this.options.min;
  1269.  
  1270.             if ((dir ? curValue < limValue : curValue > limValue)) {
  1271.                 var newVal = curValue + (dir ? 1 : -1) * this.options.step;
  1272.  
  1273.                 if (dir ? newVal > limValue : newVal < limValue) {
  1274.                     this.value(limValue);
  1275.                 } else {
  1276.                     this.value(newVal);
  1277.                 }
  1278.             }
  1279.         },
  1280.  
  1281.         value: function (value) {
  1282.             if (!isNaN(parseFloat(value)) && isFinite(value)) {
  1283.                 value = parseFloat(value);
  1284.                 this.options.value = value;
  1285.                 this.$input.val(value);
  1286.                 return this;
  1287.             } else {
  1288.                 return this.options.value;
  1289.             }
  1290.         },
  1291.  
  1292.         disable: function () {
  1293.             this.options.disabled = true;
  1294.             this.$input.attr('disabled','');
  1295.             this.$element.find('button').addClass('disabled');
  1296.         },
  1297.  
  1298.         enable: function () {
  1299.             this.options.disabled = false;
  1300.             this.$input.removeAttr("disabled");
  1301.             this.$element.find('button').removeClass('disabled');
  1302.         }
  1303.     };
  1304.  
  1305.  
  1306.     // SPINNER PLUGIN DEFINITION
  1307.  
  1308.     $.fn.spinner = function (option,value) {
  1309.         var methodReturn;
  1310.  
  1311.         var $set = this.each(function () {
  1312.             var $this = $(this);
  1313.             var data = $this.data('spinner');
  1314.             var options = typeof option === 'object' && option;
  1315.  
  1316.             if (!data) $this.data('spinner', (data = new Spinner(this, options)));
  1317.             if (typeof option === 'string') methodReturn = data[option](value);
  1318.         });
  1319.  
  1320.         return (methodReturn === undefined) ? $set : methodReturn;
  1321.     };
  1322.  
  1323.     $.fn.spinner.defaults = {
  1324.         value: 1,
  1325.         min: 1,
  1326.         max: 999,
  1327.         step: 1,
  1328.         hold: true,
  1329.         speed: 'medium',
  1330.         disabled: false
  1331.     };
  1332.  
  1333.     $.fn.spinner.Constructor = Spinner;
  1334.  
  1335.  
  1336.     // SPINNER DATA-API
  1337.  
  1338.     $(function () {
  1339.         $('body').on('mousedown.spinner.data-api', '.spinner', function (e) {
  1340.             var $this = $(this);
  1341.             if ($this.data('spinner')) return;
  1342.             $this.spinner($this.data());
  1343.         });
  1344.     });
  1345.  
  1346. }(window.jQuery);
  1347.  
  1348. /*
  1349.  * Fuel UX Select
  1350.  * https://github.com/ExactTarget/fuelux
  1351.  *
  1352.  * Copyright (c) 2012 ExactTarget
  1353.  * Licensed under the MIT license.
  1354.  */
  1355.  
  1356. +function ($) { "use strict";
  1357.  
  1358.     // SELECT CONSTRUCTOR AND PROTOTYPE
  1359.  
  1360.     var Select = function (element, options) {
  1361.         this.$element = $(element);
  1362.         this.options = $.extend({}, $.fn.select.defaults, options);
  1363.         this.$element.on('click', 'a', $.proxy(this.itemclicked, this));
  1364.         this.$button = this.$element.find('.btn');
  1365.         this.$label = this.$element.find('.dropdown-label');
  1366.         this.setDefaultSelection();
  1367.  
  1368.         if (options.resize === 'auto') {
  1369.             this.resize();
  1370.         }
  1371.     };
  1372.  
  1373.     Select.prototype = {
  1374.  
  1375.         constructor: Select,
  1376.  
  1377.         itemclicked: function (e) {
  1378.             this.$selectedItem = $(e.target).parent();
  1379.             this.$label.text(this.$selectedItem.text());
  1380.  
  1381.             // pass object including text and any data-attributes
  1382.             // to onchange event
  1383.             var data = this.selectedItem();
  1384.  
  1385.             // trigger changed event
  1386.             this.$element.trigger('changed', data);
  1387.  
  1388.             e.preventDefault();
  1389.         },
  1390.  
  1391.         resize: function() {
  1392.             var el = $('#selectTextSize')[0];
  1393.  
  1394.             // create element if it doesn't exist
  1395.             // used to calculate the length of the longest string
  1396.             if(!el) {
  1397.                 $('<div/>').attr({id:'selectTextSize'}).appendTo('body');
  1398.             }
  1399.  
  1400.             var width = 0;
  1401.             var newWidth = 0;
  1402.  
  1403.             // iterate through each item to find longest string
  1404.             this.$element.find('a').each(function () {
  1405.                 var $this = $(this);
  1406.                 var txt = $this.text();
  1407.                 var $txtSize = $('#selectTextSize');
  1408.                 $txtSize.text(txt);
  1409.                 newWidth = $txtSize.outerWidth();
  1410.                 if(newWidth > width) {
  1411.                     width = newWidth;
  1412.                 }
  1413.             });
  1414.  
  1415.             this.$label.width(width);
  1416.         },
  1417.  
  1418.         selectedItem: function() {
  1419.             var txt = this.$selectedItem.text();
  1420.             return $.extend({ text: txt }, this.$selectedItem.data());
  1421.         },
  1422.  
  1423.         selectByText: function(text) {
  1424.             var selector = 'li a:fuelTextExactCI(' + text + ')';
  1425.             this.selectBySelector(selector);
  1426.         },
  1427.  
  1428.         selectByValue: function(value) {
  1429.             var selector = 'li[data-value="' + value + '"]';
  1430.             this.selectBySelector(selector);
  1431.         },
  1432.  
  1433.         selectByIndex: function(index) {
  1434.             // zero-based index
  1435.             var selector = 'li:eq(' + index + ')';
  1436.             this.selectBySelector(selector);
  1437.         },
  1438.  
  1439.         selectBySelector: function(selector) {
  1440.             var item = this.$element.find(selector);
  1441.  
  1442.             this.$selectedItem = item;
  1443.             this.$label.text(this.$selectedItem.text());
  1444.         },
  1445.  
  1446.         setDefaultSelection: function() {
  1447.             var selector = 'li[data-selected=true]:first';
  1448.             var item = this.$element.find(selector);
  1449.             if(item.length === 0) {
  1450.                 // select first item
  1451.                 this.selectByIndex(0);
  1452.             }
  1453.             else {
  1454.                 // select by data-attribute
  1455.                 this.selectBySelector(selector);
  1456.                 item.removeData('selected');
  1457.                 item.removeAttr('data-selected');
  1458.             }
  1459.         },
  1460.  
  1461.         enable: function() {
  1462.             this.$button.removeClass('disabled');
  1463.         },
  1464.  
  1465.         disable: function() {
  1466.             this.$button.addClass('disabled');
  1467.         }
  1468.  
  1469.     };
  1470.  
  1471.  
  1472.     // SELECT PLUGIN DEFINITION
  1473.  
  1474.     $.fn.select = function (option,value) {
  1475.         var methodReturn;
  1476.  
  1477.         var $set = this.each(function () {
  1478.             var $this = $(this);
  1479.             var data = $this.data('select');
  1480.             var options = typeof option === 'object' && option;
  1481.  
  1482.             if (!data) $this.data('select', (data = new Select(this, options)));
  1483.             if (typeof option === 'string') methodReturn = data[option](value);
  1484.         });
  1485.  
  1486.         return (methodReturn === undefined) ? $set : methodReturn;
  1487.     };
  1488.  
  1489.     $.fn.select.defaults = {};
  1490.  
  1491.     $.fn.select.Constructor = Select;
  1492.  
  1493.  
  1494.     // SELECT DATA-API
  1495.  
  1496.     $(function () {
  1497.  
  1498.         $(window).on('load', function () {
  1499.             $('.select').each(function () {
  1500.                 var $this = $(this);
  1501.                 if ($this.data('select')) return;
  1502.                 $this.select($this.data());
  1503.             });
  1504.         });
  1505.  
  1506.         $('body').on('mousedown.select.data-api', '.select', function (e) {
  1507.             var $this = $(this);
  1508.             if ($this.data('select')) return;
  1509.             $this.select($this.data());
  1510.         });
  1511.     });
  1512.  
  1513. }(window.jQuery);
  1514.  
  1515. /*
  1516.  * Fuel UX Tree
  1517.  * https://github.com/ExactTarget/fuelux
  1518.  *
  1519.  * Copyright (c) 2012 ExactTarget
  1520.  * Licensed under the MIT license.
  1521.  */
  1522.  
  1523. +function ($) { "use strict";
  1524.  
  1525.     // TREE CONSTRUCTOR AND PROTOTYPE
  1526.  
  1527.     var Tree = function (element, options) {
  1528.         this.$element = $(element);
  1529.         this.options = $.extend({}, $.fn.tree.defaults, options);
  1530.  
  1531.         this.$element.on('click', '.tree-item', $.proxy( function(ev) { this.selectItem(ev.currentTarget); } ,this));
  1532.         this.$element.on('click', '.tree-folder-header', $.proxy( function(ev) { this.selectFolder(ev.currentTarget); }, this));
  1533.  
  1534.         this.render();
  1535.     };
  1536.  
  1537.     Tree.prototype = {
  1538.         constructor: Tree,
  1539.  
  1540.         render: function () {
  1541.             this.populate(this.$element);
  1542.         },
  1543.  
  1544.         populate: function ($el) {
  1545.             var self = this;
  1546.             var loader = $el.parent().find('.tree-loader:eq(0)');
  1547.  
  1548.             loader.show();
  1549.             this.options.dataSource.data($el.data(), function (items) {
  1550.                 loader.hide();
  1551.  
  1552.                 $.each( items.data, function(index, value) {
  1553.                     var $entity;
  1554.  
  1555.                     if(value.type === "folder") {
  1556.                         $entity = self.$element.find('.tree-folder:eq(0)').clone().show();
  1557.                         $entity.find('.tree-folder-name').html(value.name);
  1558.                         $entity.find('.tree-loader').html(self.options.loadingHTML);
  1559.                         $entity.find('.tree-folder-header').data(value);
  1560.                     } else if (value.type === "item") {
  1561.                         $entity = self.$element.find('.tree-item:eq(0)').clone().show();
  1562.                         $entity.find('.tree-item-name').html(value.name);
  1563.                         $entity.data(value);
  1564.                     }
  1565.  
  1566.                     if($el.hasClass('tree-folder-header')) {
  1567.                         $el.parent().find('.tree-folder-content:eq(0)').append($entity);
  1568.                     } else {
  1569.                         $el.append($entity);
  1570.                     }
  1571.                 });
  1572.  
  1573.                 self.$element.trigger('loaded');
  1574.             });
  1575.         },
  1576.  
  1577.         selectItem: function (el) {
  1578.             var $el = $(el);
  1579.             var $all = this.$element.find('.tree-selected');
  1580.             var data = [];
  1581.  
  1582.             if (this.options.multiSelect) {
  1583.                 $.each($all, function(index, value) {
  1584.                     var $val = $(value);
  1585.                     if($val[0] !== $el[0]) {
  1586.                         data.push( $(value).data() );
  1587.                     }
  1588.                 });
  1589.             } else if ($all[0] !== $el[0]) {
  1590.                 $all.removeClass('tree-selected')
  1591.                     .find('i').removeClass('icon-ok').addClass('tree-dot');
  1592.                 data.push($el.data());
  1593.             }
  1594.  
  1595.             if($el.hasClass('tree-selected')) {
  1596.                 $el.removeClass('tree-selected');
  1597.                 $el.find('i').removeClass('icon-ok').addClass('tree-dot');
  1598.             } else {
  1599.                 $el.addClass ('tree-selected');
  1600.                 $el.find('i').removeClass('tree-dot').addClass('icon-ok');
  1601.                 if (this.options.multiSelect) {
  1602.                     data.push( $el.data() );
  1603.                 }
  1604.             }
  1605.  
  1606.             if(data.length) {
  1607.                 this.$element.trigger('selected', {info: data});
  1608.             }
  1609.  
  1610.         },
  1611.  
  1612.         selectFolder: function (el) {
  1613.             var $el = $(el);
  1614.             var $par = $el.parent();
  1615.  
  1616.             if($el.find('.icon-folder-close').length) {
  1617.                 if ($par.find('.tree-folder-content').children().length) {
  1618.                     $par.find('.tree-folder-content:eq(0)').show();
  1619.                 } else {
  1620.                     this.populate( $el );
  1621.                 }
  1622.  
  1623.                 $par.find('.icon-folder-close:eq(0)')
  1624.                     .removeClass('icon-folder-close')
  1625.                     .addClass('icon-folder-open');
  1626.  
  1627.                 this.$element.trigger('opened', $el.data());
  1628.             } else {
  1629.                 if(this.options.cacheItems) {
  1630.                     $par.find('.tree-folder-content:eq(0)').hide();
  1631.                 } else {
  1632.                     $par.find('.tree-folder-content:eq(0)').empty();
  1633.                 }
  1634.  
  1635.                 $par.find('.icon-folder-open:eq(0)')
  1636.                     .removeClass('icon-folder-open')
  1637.                     .addClass('icon-folder-close');
  1638.  
  1639.                 this.$element.trigger('closed', $el.data());
  1640.             }
  1641.         },
  1642.  
  1643.         selectedItems: function () {
  1644.             var $sel = this.$element.find('.tree-selected');
  1645.             var data = [];
  1646.  
  1647.             $.each($sel, function (index, value) {
  1648.                 data.push($(value).data());
  1649.             });
  1650.             return data;
  1651.         }
  1652.     };
  1653.  
  1654.  
  1655.     // TREE PLUGIN DEFINITION
  1656.  
  1657.     $.fn.tree = function (option, value) {
  1658.         var methodReturn;
  1659.  
  1660.         var $set = this.each(function () {
  1661.             var $this = $(this);
  1662.             var data = $this.data('tree');
  1663.             var options = typeof option === 'object' && option;
  1664.  
  1665.             if (!data) $this.data('tree', (data = new Tree(this, options)));
  1666.             if (typeof option === 'string') methodReturn = data[option](value);
  1667.         });
  1668.  
  1669.         return (methodReturn === undefined) ? $set : methodReturn;
  1670.     };
  1671.  
  1672.     $.fn.tree.defaults = {
  1673.         multiSelect: false,
  1674.         loadingHTML: '<div>Loading...</div>',
  1675.         cacheItems: true
  1676.     };
  1677.  
  1678.     $.fn.tree.Constructor = Tree;
  1679.  
  1680. }(window.jQuery);
  1681.  
  1682. /*
  1683.  * Fuel UX Wizard
  1684.  * https://github.com/ExactTarget/fuelux
  1685.  *
  1686.  * Copyright (c) 2012 ExactTarget
  1687.  * Licensed under the MIT license.
  1688.  */
  1689.  
  1690. +function ($) { "use strict";
  1691.  
  1692.     // WIZARD CONSTRUCTOR AND PROTOTYPE
  1693.  
  1694.     var Wizard = function (element, options) {
  1695.         var kids;
  1696.  
  1697.         this.$element = $(element);
  1698.         this.options = $.extend({}, $.fn.wizard.defaults, options);
  1699.         this.currentStep = 1;
  1700.         this.numSteps = this.$element.find('li').length;
  1701.         this.$prevBtn = this.$element.find('button.btn-prev');
  1702.         this.$nextBtn = this.$element.find('button.btn-next');
  1703.  
  1704.         kids = this.$nextBtn.children().detach();
  1705.         this.nextText = $.trim(this.$nextBtn.text());
  1706.         this.$nextBtn.append(kids);
  1707.  
  1708.         // handle events
  1709.         this.$prevBtn.on('click', $.proxy(this.previous, this));
  1710.         this.$nextBtn.on('click', $.proxy(this.next, this));
  1711.         this.$element.on('click', 'li.complete', $.proxy(this.stepclicked, this));
  1712.     };
  1713.  
  1714.     Wizard.prototype = {
  1715.  
  1716.         constructor: Wizard,
  1717.  
  1718.         setState: function () {
  1719.             var canMovePrev = (this.currentStep > 1);
  1720.             var firstStep = (this.currentStep === 1);
  1721.             var lastStep = (this.currentStep === this.numSteps);
  1722.  
  1723.             // disable buttons based on current step
  1724.             this.$prevBtn.attr('disabled', (firstStep === true || canMovePrev === false));
  1725.  
  1726.             // change button text of last step, if specified
  1727.             var data = this.$nextBtn.data();
  1728.             if (data && data.last) {
  1729.                 this.lastText = data.last;
  1730.                 if (typeof this.lastText !== 'undefined') {
  1731.                     // replace text
  1732.                     var text = (lastStep !== true) ? this.nextText : this.lastText;
  1733.                     var kids = this.$nextBtn.children().detach();
  1734.                     this.$nextBtn.text(text).append(kids);
  1735.                 }
  1736.             }
  1737.  
  1738.             // reset classes for all steps
  1739.             var $steps = this.$element.find('li');
  1740.             $steps.removeClass('active').removeClass('complete');
  1741.             $steps.find('span.badge').removeClass('badge-info').removeClass('badge-success');
  1742.  
  1743.             // set class for all previous steps
  1744.             var prevSelector = 'li:lt(' + (this.currentStep - 1) + ')';
  1745.             var $prevSteps = this.$element.find(prevSelector);
  1746.             $prevSteps.addClass('complete');
  1747.             $prevSteps.find('span.badge').addClass('badge-success');
  1748.  
  1749.             // set class for current step
  1750.             var currentSelector = 'li:eq(' + (this.currentStep - 1) + ')';
  1751.             var $currentStep = this.$element.find(currentSelector);
  1752.             $currentStep.addClass('active');
  1753.             $currentStep.find('span.badge').addClass('badge-info');
  1754.  
  1755.             // set display of target element
  1756.             var target = $currentStep.data().target;
  1757.             // Dillon changed for support multi wizard
  1758.             $('.step-pane', $(target).parent()).removeClass('active');
  1759.             $(target).addClass('active');
  1760.  
  1761.             this.$element.trigger('changed');
  1762.         },
  1763.  
  1764.         stepclicked: function (e) {
  1765.             var li = $(e.currentTarget);
  1766.  
  1767.             // Dillon changed for support multi wizard
  1768.             var index = li.parent().find('li').index(li);
  1769.  
  1770.             var evt = $.Event('stepclick');
  1771.             this.$element.trigger(evt, {step: index + 1});
  1772.             if (evt.isDefaultPrevented()) return;
  1773.  
  1774.             this.currentStep = (index + 1);
  1775.             this.setState();
  1776.         },
  1777.  
  1778.         previous: function () {
  1779.             var canMovePrev = (this.currentStep > 1);
  1780.             if (canMovePrev) {
  1781.                 var e = $.Event('change');
  1782.                 this.$element.trigger(e, {step: this.currentStep, direction: 'previous'});
  1783.                 if (e.isDefaultPrevented()) return;
  1784.  
  1785.                 this.currentStep -= 1;
  1786.                 this.setState();
  1787.             }
  1788.         },
  1789.  
  1790.         next: function () {
  1791.             var canMoveNext = (this.currentStep + 1 <= this.numSteps);
  1792.             var lastStep = (this.currentStep === this.numSteps);
  1793.  
  1794.             if (canMoveNext) {
  1795.                 var e = $.Event('change');
  1796.                 this.$element.trigger(e, {step: this.currentStep, direction: 'next'});
  1797.  
  1798.                 if (e.isDefaultPrevented()) return;
  1799.  
  1800.                 this.currentStep += 1;
  1801.                 this.setState();
  1802.             }
  1803.             else if (lastStep) {
  1804.                 this.$element.trigger('finished');
  1805.             }
  1806.         },
  1807.  
  1808.         selectedItem: function (val) {
  1809.             return {
  1810.                 step: this.currentStep
  1811.             };
  1812.         }
  1813.     };
  1814.  
  1815.  
  1816.     // WIZARD PLUGIN DEFINITION
  1817.  
  1818.     $.fn.wizard = function (option, value) {
  1819.         var methodReturn;
  1820.  
  1821.         var $set = this.each(function () {
  1822.             var $this = $(this);
  1823.             var data = $this.data('wizard');
  1824.             var options = typeof option === 'object' && option;
  1825.  
  1826.             if (!data) $this.data('wizard', (data = new Wizard(this, options)));
  1827.             if (typeof option === 'string') methodReturn = data[option](value);
  1828.         });
  1829.  
  1830.         return (methodReturn === undefined) ? $set : methodReturn;
  1831.     };
  1832.  
  1833.     $.fn.wizard.defaults = {};
  1834.  
  1835.     $.fn.wizard.Constructor = Wizard;
  1836.  
  1837.  
  1838.     // WIZARD DATA-API
  1839.  
  1840.     $(function () {
  1841.         $('body').on('mousedown.wizard.data-api', '.wizard', function () {
  1842.             var $this = $(this);
  1843.             if ($this.data('wizard')) return;
  1844.             $this.wizard($this.data());
  1845.         });
  1846.     });
  1847.  
  1848. }(window.jQuery);})();
  1849. (function(){//fgnass.github.com/spin.js#v2.0.1
  1850. !function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<k.length;d++)if(c=k[d]+b,void 0!==e[c])return c;return void 0!==e[b]?b:void 0}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a,b){return"string"==typeof a?a:a[b%a.length]}function h(a){this.opts=f(a||{},h.defaults,n)}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.width,left:d.radius,top:-d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.length+d.width,k=2*j,l=2*-(d.width+d.length)+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k=["webkit","Moz","ms","O"],l={},m=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}(),n={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",position:"absolute"};h.defaults={},f(h.prototype,{spin:function(b){this.stop();{var c=this,d=c.opts,f=c.el=e(a(0,{className:d.className}),{position:d.position,width:0,zIndex:d.zIndex});d.radius+d.length+d.width}if(e(f,{left:d.left,top:d.top}),b&&b.insertBefore(f,b.firstChild||null),f.setAttribute("role","progressbar"),c.lines(f,c.opts),!j){var g,h=0,i=(d.lines-1)*(1-d.direction)/2,k=d.fps,l=k/d.speed,m=(1-d.opacity)/(l*d.trail/100),n=l/d.lines;!function o(){h++;for(var a=0;a<d.lines;a++)g=Math.max(1-(h+(d.lines-a)*n)%l*m,d.opacity),c.opacity(f,a*d.direction+i,g,d);c.timeout=c.el&&setTimeout(o,~~(1e3/k))}()}return c},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function h(b,c){return e(a(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*k+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k<f.lines;k++)i=e(a(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,l+k*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(i,e(h("#000","0 0 4px #000"),{top:"2px"})),b(d,b(i,h(g(f.color,k),"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}});var o=e(a("group"),{behavior:"url(#default#VML)"});return!d(o,"transform")&&o.adj?i():j=d(o,"animation"),h});})();
  1851. (function(){/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
  1852.  * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
  1853.  * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
  1854.  *
  1855.  * Version: 1.3.0
  1856.  *
  1857.  */
  1858. (function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d||
  1859. window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());
  1860. e=l*(b[0].scrollHeight-b.outerHeight());h&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),g),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);v();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",r,!1),this.addEventListener("mousewheel",r,!1),this.addEventListener("MozMousePixelScroll",r,!1)):document.attachEvent("onmousewheel",r)}function w(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:u+"px"});
  1861. var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function v(){w();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;u>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),
  1862. c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative",
  1863. overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var g=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?
  1864. "block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});
  1865. b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&
  1866. (m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery);})();
  1867. !function(){"use strict";angular.module("mean.theme",[])}();
  1868. !function(){"use strict";angular.module("mean.users",[])}();
  1869. !function(){"use strict";angular.element(document).ready(function(){"#_=_"===window.location.hash&&(window.location.hash="#!"),angular.bootstrap(document,["mean"])});var packageModules=[];for(var index in window.modules)angular.module(window.modules[index].module,window.modules[index].angularDependencies||[]),packageModules.push(window.modules[index].module);var modules=["ngCookies","ngResource","ui.bootstrap","ui.router","ngAnimate","angulartics","angulartics.google.analytics"];modules=modules.concat(packageModules),angular.module("mean",modules)}();
  1870. !function(){"use strict";angular.module("mean.system",["mean-factory-interceptor"])}();
  1871. !function(){"use strict";angular.module("mean.pagos",[])}();
  1872. !function(){"use strict";angular.module("mean.mean-admin").filter("startFrom",function(){return function(input,start){return input?(start=+start,input.slice(start)):void 0}}).directive("onFinishRender",function(){return function(scope,element,attrs){scope.$last&&$(attrs.onFinishRender).trigger("footable_redraw")}}).controller("AdminController",["$scope","Global","Menus","$rootScope",function($scope,Global,Menus,$rootScope){function queryMenu(name,defaultMenu){Menus.query({name:name,defaultMenu:defaultMenu},function(menu){$scope.menus[name]=menu})}$scope.global=Global,$scope.menus={},$scope.overIcon=!1,$scope.userroles={ops:!1},console.log($scope.global.user.roles);for(var roleind in $scope.global.user.roles)"operaciones"===$scope.global.user.roles[roleind]&&($scope.userroles.ops=!0);var icons="mean-admin/assets/img/icons/",defaultAdminMenu=[{roles:["admin"],title:"MODULES",link:"modules",icon:icons+"modules.png",nfops:!0},{roles:["admin"],title:"USERS",link:"users",icon:icons+"users.png",nfops:!0},{roles:["admin"],title:"Logs",link:"onlyquering",icon:icons+"marketplace.png",nfops:!1},{roles:["admin"],title:"Payments",link:"payments",icon:icons+"card.png",nfops:!1},{roles:["admin"],title:"Dashboard",link:"adminDash",icon:icons+"Dash.png",nfops:!0}];queryMenu("admin",defaultAdminMenu),$scope.isCollapsed=!1,$rootScope.$on("loggedin",function(){queryMenu("admin",defaultAdminMenu),$scope.global={authenticated:!!$rootScope.user,user:$rootScope.user}})}])}();
  1873. !function(){"use strict";angular.module("mean.theme").factory("Theme",[function(){return{name:"theme"}}])}();
  1874. !function(){"use strict";angular.module("mean.theme").config(["$stateProvider",function($stateProvider){$stateProvider.state("theme example page",{url:"/theme/example",templateUrl:"theme/views/index.html"})}])}();
  1875. !function(){"use strict";angular.module("mean.theme").controller("ThemeController",["$scope","Global","$location","$rootScope",function($scope,Global,$location,$rootScope){$rootScope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){var toPath=toState.url.replace("/","");"reset-password"===toState.name&&(toPath="reset-password"),$("html").removeClass("home"),$("html").removeClass("pruebalo"),$("html").removeClass("nohiden"),$scope.state=toPath,""===$scope.state&&($scope.state="firstPage"),"rapido/:colector/:servicio/:tipoB/:valor/:fecha/:hash"===$scope.state&&($scope.state="pagar"),("realizados"===$scope.state||"dashboard"===$scope.state)&&$("html").addClass("nohiden"),("pruebalo"===$scope.state||"promo-pago"===$scope.state||"PromoLF"===$scope.state||"myProfile"===$scope.state||"blog"===$scope.state||$scope.state.indexOf("admin/")>-1)&&$("html").addClass("pruebalo"),$scope.state.indexOf("admin/")>-1&&($scope.state="admin")}),$scope.goToHowWorks=function(){location.href="/como-funciona"},$scope.global=Global,$scope["package"]={name:"theme"}}])}();
  1876. !function(){"use strict";angular.module("mean.mean-admin").controller("ModulesController",["$scope","$filter","Global","$rootScope","$http","Modules",function($scope,$filter,Global,$rootScope,$http,Modules){function calculatePages(num){$scope.nregs.normal=num;var pageNum=num/queryOpts.pagesize;pageNum=Math.ceil(pageNum),$scope.pages.arr=[];for(var i=0;pageNum>i;i++)$scope.pages.arr.push(i+1);$scope.pages.active=1}function advCalculatePages(num){$scope.nregs.adv=num;var pageNum=num/queryOpts.pagesize;pageNum=Math.ceil(pageNum),$scope.advPages.arr=[];for(var i=0;pageNum>i;i++)$scope.advPages.arr.push(i+1);0!==$scope.advPages.arr.length&&($scope.advPages.active=1)}$scope.pages={active:0,arr:[]},$scope.nregs={normal:0,adv:0},$scope.advPages={active:0,arr:[]},$scope.advSearch={pagesize:15,ind:0,on:!1,switchh:!1},$scope.providers=["","local","google","facebook"],$scope.eventTypes=["","trygetFacturas","getSucces","getError","getTimeOut","tryPayFacturas","PaySucces","ErrorPayFacturas","trySendCredomatic","ResponseSendCredomatic","ErrorSendCredomatic"];var queryOpts={pageind:0,pagesize:15};$scope.init=function(){Modules.get(queryOpts,function(data){$scope.Logs=data.logs,calculatePages(data.ndocs),$("#tablelogs").footable()})},$scope.order=function(reverse){$scope.Logs=$filter("orderBy")($scope.Logs,"created",reverse)},$scope.getadv=function(){Modules.getAdv($scope.advSearch,function(data){$scope.Logs=data.logs,$scope.advModeSwitch(!0),advCalculatePages(data.ndocs),$("#tablelogs").footable()})},$scope.xport=function(){function genCsv(lgs){var log,ind,datalogs=[];for(ind in lgs.logs){log=lgs.logs[ind];var tlog={Name:log.name,Provider:log.provider,"Event Type":log.eventType,"IP Origen":log.ipOrigen,Message:log.message,Date:$filter("date")(log.created,"dd/MM/yyyy HH:mm:ss"),Stack:log.stackQuery?log.stackQuery.replace(/['"]+/g,""):"N/A"};datalogs.push(tlog)}JSONToCSVConvertor(datalogs,"Transacciones de Usuarios",!0,"Reporte_")}Modules.get({skip:0,pagesize:0},genCsv)},$scope.navigate=function(page,ind,prevnext){if(page===$scope.pages.active)return!1;if(prevnext)if("prev"===prevnext){if(1===$scope.pages.active)return!1;page=$scope.pages.active-1,ind=page-1}else{if($scope.pages.active===$scope.pages.arr.length)return!1;page=$scope.pages.active+1,ind=$scope.pages.active}queryOpts.pageind=ind,Modules.get(queryOpts,function(data){$scope.Logs=data.logs,$scope.pages.active=page,$("#tablelogs").footable()})},$scope.limitPagination=function(page){return page===$scope.pages.active||page===$scope.pages.active+1||page===$scope.pages.active+2||page===$scope.pages.active-1||page===$scope.pages.active-2?!0:!1},$scope.paginationHelp=function(where){return"behind"===where?$scope.pages.active<=3?!1:!0:$scope.pages.active<$scope.pages.arr.length-2?!0:!1},$scope.navigateMore=function(where){"back"===where?$scope.navigate($scope.pages.active-2,$scope.pages.active-3):$scope.navigate($scope.pages.active+2,$scope.pages.active+1)},$scope.advPaginationHelp=function(where){return"behind"===where?$scope.advPages.active<=3?!1:!0:$scope.advPages.arr.length<=3?!1:$scope.advPages.active<$scope.advPages.arr.length-2?!0:!1},$scope.advNavigate=function(page,ind,prevnext){if(page===$scope.advPages.active)return!1;if(prevnext)if("prev"===prevnext){if(1===$scope.advPages.active)return!1;page=$scope.advPages.active-1,ind=page-1}else{if($scope.advPages.active===$scope.advPages.arr.length)return!1;page=$scope.advPages.active+1,ind=$scope.advPages.active}$scope.advSearch.ind=ind,Modules.getAdv($scope.advSearch,function(data){$scope.Logs=data.logs,$scope.advPages.active=page,$("#tablelogs").footable()})},$scope.advLimitPagination=function(page){return page===$scope.advPages.active||page===$scope.advPages.active+1||page===$scope.advPages.active+2||page===$scope.advPages.active-1||page===$scope.advPages.active-2?!0:!1},$scope.advNavigateMore=function(where){"back"===where?$scope.advNavigate($scope.advPages.active-2,$scope.advPages.active-3):$scope.advNavigate($scope.advPages.active+2,$scope.advPages.active+1)},$scope.advModeSwitch=function(truth){$scope.advSearch.on=truth,truth?$scope.advSearch.switchh=!1:$scope.init()}}])}();
  1877. !function(){"use strict";angular.module("mean.mean-admin").filter("servactivity",function(){return function(val){return val>0?"hasactivity":void 0}}).filter("servicefilter",function(){return function(val){var clas="";switch(val){case"Telefonía Pospago":clas="tel-pospago to-big";break;case"Cuota Crédito Gallo":clas="gallo to-big";break;case"Cuota Crédito Verdugo":clas="verdugo to-big";break;case"Agua":clas="agua";break;case"Telefonía Fija":clas="tel-fija";break;case"Internet Fijo":clas="internet-fijo";break;case"TV/Cable":clas="tv-cable";break;case"Internet Móvil":clas="internet-movil";break;case"Casa CLARO":clas="casa-claro";break;case"Internet/Cable":clas="internet-cable";break;case"Suscripción":clas="suscripcion";break;case"DISNORTE":clas="disnorte";break;case"DISSUR":clas="dissur";break;default:clas="badservice"}return clas}}).filter("statefilter",function(){return function(val){return val===!0?"Activos":val===!1?"Bloqueados":"noactive"===val?"Sin Confirmar":void 0}}).filter("yearactmonthremove",function(){return function(array,ind){if(array&&array.length){var na=array.slice(0);return na.splice(ind,1),na}}}).filter("monthformat",function(){return function(year,opt){if(year){if(!opt)return year.toString().length>1?year:"0"+year;var tmp="";if("cad"===opt){switch(year){case 1:tmp="Enero";break;case 2:tmp="Febrero";break;case 3:tmp="Marzo";break;case 4:tmp="Abril";break;case 5:tmp="Mayo";break;case 6:tmp="Junio";break;case 7:tmp="Julio";break;case 8:tmp="Agosto";break;case 9:tmp="Septiembre";break;case 10:tmp="Octubre";break;case 11:tmp="Noviembre";break;case 12:tmp="Diciembre"}return tmp}}}}).controller("AdminDashboardController",["$scope","Global","AdminDashboard",function($scope,Global,AdminDashboard){function updateUsrsStatesNType(){$scope.usersTypes=selectYear($scope.masterUserTypes,$scope.users.year),$scope.usersStates=selectYear($scope.masterUserStates,$scope.users.year)}function drawUsersGraphics(){if(!usersCharts.totals.states||!usersCharts.totals.types){usersCharts.totals.states=new Chart(usersContexts.totals.states).Pie(cnvUsersTotalsData1.data,pieChartOpts),usersCharts.totals.types=new Chart(usersContexts.totals.types).Pie(cnvUsersTotalsData2.data,pieChartOpts);var tmp1=document.createElement("div");tmp1.innerHTML=usersCharts.totals.states.generateLegend(),usersCanvas.totals.states.parentNode.children[2]&&usersCanvas.totals.states.parentNode.removeChild(usersCanvas.totals.states.parentNode.children[2]),usersCanvas.totals.states.parentNode.appendChild(tmp1),tmp1=document.createElement("div"),tmp1.innerHTML=usersCharts.totals.types.generateLegend(),usersCanvas.totals.types.parentNode.children[2]&&usersCanvas.totals.types.parentNode.removeChild(usersCanvas.totals.types.parentNode.children[2]),usersCanvas.totals.types.parentNode.appendChild(tmp1)}usersCharts.regs.lines=new Chart(usersContexts.regs.lines).Line(cnvUsersRegsData,lineChartOpts),usersCharts.regs.radar=new Chart(usersContexts.regs.radar).Radar(cnvUsersRegsData,polarChartOpts),usersCharts.regs.bars=new Chart(usersContexts.regs.bars).Bar(cnvUsersRegsData,barChartOpts);var tmp=document.createElement("div");tmp.innerHTML=usersCharts.regs.lines.generateLegend(),usersCanvas.regs.lines.parentNode.children[1]&&usersCanvas.regs.lines.parentNode.removeChild(usersCanvas.regs.lines.parentNode.children[1]),usersCanvas.regs.lines.parentNode.appendChild(tmp),tmp=document.createElement("div"),tmp.innerHTML=usersCharts.regs.radar.generateLegend(),usersCanvas.regs.radar.parentNode.children[1]&&usersCanvas.regs.radar.parentNode.removeChild(usersCanvas.regs.radar.parentNode.children[1]),usersCanvas.regs.radar.parentNode.appendChild(tmp),tmp=document.createElement("div"),tmp.innerHTML=usersCharts.regs.bars.generateLegend(),usersCanvas.regs.bars.parentNode.children[1]&&usersCanvas.regs.bars.parentNode.removeChild(usersCanvas.regs.bars.parentNode.children[1]),usersCanvas.regs.bars.parentNode.appendChild(tmp)}function drawQueriesGraphics(){if(!queriesCharts.totals.byServ){queriesCharts.totals.byServ=new Chart(queriesContexts.totals.byServ).Pie(cnvQueriesTotalData.data,pieChartOpts);var tmp1=document.createElement("div");tmp1.innerHTML=queriesCharts.totals.byServ.generateLegend(),queriesCanvas.totals.byServ.parentNode.children[2]&&queriesCanvas.totals.byServ.parentNode.removeChild(queriesCanvas.totals.byServ.parentNode.children[2]),queriesCanvas.totals.byServ.parentNode.appendChild(tmp1)}queriesCharts.totals.byYears=new Chart(queriesContexts.totals.byYears).Bar(cnvQueriesTotalData2,barChartOpts);var tmp=document.createElement("div");tmp.innerHTML=queriesCharts.totals.byYears.generateLegend(),queriesCanvas.totals.byYears.parentNode.children[3]&&queriesCanvas.totals.byYears.parentNode.removeChild(queriesCanvas.totals.byYears.parentNode.children[3]),queriesCanvas.totals.byYears.parentNode.appendChild(tmp),queriesCharts.totals.byServInOneYear=new Chart(queriesContexts.totals.byServInOneYear).StackedBar(cnvQueriesTotalData3,{}),tmp=document.createElement("div"),tmp.innerHTML=queriesCharts.totals.byServInOneYear.generateLegend(),queriesCanvas.totals.byServInOneYear.parentNode.children[3]&&queriesCanvas.totals.byServInOneYear.parentNode.removeChild(queriesCanvas.totals.byServInOneYear.parentNode.children[3]),queriesCanvas.totals.byServInOneYear.parentNode.appendChild(tmp)}function drawPaymentsGraphics(){if(!paymentsCharts.totals.byServ){paymentsCharts.totals.byServ=new Chart(paymentsContexts.totals.byServ).Pie(cnvPaymentsTotalData.data,pieChartOpts);var tmp1=document.createElement("div");tmp1.innerHTML=paymentsCharts.totals.byServ.generateLegend(),paymentsCanvas.totals.byServ.parentNode.children[2]&&paymentsCanvas.totals.byServ.parentNode.removeChild(paymentsCanvas.totals.byServ.parentNode.children[2]),paymentsCanvas.totals.byServ.parentNode.appendChild(tmp1)}paymentsCharts.totals.byYears=new Chart(paymentsContexts.totals.byYears).Bar(cnvPaymentsTotalData2,barChartOpts);var tmp=document.createElement("div");tmp.innerHTML=paymentsCharts.totals.byYears.generateLegend(),paymentsCanvas.totals.byYears.parentNode.children[3]&&paymentsCanvas.totals.byYears.parentNode.removeChild(paymentsCanvas.totals.byYears.parentNode.children[3]),paymentsCanvas.totals.byYears.parentNode.appendChild(tmp),paymentsCharts.totals.byServInOneYear=new Chart(paymentsContexts.totals.byServInOneYear).StackedBar(cnvPaymentsTotalData3,{}),tmp=document.createElement("div"),tmp.innerHTML=paymentsCharts.totals.byServInOneYear.generateLegend(),paymentsCanvas.totals.byServInOneYear.parentNode.children[3]&&paymentsCanvas.totals.byServInOneYear.parentNode.removeChild(paymentsCanvas.totals.byServInOneYear.parentNode.children[3]),paymentsCanvas.totals.byServInOneYear.parentNode.appendChild(tmp)}function selectYear(data,year){for(var i=0;i<data.length;i++)if(data[i].year===year)return data[i]}function selectMonth(data,month){for(var i=0;i<data.length;i++)if(data[i].month===month)return data[i]}function GraphData(){this.labels=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],this.datasets=[]}function GraphDataSet(year,color,data,colorsame){this.label=year,colorsame?this.fillColor="rgba("+color.r+","+color.g+","+color.b+",1)":this.fillColor="rgba("+color.r+","+color.g+","+color.b+",0.2)",this.strokeColor="rgba("+color.r+","+color.g+","+color.b+",1)",this.pointColor="rgba("+color.r+","+color.g+","+color.b+",1)",this.pointStrokeColor="#fff",this.pointHighlightFill="#fff",this.pointHighlightStroke="rgba("+color.r+","+color.g+","+color.b+",1)",this.data=data}function StackedGraphData(){this.superConstructor=GraphData,this.superConstructor(),this.formatNPutData=function(year){for(var tmpArr,servLength=year.months[0].byServ.length,i=0;servLength>i;i++){tmpArr=[];for(var j=0;j<year.months.length;j++)tmpArr.push(year.months[j].byServ[i].count);this.datasets.push(new GraphDataSet(year.months[0].byServ[i].servicio,getServColor(year.months[0].byServ[i].servicio),tmpArr,!0))}}}function PieGraphData(){this.data=[]}function formatUsersTotals(obj,comodin){var arr;return arr=comodin?[{value:obj.actives,color:"rgba("+defColors.active.r+","+defColors.active.g+","+defColors.active.b+",0.7)",highlight:"rgba("+defColors.active.r+","+defColors.active.g+","+defColors.active.b+",1)",label:"Activos"},{value:obj.blocked,color:"rgba("+defColors.blocked.r+","+defColors.blocked.g+","+defColors.blocked.b+",0.7)",highlight:"rgba("+defColors.blocked.r+","+defColors.blocked.g+","+defColors.blocked.b+",1)",label:"Bloqueados"},{value:obj.unconfirmed,color:"rgba("+defColors.unconfirmed.r+","+defColors.unconfirmed.g+","+defColors.unconfirmed.b+",0.7)",highlight:"rgba("+defColors.unconfirmed.r+","+defColors.unconfirmed.g+","+defColors.unconfirmed.b+",1)",label:"Sin Confirmar"}]:[{value:obj.Facebook,color:"rgba("+defColors.facebook.r+","+defColors.facebook.g+","+defColors.facebook.b+",0.7)",highlight:"rgba("+defColors.facebook.r+","+defColors.facebook.g+","+defColors.facebook.b+",1)",label:"Facebook"},{value:obj["Google+"],color:"rgba("+defColors.google.r+","+defColors.google.g+","+defColors.google.b+",0.7)",highlight:"rgba("+defColors.google.r+","+defColors.google.g+","+defColors.google.b+",1)",label:"Google"},{value:obj.Local,color:"rgba("+defColors.local.r+","+defColors.local.g+","+defColors.local.b+",0.7)",highlight:"rgba("+defColors.local.r+","+defColors.local.g+","+defColors.local.b+",1)",label:"Local"}]}function formatQueriesTotals(servarr){for(var arr=[],tmpcolor={},i=0;i<servarr.length;i++)tmpcolor=getServColor(servarr[i].servicio),arr.push({value:servarr[i].count,color:"rgba("+tmpcolor.r+","+tmpcolor.g+","+tmpcolor.b+",0.7)",highlight:"rgba("+tmpcolor.r+","+tmpcolor.g+","+tmpcolor.b+",1)",label:servarr[i].servicio});return arr}function getServColor(serv){var _color="#fff";switch(serv){case"Telefonía Pospago":_color="#1c1003";break;case"Cuota Crédito Gallo":_color="#a1b7b9";break;case"Cuota Crédito Verdugo":_color="#45392b";break;case"Agua":_color="#83b1c4";break;case"Telefonía Fija":_color="#136a8f";break;case"Internet Fijo":_color="#c6d8da";break;case"TV/Cable":_color="#755638";break;case"Internet Móvil":_color="#b8b9b4";break;case"Casa CLARO":_color="#c1a75c";break;case"Internet/Cable":_color="#2d4d50";break;case"Suscripción":_color="#3299bb";break;case"DISNORTE":_color="#bcbcbc";break;case"DISSUR":_color="#424242"}return hexToRgb(_color)}function getRandomColor(){for(var letters="0123456789ABCDEF".split(""),color="#",i=0;6>i;i++)color+=letters[Math.floor(16*Math.random())];return color}function hexToRgb(hex){var result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16)}:null}$scope.global=Global,$scope.actDate=new Date,$scope.masterUser=[],$scope.users={},$scope.actUser={},$scope.masterUserStates=[],$scope.usersStates=[],$scope.masterUserTypes=[],$scope.usersTypes=[],$scope.userTotals={global:0,Facebook:0,"Google+":0,Local:0,actives:0,unconfirmed:0,blocked:0},$scope.masterQueries=[],$scope.queries={},$scope.actQuery={},$scope.queriesTotals={},$scope.masterPayments=[],$scope.payments={},$scope.actPayment={},$scope.paymentsTotals={};var cnvUsersRegsData,cnvUsersTotalsData1,cnvUsersTotalsData2,cnvQueriesTotalData,cnvQueriesTotalData2,cnvQueriesTotalData3,cnvPaymentsTotalData,cnvPaymentsTotalData2,cnvPaymentsTotalData3,defColors={active:{r:66,g:139,b:202},blocked:{r:181,g:181,b:181},unconfirmed:{r:255,g:197,b:0},facebook:{r:59,g:89,b:152},google:{r:221,g:75,b:57},local:{r:73,g:175,b:46}},usersCanvas={totals:{types:document.getElementById("usersTotalTypesCnv"),states:document.getElementById("usersTotalStatesCnv")},regs:{radar:document.getElementById("usersRadarCnv"),lines:document.getElementById("usersLinesCnv"),bars:document.getElementById("usersBarsCnv")}},usersContexts={totals:{types:usersCanvas.totals.types.getContext("2d"),states:usersCanvas.totals.states.getContext("2d")},regs:{radar:usersCanvas.regs.radar.getContext("2d"),lines:usersCanvas.regs.lines.getContext("2d"),bars:usersCanvas.regs.bars.getContext("2d")}},usersCharts={totals:{},regs:{}},queriesCanvas={totals:{byServ:document.getElementById("queriesTotalsByServ"),byYears:document.getElementById("queriesTotalsByYears"),byServInOneYear:document.getElementById("queriesByServInOneYear")}},queriesContexts={totals:{byServ:queriesCanvas.totals.byServ.getContext("2d"),byYears:queriesCanvas.totals.byYears.getContext("2d"),byServInOneYear:queriesCanvas.totals.byServInOneYear.getContext("2d")}},queriesCharts={totals:{}},paymentsCanvas={totals:{byServ:document.getElementById("paymentsTotalsByServ"),byYears:document.getElementById("paymentsTotalsByYears"),byServInOneYear:document.getElementById("paymentsByServInOneYear")}},paymentsContexts={totals:{byServ:paymentsCanvas.totals.byServ.getContext("2d"),byYears:paymentsCanvas.totals.byYears.getContext("2d"),byServInOneYear:paymentsCanvas.totals.byServInOneYear.getContext("2d")}},paymentsCharts={totals:{}},pieChartOpts={responsive:!0,animationSteps:15,animationEasing:"easeOutSine",maintainAspectRatio:!1,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %> (<%=Math.round(circumference / 6.283 * 100)+'%'%>)"},lineChartOpts={responsive:!0,animationSteps:60,animationEasing:"easeOutSine",bezierCurve:!1,datasetFill:!1,maintainAspectRatio:!1},polarChartOpts={animationSteps:60,animationEasing:"easeOutSine",responsive:!0,datasetFill:!1,datasetStroke:!1,maintainAspectRatio:!1},barChartOpts={animationSteps:60,animationEasing:"easeOutSine",responsive:!0,maintainAspectRatio:!1,showTooltips:!1};$scope.initUsers=function(){AdminDashboard.getByYearNMonth.users(function(data){$scope.masterUser=data.regs,$scope.users=selectYear($scope.masterUser,$scope.actDate.getFullYear()),$("#users-stats-container .month.act-month").removeClass("anim"),$scope.actUser=selectMonth($scope.users.months,$scope.actDate.getMonth()+1),setTimeout(function(){$("#users-stats-container .month.act-month").addClass("anim")},400),$scope.genUsersTotals(data),$scope.masterUserTypes=data.acTypes,$scope.usersTypes=selectYear($scope.masterUserTypes,$scope.actDate.getFullYear()),$scope.masterUserStates=data.acStates,$scope.usersStates=selectYear($scope.masterUserStates,$scope.actDate.getFullYear()),cnvUsersTotalsData1=new PieGraphData,cnvUsersTotalsData2=new PieGraphData,cnvUsersTotalsData1.putData(formatUsersTotals($scope.userTotals,1)),cnvUsersTotalsData2.putData(formatUsersTotals($scope.userTotals)),cnvUsersRegsData=new GraphData;for(var i=0,len=$scope.masterUser.length;len>i;i++)($scope.masterUser[i].year===$scope.actDate.getFullYear()||$scope.masterUser[i].year===$scope.actDate.getFullYear()-1)&&($scope.masterUser[i].selected=!0);cnvUsersRegsData.genData($scope.masterUser)})},$scope.updateActUser=function(month){$("#users-stats-container .month.act-month").removeClass("anim"),$scope.actUser=selectMonth($scope.users.months,month||$scope.actDate.getMonth()+1),setTimeout(function(){$("#users-stats-container .month.act-month").addClass("anim")},400),updateUsrsStatesNType()},$scope.drawUsersGraphs=function(){return usersCharts.regs.lines&&usersCharts.regs.radar&&usersCharts.regs.bars?!1:void setTimeout(function(){drawUsersGraphics()},500)},$scope.genNDrawUsersGraphs=function(){for(var atLeastOneYear=!1,i=0,len=$scope.masterUser.length;len>i;i++)if($scope.masterUser[i].selected){atLeastOneYear=!0;break}return atLeastOneYear?(cnvUsersRegsData=new GraphData,cnvUsersRegsData.genData($scope.masterUser),usersCharts.regs.lines.destroy(),usersCharts.regs.radar.destroy(),usersCharts.regs.bars.destroy(),void drawUsersGraphics()):alert("Selecione al menos un año!")},$scope.genUsersTotals=function(data){for(var i=0;i<data.acTypes.length;i++)for(var j=0;j<data.acTypes[i].types.length;j++)$scope.userTotals.global+=data.acTypes[i].types[j].count;for(var i=0,len=data.acTypes.length;len>i;i++)for(var j=0;j<data.acTypes[i].types.length;j++)$scope.userTotals[data.acTypes[i].types[j].provider]+=data.acTypes[i].types[j].count;for(var i=0,len=data.acStates.length;len>i;i++)for(var j=0;j<data.acStates[i].states.length;j++)data.acStates[i].states[j].state?"boolean"==typeof data.acStates[i].states[j].state?$scope.userTotals.actives+=data.acStates[i].states[j].count:$scope.userTotals.unconfirmed+=data.acStates[i].states[j].count:$scope.userTotals.blocked+=data.acStates[i].states[j].count};var resizeTimer;$(window).on("resize",function(e){clearTimeout(resizeTimer),resizeTimer=setTimeout(function(){usersCharts.totals.states&&usersCharts.totals.states.resize().render(),usersCharts.totals.types&&usersCharts.totals.types.resize().render(),usersCharts.regs.lines&&usersCharts.regs.lines.resize().render(),usersCharts.regs.radar&&usersCharts.regs.radar.resize().render(),usersCharts.regs.bars&&usersCharts.regs.bars.resize().render(),queriesCharts.totals.byServ&&queriesCharts.totals.byServ.resize().render(),queriesCharts.totals.byYears&&queriesCharts.totals.byYears.resize().render(),queriesCharts.totals.byServInOneYear&&queriesCharts.totals.byServInOneYear.resize().render(),paymentsCharts.totals.byServ&&paymentsCharts.totals.byServ.resize().render(),paymentsCharts.totals.byYears&&paymentsCharts.totals.byYears.resize().render(),paymentsCharts.totals.byServInOneYear&&paymentsCharts.totals.byServInOneYear.resize().render()},250)}),$scope.initQueries=function(){AdminDashboard.getByYearNMonth.queries(function(data){$scope.masterQueries=data.src,$scope.queriesTotals=data.totals,$scope.queries=selectYear($scope.masterQueries,$scope.actDate.getFullYear()),$("#queries-stats-container .month.act-month").removeClass("anim"),$scope.actQuery=selectMonth($scope.queries.months,$scope.actDate.getMonth()+1),setTimeout(function(){$("#queries-stats-container .month.act-month").addClass("anim")},400),cnvQueriesTotalData=new PieGraphData,cnvQueriesTotalData.putData(formatQueriesTotals($scope.queriesTotals.services)),cnvQueriesTotalData2=new GraphData;for(var i=0,len=$scope.masterQueries.length;len>i;i++)($scope.masterQueries[i].year===$scope.actDate.getFullYear()||$scope.masterQueries[i].year===$scope.actDate.getFullYear()-1)&&($scope.masterQueries[i].selected=!0);cnvQueriesTotalData2.genData($scope.masterQueries),cnvQueriesTotalData3=new StackedGraphData,$scope.queriesByServInYear=$scope.masterQueries[0],cnvQueriesTotalData3.formatNPutData($scope.queriesByServInYear)})},$scope.updateActQuery=function(month){$("#queries-stats-container .month.act-month").removeClass("anim"),$scope.actQuery=selectMonth($scope.queries.months,month||$scope.actDate.getMonth()+1),setTimeout(function(){$("#queries-stats-container .month.act-month").addClass("anim")},400)},$scope.drawQueriesGraphs=function(){return queriesCharts.totals.byServ?!1:void setTimeout(function(){drawQueriesGraphics()},500)},$scope.genNDrawQueriesGraphs=function(){for(var atLeastOneYear=!1,i=0,len=$scope.masterQueries.length;len>i;i++)if($scope.masterQueries[i].selected){atLeastOneYear=!0;break}return atLeastOneYear?(cnvQueriesTotalData2=new GraphData,cnvQueriesTotalData3=new StackedGraphData,cnvQueriesTotalData2.genData($scope.masterQueries),cnvQueriesTotalData3.formatNPutData($scope.queriesByServInYear),queriesCharts.totals.byYears.destroy(),queriesCharts.totals.byServInOneYear.destroy(),void drawQueriesGraphics()):alert("Selecione al menos un año!")},$scope.initPayments=function(){AdminDashboard.getByYearNMonth.payments(function(data){$scope.masterPayments=data.src,$scope.paymentsTotals=data.totals,$scope.payments=selectYear($scope.masterPayments,$scope.actDate.getFullYear()),$("#payments-stats-container .month.act-month").removeClass("anim"),$scope.actPayment=selectMonth($scope.payments.months,$scope.actDate.getMonth()+1),setTimeout(function(){$("#payments-stats-container .month.act-month").addClass("anim")},400),cnvPaymentsTotalData=new PieGraphData,cnvPaymentsTotalData.putData(formatQueriesTotals($scope.paymentsTotals.services)),cnvPaymentsTotalData2=new GraphData;for(var i=0,len=$scope.masterPayments.length;len>i;i++)($scope.masterPayments[i].year===$scope.actDate.getFullYear()||$scope.masterPayments[i].year===$scope.actDate.getFullYear()-1)&&($scope.masterPayments[i].selected=!0);cnvPaymentsTotalData2.genData($scope.masterPayments),cnvPaymentsTotalData3=new StackedGraphData,$scope.paymentsByServInYear=$scope.masterPayments[0],cnvPaymentsTotalData3.formatNPutData($scope.paymentsByServInYear)})},$scope.updateActPayment=function(month){$("#payments-stats-container .month.act-month").removeClass("anim"),$scope.actPayment=selectMonth($scope.payments.months,month||$scope.actDate.getMonth()+1),setTimeout(function(){$("#payments-stats-container .month.act-month").addClass("anim")},400)},$scope.drawPaymentsGraphs=function(){return paymentsCharts.totals.byServ?!1:void setTimeout(function(){drawPaymentsGraphics()},500)},$scope.genNDrawPaymentsGraphs=function(){for(var atLeastOneYear=!1,i=0,len=$scope.masterPayments.length;len>i;i++)if($scope.masterPayments[i].selected){atLeastOneYear=!0;break}return atLeastOneYear?(cnvPaymentsTotalData2=new GraphData,cnvPaymentsTotalData3=new StackedGraphData,cnvPaymentsTotalData2.genData($scope.masterPayments),cnvPaymentsTotalData3.formatNPutData($scope.paymentsByServInYear),paymentsCharts.totals.byYears.destroy(),paymentsCharts.totals.byServInOneYear.destroy(),void drawPaymentsGraphics()):alert("Selecione al menos un año!")},$scope.setRowClass=function(index){var clases="",nindex=index;switch(index>=0&&3>=index&&(clases="rw1"),index>=4&&7>=index&&(clases="rw2",nindex-=4),index>=8&&10>=index&&(clases="rw3",nindex-=8),nindex){case 0:clases+=" cell1";break;case 1:clases+=" cell2";break;case 2:clases+=" cell3";break;case 3:clases+=" cell4"}return clases},GraphData.prototype.genData=function(years){for(var tmpArr,i=0,len=years.length;len>i;i++)if(years[i].selected){tmpArr=[];for(var j=0,len2=years[i].months.length;len2>j;j++)tmpArr.push(years[i].months[j].count);this.datasets.push(new GraphDataSet(years[i].year,hexToRgb(getRandomColor()),tmpArr))}},StackedGraphData.prototype=new GraphData,PieGraphData.prototype.putData=function(array){this.data=array}}])}();
  1878. !function(){"use strict";angular.module("mean.mean-admin").filter("discount",function(){return function(fee,discount){return"NA"===discount?fee:fee-fee*discount/100}}).controller("PaymentsController",["$scope","$filter","Global","Menus","$rootScope","$http","Payments",function($scope,$filter,Global,Menus,$rootScope,$http,Payments){function calculatePages(num){$scope.nregs.normal=num;var pageNum=num/queryOpts.pagesize;pageNum=Math.ceil(pageNum),$scope.pages.arr=[];for(var i=0;pageNum>i;i++)$scope.pages.arr.push(i+1);$scope.pages.active=1}function checkNoEmpties(){if($scope.searchParms){for(var props=Object.keys($scope.searchParms),propstodel=[],i=0;i<props.length;i++)/^\s*$/.test($scope.searchParms[props[i]])&&propstodel.push(props[i]);for(var k=0;k<propstodel.length;k++)delete $scope.searchParms[propstodel[k]];return $.isEmptyObject($scope.searchParms)?(delete $scope.searchParms,!1):!0}return!1}function advCalculatePages(num){$scope.nregs.adv=num;var pageNum=num/queryOpts.pagesize;pageNum=Math.ceil(pageNum),$scope.advPages.arr=[];for(var i=0;pageNum>i;i++)$scope.advPages.arr.push(i+1);0!==$scope.advPages.arr.length&&($scope.advPages.active=1)}function reload(){$scope.advSearch.on?($scope.searchParms.pagesize=queryOpts.pagesize,$scope.searchParms.ind=$scope.advPages.active-1,Payments.getWithFilter($scope.searchParms,function(data){$scope.payments=data.pays,$("#tablepayments").footable()})):(queryOpts.pageind=$scope.pages.active-1,Payments.get(queryOpts,function(data){$scope.payments=data.pays}))}$scope.nregs={normal:0,adv:0},$scope.pages={active:0,arr:[]},$scope.advPages={active:0,arr:[]},$scope.advSearch={pagesize:15,ind:0,on:!1,switchh:!1},$scope.colectores=[{nom:"MOVISTAR",cad:"4FED27A6-FD4A-4E52-88B0-405EDF90F110"},{nom:"ENACAL",cad:"650141FD-7B9E-40F7-82FF-28FD308BF314"},{nom:"GRUPO MONGE",cad:"2BC2EE0D-9007-4665-8694-DD82A0777771"},{nom:"CLARO",cad:"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"IBW",cad:"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"LA PRENSA",cad:"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"YOTA",cad:"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2"},{nom:"DISNORTE DISSUR",cad:"460DD882-9E73-4A89-BD54-6E500696F9D7"}],$scope.servicios=[{nom:"Telefonía Pospago",cad:"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9"},{nom:"Agua",cad:"7F397666-14FB-496F-A7DD-43E9E09A0DDD"},{nom:"Cuota Crédito Gallo",cad:"586080C0-1E48-E411-A034-005056C00008"},{nom:"Cuota Crédito Verdugo",cad:"596080C0-1E48-E411-A034-005056C00008"},{nom:"Casa CLARO",cad:"2F0E010E-D009-E311-8F13-BC5FF42EE8D2"},{nom:"Telefonía Fija",cad:"A7CB9F41-3546-4F3A-BB60-3ED5D6E17036"},{nom:"Internet Fijo",cad:"0C9D791E-A53B-4086-9389-62DE814F3B68"},{nom:"TV/Cable",cad:"587D532F-DC04-4972-8376-F2C36786A409"},{nom:"Internet Móvil",cad:"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2"},{nom:"Internet/Cable",cad:"71084F07-ACC4-E211-9D20-BC5FF42EE8D2"},{nom:"Suscripción",cad:"194CC25B-3FCB-E311-8819-BC5FF42EE8D2"},{nom:"DISNORTE",cad:"A669414A-BD1A-E511-8A03-BC5FF42EE8D2"},{nom:"DISSUR",cad:"DBC08955-BD1A-E511-8A03-BC5FF42EE8D2"}],$("#tablepayments").footable();var queryOpts={pageind:0,pagesize:15};$scope.init=function(arg){arg&&(queryOpts.state="ON")||queryOpts.state&&delete queryOpts.state,Payments.get(queryOpts,function(data){$scope.payments=data.pays,calculatePages(data.ndocs)})},$scope.order=function(reverse){console.log("sorting"),$scope.payments=$filter("orderBy")($scope.payments,"created",reverse)},$scope.search=function(arg){return checkNoEmpties()?($scope.searchParms.pagesize=queryOpts.pagesize,$scope.searchParms.ind=0,arg&&($scope.searchParms.onlyTrue=!0)||$scope.searchParms.onlyTrue&&delete $scope.searchParms.onlyTrue,void Payments.getWithFilter($scope.searchParms,function(data){$scope.payments=data.pays,$scope.advModeSwitch(!0),advCalculatePages(data.ndocs),$("#tablepayments").footable()})):(alert("Por favor, llena al menos un campo"),!1)},$scope.xport=function(){function genCsv(pays){var pay,ind,datapayments=[];for(ind in pays.pays){pay=pays.pays[ind];var tlog={OrderID:pay.orderid,Nombre:pay.usersname,Email:pay.usersemail,"Referer de Usuario":pay.userref,Colector:$filter("colector")(pay.colector),Servicio:$filter("servicio")(pay.servicio),docReferencia:pay.parametro,"No Factura":pay.nofactura,fecha:$filter("date")(pay.created,"dd/MM/yyyy h:mm:ss a"),MontoUS:pay.monto,Fee:pay.fee,"Referer de Pago":pay.refPago,"Descuento codigo":pay.discountcode,"descuento porcentaje":pay.discountpercent};datapayments.push(tlog)}JSONToCSVConvertor(datapayments,"Pagos realizados",!0,"Reporte_")}Payments.get({pageind:0,pagesize:0},genCsv)},$scope.navigate=function(page,ind,prevnext){if(page===$scope.pages.active)return!1;if(prevnext)if("prev"===prevnext){if(1===$scope.pages.active)return!1;page=$scope.pages.active-1,ind=page-1}else{if($scope.pages.active===$scope.pages.arr.length)return!1;page=$scope.pages.active+1,ind=$scope.pages.active}queryOpts.pageind=ind,Payments.get(queryOpts,function(data){$scope.payments=data.pays,$scope.pages.active=page})},$scope.limitPagination=function(page){return page===$scope.pages.active||page===$scope.pages.active+1||page===$scope.pages.active+2||page===$scope.pages.active-1||page===$scope.pages.active-2?!0:!1},$scope.paginationHelp=function(where){return"behind"===where?$scope.pages.active<=3?!1:!0:$scope.pages.active<$scope.pages.arr.length-2?!0:!1},$scope.navigateMore=function(where){"back"===where?$scope.navigate($scope.pages.active-2,$scope.pages.active-3):$scope.navigate($scope.pages.active+2,$scope.pages.active+1)},$scope.advPaginationHelp=function(where){return"behind"===where?$scope.advPages.active<=3?!1:!0:$scope.advPages.arr.length<=3?!1:$scope.advPages.active<$scope.advPages.arr.length-2?!0:!1},$scope.advNavigate=function(page,ind,prevnext){if(page===$scope.advPages.active)return!1;if(prevnext)if("prev"===prevnext){if(1===$scope.advPages.active)return!1;page=$scope.advPages.active-1,ind=page-1}else{if($scope.advPages.active===$scope.advPages.arr.length)return!1;page=$scope.advPages.active+1,ind=$scope.advPages.active}$scope.searchParms.pagesize=queryOpts.pagesize,$scope.searchParms.ind=ind,Payments.getWithFilter($scope.searchParms,function(data){$scope.payments=data.pays,$scope.advPages.active=page,$("#tablepayments").footable()})},$scope.advLimitPagination=function(page){return page===$scope.advPages.active||page===$scope.advPages.active+1||page===$scope.advPages.active+2||page===$scope.advPages.active-1||page===$scope.advPages.active-2?!0:!1},$scope.advNavigateMore=function(where){"back"===where?$scope.advNavigate($scope.advPages.active-2,$scope.advPages.active-3):$scope.advNavigate($scope.advPages.active+2,$scope.advPages.active+1)},$scope.advModeSwitch=function(truth,opt){$scope.advSearch.on=truth,truth?$scope.advSearch.switchh=!1:opt?$scope.init(1):$scope.init()},$scope.setAprobado=function(doc){$scope.toaprove={orderid:doc.orderid,ind:doc.docind,on:!0}},$scope.cancelSetAprobado=function(doc){$scope.toaprove={}},$scope.sendToAprove=function(){Payments.aprove($scope.toaprove,function(res){reload(),$scope.cancelSetAprobado()})},$scope.switchAnulacion=function(payment){function sendToSwitch(){Payments.stateSwitch({objid:payment.objid,state:!payment.state},function(res){alert(res.success||res.error),reload()})}console.log(payment),payment.state?(console.log("oki -> anulando"),window.confirm("Esta seguro que quiere anular el pago de OrderID: "+payment.orderid+"?")&&sendToSwitch()):(console.log("oki -> activar"),window.confirm("Esta seguro que quiere activar el pago de OrderID: "+payment.orderid+"?")&&sendToSwitch())},$("#fechaInicio").datetimepicker({pickTime:!1}),$("#fechaFin").datetimepicker({pickTime:!1}),$("#inputFechaAprobado").datetimepicker(),$("#fechaInicio").on("dp.change",function(e){console.log($("#fechaFin").data("DateTimePicker")),$("#fechaFin").data("DateTimePicker").setMinDate(e.date)}),$("#fechaFin").on("dp.change",function(e){console.log($("#fechaInicio").data("DateTimePicker")),$("#fechaInicio").data("DateTimePicker").setMaxDate(e.date)})}])}();
  1879. !function(){"use strict";angular.module("mean.mean-admin").controller("SettingsController",["$scope","Global","Settings",function($scope,Global,Settings){$scope.newItem={key:"",value:{value:""}},$scope.init=function(){Settings.get(function(data){data.success&&($scope.settings=data.settings)})},$scope.update=function(settings){settings=JSON.clean(JSON.unflatten(settings)),Settings.update(settings,function(data){})},$scope.getTextToCopy=function(){var settings=JSON.clean(JSON.unflatten($scope.settings));return JSON.stringify(settings)},JSON.unflatten=function(data){if(Object(data)!==data||Array.isArray(data))return data;var regex=/\.?([^.\[\]]+)|\[(\d+)\]/g,resultholder={};for(var p in data){for(var m,cur=resultholder,prop="";m=regex.exec(p);)cur=cur[prop]||(cur[prop]=m[2]?[]:{}),prop=m[2]||m[1];cur[prop]=data[p]}return resultholder[""]||resultholder},JSON.clean=function(data,options){function clean(config,root){for(var index in config)config[index]&&!config[index].value&&"object"==typeof config[index]?clean(config[index],index):root&&!result[root]?(result[root]={},result[root][index]=config[index]?config[index].value:null):root&&result[root]?result[root][index]=config[index]?config[index].value:null:result[index]=config[index]?config[index].value:null}var result={};return clean(data,""),result},$scope.add=function(newItem){$scope.settings[newItem.key]=newItem.value,$scope.update($scope.settings),$scope.newItem={key:"",value:{value:""}}},$scope.remove=function(key){delete $scope.settings[key],$scope.update($scope.settings)},$scope.setDefault=function(key){$scope.settings[key].value=$scope.settings[key]["default"],$scope.update($scope.settings)}}])}();
  1880. !function(){"use strict";angular.module("mean.mean-admin").controller("ThemesController",["$scope","Global","$rootScope","$http",function($scope,Global,$rootScope,$http){$scope.global=Global,$scope.themes=[],$scope.init=function(){$http({method:"GET",url:"http://api.bootswatch.com/3/"}).success(function(data,status,headers,config){$scope.themes=data.themes}).error(function(data,status,headers,config){})},$scope.changeTheme=function(theme){$(".progress-striped").show(),$http.get("/admin/themes?theme="+theme.css).success(function(data,status,headers,config){data&&window.location.reload()}).error(function(data,status,headers,config){alert("error"),$(".progress-striped").hide()})},$scope.defaultTheme=function(){$http.get("/admin/themes/defaultTheme").success(function(data,status,headers,config){data&&window.location.reload()}).error(function(data,status,headers,config){alert("error")})}}])}();
  1881. !function(){"use strict";angular.module("mean.mean-admin").controller("UsersController",["$scope","$filter","Global","Menus","$rootScope","$http","Users",function($scope,$filter,Global,Menus,$rootScope,$http,Users){$scope.global=Global,$scope.userSchema=[{title:"Email",schemaKey:"email",type:"text",inTable:!0},{title:"Name",schemaKey:"name",type:"text",inTable:!0},{title:"State",schemaKey:"state",type:"text",inTable:!0},{title:"Create",schemaKey:"created_at",type:"text",inTable:!0},{title:"Provider",schemaKey:"provider",type:"text",inTable:!0},{title:"Referer",schemaKey:"ref",type:"text",inTable:!0},{title:"Password",schemaKey:"password",type:"password",inTable:!1},{title:"Repeat password",schemaKey:"confirmPassword",type:"password",inTable:!1}],$scope.user={},$scope.pages={arr:[],active:1},$scope.currentPage=0,$scope.pagesize=15,$scope.init=function(){Users.query({},function(users){$scope.users=users;for(var pagesnum=Math.ceil(users.length/$scope.pagesize),i=1;$scope.pages.arr.push(i++)<pagesnum;);})},$scope.add=function(){$scope.users||($scope.users=[]);var user=new Users({email:$scope.user.email,name:$scope.user.name,username:$scope.user.username,password:$scope.user.password,confirmPassword:$scope.user.confirmPassword,roles:$scope.user.roles});user.$save(function(response){$scope.users.push(response)}),this.firstName=this.lastName=this.email=this.password=this.role=""},$scope.remove=function(user){for(var i in $scope.users)$scope.users[i]===user&&$scope.users.splice(i,1);user.$remove()},$scope.update=function(user,userField){userField&&"state"===userField&&confirm("Hummm.. Seguro, seguro desea bloquearlo?")&&user.$update()},$scope.beforeSelect=function(userField,user){"roles"===userField&&(user.tmpRoles=user.roles)},$scope.prev=function(){$scope.currentPage--,$scope.pages.active=$scope.currentPage+1},$scope.next=function(){$scope.currentPage++,$scope.pages.active=$scope.currentPage+1},$scope.navigate=function(page,ind){return page===$scope.pages.active?(console.log("okis"),!1):($scope.currentPage=ind,void($scope.pages.active=page))},$scope.limitPagination=function(page){return page===$scope.pages.active||page===$scope.pages.active+1||page===$scope.pages.active+2||page===$scope.pages.active-1||page===$scope.pages.active-2?!0:!1},$scope.paginationHelp=function(where){return"behind"===where?$scope.pages.active<=3?!1:!0:$scope.pages.active<$scope.pages.arr.length-2?!0:!1},$scope.navigateMore=function(where){"back"===where?$scope.navigate($scope.pages.active-2,$scope.pages.active-3):$scope.navigate($scope.pages.active+2,$scope.pages.active+1)},$scope.updateSearch=function(){$scope.currentPage=0,$scope.pages.active=1;var pagesnum;if(""===$scope.searchParam){pagesnum=Math.ceil($scope.users.length/$scope.pagesize),$scope.pages.arr=[];for(var i=1;$scope.pages.arr.push(i++)<pagesnum;);return!1}var filtrado=$filter("filter")($scope.users,$scope.searchParam);pagesnum=Math.ceil(filtrado.length/$scope.pagesize),$scope.pages.arr=[];for(var i=1;$scope.pages.arr.push(i++)<pagesnum;);}}])}();
  1882. !function(){angular.module("mean.mean-admin").directive("ngEnter",function(){return function(scope,elm,attrs){elm.bind("keypress",function(e){13!==e.charCode||e.ctrlKey||scope.$apply(attrs.ngEnter)})}}),angular.module("mean.mean-admin").directive("ngEditable",function(){return{template:'<span class="editable-wrapper"><span data-ng-hide="edit" data-ng-click="edit=true;value=model;">{{model}}</span><input type="text" data-ng-model="value" data-ng-blur="edit = false; model = value" data-ng-show="edit" data-ng-enter="model=value;edit=false;"/></span>',scope:{model:"=ngEditableModel",update:"&ngEditable"},replace:!0,link:function(scope,element,attrs){scope.focus=function(){element.find("input").focus()},scope.$watch("edit",function(isEditable){isEditable===!1&&scope.update()})}}}),angular.module("mean.mean-admin").directive("ngEditableParagraph",function(){return{template:'<span class="editable-wrapper"><span data-ng-hide="edit" data-ng-click="edit=true;value=model;" class="respect-newline">{{model}}</span><textarea data-ng-model="value" data-ng-blur="model=value ; edit=false" data-ng-show="edit" data-ng-enter="model=value;edit=false;" class="span8"></textarea></span>',scope:{model:"=ngEditableModel",update:"&ngEditableParagraph"},replace:!0,link:function(scope,element,attrs){scope.focus=function(){element.find("input").focus()},scope.$watch("edit",function(isEditable){isEditable===!1?scope.update():scope.focus()})}}}),angular.module("mean.mean-admin").directive("ngEditableSelect",function(){return{template:'<span class="editable-wrapper"><span data-ng-hide="edit" data-ng-click="edit=true;value=model;"><span data-ng-repeat="m in model">{{m}};</span></span><select data-ng-model="value" data-ng-show="edit" data-ng-multiple="true" multiple data-ng-options="option for option in options" data-ng-change="model=value;edit=false;"><option value="">Choose Option</option></select></span>',scope:{text:"&ngEditableSelectText",model:"=ngEditableSelectModel",options:"=ngEditableSelectOptions",update:"&ngEditableSelect"},transclude:!0,replace:!0,link:function(scope,element,attrs){scope.$watch("edit",function(isEditable){isEditable===!1&&scope.update()})}}})}();
  1883. !function(){"use strict";angular.module("mean.mean-admin").filter("colector",function(){return function(colector){switch(colector){case"4FED27A6-FD4A-4E52-88B0-405EDF90F110":colector="MOVISTAR";break;case"650141FD-7B9E-40F7-82FF-28FD308BF314":colector="ENACAL";break;case"2BC2EE0D-9007-4665-8694-DD82A0777771":colector="GRUPO MONGE";break;case"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2":colector="CLARO";break;case"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2":colector="IBW";break;case"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2":colector="LA PRENSA";break;case"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2":colector="YOTA";break;case"460DD882-9E73-4A89-BD54-6E500696F9D7":colector="DISNORTE DISSUR";break;default:return null}return colector}}).filter("servicio",function(){return function(servicio){switch(servicio){case"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9":servicio="Telefonía Pospago";break;case"586080C0-1E48-E411-A034-005056C00008":servicio="Cuota Crédito Gallo";break;case"596080C0-1E48-E411-A034-005056C00008":servicio="Cuota Crédito Verdugo";break;case"7F397666-14FB-496F-A7DD-43E9E09A0DDD":servicio="Agua";break;case"A7CB9F41-3546-4F3A-BB60-3ED5D6E17036":servicio="Telefonía Fija";break;case"0C9D791E-A53B-4086-9389-62DE814F3B68":servicio="Internet Fijo";break;case"587D532F-DC04-4972-8376-F2C36786A409":servicio="TV/Cable";break;case"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2":servicio="Internet Móvil";break;case"2F0E010E-D009-E311-8F13-BC5FF42EE8D2":servicio="Casa CLARO";break;case"71084F07-ACC4-E211-9D20-BC5FF42EE8D2":servicio="Internet/Cable";break;case"194CC25B-3FCB-E311-8819-BC5FF42EE8D2":servicio="Suscripción";break;case"A669414A-BD1A-E511-8A03-BC5FF42EE8D2":servicio="DISNORTE";break;case"DBC08955-BD1A-E511-8A03-BC5FF42EE8D2":servicio="DISSUR";break;default:return null}return servicio}}).filter("tipoB",function(){return function(tipoB){switch(tipoB){case"250669A4-6F7C-E211-B93B-BC5FF42EE8D2":tipoB="Teléfono";break;case"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2":tipoB="No. Cliente";break;case"65F94DF1-3B7C-E211-B93B-BC5FF42EE8D2":tipoB="No. Cuenta";break;case"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2":tipoB="Nombres";break;case"AE1B287C-EC1F-4389-A123-1316B3519364":tipoB="Cédula";break;case"95D5F7B3-36A9-E211-A0D1-BC5FF42EE8D2":tipoB="RUC";break;case"42614C97-47A9-E211-A0D1-BC5FF42EE8D2":tipoB="Factura";break;case"016B8F2D-B81A-E511-8A03-BC5FF42EE8D2":tipoB="NIS/NIR";break;default:return null}return tipoB}}).controller("UsersQController",["$scope","$q","$filter","Global","Menus","$rootScope","$http","UsersSp",function($scope,$q,$filter,Global,Menus,$rootScope,$http,UsersSp){function checkEmpties(){return $scope.advSearch.name&&/^\s*$/.test($scope.advSearch.name)&&delete $scope.advSearch.name,$scope.advSearch.email&&/^\s*$/.test($scope.advSearch.email)&&delete $scope.advSearch.email,$scope.advSearch.param&&/^\s*$/.test($scope.advSearch.param)&&delete $scope.advSearch.param,$scope.advSearch.name||$scope.advSearch.email||$scope.advSearch.param||$scope.advSearch.colector||$scope.advSearch.servicio||$scope.advSearch.tipob?!0:!1}function calculatePages(num){$scope.nregs.normal=num;var pageNum=num/queryOpts.pagesize;pageNum=Math.ceil(pageNum),$scope.pages.arr=[];for(var i=0;pageNum>i;i++)$scope.pages.arr.push(i+1);$scope.pages.active=1}function advCalculatePages(num){$scope.nregs.adv=num;var pageNum=num/queryOpts.pagesize;pageNum=Math.ceil(pageNum),$scope.advPages.arr=[];for(var i=0;pageNum>i;i++)$scope.advPages.arr.push(i+1);0!==$scope.advPages.arr.length&&($scope.advPages.active=1)}$scope.global=Global,$scope.logs={},$scope.nregs={normal:0,adv:0},$scope.pages={active:0,arr:[]},$scope.advPages={active:0,arr:[]},$scope.advSearch={pagesize:15,ind:0,on:!1,switchh:!1},$scope.tableHeaders=["Username","Email","Nombre","Fecha","Colector","Servicio","Tipo de Busqueda","Parametro"],$scope.colectores=[{nom:"MOVISTAR",cad:"4FED27A6-FD4A-4E52-88B0-405EDF90F110"},{nom:"ENACAL",cad:"650141FD-7B9E-40F7-82FF-28FD308BF314"},{nom:"GRUPO MONGE",cad:"2BC2EE0D-9007-4665-8694-DD82A0777771"},{nom:"CLARO",cad:"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"IBW",cad:"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"LA PRENSA",cad:"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"YOTA",cad:"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2"},{nom:"DISNORTE DISSUR",cad:"460DD882-9E73-4A89-BD54-6E500696F9D7"}],$scope.servicios=[],$scope.tipob=[];var queryOpts={pageind:0,pagesize:15};$scope.changeServsNSearchType=function(){switch($filter("colector")($scope.advSearch.colector)){case"MOVISTAR":$scope.servicios=[{nom:"Telefonía Pospago",cad:"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9"}],$scope.tipob=[{nom:"Teléfono",cad:"250669A4-6F7C-E211-B93B-BC5FF42EE8D2"},{nom:"Número de Cliente",cad:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"ENACAL":$scope.servicios=[{nom:"Agua",cad:"7F397666-14FB-496F-A7DD-43E9E09A0DDD"}],$scope.tipob=[{nom:"Número de Cuenta",cad:"65F94DF1-3B7C-E211-B93B-BC5FF42EE8D2"},{nom:"Nombres",cad:"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2"}];break;case"GRUPO MONGE":$scope.servicios=[{nom:"Cuota Crédito Gallo",cad:"586080C0-1E48-E411-A034-005056C00008"},{nom:"Cuota Crédito Verdugo",cad:"596080C0-1E48-E411-A034-005056C00008"}],$scope.tipob=[{nom:"Cédula",cad:"AE1B287C-EC1F-4389-A123-1316B3519364"}];break;case"CLARO":$scope.servicios=[{nom:"Casa CLARO",cad:"2F0E010E-D009-E311-8F13-BC5FF42EE8D2"},{nom:"Telefonía Fija",cad:"A7CB9F41-3546-4F3A-BB60-3ED5D6E17036"},{nom:"Internet Fijo",cad:"0C9D791E-A53B-4086-9389-62DE814F3B68"},{nom:"Telefonía Pospago",cad:"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9"},{nom:"TV/Cable",cad:"587D532F-DC04-4972-8376-F2C36786A409"},{nom:"Internet Móvil",cad:"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2"}],$scope.tipob=[{nom:"Teléfono",cad:"250669A4-6F7C-E211-B93B-BC5FF42EE8D2"},{nom:"No.Cliente",cad:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"IBW":$scope.servicios=[{nom:"Internet/Cable",cad:"71084F07-ACC4-E211-9D20-BC5FF42EE8D2"}],$scope.tipob=[{nom:"Cédula",cad:"AE1B287C-EC1F-4389-A123-1316B3519364"},{nom:"RUC",cad:"95D5F7B3-36A9-E211-A0D1-BC5FF42EE8D2"},{nom:"Nombres",cad:"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2"},{nom:"Factura",cad:"42614C97-47A9-E211-A0D1-BC5FF42EE8D2"},{nom:"No.Cliente",cad:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"LA PRENSA":$scope.servicios=[{nom:"Suscripción",cad:"194CC25B-3FCB-E311-8819-BC5FF42EE8D2"}],$scope.tipob=[{nom:"Nombres",cad:"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2"},{nom:"No.Cliente",cad:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"YOTA":$scope.servicios=[{nom:"Internet Móvil",cad:"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2"}],$scope.tipob=[{nom:"No.Cuenta",cad:"65F94DF1-3B7C-E211-B93B-BC5FF42EE8D2"},{nom:"No. Teléfono",cad:"250669A4-6F7C-E211-B93B-BC5FF42EE8D2"}];break;case"DISNORTE DISSUR":$scope.servicios=[{nom:"DISNORTE",cad:"A669414A-BD1A-E511-8A03-BC5FF42EE8D2"},{nom:"DISSUR",cad:"DBC08955-BD1A-E511-8A03-BC5FF42EE8D2"}],$scope.tipob=[{nom:"NIS/NIR",cad:"016B8F2D-B81A-E511-8A03-BC5FF42EE8D2"}];break;default:$scope.servicios=[],$scope.tipob=[],$scope.advSearch.servicio=null,$scope.advSearch.tipob=null}},$scope.init=function(){UsersSp.get(queryOpts,function(data){$scope.logs=data.logs,calculatePages(data.ndocs),$("#tablequerylogs").footable()})},$scope.order=function(reverse){$scope.logs=$filter("orderBy")($scope.logs,"created",reverse)},$scope.getadv=function(){return checkEmpties()?void UsersSp.getAdv($scope.advSearch,function(data){$scope.logs=data.logs,$scope.advModeSwitch(!0),advCalculatePages(data.ndocs),$("#tablequerylogs").footable()}):(alert("Completa al menos un campo"),!1)},$scope.xport=function(){function genCsv(lgs){var log,ind,datalogs=[];for(ind in lgs.logs){log=lgs.logs[ind];var tlog={Username:log.stackQuery.user.username,Email:log.stackQuery.user.email,Nombre:log.stackQuery.user.name,Fecha:$filter("date")(log.created,"dd/MM/yyyy HH:mm:ss"),Colector:$filter("colector")(log.stackQuery.colector),Servicio:$filter("servicio")(log.stackQuery.servicio),"Tipo de Busqueda":$filter("tipoB")(log.stackQuery.tipoB),Parametro:log.stackQuery.idParm};datalogs.push(tlog)}JSONToCSVConvertor(datalogs,"Consultas de Usuarios",!0,"Reporte_")}UsersSp.get({skip:0,pagesize:0},genCsv)},$scope.navigate=function(page,ind,prevnext){if(page===$scope.pages.active)return!1;if(prevnext)if("prev"===prevnext){if(1===$scope.pages.active)return!1;page=$scope.pages.active-1,ind=page-1}else{if($scope.pages.active===$scope.pages.arr.length)return!1;page=$scope.pages.active+1,ind=$scope.pages.active}queryOpts.pageind=ind,UsersSp.get(queryOpts,function(data){$scope.logs=data.logs,$scope.pages.active=page,$("#tablequerylogs").footable()})},$scope.limitPagination=function(page){return page===$scope.pages.active||page===$scope.pages.active+1||page===$scope.pages.active+2||page===$scope.pages.active-1||page===$scope.pages.active-2?!0:!1},$scope.paginationHelp=function(where){return"behind"===where?$scope.pages.active<=3?!1:!0:$scope.pages.active<$scope.pages.arr.length-2?!0:!1},$scope.navigateMore=function(where){"back"===where?$scope.navigate($scope.pages.active-2,$scope.pages.active-3):$scope.navigate($scope.pages.active+2,$scope.pages.active+1)},$scope.advPaginationHelp=function(where){return"behind"===where?$scope.advPages.active<=3?!1:!0:$scope.advPages.arr.length<=3?!1:$scope.advPages.active<$scope.advPages.arr.length-2?!0:!1},$scope.advNavigate=function(page,ind,prevnext){if(page===$scope.advPages.active)return!1;if(prevnext)if("prev"===prevnext){if(1===$scope.advPages.active)return!1;page=$scope.advPages.active-1,ind=page-1}else{if($scope.advPages.active===$scope.advPages.arr.length)return!1;page=$scope.advPages.active+1,ind=$scope.advPages.active}$scope.advSearch.ind=ind,UsersSp.getAdv($scope.advSearch,function(data){$scope.logs=data.logs,$scope.advPages.active=page,$("#tablequerylogs").footable()})},$scope.advLimitPagination=function(page){return page===$scope.advPages.active||page===$scope.advPages.active+1||page===$scope.advPages.active+2||page===$scope.advPages.active-1||page===$scope.advPages.active-2?!0:!1},$scope.advNavigateMore=function(where){"back"===where?$scope.advNavigate($scope.advPages.active-2,$scope.advPages.active-3):$scope.advNavigate($scope.advPages.active+2,$scope.advPages.active+1)},$scope.advModeSwitch=function(truth){$scope.advSearch.on=truth,truth?$scope.advSearch.switchh=!1:$scope.init()}}])}();
  1884. !function(){"use strict";angular.module("mean.mean-admin").factory("AdminDashboard",["$http",function($http){return{getByYearNMonth:{users:function(callback){$http.get("/admin/users/byYearNMonth").success(function(data){callback(data)})},queries:function(callback){$http.get("/admin/queries/byYearNMonth").success(function(data){callback(data)})},payments:function(callback){$http.get("/admin/payments/byYearNMonth").success(function(data){callback(data)})}}}}])}();
  1885. !function(){"use strict";angular.module("mean.mean-admin").factory("Modules",["$http",function($http){return{get:function(obj,callback){$http.get("/admin/modules?skip="+obj.pageind+"&pagesize="+obj.pagesize).success(function(data){for(var i=0;i<data.logs.length;i++)data.logs[i].stackQuery?data.logs[i].name=JSON.parse(data.logs[i].stackQuery).user.name:data.logs[i].name=data.logs[i].username,data.logs[i].username=void 0;callback(data)})},getAdv:function(obj,callback){$http.post("/admin/modulesAdv",obj).success(function(data){for(var i=0;i<data.logs.length;i++)data.logs[i].stackQuery?data.logs[i].name=JSON.parse(data.logs[i].stackQuery).user.name:data.logs[i].name=data.logs[i].username,data.logs[i].username=void 0;callback(data)})}}}])}();
  1886. !function(){"use strict";angular.module("mean.mean-admin").factory("Payments",["$http",function($http){return{process:function(data){for(var singlepayments=[],bill={},i=0;i<data.payments.length;i++)for(var k=0;k<data.payments[i].docs.length;k++)bill={objid:data.payments[i]._id,orderid:data.payments[i].credResp.orderid,usersname:data.payments[i].user.name,usersemail:data.payments[i].user.email,userref:data.payments[i].user.ref||"NA",colector:data.payments[i].colector,servicio:data.payments[i].servicio,parametro:data.payments[i].parametro,nofactura:data.payments[i].docs[k].noFactura,created:data.payments[i].created,monto:data.payments[i].docs[k].monto,fee:data.payments[i].fee,state:data.payments[i].state,docind:k,codaprob:data.payments[i].docs[k].codAprob||"NA",fechaaprob:data.payments[i].docs[k].fechaAprob||"NA",refPago:data.payments[i].refPago||"NA",discountcode:data.payments[i].discount&&data.payments[i].discount.codigo||"NA",discountpercent:data.payments[i].discount&&data.payments[i].discount.percent||"NA"},singlepayments.push(bill);return singlepayments},get:function(obj,callback){var self=this;$http.get("admin/payments?skip="+obj.pageind+"&pagesize="+obj.pagesize+(obj.state&&"&state="+obj.state||"")).success(function(data){callback({ndocs:data.ndocs,pays:self.process(data)})})},getWithFilter:function(obj,callback){var self=this;$http.post("admin/payments",obj).success(function(data){callback({ndocs:data.ndocs,pays:self.process(data)})})},aprove:function(obj,callback){$http.post("/admin/payments/aprove",obj).success(function(res){callback(res)})},stateSwitch:function(obj,callback){obj.state&&(obj.state="true")||(obj.state="false"),$http.post("/admin/payments/stateswitch",obj).success(function(res){callback(res)})}}}])}();
  1887. !function(){"use strict";angular.module("mean.mean-admin").factory("Settings",["$http",function($http){var get=function(callback){$http.get("/admin/settings").success(function(data,status,headers,config){callback({success:!0,settings:data})}).error(function(data,status,headers,config){callback({success:!1})})};return{get:get}}])}();
  1888. !function(){angular.module("mean.mean-admin").factory("Users",["$resource",function($resource){return $resource("/admin/users/:userId",{userId:"@_id"},{update:{method:"PUT"}})}])}();
  1889. !function(){"use strict";angular.module("mean.mean-admin").factory("UsersSp",["$http",function($http){return{get:function(obj,callback){$http.get("/admin/spusers?skip="+obj.pageind+"&pagesize="+obj.pagesize).success(function(data){for(var i=0;i<data.logs.length;i++)data.logs[i].stackQuery=jQuery.parseJSON(data.logs[i].stackQuery);callback(data)})},getAdv:function(obj,callback){$http.post("/admin/spusersAdv",obj).success(function(data){for(var i=0;i<data.logs.length;i++)data.logs[i].stackQuery=jQuery.parseJSON(data.logs[i].stackQuery);callback(data)})}}}])}();
  1890. !function(){"use strict";angular.module("mean.mean-admin").config(["$stateProvider","$urlRouterProvider",function($stateProvider,$urlRouterProvider){$stateProvider.state("users",{url:"/admin/users",templateUrl:"mean-admin/views/users.html"}).state("settings",{url:"/admin/settings",templateUrl:"mean-admin/views/settings.html"}).state("modules",{url:"/admin/modules",templateUrl:"mean-admin/views/modules.html"}).state("onlyquering",{url:"/admin/onlyqueringusers",templateUrl:"mean-admin/views/usersq.html"}).state("payments",{url:"/admin/payments",templateUrl:"mean-admin/views/payments.html"}).state("paymentspfaprove",{url:"/admin/paymentsaprove",templateUrl:"mean-admin/views/paymentsaprove.html"}).state("adminDash",{url:"/admin/dashboard",templateUrl:"mean-admin/views/adminDashboard.html"})}]).config(["ngClipProvider",function(ngClipProvider){ngClipProvider.setPath("../mean-admin/assets/lib/zeroclipboard/dist/ZeroClipboard.swf")}])}();
  1891. !function(){"use strict";angular.module("mean.users").directive("finishedFilledCarousel",function($timeout){return{restrict:"A",link:function(scope,element,attr){scope.$last===!0&&$timeout(function(){scope.$emit("carouselReady")})}}}).directive("finishedFilledQueries",function($timeout){return{restrict:"A",link:function(scope,element,attr){scope.$last===!0&&$timeout(function(){scope.$emit("queriesReady")})}}}).directive("bsPop",function(){return function(scope,element,attrs){element.popover({placement:"top",html:!0,container:"body"})}}).directive("bsPopRef",function(){return function(scope,element,attrs){element.find("h4 span[rel=popover]").popover({placement:"top",html:!0,container:"body"})}}).controller("dashboardControl",["$scope","$http","$sce","Global",function($scope,$http,$sce,Global){function SelectText(element){var range,selection,doc=document,text=doc.getElementById(element);doc.body.createTextRange?(range=document.body.createTextRange(),range.moveToElementText(text),range.select()):window.getSelection&&(selection=window.getSelection(),range=document.createRange(),range.selectNodeContents(text),selection.removeAllRanges(),selection.addRange(range))}$scope.global=Global,$scope.fbFeed={},$scope.carouselready=!1,$scope.showLinks=!1,$scope.activeslide=0,$scope.dayMaxQueries=10,$scope.detailsboxes={totalpayments:0,totalTQueries:0,totalSQueries:0,totalDayQueries:0,ready:!1},$scope.error={onMonthQs:!1,onLastQs:!1,onReferrers:!1,onFB:!1,onSmallOverview:!1},$scope.fbReady=!1;var lgn,graph,ctx=$("#monthQsCanvas").get(0).getContext("2d"),cnvwrap=$("#monthQsCanvas").parent(),myDoughnutChart=new Chart(ctx),donutOptions={responsive:!0,animateScale:!0,legendTemplate:'<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<segments.length; i++){%><li><span style="background-color:<%=segments[i].fillColor%>">&nbsp;</span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>'};$scope.getFBFeed=function(){$http.get("/getPFFeed").success(function(resp){"BAD"===resp.stat&&($scope.error.onFB=!0),$scope.fbFeed=resp.stuff,setTimeout(function(){$scope.fbReady=!0,$scope.$apply()},1e3)}).error(function(err){$scope.fbReady=!0,$scope.error.onFB=!0})},$scope.getMyMonthQueries=function(){$http.get("/getMyLastMonthQs").success(function(resp){$("#clastm").removeClass("loading"),"BAD"===resp.stat&&($scope.error.onMonthQs=!0),resp.stuff.length||$("#clastm").siblings().toggleClass("hidden"),graph=myDoughnutChart.Doughnut(resp.stuff,donutOptions),lgn=graph.generateLegend(),cnvwrap.append(lgn)}).error(function(err){$("#clastm").removeClass("loading"),$scope.error.onMonthQs=!0})},$scope.getMyQueries=function(){$http.get("/getMyLastQs").success(function(resp){$("#clastq").removeClass("loading"),"BAD"===resp.stat&&($scope.error.onLastQs=!0),$scope.usersQueries=resp.stuff}).error(function(err){$("#clastq").removeClass("loading"),$scope.error.onLastQs=!0})},$scope.getMyTotals=function(){$http.get("/getMyTotals").success(function(resp){$(".detail-box .cogs-container").removeClass("loading"),"BAD"===resp.stat&&($scope.error.onSmallOverview=!0),$scope.detailsboxes=resp.stuff,$scope.detailsboxes.ready=!0}).error(function(err){$scope.error.onSmallOverview=!0})},$scope.getMyReferrals=function(){$http.get("/getMyReferers").success(function(resp){$("#RefBox .cogs-container").removeClass("loading"),"BAD"===resp.stat&&($scope.error.onReferrers=!0),$scope.refurl="https://www.puntofacil.us/register/"+resp.stuff[0].url,$scope.referers=resp.stuff[0].referers,$scope.refDiscounts=resp.stuff[0].refDiscounts}).error(function(err){$("#RefBox .cogs-container").removeClass("loading"),$scope.error.onReferrers=!0})},$scope.getTrustedURL=function(feed){return $sce.trustAsResourceUrl(feed.uris.vidsource)},$scope.getRefPopContent=function(ref){var feed="",discount=0,feed2="",discXQ=!1,discXP=!1;return ref.benefit?(ref.benefit.queried&&(feed="Este usuario a consultado",ref.benefit.queried.val||(discount=$scope.refDiscounts.qDis,discXQ=!0)),ref.benefit.payed&&(feed+=" y pagado",ref.benefit.payed.val||(discount+=$scope.refDiscounts.pDis,discXP=!0)),feed+=".",feed2=discXQ?discXP?"Usted tiene "+($scope.refDiscounts.qDis+$scope.refDiscounts.pDis)+"% de descuento por este referido!":"Usted tiene "+$scope.refDiscounts.qDis+"% de descuento por este referido!":discXP?"Usted utilizó "+$scope.refDiscounts.qDis+"% de descuento por consulta, Aun posee "+$scope.refDiscounts.pDis+"% de descuento por pago.":"Usted ya consumió el descuento de este referido.",""!==feed2&&(feed+="<br>"+feed2),feed):feed="No tienes descuento por este referido, ya que no ha consultado ni pagado. Invítalo a que lo haga!"},$scope.$on("queriesReady",function(queriesReadyEvent){$("#lastUserQueriesT").footable()}),$scope.$on("carouselReady",function(carouselReadyEvent){$scope.carouselready=!0,setTimeout(function(){$("#pf-feed-carousel .carousel-indicators li:first-child, #pf-feed-carousel .carousel-inner .item:first-child").addClass("active"),$("#pf-feed-carousel, i.fb-icon").removeClass("loading"),$("#pf-feed-carousel").carousel({interval:1e4}),setTimeout(function(){$scope.showLinks=!0,$scope.$apply()},1e3)},700)}),$("#pf-feed-carousel").on("slide.bs.carousel",function(){var ind=$("#pf-feed-carousel .item.active").index();ind=4===ind?0:ind+1,$scope.activeslide=ind,$scope.$apply()}),$(".dashboard-box .panel-heading .collap-box-icon").click(function(){$(".panel-body.min-200").length&&$(".panel-body.min-200").removeClass("min-200"),$(this).toggleClass("fa-rotate-180").parent().siblings(".panel-body").slideToggle()}),$(document).on("click","#refuri",function(){SelectText("refuri")})}])}();
  1892. !function(){"use strict";angular.module("mean.users").config(["$stateProvider",function($stateProvider){var checkLoggedOut=function($q,$timeout,$http,$location){var deferred=$q.defer();return $http.get("/loggedin").success(function(user){"0"!==user?($timeout(deferred.reject),$location.url("/login")):$timeout(deferred.resolve)}),deferred.promise},checkLoggedIn=function($q,$timeout,$http,$location){var deferred=$q.defer();return $http.get("/loggedin").success(function(user){"0"!==user?$timeout(deferred.resolve):($location.url("/login"),$timeout(deferred.reject))}),deferred.promise};$stateProvider.state("auth",{url:"/auth",templateUrl:"users/views/index.html"}).state("auth.login",{url:"/login",templateUrl:"users/views/login.html",resolve:{loggedin:checkLoggedOut}}).state("auth.register",{url:"/register",templateUrl:"users/views/register.html",resolve:{loggedin:checkLoggedOut}}).state("forgot-password",{url:"/forgot-password",templateUrl:"users/views/forgot-password.html",resolve:{loggedin:checkLoggedOut}}).state("reset-password",{url:"/reset/:tokenId",templateUrl:"users/views/reset-password.html",resolve:{loggedin:checkLoggedOut}}).state("dashboard",{url:"/dashboard",templateUrl:"users/views/dashboard.html",resolve:{loggedin:checkLoggedIn}}).state("myself",{url:"/myProfile",templateUrl:"users/views/profile.html",resolve:{loggedin:checkLoggedIn}})}])}();
  1893. !function(){"use strict";$('[data-toggle^="class"]').unbind("click"),angular.module("mean.users").controller("AuthCtrl",["$scope","$rootScope","$http","$location","Global",function($scope,$rootScope,$http,$location,Global){$scope.socialButtons={},$scope.socialButtonsCounter=0,$scope.global=Global,$scope.actYear=(new Date).getFullYear(),clearInterval($scope.global.indxIntervalbtn)}]).controller("LoginCtrl",["$scope","$rootScope","$http","$location","Global",function($scope,$rootScope,$http,$location,Global){$scope.user={},$scope.global=Global,$scope.global.registerForm=!1,$scope.input={type:"password",placeholder:"Password",confirmPlaceholder:"Repeat Password",iconClass:"fa-eye",tooltipText:"Show password"},$scope.togglePasswordVisible=function(){$scope.input.type="text"===$scope.input.type?"password":"text",$scope.input.iconClass="fa-eye"===$scope.input.iconClass?"fa-eye-slash":"fa-eye",$scope.input.tooltipText="Show password"===$scope.input.tooltipText?"Hide password":"Show password"},$scope.login=function(){"undefined"!=typeof $scope.loginerror&&($scope.loginerror=""),$http.post("/login",{email:$scope.user.email,password:$scope.user.password}).success(function(response){if($scope.loginError=0,$rootScope.user=response.user,$rootScope.$emit("loggedin"),$scope.user.remember){var user={email:$scope.user.email,password:$scope.user.password};$.cookie("user",user)}console.log(response),console.log(response.redirect),console.log($scope.global),response.redirect?window.location.href===response.redirect?window.location.reload():window.location=response.redirect:$("#rediFallback")[0].click()}).error(function(err,status){console.log(err),401==status?$scope.loginerror="El correo y contraseña son inválidas":$scope.loginerror="Fallo en la Autenticación"})},$scope.rememberSwitch=function(){console.log($.cookie("user")),$scope.user.remember||null===$.cookie("user")||($.cookie("user",null),console.log("cookie borrada"))},$scope.getCookieData=function(){if($.cookie.json=!0,$.cookie("user")){var usr=$.cookie("user");$scope.user.email=usr.email,$scope.user.password=usr.password,$scope.user.remember=!0}},$scope.getCookieData(),$("li.usrli.logi").addClass("active"),$("li.usrli.regi").removeClass("active"),0!==$(".zopim").length&&$(".zopim").remove()}]).controller("RegisterCtrl",["$scope","$rootScope","$http","$location","Global",function($scope,$rootScope,$http,$location,Global){$scope.user={},$scope.global=Global,$scope.global.registerForm=!0,$scope.feed={is:!1,email:void 0},$scope.input={type:"password",placeholder:"Password",placeholderConfirmPass:"Repeat Password",iconClassConfirmPass:"",tooltipText:"Show password",iconClass:"fa-eye",tooltipTextConfirmPass:"Show password"},$scope.togglePasswordVisible=function(){$scope.input.type="text"===$scope.input.type?"password":"text",$scope.input.placeholder="Password"===$scope.input.placeholder?"Visible Password":"Password",$scope.input.iconClass="fa-eye"===$scope.input.iconClass?"fa-eye-slash":"fa-eye",$scope.input.tooltipText="Show password"===$scope.input.tooltipText?"Hide password":"Show password"},$scope.togglePasswordConfirmVisible=function(){$scope.input.type="text"===$scope.input.type?"password":"text",$scope.input.placeholderConfirmPass="Repeat Password"===$scope.input.placeholderConfirmPass?"Visible Password":"Repeat Password",$scope.input.iconClassConfirmPass="icon_hide_password"===$scope.input.iconClassConfirmPass?"":"icon_hide_password",$scope.input.tooltipTextConfirmPass="Show password"===$scope.input.tooltipTextConfirmPass?"Hide password":"Show password"},$scope.register=function(){$scope.user.username=$scope.user.email.split("@")[0]+"-*--*-"+$scope.user.email.split("@")[1],$scope.usernameError=null,$scope.registerError=null,$scope.user.confirmPassword=$scope.user.password,$http.post("/register",{email:$scope.user.email,password:$scope.user.password,confirmPassword:$scope.user.confirmPassword,username:$scope.user.username,name:$scope.user.name}).success(function(res){$scope.feed.is=!0,$scope.feed.email=res.email}).error(function(error){console.log(error),"Username already taken"===error?$scope.usernameError=error:"Email already taken"===error?$scope.emailError=error:$scope.registerError=error})},$("li.usrli.regi").addClass("active"),$("li.usrli.logi").removeClass("active"),0!==$(".zopim").length&&$(".zopim").remove()}]).controller("ForgotPasswordCtrl",["$scope","$rootScope","$http","$location","Global",function($scope,$rootScope,$http,$location,Global){$scope.user={},$scope.global=Global,$scope.global.registerForm=!1,$scope.actYear=(new Date).getFullYear(),$scope.forgotpassword=function(){console.log($scope.user.email),$http.post("/forgot-password",{email:$scope.user.email}).success(function(response){$scope.response=response}).error(function(error){$scope.response=error})},$("li.usrli.logi").removeClass("active"),$("li.usrli.regi").removeClass("active"),0!==$(".zopim").length&&$(".zopim").remove()}]).controller("ResetPasswordCtrl",["$scope","$rootScope","$http","$location","$stateParams","Global",function($scope,$rootScope,$http,$location,$stateParams,Global){$scope.user={},$scope.global=Global,$scope.global.registerForm=!1,$scope.actYear=(new Date).getFullYear(),$scope.resetpassword=function(){$http.post("/reset/"+$stateParams.tokenId,{password:$scope.user.password,confirmPassword:$scope.user.confirmPassword}).success(function(response){$rootScope.user=response.user,$rootScope.$emit("loggedin"),response.redirect?window.location.href===response.redirect?window.location.reload():window.location=response.redirect:$location.url("/")}).error(function(error){"Token invalid or expired"===error.msg?$scope.resetpassworderror="Could not update password as token is invalid or may have expired":$scope.validationError=error})},$("li.usrli.logi").removeClass("active"),$("li.usrli.regi").removeClass("active"),0!==$(".zopim").length&&$(".zopim").remove()}]).controller("ProfileCtrl",["$scope","$filter","$rootScope","$http","$location","$timeout","Global",function($scope,$filter,$rootScope,$http,$location,$timeout,Global){function diffInUserInfo(){var copyact=angular.copy($scope.user),copybk=angular.copy($scope.userbk);return delete copyact.emails,delete copybk.emails,delete copyact.phones,delete copybk.phones,!angular.equals(copyact,copybk)}function diffInEmailandPhone(){return angular.equals($scope.user.emails,$scope.userbk.emails)&&angular.equals($scope.user.phones,$scope.userbk.phones)?!1:!0}function cleanEditEmails(){$scope.cache.editingEmail.ind=void 0,$scope.cache.email="",$scope.cache.editingEmail.stat=!1,$scope.feedback.emails.wrongnew=!1,$scope.feedback.emails.duplicatenew=!1}function checkEmail(){return""===$scope.cache.email?!1:$scope.cache.email.match(/^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/)?-1!==$scope.user.emails.indexOf($scope.cache.email)?($scope.feedback.emails.duplicatenew=!0,!1):!0:($scope.feedback.emails.wrongnew=!0,!1)}function checkPhone(){return""===$scope.cache.phone?!1:-1!==$scope.user.phones.indexOf($scope.cache.phone)?($scope.feedback.phones.duplicatenew=!0,!1):!0}function cleanEditPhones(){$scope.cache.editingPhone.ind=void 0,$scope.cache.phone="",$scope.cache.editingPhone.stat=!1,$scope.feedback.phones.wrongnew=!1,$scope.feedback.phones.duplicatenew=!1}function cleanNewCC(){$scope.newCC.obj={},$scope.newCC.obj.company="pflogo",$scope.newCC.creating=!1}function cleanEditCC(){$scope.actCC.editing=!1,$scope.actCC.ind=void 0,$scope.actCC.obj=void 0}function cleanFeedback(feed){"password"===feed&&($scope.feedback.userpassword.msg=void 0,$scope.feedback.userpassword.status=void 0),"user"===feed&&($scope.feedback.userupdate.msg=void 0,$scope.feedback.userupdate.status=void 0),"emailphone"===feed&&($scope.feedback.useremailnphone.msg=void 0,$scope.feedback.useremailnphone.status=void 0),"creditcard"===feed&&($scope.feedback.usercreditcard.msg=void 0,$scope.feedback.usercreditcard.status=void 0)}$scope.user={},$scope.creditcards=[],$scope.userbk={},$scope.userdefaultbk={},$scope.ofpuser={showpass:!1,inputtype:"password"},$scope.cache={email:"",phone:"",editingEmail:{stat:!1,ind:void 0,val:void 0},editingPhone:{stat:!1,ind:void 0,val:void 0}},$scope.global=Global,$scope.feedback={userupdate:{status:void 0,msg:void 0},userpassword:{status:void 0,msg:void 0},useremailnphone:{status:void 0,msg:void 0},usercreditcard:{status:void 0,msg:void 0},emails:{wrongnew:!1,duplicatenew:!1},phones:{wrongnew:!1,duplicatenew:!1}},$scope.actCC={editing:!1,ind:void 0,obj:void 0},$scope.newCC={creating:!1,obj:void 0},$scope.getProfile=function(){$http.get("/users/me").success(function(response){if($scope.user=response,$scope.user.emails||($scope.user.emails=[]),$scope.user.phones||($scope.user.phones=[]),$scope.user.birthdate){var localDate=new Date($scope.user.birthdate),localTime=localDate.getTime(),localOffset=6e4*localDate.getTimezoneOffset();$scope.user.birthdate=$filter("date")(new Date(localTime+localOffset),"dd/MM/yyyy")}angular.copy($scope.user,$scope.userbk),angular.copy($scope.user,$scope.userdefaultbk),$scope.getCC(response._id)}).error(function(response){})},$scope.getCC=function(id){$http.get("/getCC/"+id).success(function(response){$scope.creditcards=response}).error(function(response){})},$scope.updateInfoUser=function(){if(diffInUserInfo()){$scope.feedback.userupdate={status:"",msg:""};var tmpdate=moment($scope.user.birthdate,"D/MM/YYYY");$scope.user.birthdate=tmpdate.format("YYYY/MM/D"),$http.post("/updateUser",$scope.user).success(function(response){$scope.feedback.userupdate=response,$scope.user.birthdate=tmpdate.format("D/MM/YYYY"),angular.copy($scope.user,$scope.userbk),$timeout(function(){cleanFeedback("user")},5e3)}).error(function(response){$scope.feedback.userupdate={status:"danger",msg:"Error al Guardar, Intente de nuevo"},$timeout(function(){cleanFeedback("user")},5e3)})}else $scope.feedback.userupdate={status:"info",msg:"No hay cambios a guardar"},$timeout(function(){cleanFeedback("user")},5e3)},$scope.updateEmailsNPhones=function(){diffInEmailandPhone()?$http.post("/upUserEmPh",$scope.user).success(function(response){$scope.feedback.useremailnphone=response,angular.copy($scope.user,$scope.userbk),$timeout(function(){cleanFeedback("emailphone")},5e3)}).error(function(response){$scope.feedback.useremailnphone={status:"danger",msg:"Error al Guardar, Intente de nuevo"},$timeout(function(){cleanFeedback("emailphone")},5e3)}):($scope.feedback.useremailnphone={status:"info",msg:"No hay cambios a guardar"},$timeout(function(){cleanFeedback("emailphone")},5e3))},$scope.settoDefaultuser=function(){angular.copy($scope.userdefaultbk,$scope.user)},$scope.areDefChangesonUser=function(){var copyact=angular.copy($scope.user),copybk=angular.copy($scope.userdefaultbk);return delete copyact.emails,delete copybk.emails,delete copyact.phones,delete copybk.phones,angular.equals(copyact,copybk)},$scope.settoDefaultUsernEmails=function(){angular.copy($scope.userdefaultbk.emails,$scope.user.emails),angular.copy($scope.userdefaultbk.phones,$scope.user.phones)},$scope.areDefChangesonUsernEmails=function(){return angular.equals($scope.user.emails,$scope.userdefaultbk.emails)&&angular.equals($scope.user.phones,$scope.userdefaultbk.phones)},$scope.addEmail=function(){if($scope.user.emails){if(!checkEmail())return!1;$scope.user.emails.push($scope.cache.email),$scope.cache.email="",$scope.feedback.emails.wrongnew=!1,$scope.feedback.emails.duplicatenew=!1}},$scope.editEmail=function(email,index){$scope.cache.editingEmail.stat=!0,$scope.cache.editingEmail.ind=index,$scope.cache.editingEmail.val=email,$scope.cache.email=email},$scope.cancelEmailEdit=function(){cleanEditEmails()},$scope.deleteEmail=function(email){$scope.user.emails.splice($scope.user.emails.indexOf(email),1)},$scope.endEditEmail=function(){if($scope.cache.editingEmail.stat){if($scope.cache.email===$scope.cache.editingEmail.val)return $scope.cancelEmailEdit(),!1;if(!checkEmail())return!1;$scope.user.emails[$scope.cache.editingEmail.ind]=$scope.cache.email,cleanEditEmails()}},$scope.emailKeyp=function(evt){return 13!==evt.keyCode?!1:void($scope.cache.editingEmail.stat?$scope.endEditEmail():$scope.addEmail())},$scope.addPhone=function(){if($scope.user.phones){if(!checkPhone())return!1;$scope.user.phones.push($scope.cache.phone),$scope.cache.phone="",$scope.feedback.phones.wrongnew=!1,$scope.feedback.phones.duplicatenew=!1}},$scope.editPhone=function(phone,index){$scope.cache.editingPhone.stat=!0,$scope.cache.editingPhone.ind=index,$scope.cache.editingPhone.val=phone,$scope.cache.phone=phone},$scope.cancelPhoneEdit=function(){cleanEditPhones()},$scope.deletePhone=function(phone){$scope.user.phones.splice($scope.user.phones.indexOf(phone),1)},$scope.endEditPhone=function(){if($scope.cache.editingPhone.stat){if($scope.cache.phone===$scope.cache.editingPhone.val)return $scope.cancelPhoneEdit(),!1;if(!checkPhone())return!1;$scope.user.phones[$scope.cache.editingPhone.ind]=$scope.cache.phone,cleanEditPhones()}},$scope.phoneKeyp=function(evt){return 13!==evt.keyCode?!1:void($scope.cache.editingPhone.stat?$scope.endEditPhone():$scope.addPhone())},$scope.addCreditcard=function(){$http.post("/addCreditCard",$scope.newCC.obj).success(function(response){response.error?($scope.feedback.usercreditcard.status="danger",$scope.feedback.usercreditcard.msg=response.error):($scope.feedback.usercreditcard.status="success",$scope.feedback.usercreditcard.msg="Tarjeta guardada con éxito!",cleanNewCC(),$scope.creditcards.push(response)),$timeout(function(){cleanFeedback("creditcard")},5e3)}).error(function(response){response.error?($scope.feedback.usercreditcard.status="danger",$scope.feedback.usercreditcard.msg=response.error):($scope.feedback.usercreditcard.status="danger",$scope.feedback.usercreditcard.msg="Error al guardar, por favor intente mas tarde."),$timeout(function(){cleanFeedback("creditcard")},5e3)})},$scope.cancelNewCC=function(){cleanNewCC()},$scope.editCreditcard=function(creditcard,index){$scope.actCC.editing=!0,$scope.actCC.ind=index,$scope.actCC.obj=creditcard},$scope.endEditCreditcard=function(){$scope.actCC.editing&&$http.post("/cc/update",$scope.actCC.obj).success(function(response){$scope.feedback.usercreditcard.status=response.status,$scope.feedback.usercreditcard.msg=response.msg,cleanEditCC(),$timeout(function(){cleanFeedback("creditcard")},5e3)}).error(function(response){})},$scope.cancelEditCC=function(){cleanEditCC()},$scope.deleteCreditcard=function(cc){$http.post("/cc/delete",cc).success(function(response){$scope.feedback.usercreditcard.status=response.status,$scope.feedback.usercreditcard.msg=response.msg,$scope.creditcards.splice($scope.creditcards.indexOf(cc),1),$timeout(function(){cleanFeedback("creditcard")},5e3)}).error(function(response){$scope.feedback.usercreditcard.status="danger",$scope.feedback.usercreditcard.msg="Error al tratar de borrar, intente mas tarde",$timeout(function(){cleanFeedback("creditcard")},5e3)})},$scope.checkCompany=function(){if(""===$scope.newCC.obj.creditCard)return $scope.newCC.obj.company="pflogo",!1;for(var cardType,valid,ccnumber=$scope.newCC.obj.creditCard,len=ccnumber.length,mul=0,prodArr=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],sum=0;len--;)sum+=prodArr[mul][parseInt(ccnumber.charAt(len),10)],mul^=1;return valid=sum%10===0&&sum>0?"valid":"not valid",ccnumber=ccnumber.toString().replace(/\s+/g,""),/^(34)|^(37)/.test(ccnumber)&&(cardType="american_express"),/^36/.test(ccnumber)&&(cardType="diners_club_international"),/^(6011)|^(622(1(2[6-9]|[3-9][0-9])|[2-8][0-9]{2}|9([01][0-9]|2[0-5])))|^(64[4-9])|^65/.test(ccnumber)&&(cardType="discover_network"),/^35(2[89]|[3-8][0-9])/.test(ccnumber)&&(cardType="jcb"),/^5[1-5]/.test(ccnumber)&&(cardType="mastercard"),/^4/.test(ccnumber)&&(cardType="visa"),"american_express"!=cardType&&"diners_club_international"!=cardType&&"discover_network"!=cardType&&"jcb"!=cardType&&"mastercard"!=cardType&&"visa"!=cardType?($scope.newCC.obj.company="pflogo",!1):void($scope.newCC.obj.company=cardType)},$scope.checkExp=function(whom){var tod=new Date;if("update"===whom){if(parseInt($scope.actCC.obj.expirationYear)>tod.getFullYear())return!1;parseInt($scope.actCC.obj.expirationYear)===tod.getFullYear()&&($scope.actCC.obj.expirationMonth=("0"+(tod.getMonth()+1)).slice(-2))}if("new"===whom){if(parseInt($scope.newCC.obj.expirationYear)>tod.getFullYear())return!1;parseInt($scope.newCC.obj.expirationYear)===tod.getFullYear()&&($scope.newCC.obj.expirationMonth=("0"+(tod.getMonth()+1)).slice(-2))}},$scope.validMonthforNewCC=function(){if(!$scope.newCC.obj)return!1;var tmp=$scope.newCC.obj.expirationMonth;return"undefined"==typeof tmp?!1:"01"!==tmp&&"02"!==tmp&&"03"!==tmp&&"04"!==tmp&&"05"!==tmp&&"06"!==tmp&&"07"!==tmp&&"08"!==tmp&&"09"!==tmp&&"10"!==tmp&&"11"!==tmp&&"12"!==tmp?!1:!0},$scope.changePassword=function(){$http.post("user/changepassword",$scope.ofpuser).success(function(response){$scope.feedback.userpassword.status=response.status,$scope.feedback.userpassword.msg=response.msg,$timeout(function(){cleanFeedback("password")},5e3)}).error(function(response){$scope.feedback.userpassword.status=response.status,$scope.feedback.userpassword.msg=response.msg})},$scope.setpsVisible=function(){$scope.ofpuser.showpass=!0,$scope.ofpuser.inputtype="text"},$scope.setpsInvisible=function(){$scope.ofpuser.showpass=!1,$scope.ofpuser.inputtype="password"},$(".btnwtool").tooltip(),$scope.getProfile(),$("#userbirth").datetimepicker({pickTime:!1}),$(document).on("keypress","#phonenemail",function(e){var code=e.keyCode||e.which;return 13==code?(e.preventDefault(),!1):void 0})}]).directive("numbersOnly",function(){return{require:"ngModel",link:function(scope,element,attrs,modelCtrl){modelCtrl.$parsers.push(function(inputValue){if(void 0==inputValue)return"";var transformedInput=inputValue.replace(/[^0-9+.]/g,"");return transformedInput!=inputValue&&(modelCtrl.$setViewValue(transformedInput),modelCtrl.$render()),transformedInput})}}}).filter("ccMask",function(ccCompanyFilter){return function(creditcard,who,company){var cc;return creditcard?("asterisk"===who&&(cc=creditcard.toString().substring(creditcard.toString().length-4,creditcard.toString().length)),"nametag"===who&&(cc=ccCompanyFilter(company)+" - "+creditcard.toString().substring(creditcard.toString().length-4,creditcard.toString().length)),cc):""}}).filter("cctype",function(){return function(type){return"debit"===type?"Debito":"credit"===type?"Credito":void 0}}).filter("validmonths",function(){return function(montharray,year){for(var month,today=new Date,montharr=[],i=1;12>=i;i++)month=("0"+i).slice(-2),montharr.push(month);if(parseInt(year)>today.getFullYear())return montharray=montharr;if(parseInt(year)===today.getFullYear()){var actMonth=("0"+(today.getMonth()+1)).slice(-2);return montharray=montharr.splice(montharr.indexOf(actMonth),montharr.length+1-montharr.indexOf(actMonth))}}}).filter("rangeString",function(){return function(input){for(var act,min=(new Date).getFullYear(),max=parseInt(min)+10,i=parseInt(min);max>=i;i++)act=i.toString(),input.push(act);return input}}).filter("ccCompany",function(){return function(company){var comp;switch(company){case"visa":comp="Visa";break;case"mastercard":comp="MasterCard";break;case"jcb":comp="JCB";break;case"discover_network":comp="Discover Network";break;case"american_express":comp="American Express";break;case"diners_club_international":comp="Dinners Club Int."}return comp}})}();
  1894. !function(){"use strict";angular.module("mean.users").factory("MeanUser",[function(){return{name:"users"}}])}();
  1895. !function(){"use strict";angular.module("mean.system").controller("HeaderController",["$scope","$rootScope","Global","Menus",function($scope,$rootScope,Global,Menus){function queryMenu(name,defaultMenu){Menus.query({name:name,defaultMenu:defaultMenu},function(menu){$scope.menus[name]=menu})}$scope.global=Global,$scope.menus={},"undefined"==typeof $scope.global.user._id&&$scope.global.authenticated&&window.location.reload();var st=0,doc=$(document);doc.scroll(function(){st=doc.scrollTop(),st>20?$(".top-headers").addClass("go"):$(".top-headers").removeClass("go")});var defaultMainMenu=[];queryMenu("main",defaultMainMenu),$scope.isCollapsed=!1,$rootScope.$on("loggedin",function(){queryMenu("main",defaultMainMenu),$scope.global={authenticated:!!$rootScope.user,user:$rootScope.user}})}])}();
  1896. !function(){"use strict";angular.module("mean.system").config(["$stateProvider","$urlRouterProvider",function($stateProvider,$urlRouterProvider){$urlRouterProvider.otherwise("/"),$stateProvider.state("home",{url:"/",templateUrl:"system/views/index.html"}).state("second-home",{url:"/pruebalo",templateUrl:"system/views/index2.html"}).state("fourth-home",{url:"/PromoLF",templateUrl:"system/views/index4.html"})}]).config(["$locationProvider",function($locationProvider){$locationProvider.hashPrefix("!")}])}();
  1897. !function(){"use strict";angular.module("mean.system").controller("IndexController",["$scope","Global","$timeout","$interval",function($scope,Global,$timeout,$interval){function SpecialSlider(divs,images,time,transitionTime){function processSlides(){for(var act={},temp=[],i=0,len=divs.length;len>i;i++)act=$(divs[i]),temp=$("#"+act.attr("id")+" .slide-part"),temp.push(images[i]),self.slides.push(temp)}function iterateChilds(slide,callback){for(var i=0,len=slide.length;len>i;i++)callback($(slide[i]))}var self=this;this.act=0,this.to=0,this.max=images.length-1,this.timing=time||8e3,this.interval={},this.transitionTime=transitionTime||500,this.slides=[],processSlides(),this.prev=function(reset){self.to=self.act-1,self.to<0&&(self.to=self.max),self.move(),self.act=self.to,reset&&self.resetTime()},this.move=function(){iterateChilds(self.slides[self.act],function(element){element.removeClass("showing"),element.addClass("hide-it hide-it-now"),setTimeout(function(){element.removeClass("hide-it-now")},self.transitionTime)}),iterateChilds(self.slides[self.to],function(element){element.removeClass("hide-it"),element.addClass("showing show-it"),setTimeout(function(){element.removeClass("show-it")},self.transitionTime+parseInt(element.data("show-delay")))})},this.next=function(reset){self.to=self.act+1,self.to>self.max&&(self.to=0),self.move(),self.act=self.to,reset&&self.resetTime()},this.resetTime=function(){clearInterval(self.interval),self.interval=setInterval(function(){self.next()},self.timing)},this.start=function(){iterateChilds(self.slides[self.act],function(element){element.removeClass("hide-it"),element.addClass("showing show-it"),setTimeout(function(){element.removeClass("show-it")},self.transitionTime+parseInt(element.data("show-delay")))}),self.resetTime()}}function register($form){$.ajax({type:"post",url:$form.attr("action"),data:$form.serialize(),cache:!1,dataType:"jsonp",contentType:"application/json; charset=utf-8",error:function(err){$("#mce-error-response").hide().html('<span class="alert">Error de Conexión, Prueba de nuevo mas tarde</span>').fadeIn("slow")},success:function(data){if("success"!=data.result){var message=data.msg.substring(4);$("#mce-error-response").hide().html('<span class="alert">'+message+"</span>").fadeIn("slow")}else{var message=data.msg.substring(4);$("#mce-success-response").hide().html('<span class="success">¡Éxito! Hemos enviado un correo de Confirmación.</span>').fadeIn("slow"),$(".mc-field-group").hide("slow"),$(".suscribe-body .clear:not(#mce-responses)").hide("slow")}}})}$("#BannerArea").height(window.innerHeight-70),$(window).resize(function(){$("#BannerArea").height(window.innerHeight-70)}),$scope.actYear=(new Date).getFullYear(),$scope.global=Global,$("li.usrli.regi").removeClass("active"),$("li.usrli.logi").removeClass("active"),$('[data-toggle^="class"]').unbind("click"),$("html").addClass("home"),$(document).on("dragstart","img",function(event){event.preventDefault()}),$scope.global.authenticated||(Global.indxIntervalbtn=setInterval(function(){$("a.home-btn.btn-red").addClass("tada"),$("li.regi").addClass("flash"),setTimeout(function(){$("a.home-btn.btn-red").removeClass("tada"),$("li.regi").removeClass("flash")},1500)},1e4)),$("#mc-embedded-subscribe").on("click",function(event){event&&event.preventDefault(),register($("#mc-embedded-subscribe-form"))});var onMovement=!1;$scope.slidermoves={next:function(){return onMovement?!1:(onMovement=!0,slide.next(1),void setTimeout(function(){onMovement=!1},2e3))},prev:function(){return onMovement?!1:(onMovement=!0,slide.prev(1),void setTimeout(function(){onMovement=!1},2e3))}};var slide={};angular.element(document).ready(function(){slide=new SpecialSlider($("#BannerArea .slide"),$("#BannerArea .img-slide"),8e3),slide.start(),$("#mc_embed_signup").on("click",function(e){1==$(e.target).closest("form").length?null:mc.closePopup()}),1!==$.cookie("pf_MailChimp",Number)&&(window.mc.showPopup=!0,window.mc.delayPopup=2e3,mc.showPopup&&mc.evalPopup(),$.cookie("pf_MailChimp","1",{expires:30}))}),$scope.$on("$destroy",function(){$(window).off("resize")}),$(window).focus(function(){}),$(window).blur(function(){})}]).controller("alt-homes",["$scope","$timeout","$http","$rootScope","$location","Global",function($scope,$timeout,$http,$rootScope,$location,Global){$("#Home2BannerArea").height(window.innerHeight-60),$(window).resize(function(){$("#Home2BannerArea").height(window.innerHeight-60)}),$scope.actYear=(new Date).getFullYear(),$scope.$on("$destroy",function(){$(window).off("resize")}),clearInterval($scope.global.indxIntervalbtn),$scope.services=["ENACAL - Agua","IBW - Internet","CLARO - Casa Claro","CLARO - Telefonia Fija","CLARO - Tel. Pospago","CLARO - TV Cable","CLARO - Internet Fijo","CLARO - Internet Movil","YOTA - Internet","MOVISTAR - Tel. Pospago","El Verudgo - Cuota de Credito","El Gallo mas Gallo - Cuota de Credito","LA PRENSA - Suscripcion"],$scope.user={},$scope.feedback={},$scope.input={type:"password",iconClass:"fa-eye"},$scope.sendEmail=function(){$scope.user.proced=window.location,$http.post("/sendEmailto",$scope.user).success(function(res,status,headers,config){$scope.feedback.status=res.status,$scope.feedback.msg=res.message}).error(function(err,status,headers,config){$scope.feedback.status="danger",$scope.feedback.msg="Error de conexion"})},$scope.register=function(){$scope.user.username=$scope.user.email.split("@")[0]+"-*--*-"+$scope.user.email.split("@")[1],$scope.usernameError=null,$scope.registerError=null,$scope.user.confirmPassword=$scope.user.password,$http.post("/register",{email:$scope.user.email,password:$scope.user.password,confirmPassword:$scope.user.confirmPassword,username:$scope.user.username,name:$scope.user.name}).success(function(){$scope.registerError=0,$rootScope.user=$scope.user,$rootScope.$emit("loggedin"),$("#rediFallback")[0].click()}).error(function(error){console.log(error),$scope.registerError=error,$timeout(function(){$scope.registerError=void 0},3e3)})},$scope.togglePasswordVisible=function(){$scope.input.type="text"===$scope.input.type?"password":"text",$scope.input.iconClass="fa-eye"===$scope.input.iconClass?"fa-eye-slash":"fa-eye"}}])}();
  1898. !function(){"use strict";angular.module("mean.system").factory("Global",[function(){var _this=this;return _this._data={user:window.user,authenticated:!1,isAdmin:!1},window.user&&window.user.roles&&(_this._data.authenticated=window.user.roles.length,_this._data.isAdmin=-1!==window.user.roles.indexOf("admin")),_this._data}]).config(["$httpProvider",function($httpProvider){$httpProvider.defaults.xsrfCookieName="funnycookie",$httpProvider.defaults.xsrfHeaderName="bla-bla-header"}]).factory("TransServ",[function(){var tran={h1:"hola",h2:"KE",h3:"ASE"};return tran}])}();
  1899. !function(){"use strict";angular.module("mean-factory-interceptor",[]).factory("httpInterceptor",["$q","$location",function($q,$location){return{response:function(response){return 401===response.status?($location.path("/auth/login"),$q.reject(response)):response||$q.when(response)},responseError:function(rejection){return 401===rejection.status?($location.url("/auth/login"),$q.reject(rejection)):$q.reject(rejection)}}}]).config(["$httpProvider",function($httpProvider){$httpProvider.interceptors.push("httpInterceptor")}])}();
  1900. !function(){"use strict";angular.module("mean.system").factory("Menus",["$resource",function($resource){return $resource("admin/menu/:name",{name:"@name",defaultMenu:"@defaultMenu"})}])}();
  1901. !function(){"use strict";angular.module("mean.pagos").filter("fastpayiconfix",function(){return function(step){var stepfix;switch(step){case 0:stepfix=3;break;case 1:stepfix=5}return stepfix}}).filter("stringtocolector",function(){return function(colector){var cole="";switch(colector){case"4FED27A6-FD4A-4E52-88B0-405EDF90F110":cole="MOVISTAR";break;case"650141FD-7B9E-40F7-82FF-28FD308BF314":cole="ENACAL";break;case"2BC2EE0D-9007-4665-8694-DD82A0777771":cole="GRUPO MONGE";break;case"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2":cole="CLARO";break;case"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2":cole="IBW";break;case"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2":cole="LA PRENSA";break;case"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2":cole="YOTA";break;case"460DD882-9E73-4A89-BD54-6E500696F9D7":cole="DISNORTE DISSUR";break;default:cole=null}return cole}}).filter("stringtoservicio",function(){return function(servicio){var serv="";switch(servicio){case"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9":serv="Telefonía Pospago";break;case"586080C0-1E48-E411-A034-005056C00008":serv="Cuota Crédito Gallo";break;case"596080C0-1E48-E411-A034-005056C00008":serv="Cuota Crédito Verdugo";break;case"7F397666-14FB-496F-A7DD-43E9E09A0DDD":serv="Agua";break;case"A7CB9F41-3546-4F3A-BB60-3ED5D6E17036":serv="Telefonía Fija";break;case"0C9D791E-A53B-4086-9389-62DE814F3B68":serv="Internet Fijo";break;case"587D532F-DC04-4972-8376-F2C36786A409":serv="TV/Cable";break;case"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2":serv="Internet Móvil";break;case"2F0E010E-D009-E311-8F13-BC5FF42EE8D2":serv="Casa CLARO";break;case"71084F07-ACC4-E211-9D20-BC5FF42EE8D2":serv="Internet/Cable";break;case"194CC25B-3FCB-E311-8819-BC5FF42EE8D2":serv="Suscripción";break;case"A669414A-BD1A-E511-8A03-BC5FF42EE8D2":serv="DISNORTE";break;case"DBC08955-BD1A-E511-8A03-BC5FF42EE8D2":serv="DISSUR";break;default:serv=null}return serv}}).controller("controllerTest",["$scope","$filter","$http","$state","$stateParams","Global","Pagos",function($scope,$filter,$http,$state,$stateParams,Global,Pagos){function searchBills(queryParms){$http.post("/getBills",queryParms).success(function(res,status,headers,config){200===status&&($scope.fptbills=res,getCreditcards()),203===status&&($scope.errors.gettingInfo=!0)}).error(function(err,status,headers,config){404!==status&&($scope.errors.gettingInfo=!0)})}function sendCredom(ccin,spinner){$http.post("/sendForm",ccin).success(function(res){var credomaticRes=res;switch($scope.fastp.orderId=credomaticRes.orderid,credomaticRes.response){case"1":sendBills(credomaticRes,spinner),$(".steps>li.complete").removeClass("complete");break;case"2":$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Transacción rechazada",$scope.payFeedbck.msg="FEED",$scope.payFeedbck.typ="danger";break;case"3":$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Fallo de conexión",$scope.payFeedbck.msg="FEED",$scope.payFeedbck.typ="warning"}}).error(function(err){})}function sendBills(crdres,spinner){$("#fpMyWizard li.complete").removeClass("complete");var billsToSend={},docs=[],sbill={};for(var ind in $scope.fppbills)sbill={idPago:$scope.fppbills[ind].idPago,monto:$scope.fppbills[ind].pagar,idColector:$scope.info.colector,idServicio:$scope.info.servicio,idTipoBusqueda:$scope.info.tipoB,docReferencia:$scope.fppbills[ind].refCliente,noFactura:$scope.fppbills[ind].noDocumento,DataKey:$scope.fppbills[ind].DataKey,HashPF:$scope.fppbills[ind].HashPF},docs.push(sbill);var cctyp="credit"==$scope.creditcards.selected.type?1:2;if(billsToSend={idUserMongo:$scope.global.user._id,loginApp:$scope.global.user.name,NoTarjeta:$scope.creditcards.selected.creditCard.toString(),tipoT:cctyp,FechaExp:$scope.creditcards.selected.expirationMonth.toString()+"-"+$scope.creditcards.selected.expirationYear.toString(),TCName:$scope.creditcards.selected.name,CVV:$scope.creditcards.selected.cvc,mailCustomer:$scope.global.user.email,telefono:$scope.global.user.phone,responseCredomatic:crdres,fi:$scope.payment.fee,tasaCambio:$scope.fppbills[0].TasaC,user:$scope.global.user,docs:docs},$scope.fpdiscount.haveDiscount&&(billsToSend.codDesc=$scope.fpdiscount.disc.codigo,billsToSend.porcentDesc=$scope.fpdiscount.disc.percent,billsToSend.montoDesc=$scope.fpdiscount.mount),$scope.referers&&$scope.referers.length)for(var i=0,len=$scope.referers.length;len>i;i++)if($scope.referers[i].selected){billsToSend.refdisc=$scope.referers[i].referer;break}$http.post("/SendBills",billsToSend,{rejectUnauthorized:!1,requestCert:!0,agent:!1,dataType:"jsonp"}).success(function(res,status){201===status&&($scope.fastp.validpay=!0,$scope.fastp.firstTime=!1,spinner.stop(),$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Exito!",$scope.payFeedbck.msg="Su Pago se Ha Realizado Exitosamente",$scope.payFeedbck.typ="success"),202===status&&(spinner.stop(),$scope.fastp.validpay=!0,$scope.fastp.firstTime=!0,$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Exito!",$scope.payFeedbck.msg="Debido a ser Primera vez que Utiliza esta\n                  Tarjeta con nuestro servicio, validaremos su tarjeta y le daremos respuesta",$scope.payFeedbck.typ="info"),$scope.blockURL()}).error(function(err,status){spinner.stop(),$scope.fastp.validpay=!0,$scope.fastp.error=!0,$scope.payFeedbck.showSpin=!1,$scope.blockURL()})}function next(){$scope.fpActstep++,$(window).scrollTop()>0?($("html, body").animate({scrollTop:0},800),setTimeout(function(){$("#fpMyWizard").wizard("next")},900)):$("#fpMyWizard").wizard("next")}function getCreditcards(){$http.get("/getCC/"+$scope.global.user._id).success(function(res){$scope.creditcards.arr=res,$scope.creditcards.selected=$scope.creditcards.arr[0]}).error(function(error){})}function applyDiscount(){$scope.fpdiscount.searchfor=!1,$scope.fpdiscount.mount=$scope.payment.fee*($scope.fpdiscount.disc.percent/100),$scope.fpdiscount.mount=$scope.fpdiscount.mount.toFixed(2),$scope.payment.total-=$scope.fpdiscount.mount,$scope.payment.total=$scope.payment.total.toFixed(2),$scope.fpdiscount.mount=parseFloat($scope.fpdiscount.mount),$scope.payment.total=parseFloat($scope.payment.total)}function resetDiscount(){$scope.payment.total=parseFloat($scope.payment.total)+parseFloat($scope.fpdiscount.mount),$scope.payment.total=$scope.payment.total.toFixed(2),$scope.fpdiscount.mount=0,$scope.fpdiscount.disc=void 0,$scope.fpdiscount.haveDiscount=!1,$scope.fpdiscount.searchfor=!1,$scope.fpdiscount.byBeingRef=!1,$scope.fpdiscount.referral=void 0}function getRefs(){$http.get("/getDisRefs").success(function(resp,stat){$scope.referers=resp.referers,$scope.refDiscounts=resp.refDiscounts,$scope.referers&&determinateDiscounts(),resp.discByBeRef&&($scope.fpdiscount.disc={codigo:resp.discByBeRef.discountName,percent:resp.discByBeRef.percent},$scope.fpdiscount.haveDiscount=!0,$scope.fpdiscount.byBeingRef=!0,$scope.fpdiscount.referral=resp.discByBeRef.referral,applyDiscount())}).error(function(err,stat){})}function determinateDiscounts(){for(var i=0;i<$scope.referers.length&&($scope.referers[i].benefit.queried&&!$scope.referers[i].benefit.payed&&($scope.refdesc.half=!0),$scope.referers[i].benefit.queried&&$scope.referers[i].benefit.payed&&($scope.refdesc.full=!0),!$scope.refdesc.half||!$scope.refdesc.full);i++);}function setReferer(ref,tx){selectRef(ref),$scope.fpdiscount.haveDiscount&&resetDiscount(),$http.post("/setRefDisc",ref).success(function(res){res.error||($scope.fpdiscount.disc={codigo:res.discount.discountName,percent:res.discount.percent},$scope.fpdiscount.haveDiscount=!0,applyDiscount(),"half"===tx?$scope.refdesc.selected.half=!0:$scope.refdesc.selected.full=!0)}).error(function(err){})}function selectRef(ref){for(var i=0,len=$scope.referers.length;len>i;i++)$scope.referers[i].selected&&delete $scope.referers[i].selected;ref.selected=!0}function feeCalc(subtotal){var fee,subtotal=parseFloat($scope.payment.subtotal);switch(!0){case 0==subtotal:fee=0;break;case subtotal>0&&10>subtotal:fee=1.49;break;case subtotal>=10&&15>subtotal:fee=1.99;break;case subtotal>=15&&20>subtotal:fee=2.99;break;case subtotal>=20&&25>=subtotal:fee=3.99;break;case subtotal>25&&50>=subtotal:fee=4.99;break;case subtotal>50&&75>=subtotal:fee=5.99;break;case subtotal>75&&100>=subtotal:fee=6.99;break;case subtotal>100&&125>=subtotal:fee=7.99;break;case subtotal>125&&150>=subtotal:fee=8.99;break;case subtotal>150&&175>=subtotal:fee=10.99;break;case subtotal>175&&200>=subtotal:fee=11.99;break;case subtotal>200&&225>=subtotal:fee=12.99;break;case subtotal>225&&250>=subtotal:fee=13.99;break;case subtotal>250&&300>=subtotal:fee=21.99;break;case subtotal>300&&350>=subtotal:fee=25.99;break;case subtotal>350&&400>=subtotal:fee=26.99;break;case subtotal>400&&450>=subtotal:fee=31.99;break;case subtotal>450&&500>=subtotal:fee=33.99;break;case subtotal>500&&550>=subtotal:fee=37.99;break;case subtotal>550&&600>=subtotal:fee=38.99;break;case subtotal>600&&650>=subtotal:fee=43.99;break;case subtotal>650&&700>=subtotal:fee=44.99;break;case subtotal>700&&750>=subtotal:fee=47.99;break;case subtotal>750&&800>=subtotal:fee=49.99;break;case subtotal>800&&850>=subtotal:fee=53.99;break;case subtotal>850&&900>=subtotal:fee=54.99;break;case subtotal>900&&950>=subtotal:fee=60.99;break;case subtotal>950&&1e3>=subtotal:fee=61.99}return fee}$scope.global=Global,$scope.fech=new Date,$scope.fpActstep=0,$scope.fpSteps=["Selecciona tu Factura","Efectúe su pago"],$scope.fpActDate=new Date,$scope.fastp={orderId:void 0,validpay:void 0,firstTime:void 0,error:void 0},$scope.payment={subtotal:0,fee:0,total:0},$scope.fpdiscount={searchfor:!1,searchparm:void 0,disc:void 0,haveDiscount:!1,mount:0,feedback:{msg:"",status:""}},$scope.creditcards={arr:[],selected:void 0},$scope.fppbills=[],$scope.fptbills=[],$scope.errors={},$scope.refdesc={half:!1,full:!1,selected:{half:!1,full:!1}},$scope.newccfeed={msg:void 0,stat:void 0,incomplete:!1,error:!1,monthErr:!1},$scope.newccSavingfeed={stat:void 0,msg:void 0,show:!1};var opts={lines:13,length:0,width:11,radius:30,corners:1,rotate:0,direction:1,color:"#000",speed:1.9,trail:60,shadow:!0,hwaccel:!1,className:"spinner",zIndex:2e9,top:"50%",left:"50%"};$http.post("/pagorapido/checkUrl",$stateParams).success(function(resp){if(resp.error||"OK"!==resp.stat)$("<a>").attr("href","/#!/")[0].click();else{$scope.info=$stateParams;var queryParms={colector:$stateParams.colector,servicio:$stateParams.servicio,tipoB:$stateParams.tipoB,idParm:$stateParams.valor,user:$scope.global.user};searchBills(queryParms)}}),$scope.blockURL=function(){$http.post("/pagorapido/disableUrl",$stateParams).success(function(res){}).error(function(res){})},$scope.pagorapidocalc=function(index){var bill=$scope.fptbills[index];bill.topay?($scope.payment.subtotal=parseFloat($scope.payment.subtotal)+parseFloat(bill.pagar),$scope.fppbills.push(bill)):($scope.payment.subtotal=parseFloat($scope.payment.subtotal)-parseFloat(bill.pagar),$scope.fppbills.splice($scope.fppbills.indexOf(bill),1)),$scope.payment.subtotal=parseFloat($scope.payment.subtotal.toFixed(2)),$scope.payment.fee=parseFloat(feeCalc($scope.payment.subtotal).toFixed(2)),$scope.payment.total=parseFloat((parseFloat($scope.payment.subtotal)+parseFloat($scope.payment.fee)).toFixed(2))},$scope.pagorapidoprepay=function(){return $("#sbtBills").prop("disabled",!0),0===$scope.fppbills.length?!1:(next(),"undefined"!=typeof $scope.creditcards.selected&&($scope.creditcards.selected.cvc=""),0===$scope.creditcards.arr.length&&$("#cardAddStep").fadeIn(700),getRefs(),void $("#sbtBills").prop("disabled",!1))},$scope.fastPay=function(){function fpcontinue(){var spinner=new Spinner(opts).spin(document.getElementById("payFeedPanel")),ccInfo={cc:$scope.creditcards.selected,amount:$scope.payment.total,user:$scope.global.user};$scope.global.user.telephoneset?sendCredom(ccInfo,spinner):$http.post("/savePhone",{idd:$scope.global.user._id,phone:$scope.global.user.phone}).success(function(data,status){$scope.global.user.telephoneset=!0,sendCredom(ccInfo,spinner)}).error(function(err,status){})}$scope.payFeedbck.msg="",$scope.payFeedbck.title="Procesando Transacción...",$scope.payFeedbck.typ="info",$scope.payFeedbck.showSpin=!0,$("#detale").slideUp(500,fpcontinue)},$scope.fpsaveCC=function(){$http.post("/addCreditCard",{creditCard:$scope.newCreditcard.number,expirationMonth:$scope.newCreditcard.expMonth,expirationYear:$scope.newCreditcard.expYear,type:$scope.newCreditcard.type,company:$scope.newCreditcard.company,name:$scope.newCreditcard.ownerName}).success(function(){$scope.newccSavingfeed.show=!0,$scope.newccSavingfeed.stat="success",$scope.newccSavingfeed.msg="Su tarjeta de crédito ha sido agregada.",$scope.newCreditcard={},$scope.$$childTail.ccform.$setPristine(),getCreditcards(),$("#payResume").hide(),$("#cnlAdding").prop("disabled",!0),setTimeout(function(){$("#cnlAdding").delay(900).prop("disabled",!1),$("#cnlAdding").click()},1500)}).error(function(error,status){$scope.newccSavingfeed.show=!0,$scope.newccSavingfeed.stat="danger",501===status&&($("input[name='ccnum']").parent("div.input-group").addClass("has-error"),setTimeout(function(){$("input[name='ccnum']").parent("div.input-group").removeClass("has-error")},3e3)),$scope.newccSavingfeed.msg=501==status?"La tarjeta ingresada no es válida, esta duplicada. Ya ha sido registrada en el sistema":"Error al tratar de guardar, Intente de nuevo o mas tarde"})},$scope.fpValExpDateCC=function(){return""==$scope.newCreditcard.expYear||""==$scope.newCreditcard.expMonth?($scope.newccfeed.msg="",$scope.newccfeed.stat="",$scope.newccfeed.incomplete=!0,!1):($scope.newccfeed.msg="",$scope.newccfeed.stat="",$scope.newccfeed.incomplete=!1,$scope.newccfeed.error=!1,$scope.newccfeed.monthErr=!1,$scope.fpActDate.getFullYear()==$scope.newCreditcard.expYear?$scope.fpActDate.getMonth()+1>=parseInt($scope.newCreditcard.expMonth)&&($scope.newccfeed.msg="Tarjeta Expirada",$scope.newccfeed.stat="danger",$scope.newccfeed.error=!0,$scope.newccfeed.monthErr=!0):$scope.fpActDate.getFullYear()>$scope.newCreditcard.expYear&&($scope.newccfeed.msg="Tarjeta Expirada por Años",$scope.newccfeed.stat="danger",$scope.newccfeed.error=!0),!0)},$scope.fpaddnCardSwitch=function(swit){"add"==swit&&$("#payResume").fadeOut(700,function(){$("#cardAddStep").fadeIn(700)}),"back"==swit&&$("#cardAddStep").fadeOut(700,function(){$scope.newccSavingfeed.stat="",$scope.newccSavingfeed.show=!1,$scope.newccSavingfeed.msg="",$scope.newCreditcard={},$("input[name='ccnum']").parent("div.input-group").removeClass("has-error"),$scope.$$childTail.ccform.$setPristine(),$("#payResume").fadeIn(700)})},$scope.fptostep=function(ind,event){return 1===$scope.fpActstep&&0===$("ul.steps>li.complete").size()?!1:ind>$scope.fpActstep?!1:void($scope.fpActstep=ind)},$scope.reload=function(tar){$(tar.target).children("i").addClass("fa-spin"),window.location.reload()},$scope.fpdelcvv=function(){"undefined"!=typeof $scope.creditcards.selected.cvc&&($scope.creditcards.selected.cvc="")},$scope.fpvalCvv=function(){return"undefined"==typeof $scope.creditcards.selected?!0:"undefined"==typeof $scope.creditcards.selected.cvc?!0:""===$scope.creditcards.selected.cvc?!0:!1},$scope.fpprev=function(){$scope.fpdiscount.haveDiscount&&resetDiscount(),$scope.fpActstep--,$("#fpMyWizard").wizard("previous")},$(document).on("keypress","#slcCVV",function(evt){return $(this).val().length>=4?!1:void 0}),$(document).on("keypress",".num-only",function(evt){return 0!=evt.charCode&&46!=evt.charCode&&(evt.charCode<48||evt.charCode>57)?!1:void 0}),$scope.fastPaySearchDiscount=function(){$http.post("/searchDiscount",{codigo:$scope.fpdiscount.searchparm}).success(function(response){response.discount?($scope.fpdiscount.searchparm="",$scope.fpdiscount.disc=response.discount,$scope.fpdiscount.haveDiscount=!0,applyDiscount()):$scope.fpdiscount.feedback=response}).error(function(response){})},$scope.setHalfRef=function(){if($scope.refdesc.selected.half){$scope.refdesc.selected.half=!1,resetDiscount();for(var i=0,len=$scope.referers.length;len>i;i++)$scope.referers[i].selected&&delete $scope.referers[i].selected}else for(var i=0;i<$scope.referers.length;i++)if($scope.referers[i].benefit.queried&&!$scope.referers[i].benefit.payed){setReferer($scope.referers[i],"half");break}},$scope.setFullRef=function(){if($scope.refdesc.selected.full){$scope.refdesc.selected.full=!1,resetDiscount();for(var i=0,len=$scope.referers.length;len>i;i++)$scope.referers[i].selected&&delete $scope.referers[i].selected}else for(var i=0;i<$scope.referers.length;i++)if($scope.referers[i].benefit.queried&&$scope.referers[i].benefit.payed){setReferer($scope.referers[i],"full");break}}}])}();
  1902. !function(){"use strict";angular.module("mean.pagos").filter("stringtotipob",function(){return function(tipoB){var tipo="";switch(tipoB){case"250669A4-6F7C-E211-B93B-BC5FF42EE8D2":tipo="Teléfono";break;case"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2":tipo="Número de Cliente";break;case"65F94DF1-3B7C-E211-B93B-BC5FF42EE8D2":tipo="Número de Cuenta";break;case"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2":tipo="Nombres";break;case"AE1B287C-EC1F-4389-A123-1316B3519364":tipo="Cédula";break;case"95D5F7B3-36A9-E211-A0D1-BC5FF42EE8D2":tipo="RUC";break;case"42614C97-47A9-E211-A0D1-BC5FF42EE8D2":tipo="Factura";break;case"016B8F2D-B81A-E511-8A03-BC5FF42EE8D2":tipo="NIS/NIR";break;default:tipo=null}return tipo}}).filter("applydiscount",function(){return function(fee,discount){return"NA"===discount?fee:fee-fee*discount/100}}).controller("UsersPayments",["$scope","$filter","$http","$state","$stateParams","Global","Pagos","UserPayments",function($scope,$filter,$http,$state,$stateParams,Global,Pagos,UserPayments){function checkNoEmpties(){if($scope.query){for(var props=Object.keys($scope.query),propstodel=[],i=0;i<props.length;i++)/^\s*$/.test($scope.query[props[i]])&&propstodel.push(props[i]);for(var k=0;k<propstodel.length;k++)delete $scope.query[propstodel[k]];return $.isEmptyObject($scope.query)?(delete $scope.query,!1):!0}return!1}$scope.global=Global,$scope.payments=[],$scope.query={},$scope.feed={servicio:"Escoja un colector primero"},$scope.colectores=[{nom:"MOVISTAR",cad:"4FED27A6-FD4A-4E52-88B0-405EDF90F110"},{nom:"ENACAL",cad:"650141FD-7B9E-40F7-82FF-28FD308BF314"},{nom:"GRUPO MONGE",cad:"2BC2EE0D-9007-4665-8694-DD82A0777771"},{nom:"CLARO",cad:"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"IBW",cad:"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"LA PRENSA",cad:"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2"},{nom:"YOTA",cad:"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2"},{nom:"DISNORTE DISSUR",cad:"460DD882-9E73-4A89-BD54-6E500696F9D7"}],$scope.init=function(){UserPayments.getPayments({},function(res){$scope.payments=res,$scope.numPayments=res.length})},$scope.colectorChange=function(){if($scope.query.colector){switch($filter("stringtocolector")($scope.query.colector)){case"ENACAL":$scope.servicios=[{nom:"Agua",cad:"7F397666-14FB-496F-A7DD-43E9E09A0DDD"}];break;case"IBW":$scope.servicios=[{nom:"Internet/Cable",cad:"71084F07-ACC4-E211-9D20-BC5FF42EE8D2"}];break;case"CLARO":$scope.servicios=[{nom:"Telefonía Pospago",cad:"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9"},{nom:"Casa CLARO",cad:"2F0E010E-D009-E311-8F13-BC5FF42EE8D2"},{nom:"Telefonía Fija",cad:"A7CB9F41-3546-4F3A-BB60-3ED5D6E17036"},{nom:"Internet Fijo",cad:"0C9D791E-A53B-4086-9389-62DE814F3B68"},{nom:"TV/Cable",cad:"587D532F-DC04-4972-8376-F2C36786A409"},{nom:"Internet Móvil",cad:"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2"}];break;case"YOTA":$scope.servicios=[{nom:"Internet Móvil",cad:"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2"}];break;case"MOVISTAR":$scope.servicios=[{nom:"Telefonía Pospago",cad:"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9"}];break;case"GRUPO MONGE":$scope.servicios=[{nom:"Cuota Crédito Gallo",cad:"586080C0-1E48-E411-A034-005056C00008"},{nom:"Cuota Crédito Verdugo",cad:"596080C0-1E48-E411-A034-005056C00008"}];break;case"LA PRENSA":$scope.servicios=[{nom:"Suscripción",cad:"194CC25B-3FCB-E311-8819-BC5FF42EE8D2"}];break;case"DISNORTE DISSUR":$scope.servicios=[{nom:"DISNORTE",cad:"A669414A-BD1A-E511-8A03-BC5FF42EE8D2"},{nom:"DISSUR",cad:"DBC08955-BD1A-E511-8A03-BC5FF42EE8D2"}]}$scope.feed.servicio="-- Escoja un servicio --"}else $scope.feed.servicio="Escoja un colector primero"},$scope.search=function(){return checkNoEmpties()?void UserPayments.getPayments($scope.query,function(res){$scope.payments=res,$scope.advModeSwitch(!0)}):(alert("Por favor, llena al menos un campo"),!1)},$scope.advModeSwitch=function(val){$scope.advSearch.on=val,val?$scope.advSearch.switchh=!1:$scope.init()},$scope.init(),$("#inputFechaInicio").datetimepicker({pickTime:!1}),$("#inputFechaFin").datetimepicker({pickTime:!1}),$("#inputFechaInicio").on("dp.change",function(e){$("#inputFechaFin").data("DateTimePicker").setMinDate(e.date)}),$("#inputFechaFin").on("dp.change",function(e){$("#inputFechaInicio").data("DateTimePicker").setMaxDate(e.date)})}])}();
  1903. !function(){"use strict";angular.module("mean.pagos").directive("bspopover",function(){return function(scope,elem){elem.popover()}}).directive("bstooltip",function(){return function(scope,elem){elem.tooltip()}}).filter("numbertoletter",function(){return function(num){function Unidades(num){switch(num){case 1:return"un";case 2:return"dos";case 3:return"tres";case 4:return"cuatro";case 5:return"cinco";case 6:return"seis";case 7:return"siete";case 8:return"ocho";case 9:return"nueve"}return""}function Decenas(num){var decena=Math.floor(num/10),unidad=num-10*decena;switch(decena){case 1:switch(unidad){case 0:return"diez";case 1:return"once";case 2:return"doce";case 3:return"trece";case 4:return"catorce";case 5:return"quince";default:return"dieci"+Unidades(unidad)}case 2:switch(unidad){case 0:return"veinte";default:return"veinti"+Unidades(unidad)}case 3:return DecenasY("treinta",unidad);case 4:return DecenasY("cuarenta",unidad);case 5:return DecenasY("cincuenta",unidad);case 6:return DecenasY("sesenta",unidad);case 7:return DecenasY("setenta",unidad);case 8:return DecenasY("ochenta",unidad);case 9:return DecenasY("noventa",unidad);case 0:return Unidades(unidad)}}function DecenasY(strSin,numUnidades){return numUnidades>0?strSin+" Y "+Unidades(numUnidades):strSin}function Centenas(num){var centenas=Math.floor(num/100),decenas=num-100*centenas;switch(centenas){case 1:return decenas>0?"ciento "+Decenas(decenas):"cien";case 2:return"doscientos "+Decenas(decenas);case 3:return"trescientos "+Decenas(decenas);case 4:return"cuatrocientos "+Decenas(decenas);case 5:return"quinientos "+Decenas(decenas);case 6:return"seiscientos "+Decenas(decenas);case 7:return"setecientos "+Decenas(decenas);case 8:return"ochocientos "+Decenas(decenas);case 9:return"novecientos "+Decenas(decenas)}return Decenas(decenas)}function Seccion(num,divisor,strSingular,strPlural){var cientos=Math.floor(num/divisor),resto=num-cientos*divisor,letras="";return cientos>0&&(letras=cientos>1?Centenas(cientos)+" "+strPlural:strSingular),resto>0&&(letras+=""),letras}function Miles(num){var divisor=1e3,cientos=Math.floor(num/divisor),resto=num-cientos*divisor,strMiles=Seccion(num,divisor,"un mil","mil"),strCentenas=Centenas(resto);return""==strMiles?strCentenas:strMiles+" "+strCentenas}function Millones(num){var divisor=1e6,cientos=Math.floor(num/divisor),resto=num-cientos*divisor,strMillones=Seccion(num,divisor,"un millon","millones"),strMiles=Miles(resto);return""==strMillones?strMiles:strMillones+" "+strMiles}var data={numero:num,enteros:Math.floor(num),centavos:Math.round(100*num)-100*Math.floor(num),letrasCentavos:"",letrasMonedaPlural:"Dolares",letrasMonedaSingular:"Dolar"};return data.centavos>0&&(data.letrasCentavos="con "+data.centavos+" centavos"),0==data.enteros?"cero "+data.letrasMonedaPlural+" "+data.letrasCentavos:1==data.enteros?Millones(data.enteros)+" "+data.letrasMonedaSingular+" "+data.letrasCentavos:Millones(data.enteros)+" "+data.letrasMonedaPlural+" "+data.letrasCentavos}}).filter("ccCompany",function(){return function(company){var comp;switch(company){case"visa":comp="Visa";break;case"mastercard":comp="MasterCard";break;case"jcb":comp="JCB";break;case"discover_network":comp="Discover Network";break;case"american_express":comp="American Express";break;case"diners_club_international":comp="Dinners Club Int."}return comp}}).filter("range",function(){return function(input){for(var min=(new Date).getFullYear(),max=parseInt(min)+10,i=parseInt(min);max>=i;i++)input.push(i);return input}}).filter("validate",function(){return function(ccnumber){if(!ccnumber)return"pflogo";for(var cardType,valid,len=ccnumber.length,mul=0,prodArr=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],sum=0;len--;)sum+=prodArr[mul][parseInt(ccnumber.charAt(len),10)],mul^=1;return valid=sum%10===0&&sum>0?"valid":"not valid",ccnumber=ccnumber.toString().replace(/\s+/g,""),/^(34)|^(37)/.test(ccnumber)&&(cardType="american_express"),/^36/.test(ccnumber)&&(cardType="diners_club_international"),/^(6011)|^(622(1(2[6-9]|[3-9][0-9])|[2-8][0-9]{2}|9([01][0-9]|2[0-5])))|^(64[4-9])|^65/.test(ccnumber)&&(cardType="discover_network"),/^35(2[89]|[3-8][0-9])/.test(ccnumber)&&(cardType="jcb"),/^5[1-5]/.test(ccnumber)&&(cardType="mastercard"),/^4/.test(ccnumber)&&(cardType="visa"),"undefined"==typeof cardType?"pflogo":"american_express"!=cardType&&"diners_club_international"!=cardType&&"discover_network"!=cardType&&"jcb"!=cardType&&"mastercard"!=cardType&&"visa"!=cardType?"pflogo":cardType}}).filter("colectorhorario",function(){return function(colector){var horario="",act=new Date;if(!colector)return"";switch(colector.cad){case"460DD882-9E73-4A89-BD54-6E500696F9D7":horario="Lun - vie:  8:00AM - 5:00PM -- sab: 8:00AM - 12:30PM (GTM - 6)",0===act.getDay()&&(horario+="  (NO DISPONIBLE)",colector.available=!1),6===act.getDay()&&(act.getUTCHours()>=14&&act.getUTCHours()<=18?18==act.getUTCHours()&&act.getMinutes()>=30?(horario+="  (NO DISPONIBLE)",colector.available=!1):(horario+="  (DISPONIBLE)",colector.available=!0):(horario+="  (NO DISPONIBLE)",colector.available=!1)),act.getDay()>0&&act.getDay()<6&&(act.getUTCHours()>=14&&act.getUTCHours()<=23?23==act.getUTCHours()&&act.getMinutes()>0?(horario+="  (NO DISPONIBLE)",colector.available=!1):(horario+="  (DISPONIBLE)",colector.available=!0):(horario+="  (NO DISPONIBLE)",colector.available=!1));break;case"2BC2EE0D-9007-4665-8694-DD82A0777771":horario="Lun - sab:  9:00AM - 8:00PM (GTM - 6)",0===act.getDay()&&(horario+="  (NO DISPONIBLE)",colector.available=!1),act.getDay()>0&&act.getDay()<=6&&(act.getUTCHours()>=15&&act.getUTCHours()<=23||act.getUTCHours()>=0&&act.getUTCHours()<=2?2==act.getUTCHours()&&act.getMinutes()>0?(horario+="  (NO DISPONIBLE)",colector.available=!1):(horario+="  (DISPONIBLE)",colector.available=!0):(horario+="  (NO DISPONIBLE)",colector.available=!1))}return horario}}).controller("PagosController",["$scope","$http","Global","Pagos","TransServ",function($scope,$http,Global,Pagos,TransServ){function feeCalc(subtotal){var fee,subtotal=parseFloat($scope.sbtotal);switch(!0){case 0==subtotal:fee=0;break;case subtotal>0&&10>subtotal:fee=1.49;break;case subtotal>=10&&15>subtotal:fee=1.99;break;case subtotal>=15&&20>subtotal:fee=2.99;break;case subtotal>=20&&25>=subtotal:fee=3.99;break;case subtotal>25&&50>=subtotal:fee=4.99;break;case subtotal>50&&75>=subtotal:fee=5.99;break;case subtotal>75&&100>=subtotal:fee=6.99;break;case subtotal>100&&125>=subtotal:fee=7.99;break;case subtotal>125&&150>=subtotal:fee=8.99;break;case subtotal>150&&175>=subtotal:fee=10.99;break;case subtotal>175&&200>=subtotal:fee=11.99;break;case subtotal>200&&225>=subtotal:fee=12.99;break;case subtotal>225&&250>=subtotal:fee=13.99;break;case subtotal>250&&300>=subtotal:fee=21.99;break;case subtotal>300&&350>=subtotal:fee=25.99;break;case subtotal>350&&400>=subtotal:fee=26.99;break;case subtotal>400&&450>=subtotal:fee=31.99;break;case subtotal>450&&500>=subtotal:fee=33.99;break;case subtotal>500&&550>=subtotal:fee=37.99;break;case subtotal>550&&600>=subtotal:fee=38.99;break;case subtotal>600&&650>=subtotal:fee=43.99;break;case subtotal>650&&700>=subtotal:fee=44.99;break;case subtotal>700&&750>=subtotal:fee=47.99;break;case subtotal>750&&800>=subtotal:fee=49.99;break;case subtotal>800&&850>=subtotal:fee=53.99;break;case subtotal>850&&900>=subtotal:fee=54.99;break;case subtotal>900&&950>=subtotal:fee=60.99;break;case subtotal>950&&1e3>=subtotal:fee=61.99}return fee}function next(){$scope.actstep++,$(window).scrollTop()>0?($("html, body").animate({scrollTop:0},800),setTimeout(function(){$("#MyWizard").wizard("next")},900)):$("#MyWizard").wizard("next"),$("#firstPayWarning").show()}function check(){return"undefined"==typeof $scope.slccreditCard.selected.cvc?!1:0===$scope.pbills.length?!1:0===$scope.fi||0===$scope.totalfi?!1:!0}function sendCredom(ccin,spinner){$http.post("/sendForm",ccin).success(function(res){var credomaticRes=res;switch($scope.orderId=credomaticRes.orderid,credomaticRes.response){case"1":sendBills(credomaticRes,spinner),$(".steps>li.complete").removeClass("complete");break;case"2":spinner.stop(),$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Transacción rechazada",$scope.payFeedbck.msg="Transacción rechazada por el banco, favor verificar los datos ingresados en el método de pago o intentar la transacción con otra tarjeta de crédito",$scope.payFeedbck.typ="danger";break;case"3":spinner.stop(),$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Fallo de conexión",$scope.payFeedbck.msg="Fallo en la conexión con el Banco para verificar los datos del método de pago, por favor inténtelo de nuevo",$scope.payFeedbck.typ="warning"}}).error(function(err){console.log(err)})}function sendBills(crdres,spinner){var billsToSend={},docs=[],sbill={};for(var ind in $scope.pbills)sbill={idPago:$scope.pbills[ind].idPago,monto:$scope.pbills[ind].pagar,idColector:$scope.colector.cad,idServicio:$scope.servicio.cad,idTipoBusqueda:$scope.slcsearchtype.selected.cadid,docReferencia:$scope.pbills[ind].refCliente,noFactura:$scope.pbills[ind].noDocumento,DataKey:$scope.pbills[ind].DataKey,HashPF:$scope.pbills[ind].HashPF},docs.push(sbill);var cctyp="credit"==$scope.slccreditCard.selected.type?1:2;if(billsToSend={idUserMongo:$scope.global.user._id,loginApp:$scope.global.user.name,NoTarjeta:$scope.slccreditCard.selected.creditCard.toString(),tipoT:cctyp,FechaExp:$scope.slccreditCard.selected.expirationMonth.toString()+"-"+$scope.slccreditCard.selected.expirationYear.toString(),TCName:$scope.slccreditCard.selected.name,CVV:$scope.slccreditCard.selected.cvc,mailCustomer:$scope.global.user.email,telefono:$scope.global.user.phone,responseCredomatic:crdres,fi:$scope.fi,tasaCambio:$scope.pbills[0].TasaC,user:$scope.global.user,docs:docs},$scope.discount.haveDiscount&&(billsToSend.codDesc=$scope.discount.disc.codigo,billsToSend.porcentDesc=$scope.discount.disc.percent,billsToSend.montoDesc=$scope.discountMount),$scope.referers&&$scope.referers.length)for(var i=0,len=$scope.referers.length;len>i;i++)if($scope.referers[i].selected){billsToSend.refdisc=$scope.referers[i].referer;break}$http.post("/SendBills",billsToSend,{rejectUnauthorized:!1,requestCert:!0,agent:!1,dataType:"jsonp"}).success(function(res,status){201===status&&($scope.validPay=!0,$scope.firstTime=!1,spinner.stop(),$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Exito!",$scope.payFeedbck.msg="Su Pago se Ha Realizado Exitosamente",$scope.payFeedbck.typ="success"),202===status&&(spinner.stop(),$scope.validPay=!0,$scope.firstTime=!0,$scope.payFeedbck.showSpin=!1,$scope.payFeedbck.title="Exito!",$scope.payFeedbck.msg="Debido a ser Primera vez que Utiliza esta\n           Tarjeta con nuestro servicio, validaremos su tarjeta y le daremos respuesta",$scope.payFeedbck.typ="info")}).error(function(err,status){spinner.stop(),$scope.payFeedbck.showSpin=!1,$scope.validPay=!0,$scope.bPay=!0})}function applyDiscount(){$scope.discount.searchfor=!1,$scope.discountMount=$scope.fi*($scope.discount.disc.percent/100),$scope.discountMount=$scope.discountMount.toFixed(2),$scope.totalfi-=$scope.discountMount,$scope.totalfi=$scope.totalfi.toFixed(2),$scope.discountMount=parseFloat($scope.discountMount),$scope.totalfi=parseFloat($scope.totalfi)}function resetDiscount(){$scope.totalfi=parseFloat($scope.totalfi)+parseFloat($scope.discountMount),$scope.totalfi=$scope.totalfi.toFixed(2),$scope.discountMount=0,$scope.discount.disc=void 0,$scope.discount.haveDiscount=!1,$scope.discount.searchfor=!1,$scope.discount.byBeingRef=!1,$scope.discount.referral=void 0}function getRefs(){$http.get("/getDisRefs").success(function(resp,stat){$scope.referers=resp.referers,$scope.refDiscounts=resp.refDiscounts,resp.discByBeRef&&($scope.discount.disc={codigo:resp.discByBeRef.discountName,percent:resp.discByBeRef.percent},$scope.discount.haveDiscount=!0,$scope.discount.byBeingRef=!0,$scope.discount.referral=resp.discByBeRef.referral,applyDiscount())}).error(function(err,stat){})}function selectRef(ref){for(var i=0,len=$scope.referers.length;len>i;i++)$scope.referers[i].selected&&delete $scope.referers[i].selected;ref.selected=!0}$scope.global=Global,0===Object.keys($scope.global.user).length&&location.reload(),$scope.global.user.telephoneset=$scope.global.user.phone?!0:!1,$("li.usrli.regi").removeClass("active"),$("li.usrli.logi").removeClass("active"),clearInterval($scope.global.indxIntervalbtn),$scope.months=["01","02","03","04","05","06","07","08","09","10","11","12"],$scope.error=!1,$scope.incomplete=!1,$scope.validPay=!1,$scope.bPay=!1,$scope.colector={nm:"",cad:""},$scope.servicio={nm:"",cad:""},$scope.searchlist=[],$scope.slcsearchtype={},$scope.srcparam={parm:""},$scope.discount={searchfor:!1,searchparm:void 0,disc:void 0,haveDiscount:!1},$scope.aid={sendingMail:!1,phone:void 0},$scope.sbtotal=0,$scope.fi=0,$scope.totalfi=0,$scope.steps=["¿Qué servicio deseas Pagar?","Busca tu Cuenta","Selecciona tu Factura","Método de pago","Efectúe su pago"],$scope.actstep=0,$scope.payItems=[],$scope.loadingpayitems=!0,$scope.showAlert=!1,$scope.slccreditCard={},$scope.creditCard={number:"",expMonth:"",expYear:""},$scope.creditCards=[],$scope.monthPat=/(1[0-2]|0[1-9])/,$scope.actDate=new Date,$scope.feedbckMsg="ajsdjalskjdlkasd",$scope.feedbckStat="success",$scope.selectedCC="",$scope.orderId="",$scope.credomaticHash="";new Date;$scope.tbills=[],$scope.pbills=[],$scope.searchFeedbck={title:"",msg:"",typ:"",show:!1,showSpin:!1},$scope.payFeedbck={title:"",msg:"",typ:"",showSpin:!1,disablePay:!1},$scope.discountFeedbck={msg:"",status:""},$scope.queries={made:0,max:10},$scope.remind={on:void 0,executing:!1},$scope["package"]={name:"pagos"};var opts={lines:13,length:0,width:11,radius:30,corners:1,rotate:0,direction:1,color:"#000",speed:1.9,trail:60,shadow:!0,hwaccel:!1,className:"spinner",zIndex:2e9,top:"50%",left:"50%"};$scope.getPayItems=function(){$scope.loadingpayitems=!0,$http.get("/servsOrder").success(function(res,stat){$scope.nopayitems=!1,$scope.payItems=res,$scope.loadingpayitems=!1}).error(function(err,stat){$scope.nopayitems=!0,$scope.loadingpayitems=!1})},setTimeout(function(){$scope.getPayItems()},1500),$scope.activeV="pay",$scope.activeView=function(whc){switch(whc){case"pay":$scope.activeV="pay",$scope.initPay();break;case"see":$scope.activeV="see";break;case"cnf":$scope.activeV="cnf"}},$scope.serv=function(event){var slc=$(event.target).data(),kys=Object.keys(slc).sort().reverse();switch($scope.searchlist=[],slc[kys[0]]){case"4FED27A6-FD4A-4E52-88B0-405EDF90F110":$scope.colector={nm:"MOVISTAR",cad:"4FED27A6-FD4A-4E52-88B0-405EDF90F110",hasHours:!1},$scope.searchlist=[{tipoB:"Teléfono",cadid:"250669A4-6F7C-E211-B93B-BC5FF42EE8D2"},{tipoB:"Número de Cliente",cadid:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"650141FD-7B9E-40F7-82FF-28FD308BF314":$scope.colector={nm:"ENACAL",cad:"650141FD-7B9E-40F7-82FF-28FD308BF314",hasHours:!1},$scope.searchlist=[{tipoB:"Número de Cuenta",cadid:"65F94DF1-3B7C-E211-B93B-BC5FF42EE8D2"},{tipoB:"Nombres",cadid:"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2"}];break;case"2BC2EE0D-9007-4665-8694-DD82A0777771":$scope.colector={nm:"GRUPO MONGE",cad:"2BC2EE0D-9007-4665-8694-DD82A0777771",hasHours:!0},$scope.searchlist=[{tipoB:"Cédula",cadid:"AE1B287C-EC1F-4389-A123-1316B3519364"}];break;case"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2":$scope.colector={nm:"CLARO",cad:"965B972D-EF6B-E211-AC5B-BC5FF42EE8D2",hasHours:!1},$scope.searchlist=[{tipoB:"Teléfono",cadid:"250669A4-6F7C-E211-B93B-BC5FF42EE8D2"},{tipoB:"No.Cliente",cadid:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2":$scope.colector={nm:"IBW",cad:"9A04E736-EF6B-E211-AC5B-BC5FF42EE8D2",hasHours:!1},$scope.searchlist=[{tipoB:"Cédula",cadid:"AE1B287C-EC1F-4389-A123-1316B3519364"},{tipoB:"RUC",cadid:"95D5F7B3-36A9-E211-A0D1-BC5FF42EE8D2"},{tipoB:"Nombres",cadid:"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2"},{tipoB:"Factura",cadid:"42614C97-47A9-E211-A0D1-BC5FF42EE8D2"},{tipoB:"No.Cliente",cadid:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2":$scope.colector={nm:"LA PRENSA",cad:"A4F47674-EF6B-E211-AC5B-BC5FF42EE8D2",hasHours:!1},$scope.searchlist=[{tipoB:"Nombres",cadid:"1A77D310-3D7C-E211-B93B-BC5FF42EE8D2"},{tipoB:"No.Cliente",cadid:"921E7EE2-3C7C-E211-B93B-BC5FF42EE8D2"}];break;case"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2":$scope.colector={nm:"YOTA",cad:"2155D07F-BDC5-E311-A41A-BC5FF42EE8D2",hasHours:!1},$scope.searchlist=[{tipoB:"No.Cuenta",cadid:"65F94DF1-3B7C-E211-B93B-BC5FF42EE8D2"},{tipoB:"No. Teléfono",cadid:"250669A4-6F7C-E211-B93B-BC5FF42EE8D2"}];break;case"460DD882-9E73-4A89-BD54-6E500696F9D7":$scope.colector={nm:"DISNORTE DISSUR",cad:"460DD882-9E73-4A89-BD54-6E500696F9D7",hasHours:!0},$scope.searchlist=[{tipoB:"NIS/NIR",cadid:"016B8F2D-B81A-E511-8A03-BC5FF42EE8D2"}];break;default:return null}switch(slc[kys[1]]){case"D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9":$scope.servicio.nm="Telefonía Pospago",$scope.servicio.cad="D2BB76E2-CAAB-426B-883C-A7ED0B15C5A9";break;case"586080C0-1E48-E411-A034-005056C00008":$scope.servicio.nm="Cuota Crédito Gallo",$scope.servicio.cad="586080C0-1E48-E411-A034-005056C00008";break;case"596080C0-1E48-E411-A034-005056C00008":$scope.servicio.nm="Cuota Crédito Verdugo",$scope.servicio.cad="596080C0-1E48-E411-A034-005056C00008";break;case"7F397666-14FB-496F-A7DD-43E9E09A0DDD":$scope.servicio.nm="Agua",$scope.servicio.cad="7F397666-14FB-496F-A7DD-43E9E09A0DDD";break;case"A7CB9F41-3546-4F3A-BB60-3ED5D6E17036":$scope.servicio.nm="Telefonía Fija",$scope.servicio.cad="A7CB9F41-3546-4F3A-BB60-3ED5D6E17036";break;case"0C9D791E-A53B-4086-9389-62DE814F3B68":$scope.servicio.nm="Internet Fijo",$scope.servicio.cad="0C9D791E-A53B-4086-9389-62DE814F3B68";break;case"587D532F-DC04-4972-8376-F2C36786A409":$scope.servicio.nm="TV/Cable",$scope.servicio.cad="587D532F-DC04-4972-8376-F2C36786A409";break;case"B9159BF7-CF09-E311-8F13-BC5FF42EE8D2":$scope.servicio.nm="Internet Móvil",$scope.servicio.cad="B9159BF7-CF09-E311-8F13-BC5FF42EE8D2";break;case"2F0E010E-D009-E311-8F13-BC5FF42EE8D2":$scope.servicio.nm="Casa CLARO",$scope.servicio.cad="2F0E010E-D009-E311-8F13-BC5FF42EE8D2";break;case"71084F07-ACC4-E211-9D20-BC5FF42EE8D2":$scope.servicio.nm="Internet/Cable",$scope.servicio.cad="71084F07-ACC4-E211-9D20-BC5FF42EE8D2";break;case"194CC25B-3FCB-E311-8819-BC5FF42EE8D2":$scope.servicio.nm="Suscripción",$scope.servicio.cad="194CC25B-3FCB-E311-8819-BC5FF42EE8D2";break;case"A669414A-BD1A-E511-8A03-BC5FF42EE8D2":$scope.servicio.nm="DISNORTE",$scope.servicio.cad="A669414A-BD1A-E511-8A03-BC5FF42EE8D2";break;case"DBC08955-BD1A-E511-8A03-BC5FF42EE8D2":$scope.servicio.nm="DISSUR",$scope.servicio.cad="DBC08955-BD1A-E511-8A03-BC5FF42EE8D2";break;default:return null}$scope.srcparam.parm="",$scope.searchFeedbck.typ="",$scope.searchFeedbck.title="",$scope.searchFeedbck.msg="",$scope.searchFeedbck.show=!1,next(),$scope.slcsearchtype.selected=$scope.searchlist[0],$("input[data-ng-model='srcparam.parm']").focus()},$scope.search=function(){$("#sbtSearch").prop("disabled",!0),$(".btnback").prop({disabled:!0}),$scope.searchFeedbck.title="Buscando...",$scope.searchFeedbck.msg="",$scope.searchFeedbck.show=!0,$scope.searchFeedbck.typ="info",$scope.searchFeedbck.showSpin=!0;var spinner=new Spinner(opts).spin(document.getElementById("searchFeedPanel"));$scope.sbtotal=0,$scope.fi=0,$scope.totalfi=0,$scope.pbills=[];var queryParms={colector:$scope.colector.cad,servicio:$scope.servicio.cad,tipoB:$scope.slcsearchtype.selected.cadid,idParm:$scope.srcparam.parm,user:$scope.global.user};$http.post("/getBills",queryParms,{rejectUnauthorized:!1,requestCert:!0,agent:!1,dataType:"jsonp"}).success(function(res,status,headers,config){200==status&&($scope.tbills=res,$scope.srcparam.parm="",$scope.searchFeedbck.title="",$scope.searchFeedbck.msg="",$scope.searchFeedbck.show=!1,$scope.searchFeedbck.typ="",$scope.getReminder(),next(),$scope.loadCards(),$scope.queries.made++),203==status&&($scope.searchFeedbck.show=!0,$scope.srcparam.parm="",$scope.searchFeedbck.typ="warning",$scope.searchFeedbck.title="Tiempo de Espera Agotado",$scope.searchFeedbck.msg="La Busqueda se ha tomado demasiado tiempo y debido a esto se cancelo. intente de nuevo."),$(".btnback").prop({disabled:!1}),$scope.searchFeedbck.showSpin=!1,spinner.stop()}).error(function(err,status,headers,config){404==status?($scope.searchFeedbck.show=!0,$scope.searchFeedbck.typ="info",$scope.searchFeedbck.title="No tiene facturas pendientes",$scope.searchFeedbck.msg="¿Seguro que el dato es correcto? Regálanos el teléfono de tu familiar y lo contactamos por ti para conseguirte su información.",$scope.queries.made++):429==status?($scope.searchFeedbck.show=!0,$scope.searchFeedbck.typ="warning",$scope.searchFeedbck.title="Demasiadas consultas",$scope.searchFeedbck.msg="Ha excedido el límite diario de consultas. Por favor, comuniquese con nosotros si desea seguir consultando.",$scope.queries.made=err.cnt):($scope.searchFeedbck.show=!0,$scope.searchFeedbck.typ="danger",$scope.searchFeedbck.title="Error de conexión",$scope.searchFeedbck.msg="Hubo un error en la conexión con el servidor, por favor inténtelo de nuevo"),$(".btnback").prop({disabled:!1}),$("#sbtSearch").prop("disabled",!1),$scope.searchFeedbck.showSpin=!1,spinner.stop()})},$scope.calc=function(index,tar){var bill=$scope.tbills[index];$(tar.target).parent().children("i").toggleClass("checked"),bill.topay?($scope.sbtotal=parseFloat($scope.sbtotal)+parseFloat(bill.pagar),$scope.pbills.push(bill)):($scope.sbtotal=parseFloat($scope.sbtotal)-parseFloat(bill.pagar),$scope.pbills.splice($scope.pbills.indexOf(bill),1)),$scope.sbtotal=$scope.sbtotal.toFixed(2),$scope.fi=feeCalc($scope.sbtotal).toFixed(2),$scope.totalfi=(parseFloat($scope.sbtotal)+parseFloat($scope.fi)).toFixed(2),$scope.sbtotal=parseFloat($scope.sbtotal),$scope.fi=parseFloat($scope.fi),$scope.totalfi=parseFloat($scope.totalfi)},$scope.valpay=function(index){var bill=$scope.tbills[index];return bill.pagar>0&&bill.pagar<=bill.mont},$scope.tostep=function(ind,event){return $("#firstPayWarning").show(),4==$scope.actstep&&0===$("ul.steps>li.complete").size()?!1:ind>$scope.actstep?!1:void($scope.actstep=ind)},$scope.prev=function(){$scope.discount.haveDiscount&&resetDiscount(),$scope.actstep--,$("#MyWizard").wizard("previous"),$("#firstPayWarning").show()},$scope.back=function(){$("#MyWizard").wizard("previous"),$("#MyWizard").wizard("previous"),$("#MyWizard").wizard("previous"),$("#MyWizard").wizard("previous"),$scope.initPay(),$scope.validPay=!1,$scope.bPay=!1,$scope.payFeedbck={}},$scope.initPay=function(){$scope.actstep=0,$scope.tbills=[],$scope.pbills=[],$scope.sbtotal=0,$scope.fi=0,$scope.totalfi=0},$scope.delcv=function(){"undefined"!=typeof $scope.slccreditCard.selected.cvc&&($scope.slccreditCard.selected.cvc="")},$scope.valCvv=function(){return"undefined"==typeof $scope.slccreditCard.selected?!0:"undefined"==typeof $scope.slccreditCard.selected.cvc?!0:""===$scope.slccreditCard.selected.cvc?!0:!1},$scope.toIdparm=function(){$("#srcParm").focus()},$scope.saveCreditCard=function(){$("#payForm").hide(),$http.post("/addCreditCard",{creditCard:$scope.creditCard.number,expirationMonth:$scope.creditCard.expMonth,expirationYear:$scope.creditCard.expYear,type:$scope.creditCard.type,company:$scope.creditCard.company,name:$scope.creditCard.ownerName}).success(function(){$scope.showAlert=!0,$scope.ccStatus="success",$scope.ccMsg="Su tarjeta de crédito ha sido agregada.",$scope.creditCard={},$scope.$$childTail.ccform.$setPristine(),$scope.loadCards(),$("#cnlAdding").prop("disabled",!0),setTimeout(function(){$("#cnlAdding").delay(900).prop("disabled",!1),$("#cnlAdding").click()},1500),$("#payForm").show(700)}).error(function(error,status){$scope.showAlert=!0,$scope.ccStatus="danger",501===status&&($("input[name='ccnum']").parent("div.input-group").addClass("has-error"),setTimeout(function(){$("input[name='ccnum']").parent("div.input-group").removeClass("has-error")},3e3)),$scope.ccMsg=501==status?"La tarjeta ingresada no es válida, esta duplicada. Ya ha sido registrada en el sistema":"Error al tratar de guardar, Intente de nuevo o mas tarde",$("#payForm").show(700)})},$scope.send=function(){return $("#sbtBills").prop("disabled",!0),0===$scope.pbills.length?!1:(next(),"undefined"!=typeof $scope.creditCards.selected&&($scope.slccreditCard.selected.cvc=""),0===$scope.creditCards.length&&$("#cardAddStep").fadeIn(700),void $("#sbtBills").prop("disabled",!1))},$scope.addnCardSwitch=function(swit){"add"==swit&&$("#detale").fadeOut(700,function(){$("#cardAddStep").fadeIn(700)}),"back"==swit&&$("#cardAddStep").fadeOut(700,function(){$scope.ccStatus="",$scope.showAlert=!1,$scope.ccMsg="",$scope.creditCard={},$("input[name='ccnum']").parent("div.input-group").removeClass("has-error"),$scope.$$childTail.ccform.$setPristine(),$("#detale").fadeIn(700)})},$scope.loadCards=function(){$http.get("/getCC/"+$scope.global.user._id).success(function(res){$scope.creditCards=res,$scope.slccreditCard.selected=$scope.creditCards[0]}).error(function(error){})},$scope.valDateCC=function(){return""==$scope.creditCard.expYear||""==$scope.creditCard.expMonth?($scope.feedbckMsg="",$scope.feedbckStat="",$scope.incomplete=!0,!1):($scope.feedbckMsg="",$scope.feedbckStat="",$scope.incomplete=!1,$scope.error=!1,$scope.monthErr=!1,$scope.actDate.getFullYear()==$scope.creditCard.expYear?$scope.actDate.getMonth()+1>=parseInt($scope.creditCard.expMonth)&&($scope.feedbckMsg="Tarjeta Expirada",$scope.feedbckStat="danger",$scope.error=!0,$scope.monthErr=!0):$scope.actDate.getFullYear()>$scope.creditCard.expYear&&($scope.feedbckMsg="Tarjeta Expirada por Años",$scope.feedbckStat="danger",$scope.error=!0),!0)},$scope.prePay=function(){check()&&($scope.actstep++,$scope.payFeedbck={},$("#MyWizard").wizard("next"),getRefs())},$scope.pay=function(){$scope.payFeedbck.msg="",$scope.payFeedbck.title="Procesando Transacción...",$scope.payFeedbck.typ="info",$scope.payFeedbck.showSpin=!0,$scope.payFeedbck.disablePay=!0;var spinner=new Spinner(opts).spin(document.getElementById("payFeedPanel")),ccInfo={cc:$scope.slccreditCard.selected,amount:$scope.totalfi,user:$scope.global.user};$scope.global.user.telephoneset?sendCredom(ccInfo,spinner):$http.post("/savePhone",{idd:$scope.global.user._id,phone:$scope.global.user.phone}).success(function(data,status){$scope.global.user.telephoneset=!0,sendCredom(ccInfo,spinner)}).error(function(err,status){})},$scope.sendAidMail=function(){return""===$scope.aid.phone?!1:($scope.aid.sendingMail=!0,$scope.searchFeedbck.msg="Enviando correo, Por favor espere",void $http.post("/sendAidMail",{phone:$scope.aid.phone,colector:$scope.colector.nm,servicio:$scope.servicio.nm}).success(function(response){"OK"===response.stat&&($scope.searchFeedbck.msg=response.msg)}).error(function(response){}))},$scope.searchDiscount=function(){$http.post("/searchDiscount",{codigo:$scope.discount.searchparm}).success(function(response){response.discount?($scope.discount.searchparm="",$scope.discount.disc=response.discount,$scope.discount.haveDiscount=!0,applyDiscount()):$scope.discountFeedbck=response}).error(function(response){})},$scope.setReferer=function(ref){return ref.selected?(resetDiscount(),delete ref.selected):(selectRef(ref),$scope.discount.haveDiscount&&resetDiscount(),void $http.post("/setRefDisc",ref).success(function(res){res.error||($scope.discount.disc={codigo:res.discount.discountName,percent:res.discount.percent},$scope.discount.haveDiscount=!0,applyDiscount())}).error(function(err){}))},$scope.switchReminder=function(){$scope.remind.executing=!0,$http.post("/userPayReminder",{}).success(function(res){return"ok"===res.stat?($scope.remind.stat="success",res.added?($scope.remind.on=!0,$scope.remind.feed="Configuración guardada! Recibirá recordatorio mensual los dias 10 y 15"):($scope.remind.on=!1,$scope.remind.feed="Configuración guardada! Dejará de recibir recordatorio de esta cuenta"),void($scope.remind.executing=!1)):($scope.remind.on=!$scope.remind.on,void($scope.remind.executing=!1))}).error(function(err){$scope.remind.stat="Danger",$scope.remind.on=!$scope.remind.on,$scope.remind.feed="Error, por favor intenta mas tarde",$scope.remind.executing=!1})["finally"](function(){setTimeout(function(){$scope.remind.stat=$scope.remind.feed=void 0,$scope.$apply()},5e3)})},$scope.getReminder=function(){$http.get("/userPayReminder").success(function(res){res.error||("FOUND"===res.stat?$scope.remind.on=!0:$scope.remind.on=!1)}).error(function(err){})},$scope.preventPaste=function(e){return e.preventDefault(),!1},$(document).on("keypress","#slcCVV",function(evt){return $(this).val().length>=4?!1:void 0})}])}();
  1904. !function(){"use strict";angular.module("mean.pagos").config(["$stateProvider",function($stateProvider){var checkLoggedin=function($q,$timeout,$http,$location){var deferred=$q.defer();return $http.get("/loggedin").success(function(user){"0"!==user?$timeout(deferred.resolve):($timeout(deferred.reject),$location.url("/auth/login"))}),deferred.promise};$stateProvider.state("payment",{url:"/pagos",templateUrl:"pagos/views/index.html",resolve:{loggedin:checkLoggedin}}).state("payment.pay",{url:"/pagar",templateUrl:"pagos/views/pay.html",resolve:{loggedin:checkLoggedin}}).state("payment.fast",{url:"/rapido/:colector/:servicio/:tipoB/:valor/:fecha/:hash",templateUrl:"pagos/views/fastpay.html",resolve:{loggedin:checkLoggedin}}).state("payment.mine",{url:"/realizados",templateUrl:"pagos/views/payments.html",resolve:{loggedin:checkLoggedin}}).state("payment.conf",{url:"/settings",templateUrl:"pagos/views/settings.html",resolve:{loggedin:checkLoggedin}})}])}();
  1905. !function(){"use strict";angular.module("mean.pagos").factory("UserPayments",["$http",function($http){return{getPayments:function(obj,callback){var self=this,uri="/mypayments?",querystringvars=[];obj.orderid&&querystringvars.push("orderid="+obj.orderid),obj.colector&&querystringvars.push("colector="+obj.colector),obj.servicio&&querystringvars.push("servicio="+obj.servicio),obj.parametro&&querystringvars.push("param="+obj.parametro),obj.startdate&&obj.enddate&&querystringvars.push("stardate="+obj.startdate,"enddate="+obj.enddate),uri+=querystringvars.join("&"),$http.get(uri).success(function(res){callback(self.process(res))})},process:function(data){for(var singlepayments=[],bill={},i=0;i<data.payments.length;i++)for(var k=0;k<data.payments[i].docs.length;k++){bill={orderid:data.payments[i].credResp.orderid,colector:data.payments[i].colector,servicio:data.payments[i].servicio,tipoB:data.payments[i].tipoBusqueda,parametro:data.payments[i].parametro,bills:[],created:data.payments[i].created,fee:data.payments[i].fee,discountcode:data.payments[i].discount&&data.payments[i].discount.codigo||"NA",discountpercent:data.payments[i].discount&&data.payments[i].discount.percent||"NA"};for(var k=0;k<data.payments[i].docs.length;k++)bill.bills.push({nofactura:data.payments[i].docs[k].noFactura,monto:data.payments[i].docs[k].monto});singlepayments.push(bill)}return singlepayments}}}])}();
  1906. !function(){"use strict";angular.module("mean.pagos").factory("Pagos",[function(){return{name:"pagos"}}])}();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement