Initial commit
This commit is contained in:
commit
880e39de2e
511 files changed
+38363
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<md-dialog>
|
||||
<form name="emailTmplForm" ng-submit="emailTmplForm.$valid && ok()">
|
||||
<md-toolbar>
|
||||
<div class="md-toolbar-tools md-portal">
|
||||
<span>{{header}}</span>
|
||||
<span flex></span>
|
||||
<md-button class="md-icon-button" ng-click="cancel()">
|
||||
<md-icon aria-label="Close dialog">close</md-icon>
|
||||
</md-button>
|
||||
</div>
|
||||
</md-toolbar>
|
||||
<md-dialog-content layout-padding flex>
|
||||
<div layout="column" layout-align="start start" flex>
|
||||
<md-input-container class="md-block" flex-gt-sm>
|
||||
<label>Email Template Name</label>
|
||||
<input ng-model="emailTmpl.emailName" required id="emailTmpl" name="emailTmpl">
|
||||
<div ng-messages="emailTmplForm.emailTmpl.$error" ng-show="emailTmplForm.emailTmpl.$invalid && submitted || emailTmplForm.emailTmpl.$touched">
|
||||
<div ng-message="required">Email template name is required</div>
|
||||
</div>
|
||||
</md-input-container>
|
||||
<md-input-container class="md-block" flex-gt-sm>
|
||||
<label>Email Subject</label>
|
||||
<input ng-model="emailTmpl.emailSubject" required id="emailSubject" name="emailSubject">
|
||||
<div ng-messages="emailTmplForm.emailSubject.$error" ng-show="emailTmplForm.emailSubject.$invalid && submitted || emailTmplForm.emailSubject.$touched">
|
||||
<div ng-message="required">Email subject is required</div>
|
||||
</div>
|
||||
</md-input-container>
|
||||
<span><strong>Email Body</strong></span>
|
||||
<textarea ui-tinymce="tinymceOptions" ng-model="emailTmpl.emailMessage"></textarea>
|
||||
</div>
|
||||
</md-dialog-content>
|
||||
<md-dialog-actions layout="row" class="modal-footer">
|
||||
<div class="text-danger">{{error}}</div>
|
||||
<md-button id="okButton" type="submit" class="md-raised md-primary" >OK</md-button>
|
||||
<md-button id="cancelButton" class="md-raised md-warn" ng-click="cancel()">Cancel</md-button>
|
||||
</md-dialog-actions>
|
||||
</form>
|
||||
</md-dialog>
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* MODULE DESCRIPTION:
|
||||
*
|
||||
* TODO: Write description here.
|
||||
*/
|
||||
angular.module('portal.common.partials.addEmailTmpl', ['ui.router']).controller('AddEmailTmplCtrl', addEmailTmplCtrlController);
|
||||
|
||||
function addEmailTmplCtrlController($scope, modalInstance, $state, cache, $mdDialog, EmailTemplate,
|
||||
systemProvider, scriptStores, portalUtils, $timeout) {
|
||||
|
||||
$scope.trustAsHtml = portalUtils.trustAsHtml;
|
||||
|
||||
$scope.header = modalInstance.header;
|
||||
|
||||
$scope.submitted = false;
|
||||
|
||||
$scope.loadingBlock = false;
|
||||
|
||||
$scope.isNew = modalInstance.template === undefined;
|
||||
|
||||
$scope.emailTmpl = $scope.isNew ? new EmailTemplate() : new EmailTemplate(modalInstance.template);
|
||||
|
||||
/*jshint ignore:start*/
|
||||
$scope.tinymceOptions = {
|
||||
inline: false,
|
||||
skin: 'lightgray',
|
||||
theme : 'modern',
|
||||
branding: false,
|
||||
height: 300,
|
||||
max_height: 300,
|
||||
width: 600,
|
||||
max_width: 600,
|
||||
resize: false
|
||||
};
|
||||
/*jshint ignore:end*/
|
||||
|
||||
/**
|
||||
* OK button handler
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.ok = function () {
|
||||
$scope.loadingBlock = true;
|
||||
var status = $scope.isNew ? 'Added': 'Edited';
|
||||
systemProvider.addEmailTemplate($scope.emailTmpl).then(function(data){
|
||||
portalUtils.toast('Email Template ' + status + ' Successfully', ['top', 'left'], 2000);
|
||||
$mdDialog.hide();
|
||||
}).catch(function(err) {
|
||||
$scope.loadingBlock = false;
|
||||
$scope.error = err.message;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Cancel button handler.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.cancel = function () {
|
||||
//Dismiss the modal
|
||||
$mdDialog.cancel();
|
||||
};
|
||||
|
||||
} //end addEmailTmplCtrlController function
|
||||
|
||||
})();
|
||||
Reference in new issue
Block a user