var crmMailingAB = angular.module('crmMailingAB', ['ngRoute', 'ui.utils']);
+ crmMailingAB.run(function($rootScope, $templateCache) {
+ $rootScope.$on('$viewContentLoaded', function() {
+ $templateCache.removeAll();
+ });
+ });
+
crmMailingAB.config(['$routeProvider',
function($routeProvider) {
$routeProvider.when('/mailing', {
$scope.send_date ="10/4/2004";
+ $scope.mailA={};
+
+ $scope.mailB={};
+ $scope.save=function(dat){
+
+ var result= crmApi('Mailing', 'create',dat, true);
+ console.log("Ac "+result);
+ };
+
+ $scope.init=function(par){
+
+ $scope.whatnext=par.toString()
+ }
+
+
});
crmMailingAB.directive('nexttab', function() {
return {
// Restrict it to be an attribute in this case
restrict: 'A',
+ priority: 500,
// responsible for registering DOM listeners as well as updating the DOM
link: function(scope, element, attrs) {
var myArray1 = new Array( );
for ( var i = scope.tab_val+1; i < 4; i++ ) {
myArray1.push(i);
- console.log( "try " + i );
}
$(element).parent().parent().parent().tabs( "option", "disabled", myArray1 );
$(element).parent().parent().parent().tabs({active:scope.tab_val});
- console.log("adiroxxx");
+ console.log("Adir");
});
}
};
}
};
});
+
+ crmMailingAB.directive('submitform',function(){
+ return {
+ restrict:'A',
+ priority: 1000,
+ link: function(scope,element,attrs){
+ $(element).on("click",function() {
+
+ console.log("clicked");
+ scope.save({
+ "sequential": 1,
+ "name": "Aditya Nambiar",
+ "subject": scope.mailA.subj,
+ "created_id": "2",
+ "from_email": scope.mailA.fromEmail,
+ "body_text": scope.mailA.body
+
+ });
+ console.log("Truth "+ scope.whatnext)
+
+ if(scope.whatnext=="3"){
+ console.log("sdf");
+ scope.mailB.subj=scope.mailA.subj;
+ scope.mailB.body=scope.mailA.body;
+
+ }
+ else if(scope.whatnext=="2"){
+ scope.mailB.fromEmail=scope.mailA.fromEmail;
+ scope.mailB.body=scope.mailA.body;
+
+ }
+
+
+ scope.save({
+ "sequential": 1,
+ "name": "Aditya Nambiar",
+ "subject": scope.mailB.subj,
+ "created_id": "2",
+ "from_email": scope.mailB.fromEmail,
+ "body_text": scope.mailB.body
+
+ });
+
+ });
+ }
+ };
+
+ });
+
+
})(angular, CRM.$, CRM._);
\ No newline at end of file
<br><br>
<pre>
- From Email Address A: <input type="text"><br>
- From Email Address B: <input type="text"><br>
+ From Email Address A: <input type="text" ng-model="mailA.fromEmail"><br>
+ From Email Address B: <input type="text" ng-model="mailB.fromEmail"><br>
Use Template : <input type="text"><br>
- Mail Subject: <input type="text"><br>
+ Mail Subject: <input type="text" ng-model="mailA.subj" ><br>
- <textarea rows="4" cols="50">
+ <textarea rows="4" cols="50" ng-model="mailA.body" >
</textarea>
+ <span ng-init="init('3')" ></span>
</pre>
</div>
\ No newline at end of file
</ul>
<div id="tabs-21">
- From Email Address : <input type="text"><br>
- Use Template : <input type="text"><br>
- Mail Subject: <input type="text"><br>
+ From Email Address : <input type="text" ng-model="mailA.fromEmail"><br>
+ Use Template : <input type="text" ><br>
+ Mail Subject: <input type="text" ng-model="mailA.subj"><br>
- <textarea rows="4" cols="50">
+ <textarea rows="4" cols="50" ng-model="mailA.body">
</textarea>
</div>
<div id="tabs-22">
- From Email Address : <input type="text"><br>
+ From Email Address : <input type="text" ng-model="mailB.fromEmail"><br>
Use Template : <input type="text"><br>
- Mail Subject: <input type="text"><br>
+ Mail Subject: <input type="text" ng-model="mailB.subj"><br>
- <textarea rows="4" cols="50">
+ <textarea rows="4" cols="50" ng-model="mailB.body">
</textarea>
</div>
+
</div>
\ No newline at end of file