PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
ecommerce
/
promotion
define([], function() { return function($scope, communication, popup_coupon,$state,$uibModalStack) { var statuses = [ t('LBL_COUPON_INACTIVE'), t('LBL_COUPON_ACTIVE') ]; $scope.showStatus = function(status) { return statuses[status]; } $scope.gridInstance={ data:[] }; $scope.add = function() { popup_coupon.open().result.then(function(data) { communication.removeList('coupon'); $scope.gridInstance.instance.reloadData(); }); } $scope.delete = function() { var rows = $scope.gridInstance.selections; if(rows.length > 0) { $dialog.confirm({ title:'', message:window.t('LBL_DELETE_ITEMS_CONFIRM_MESSAGE') }).result.then(function() { communication.api('deleteItems', {ids:rows},'ecommerce.promotion.coupon').then(function() { communication.removeList('coupon'); $scope.gridInstance.instance.reloadData(); }); }); } } $scope.RowButtonClickHandler = { edit : function(id) { communication.api('getFormData',{name:'coupon', id:id}).then(function(data) { popup_coupon.open( { data:data }).result.then(function(data) { if($state.current.name =='ecommerce.promotion.coupon.view') $state.go('ecommerce.promotion.coupon'); communication.removeList('coupon'); $scope.gridInstance.instance.reloadData(); }, function() { if($state.current.name =='ecommerce.promotion.coupon.view') $state.go('ecommerce.promotion.coupon'); }); }) }, }; var checkState = function() { if($state.current.name =='ecommerce.promotion.coupon.view') $scope.RowButtonClickHandler.edit($state.params.couponID); } checkState(); $scope.$on("$stateChangeSuccess", function(event, toState, toParams, fromState, fromParams) { checkState(); if(fromState.name =='ecommerce.promotion.coupon.view') $uibModalStack.dismissAll(1); }); } });
[+]
..
[-] coupon.js
[edit]
[-] mail.js
[edit]
[-] discount.js
[edit]