PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
popup
angular.module('ui.popup') .service('popup_product_option_combination', ['$file_manager','communication','popup_form','$templateCache','$filter',function($file_manager,communication,popup_form,$templateCache,$filter) { this.open = function(opt) { opt = opt || {}; return popup_form.open({ name:'product_option_combination', data:opt.data, controller: function($scope,$modalInstance) { $scope.option_set = opt.option_set || []; var product_id = opt.product_id || 0; $scope.options = $scope.options || []; $scope.avaiable = $scope.options.length > 0; communication.getList('product_options',{set_id:$scope.option_set.id},'ecommerce.catalog.product').then(function(json) { $scope.options= json; console.log($scope.options); $scope.avaiable = $scope.options.length > 0; }); $scope.changeRadio = function(item) { } var getOption = function() { var s = []; for(var i = 0;i < $scope.options.length;i++) { var opt = $scope.options[i]; if(opt.type="radio" || opt.type=="dropdown") { if(angular.isDefined(opt.selected)) { s.push({id:opt.id, value:opt.selected}); } else if(opt.type="checkbox") { var c = []; for(var j = 0;j < opt.items.length;j++) { if(opt.items[i].checked) c.push(opt.items[i].id); } s.push({id:opt.id, value:c}); } } } return s; } $scope.selectImage = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; for(var i = 0; i < images.length;i++) { var image = images[i]; $scope.data.image = ImageUtil.decodeImageURL(image.full_url) ; } }); } $scope.changeOptionSelected = function() { $scope.option_selected = $scope.data.cprice || $scope.data.cimage || $scope.data.cweight || $scope.data.offline; } $scope.save = function() { var valid = true; if($scope.form) { valid = ($scope.form.$valid); console.log(valid); } if(valid) { $scope.data.options = getOption(); $modalInstance.close($scope.data); } } }, size:'lg', execute_path:'ecommerce.catalog.product', form_name:'ProductForm' }); } }]);
[+]
..
[-] profile.js
[edit]
[-] pagelist.js
[edit]
[-] order.js
[edit]
[-] customer_group.js
[edit]
[-] module_list.js
[edit]
[-] backgroundeditor.js
[edit]
[-] product.js
[edit]
[-] visualcsseditor.js
[edit]
[-] shipping_rule.js
[edit]
[-] profile_change_password.js
[edit]
[-] review.js
[edit]
[-] contributor_invite.js
[edit]
[-] dbfilter.js
[edit]
[-] tax_class.js
[edit]
[-] special_module_style_editor.js
[edit]
[-] idletimeout.js
[edit]
[-] address.js
[edit]
[-] contributor.js
[edit]
[-] login.js
[edit]
[-] skin.js
[edit]
[-] mail.js
[edit]
[-] discount.js
[edit]
[-] customer.js
[edit]
[-] productgrid.js
[edit]
[-] socialsharebuttonconfig.js
[edit]
[-] news.js
[edit]
[-] color.js
[edit]
[-] palette.js
[edit]
[-] newsgrid.js
[edit]
[-] product_option_combination_grid.js
[edit]
[-] page.js
[edit]
[-] product_option.js
[edit]
[-] tax_rate.js
[edit]
[-] coupons.js
[edit]
[-] zone.js
[edit]
[-] product_bulk_price.js
[edit]
[-] option_set.js
[edit]
[-] product_option_combination.js
[edit]