PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
angular.module('ecommerce', ['ui.tab_edit','ui.config.edit','ngCkeditor','stgrid','ui.tabcontent','ui.popup','ui.router','ui.bootstrap','ngLocale','base','pagemanager.communication','pagemanager.iframe']) .value('data', { noIframe: true, name:'ecommerce', }) .controller('ecommerceController', function($scope,$state, communication) { $scope.install = function() { communication.api('install', {}, 'ecommerce').then(function() { window.is_reload = true; window.top.location.reload(false); //$state.go($state.current, {}, {reload: true}); }); } }) .service("formatService", function() { this.data=[]; this.init = function() { console.log('test'); }; this.format = function() { } }) .service("currencyService", function(communication, configurationService) { this.data=[]; this.init = function() { var that = this; communication.getList('currency', {},"ecommerce").then(function(json) { that.data = json; }); communication.getDefaultCurrency().then(function(default_currency) { that.selected = default_currency || 'USD'; console.log(that.selected); }); }; this.calculate = function(value, to, from) { if (!(from)) from = configurationService.get('store_currency_code', 'USD'); if (!(this.data[from])) console.log('Currency (' + from +') does not exist'); if (!(this.data[to])) console.log('Currency ('+ to +') does not exist'); return value / this.data[from]['value'] * this.data[to]['value']; } this.convert = function(value, from, to) { if ((to)) to = configurationService.get('store_currency_code', 'USD'); return this.calculate(value, to, from); } this.format = function(value, auto_decimals=true, raw=false, currency_code, currency_value) { if (raw) return this.format_raw(value, currency_code, currency_value); if (!(currency_code)) currency_code = this.selected; if (!(currency_value) && (this.data[currency_code] != undefined)) currency_value = parseFloat(this.data[currency_code]['value']); if (!(this.data[currency_code]) && !!(currency_value)) { return (value * currency_value).format( 2, configurationService.get('decimal_point','.'), configurationService.get('thousands_sep',',')) +' '+ currency_code; } if (auto_decimals == false || value - Math.floor(value) > 0) { decimals = parseInt(this.data[currency_code]['decimals']); } else { decimals = 0; } return this.data[currency_code]['prefix'] + (value * currency_value).format(decimals, configurationService.get('decimal_point',','), configurationService.get('thousands_sep','.')) + this.data[currency_code]['suffix']; } this.format_raw = function(value, currency_code=null, currency_value) { if (!(currency_code)) currency_code = this.selected; if (!(this.data[currency_code])) {console.log('Currency ('+ currency_code +') does not exist'); return 0;}; if (!(currency_value)) currency_value = this.data[currency_code]['value']; return (value * currency_value).format( this.data[currency_code]['decimals'], configurationService.get('decimal_point','.'), configurationService.get('thousands_sep',',')); } // Round a store currency amount in a remote currency this.round = function(value, currency_code) { if (!(currency_code)) currency_code = this.selected; if (!(this.data[currency_code])) {console.log('Currency ('+ currency_code +') does not exist'); return 0;}; value = this.convert(value, configurationService.get('store_currency_code','USD'), currency_code); value = Math.round(value, this.data[currency_code]['decimals']); value = this.convert(value, currency_code, configurationService.get('store_currency_code', 'USD')); return value; } // Align an amount - friendly price this.align = function(value, step=1, subtract=0) { /* Examples: * currency::align(12.34, 0.5, 0.01); // Returns 12.49 * currency::align(12.34, 5, 0.01); // Returns 9.99 * currency::align(10.7, 2); // Returns 10 */ value += subtract; if (step == 0 || step == 1) return Math.round(value) - subtract; return (Math.round(value / step) * step) - subtract; } }) .service("lengthService", function(communication) { this.data=[]; this.init = function() { var that = this; communication.getList('length', {},"ecommerce").then(function(json) { that.data = json; }); }; this.convert = function(value, from, to) { if (value == 0) return 0; if (from == to) return value; if (!(this.data[from])) {console.log('The unit ' + from + ' is not a valid length class.'); return 0; }; if (!(this.data[to])) {console.log('The unit ' + to +' is not a valid length class.');return 0;}; return value * (this.data[to]['value'] / this.data[from]['value']); } this.format = function(value, unit) { if (!(this.data[unit])) { console.log('The unit '+ unit +' is not a valid weight class.'); return; } var num_decimals = this.data[unit]['decimals']; if (Math.round(value) == value) num_decimals = 0; return value.format(num_decimals, configurationService.get('decimal_point',','), configurationService.get('thousands_sep', ',')) +' '+ this.data[unit]['unit']; } }) .service("weightService", function(communication, configurationService) { this.data=[]; this.init = function() { var that = this; communication.getList('weight', {}, "ecommerce").then(function(json) { that.data = json; }); }; this.format = function(value, unit) { if (!(this.data[unit])) { console.log('The unit '+ unit +' is not a valid weight class.'); return; } var num_decimals = this.data[unit]['decimals']; if (Math.round(value) == value) num_decimals = 0; return value.format(num_decimals, configurationService.get('decimal_point',','), configurationService.get('thousands_sep', ',')) +' '+ this.data[unit]['unit']; } }) .config(function($stateProvider,$urlRouterProvider,$httpProvider,$logProvider,$controllerProvider) { var states = [ ['ecommerce','/ecommerce'], ['ecommerce.dashboard','/dashboard'], ['ecommerce.catalog','/catalog'], ['ecommerce.catalog.product','/product'], ['ecommerce.catalog.product.view','/:productID'], ['ecommerce.catalog.review','/review'], ['ecommerce.catalog.category','/category'], ['ecommerce.order','/order'], ['ecommerce.order.order','/order'], ['ecommerce.order.order.view','/:orderID'], ['ecommerce.customer','/customer'], ['ecommerce.customer.customer','/customer'], ['ecommerce.customer.customer.view','/:customerID'], ['ecommerce.customer.customer_group','/customer_group'], ['ecommerce.customer.customer_group.view','/:customer_groupID'], ['ecommerce.configuration','/configuration'], ['ecommerce.configuration.general','/general'], ['ecommerce.configuration.zone','/zone'], ['ecommerce.configuration.tax','/tax'], ['ecommerce.configuration.tax.tax_class','/tax_class'], ['ecommerce.configuration.tax.tax_rate','/tax_rate'], ['ecommerce.configuration.shipping','/shipping'], ['ecommerce.configuration.payment','/payment'], ['ecommerce.configuration.mail','/mail'], ['ecommerce.configuration.system','/system'], ['ecommerce.statistic','/statistic'], ['ecommerce.statistic.product','/product'], ['ecommerce.statistic.product.viewed','/viewed'], ['ecommerce.statistic.product.purchased','/purchased'], ['ecommerce.promotion','/promotion'], ['ecommerce.promotion.coupon','/coupon'], ['ecommerce.promotion.coupon.view','/:couponID'], ['ecommerce.promotion.mail','/mail'], //['ecommerce.promotion.product.purchased','/purchased'], ['ecommerce.statistic.sale','/sale'], ['ecommerce.statistic.sale.order','/order'], ['ecommerce.statistic.sale.tax','/tax'], ['ecommerce.statistic.sale.shipping','/shipping'], ['ecommerce.statistic.sale.payment','/payment'], ['ecommerce.statistic.customer','/customer'], ['ecommerce.statistic.customer.online','/online'], ['ecommerce.statistic.customer.activity','/activity'], ['ecommerce.statistic.customer.order','/order'], ]; for(var i = 0;i < states.length;i++) { $stateProvider .state(states[i][0], { url: states[i][1], }); } }) .run(function(setupFactory,$state,$rootScope,currencyService,weightService,lengthService,configurationService) { //stylesheetService.loadPalette(); configurationService.init(); weightService.init(); currencyService.init(); lengthService.init(); $rootScope.configurationService = configurationService; $rootScope.weightService = weightService; $rootScope.currencyService = currencyService; $rootScope.lengthService = lengthService; }); ;
[+]
..
[-] pagemanager.js
[edit]
[-] customize.js
[edit]
[+]
viewer
[-] ecommerce.js
[edit]
[-] pagemanager.iframe.js
[edit]
[+]
popup
[-] pagemanager.modules.js
[edit]
[+]
customize
[+]
blog
[-] settings.js
[edit]
[+]
modules
[-] content.js
[edit]
[-] blog.js
[edit]
[-] base.js
[edit]
[+]
settings
[+]
ecommerce