Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,111 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.dashboard.emailBank', ['ui.router'])
|
||||
.controller('EmailBankCtrl', EmailBankCtrlController);
|
||||
|
||||
function EmailBankCtrlController($scope, cache, systemProvider, systemStores, $mdDialog,
|
||||
uiGridConstants, portalUtils, Constants) {
|
||||
|
||||
$scope.confirmQuestionBox = true;
|
||||
|
||||
$scope.scripts = [];
|
||||
|
||||
$scope.userRole = '';
|
||||
|
||||
$scope.Constants = Constants;
|
||||
|
||||
$scope.mCache = cache.request([
|
||||
new systemStores.EmailTemplates()
|
||||
]).then(function(){
|
||||
$scope.emailTemplates = $scope.mCache.emailTmpls.data.values;
|
||||
});
|
||||
|
||||
$scope.emailGrid = {
|
||||
data: 'emailTemplates',
|
||||
paginationPageSizes: [25, 50, 75, 100, 125, 150, 175, 200],
|
||||
paginationPageSize: 25,
|
||||
enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
|
||||
toggleModifierKeysToMultiSelect : true,
|
||||
enableRowHeaderSelection: true,
|
||||
multiSelect: false,
|
||||
noUnselect: false,
|
||||
onRegisterApi: function (gridApi) {
|
||||
$scope.emailTmplGridApi = gridApi;
|
||||
},
|
||||
columnDefs: [
|
||||
{field: 'emailName', displayName: 'Name', width: '*'},
|
||||
{field: 'emailSubject', displayName: 'Subject', width: '**' },
|
||||
{field: 'id', displayName: 'Actions', width: '125', enableColumnMenu: false, enableFiltering: false, enableHiding: false,
|
||||
cellTemplate: 'main/email-bank/cell-templates/email-actions.html'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
$scope.edit = function(entity) {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-email-tmpl/add-email-tmpl.html',
|
||||
controller: 'AddEmailTmplCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Edit Email Template',
|
||||
template: entity
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addEmail = function() {
|
||||
$mdDialog.show({
|
||||
templateUrl: 'common/partials/add-email-tmpl/add-email-tmpl.html',
|
||||
controller: 'AddEmailTmplCtrl',
|
||||
escapeToClose: false,
|
||||
locals: {
|
||||
modalInstance: {
|
||||
header: 'Add New Email Template',
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.delete = function(entity) {
|
||||
if ($scope.confirmQuestionBox) {
|
||||
portalUtils.confirmBox('deleteTmpl', 'Delete Email Template', ['Are you sure you want to delete the template', entity.emailName],
|
||||
true, function(value) {
|
||||
if (value.confirm) {
|
||||
$scope.confirmQuestionBox = !value.checkbox;
|
||||
$scope.deleteTmpl(entity);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$scope.deleteTmpl(entity);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.deleteTmpl = function(entity) {
|
||||
systemProvider.deleteEmailTemplates(entity).then(function() {
|
||||
portalUtils.toast('Email Template deleted successfully', ['top', 'left'], 2000);
|
||||
},function(err){
|
||||
portalUtils.toast('Unable to delete email Template: ' + err.message, ['top', 'left'], 4000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.toggleFiltering = function() {
|
||||
$scope.scriptGrid.enableFiltering = !$scope.scriptGrid.enableFiltering;
|
||||
$scope.emailTmplGridApi.core.notifyDataChange( uiGridConstants.dataChange.COLUMN );
|
||||
};
|
||||
|
||||
/* $scope.$on('$destroy', function () {
|
||||
$scope.mCache.unlisten();
|
||||
});*/
|
||||
|
||||
} //end EmailBankCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user