Commit 7e481a06817fc8df1ab142a8a8414ce1235893d9
1 parent
c555af3123
Exists in
master
implement toogle functionality on contactView page
Showing
5 changed files
with
28 additions
and
24 deletions
Show diff stats
app/index.html
... | ... | @@ -16,6 +16,8 @@ |
16 | 16 | <link rel="stylesheet" href="bower_components/angular-bootstrap/ui-bootstrap-csp.css"/> |
17 | 17 | <link href="bower_components/jqGrid/css/ui.jqgrid.css" rel="stylesheet"> |
18 | 18 | <link href="bower_components/angular-xeditable/dist/css/xeditable.css" rel="stylesheet"> |
19 | + <link href="bower_components/angular-bootstrap-toggle/dist/angular-bootstrap-toggle.min.css" | |
20 | + rel="stylesheet"> | |
19 | 21 | |
20 | 22 | |
21 | 23 | <link rel="stylesheet" href="css/main.css"/> |
... | ... | @@ -72,6 +74,7 @@ |
72 | 74 | <script src="bower_components/jqGrid/js/i18n/grid.locale-en.js"></script> |
73 | 75 | <script src="bower_components/jqGrid/js/jquery.jqGrid.min.js"></script> |
74 | 76 | <script src="bower_components/angular-xeditable/dist/js/xeditable.js"></script> |
77 | + <script src="bower_components/angular-bootstrap-toggle/dist/angular-bootstrap-toggle.min.js"></script> | |
75 | 78 | |
76 | 79 | |
77 | 80 | <!-- | ... | ... |
app/js/app.js
1 | 1 | 'use strict'; |
2 | 2 | |
3 | 3 | |
4 | - angular.module('acufuel', ['ngCookies', 'ngResource', 'ui.router', 'ngAnimate', 'ui.bootstrap', 'xeditable']) | |
4 | + angular.module('acufuel', ['ngCookies', 'ngResource', 'ui.router', 'ngAnimate', 'ui.bootstrap', 'xeditable', 'ui.toggle']) | |
5 | 5 | |
6 | 6 | .config(['$httpProvider', function($httpProvider) { |
7 | 7 | $httpProvider.defaults.withCredentials = true; | ... | ... |
app/partials/ContactView/ContactView.controller.js
... | ... | @@ -3,11 +3,11 @@ |
3 | 3 | //Load controller |
4 | 4 | angular.module('acufuel') |
5 | 5 | |
6 | - .controller('ContactViewController', ['$scope', '$uibModal', 'ContactViewService', 'ViewCompanyService', function($scope, $uibModal, ContactViewService, ViewCompanyService) { | |
7 | - $(function() { | |
8 | - $('#toggle-one120').bootstrapToggle(); | |
9 | - $('#toggle-two21').bootstrapToggle(); | |
10 | - }) | |
6 | + .controller('ContactViewController', ['$scope', '$uibModal', 'ContactViewService', 'ViewCompanyService', 'ViewcontactService', function($scope, $uibModal, ContactViewService, ViewCompanyService, ViewcontactService) { | |
7 | + // $(function() { | |
8 | + // $('#toggle-one120').bootstrapToggle(); | |
9 | + // $('#toggle-two21').bootstrapToggle(); | |
10 | + // }) | |
11 | 11 | |
12 | 12 | $(document).ready(function() { |
13 | 13 | $('#contacts').DataTable(); |
... | ... | @@ -16,23 +16,21 @@ |
16 | 16 | ContactViewService.getContacts().then(function(result) { |
17 | 17 | console.log('==========',result); |
18 | 18 | $scope.contactList = result; |
19 | - for(var i=0; i<$scope.contactList.length; i++){ | |
20 | - console.log("adadas") | |
21 | - $scope.contactList[i].value = "" | |
22 | - console.log($scope.contactList[i].priceEmail) | |
23 | - if($scope.contactList[i].priceEmail == 'true'){ | |
24 | - console.log(aaya) | |
25 | - $scope.contactList[i].value = 'on'; | |
26 | - }else{ | |
27 | - console.log("nai") | |
28 | - $scope.contactList[i].value = 'off' | |
29 | - } | |
30 | - | |
31 | - $('#toggle-one12'+ [i]).bootstrapToggle($scope.contactList[i].value) | |
32 | - } | |
33 | - console.log($scope.contactList) | |
34 | 19 | |
35 | 20 | }) |
21 | + | |
22 | + $scope.changePriceEmail = function(id, index){ | |
23 | + var contactId = id; | |
24 | + console.log($scope.contactList[index].priceEmail) | |
25 | + var statusData = "status=" + $scope.contactList[index].priceEmail; | |
26 | + ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) { | |
27 | + if(result.success){ | |
28 | + toastr.success(''+result.success+'', { | |
29 | + closeButton: true | |
30 | + }) | |
31 | + } | |
32 | + }) | |
33 | + } | |
36 | 34 | |
37 | 35 | ContactViewService.getCompanies().then(function(result) { |
38 | 36 | console.log('==========',result); | ... | ... |
app/partials/ContactView/ContactView.html
... | ... | @@ -85,11 +85,13 @@ |
85 | 85 | <td>{{contact.mobilePhone}}</td> |
86 | 86 | <td>{{contact.title}}</td> |
87 | 87 | <td> |
88 | - <div class="my-toggle-switch" ng-click="changePriceEmail()"> | |
88 | + <toggle ng-model="contact.priceEmail" ng-change="changePriceEmail(contact.id, $index)"></toggle> | |
89 | + | |
90 | + <!-- <div class="my-toggle-switch" ng-click="changePriceEmail()"> | |
89 | 91 | <div> |
90 | 92 | <input id="toggle-one12{{$index}}" checked type="checkbox" data-size="mini" data-width="110" data-toggle="toggle" data-on="PRICE EMAIL ON" data-off="PRICE EMAIL OFF"> |
91 | 93 | </div> |
92 | - </div> | |
94 | + </div> --> | |
93 | 95 | </td> |
94 | 96 | <td>{{contact.userName}}</td> |
95 | 97 | <td>{{contact.password}}</td> | ... | ... |
bower.json