Commit c555af3123373967abbbeb4f4f5ed2abd63966fc
1 parent
90e918562d
Exists in
master
price email, company status and contact view page implementation and gulp file implementation
Showing
9 changed files
with
172 additions
and
21 deletions
Show diff stats
app/partials/ContactView/ContactView.controller.js
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | |
6 | 6 | .controller('ContactViewController', ['$scope', '$uibModal', 'ContactViewService', 'ViewCompanyService', function($scope, $uibModal, ContactViewService, ViewCompanyService) { |
7 | 7 | $(function() { |
8 | - $('#toggle-one12').bootstrapToggle(); | |
8 | + $('#toggle-one120').bootstrapToggle(); | |
9 | 9 | $('#toggle-two21').bootstrapToggle(); |
10 | 10 | }) |
11 | 11 | |
... | ... | @@ -16,6 +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) | |
19 | 34 | |
20 | 35 | }) |
21 | 36 | ... | ... |
app/partials/ContactView/ContactView.html
... | ... | @@ -38,32 +38,41 @@ |
38 | 38 | <tr> |
39 | 39 | <th> |
40 | 40 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
41 | - <label class="font-company">Company Name <i class="fa fa-sort" aria-hidden="true"></i></label> | |
41 | + <label class="font-company">Last Name <i class="fa fa-sort" aria-hidden="true"></i></label> | |
42 | 42 | </th> |
43 | 43 | |
44 | 44 | <th> |
45 | 45 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
46 | - <label class="font-company">Main Phone <i class="fa fa-sort" aria-hidden="true"></i></label> | |
46 | + <label class="font-company">First Phone <i class="fa fa-sort" aria-hidden="true"></i></label> | |
47 | 47 | </th> |
48 | 48 | <th> |
49 | 49 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
50 | - <label class="font-company">Primary Contact <i class="fa fa-sort" aria-hidden="true"></i></label> | |
50 | + <label class="font-company">Company Name <i class="fa fa-sort" aria-hidden="true"></i></label> | |
51 | 51 | </th> |
52 | 52 | |
53 | 53 | <th> |
54 | 54 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
55 | - <label class="font-company">Status <i class="fa fa-sort" aria-hidden="true"></i></label> | |
55 | + <label class="font-company">Work Phone <i class="fa fa-sort" aria-hidden="true"></i></label> | |
56 | + <th> | |
57 | + <input type="text" class="form-control" style="height:31px;" name="name" id="name"> | |
58 | + <label class="font-company">Mobile Phone <i class="fa fa-sort" aria-hidden="true"></i></label> | |
59 | + </th> | |
60 | + <th> | |
61 | + <input type="text" class="form-control" style="height:31px;" name="name" id="name"> | |
62 | + <label class="font-company">Title <i class="fa fa-sort" aria-hidden="true"></i></label> | |
63 | + </th> | |
64 | + | |
56 | 65 | <th> |
57 | 66 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
58 | - <label class="font-company">Source <i class="fa fa-sort" aria-hidden="true"></i></label> | |
67 | + <label class="font-company">Price Email<i class="fa fa-sort" aria-hidden="true"></i></label> | |
59 | 68 | </th> |
60 | 69 | <th> |
61 | 70 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
62 | - <label class="font-company">Margin Setting <i class="fa fa-sort" aria-hidden="true"></i></label> | |
71 | + <label class="font-company">Username<i class="fa fa-sort" aria-hidden="true"></i></label> | |
63 | 72 | </th> |
64 | 73 | <th> |
65 | 74 | <input type="text" class="form-control" style="height:31px;" name="name" id="name"> |
66 | - <label class="font-company">All In <i class="fa fa-sort" aria-hidden="true"></i></label> | |
75 | + <label class="font-company">Password<i class="fa fa-sort" aria-hidden="true"></i></label> | |
67 | 76 | </th> |
68 | 77 | </tr> |
69 | 78 | </thead> |
... | ... | @@ -75,8 +84,15 @@ |
75 | 84 | <td>{{contact.workPhone}}</td> |
76 | 85 | <td>{{contact.mobilePhone}}</td> |
77 | 86 | <td>{{contact.title}}</td> |
78 | - <td>{{contact.username}}</td> | |
79 | - <td>{{contact.priceEmail}}</td> | |
87 | + <td> | |
88 | + <div class="my-toggle-switch" ng-click="changePriceEmail()"> | |
89 | + <div> | |
90 | + <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 | + </div> | |
92 | + </div> | |
93 | + </td> | |
94 | + <td>{{contact.userName}}</td> | |
95 | + <td>{{contact.password}}</td> | |
80 | 96 | </tr> |
81 | 97 | </tbody> |
82 | 98 | </table> | ... | ... |
app/partials/viewCompany/viewCompany.controller.js
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | $('#company-one2').bootstrapToggle(value) |
58 | 58 | }) |
59 | 59 | |
60 | - $(function() { | |
60 | + $scope.changeStatus = function(){ | |
61 | 61 | $('#company-one2').bootstrapToggle(); |
62 | 62 | $('#company-one2').change(function() { |
63 | 63 | $('#console-event').html('Toggle: ' + $(this).prop('checked')); |
... | ... | @@ -65,10 +65,14 @@ |
65 | 65 | console.log($scope.companyData.activate) |
66 | 66 | var statusData = "status=" + $scope.companyData.activate; |
67 | 67 | ViewCompanyService.changeStatus(companyId, statusData).then(function(result) { |
68 | - | |
68 | + if(result.success){ | |
69 | + toastr.success(''+result.success+'', { | |
70 | + closeButton: true | |
71 | + }) | |
72 | + } | |
69 | 73 | }) |
70 | 74 | }) |
71 | - }) | |
75 | + } | |
72 | 76 | |
73 | 77 | |
74 | 78 | getContactList(); | ... | ... |
app/partials/viewCompany/viewCompany.html
... | ... | @@ -137,7 +137,7 @@ |
137 | 137 | <h3>Company Details</h3> |
138 | 138 | <label>BASE ICAO</label> |
139 | 139 | <input type="tel" ng-model="companyData.baseIcao" style="line-height: 18px;width: 50px;padding: 0px 9px;" ng-blur="editData()"/> |
140 | - <div class="pull-right my-toggle-switch" style="margin-top: 10px; margin-right: 10px;"> | |
140 | + <div class="pull-right my-toggle-switch" ng-click="changeStatus()" style="margin-top: 10px; margin-right: 10px;"> | |
141 | 141 | <div><input id="company-one2" checked type="checkbox" data-size="mini" data-width="55" data-toggle="toggle" data-on="Active" data-off="Dactive"> |
142 | 142 | </div> |
143 | 143 | </div> | ... | ... |
app/partials/viewcontact/viewcontact.controller.js
... | ... | @@ -11,8 +11,10 @@ |
11 | 11 | |
12 | 12 | var contactId = $stateParams.id; |
13 | 13 | $scope.contactDetail = {}; |
14 | + var value = ""; | |
14 | 15 | ViewcontactService.getContact(contactId).then(function(result) { |
15 | 16 | $scope.contactDetail = result; |
17 | + checkValue($scope.contactDetail.priceEmail); | |
16 | 18 | }) |
17 | 19 | |
18 | 20 | $scope.contactIdList = {}; |
... | ... | @@ -31,6 +33,7 @@ |
31 | 33 | selectedId = $scope.contactIdList[index]; |
32 | 34 | ViewcontactService.getContact(selectedId).then(function(result) { |
33 | 35 | $scope.contactDetail = result; |
36 | + checkValue($scope.contactDetail.priceEmail); | |
34 | 37 | }) |
35 | 38 | } |
36 | 39 | |
... | ... | @@ -39,9 +42,36 @@ |
39 | 42 | selectedId = $scope.contactIdList[index]; |
40 | 43 | ViewcontactService.getContact(selectedId).then(function(result) { |
41 | 44 | $scope.contactDetail = result; |
45 | + checkValue($scope.contactDetail.priceEmail); | |
42 | 46 | }) |
43 | 47 | } |
44 | 48 | |
49 | + function checkValue(priceEmail){ | |
50 | + if(priceEmail == true){ | |
51 | + value = 'on'; | |
52 | + }else{ | |
53 | + console.log("nai") | |
54 | + value = 'off' | |
55 | + } | |
56 | + $('#toggle-five').bootstrapToggle(value) | |
57 | + } | |
58 | + | |
59 | + $scope.changePriceEmail = function(){ | |
60 | + $('#toggle-five').bootstrapToggle(); | |
61 | + $('#toggle-five').change(function() { | |
62 | + $scope.activate = $(this).prop('checked'); | |
63 | + console.log($scope.activate) | |
64 | + var statusData = "status=" + $scope.activate; | |
65 | + ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) { | |
66 | + if(result.success){ | |
67 | + toastr.success(''+result.success+'', { | |
68 | + closeButton: true | |
69 | + }) | |
70 | + } | |
71 | + }) | |
72 | + }) | |
73 | + } | |
74 | + | |
45 | 75 | setInterval(function(){ |
46 | 76 | var checkMaxLength = $scope.contactIdList.length - one; |
47 | 77 | if (index === checkMaxLength) { | ... | ... |
app/partials/viewcontact/viewcontact.html
... | ... | @@ -25,8 +25,9 @@ |
25 | 25 | <div class="widget-header"> |
26 | 26 | <i class="fa fa-building-o" aria-hidden="true"></i> |
27 | 27 | <h3>Contact Detail</h3> |
28 | - <div class="pull-right my-toggle-switch" style="margin-top: 10px; margin-right: 30px;"> | |
29 | - <div><input id="toggle-five" checked type="checkbox" data-size="mini" data-width="110" data-toggle="toggle" data-on="PRICE EMAIL ON" data-off="PRICE EMAIL OFF"> | |
28 | + <div class="pull-right my-toggle-switch" ng-click="changePriceEmail()" style="margin-top: 10px; margin-right: 30px;"> | |
29 | + <div> | |
30 | + <input id="toggle-five" checked type="checkbox" data-size="mini" data-width="110" data-toggle="toggle" data-on="PRICE EMAIL ON" data-off="PRICE EMAIL OFF"> | |
30 | 31 | </div> |
31 | 32 | </div> |
32 | 33 | </div> | ... | ... |
app/partials/viewcontact/viewcontact.service.js
... | ... | @@ -52,6 +52,22 @@ |
52 | 52 | }) |
53 | 53 | return deferred.promise; |
54 | 54 | } |
55 | + | |
56 | + this.changePriceEmail = function(contactId, data) { | |
57 | + var deferred = $q.defer(); | |
58 | + $http({ | |
59 | + method : 'PUT', | |
60 | + url : BASE_URL.url +'/company/contact/status/'+ contactId, | |
61 | + data : data, | |
62 | + headers : {'Content-Type': 'application/json'}, | |
63 | + }) | |
64 | + .then(function (result){ | |
65 | + deferred.resolve(result.data); | |
66 | + },function (result){ | |
67 | + deferred.resolve(result.data); | |
68 | + }) | |
69 | + return deferred.promise; | |
70 | + } | |
55 | 71 | |
56 | 72 | } |
57 | 73 | ... | ... |
gulpfile.js
1 | -// gulp | |
2 | -var gulp = require('gulp'); | |
1 | +/* jshint node:true */ | |
2 | +'use strict'; | |
3 | 3 | |
4 | -// plugins | |
4 | +var gulp = require('gulp'); | |
5 | +var karma = require('karma').server; | |
6 | +var argv = require('yargs').argv; | |
7 | +var $ = require('gulp-load-plugins')(); | |
5 | 8 | var connect = require('gulp-connect'); |
9 | +var jshint = require('gulp-jshint'); | |
10 | +var uglify = require('gulp-uglify'); | |
11 | +var minifyCSS = require('gulp-minify-css'); | |
12 | +var clean = require('gulp-clean'); | |
13 | +var runSequence = require('run-sequence'); | |
6 | 14 | |
7 | - | |
15 | +gulp.task('lint', function() { | |
16 | + gulp.src(['./app/**/*.js', '!./app/bower_components/**']) | |
17 | + //.pipe(jshint()) | |
18 | + .pipe(jshint.reporter('default')) | |
19 | + //.pipe(jshint.reporter('fail')); | |
20 | +}); | |
21 | +gulp.task('clean', function() { | |
22 | + gulp.src('./dist/*') | |
23 | + .pipe(clean({force: true})); | |
24 | +}); | |
25 | +gulp.task('minify-css', function() { | |
26 | + var opts = {comments:true,spare:true,processImport: false}; | |
27 | + gulp.src(['./app/**/*.css', '!./app/bower_components/**']) | |
28 | + .pipe(minifyCSS(opts)) | |
29 | + .pipe(gulp.dest('./dist/')) | |
30 | +}); | |
31 | +gulp.task('minify-js', function() { | |
32 | + gulp.src(['./app/**/*.js', '!./app/bower_components/**']) | |
33 | + /*.pipe(uglify({ | |
34 | + // inSourceMap: | |
35 | + // outSourceMap: "app.js.map" | |
36 | + }))*/ | |
37 | + .pipe(gulp.dest('./dist/')) | |
38 | +}); | |
39 | +gulp.task('copy-images', function () { | |
40 | + gulp.src('./app/img/**') | |
41 | + .pipe(gulp.dest('dist/img')); | |
42 | +}); | |
43 | +gulp.task('copy-fonts', function () { | |
44 | + gulp.src('./app/font/**') | |
45 | + .pipe(gulp.dest('dist/font')); | |
46 | +}); | |
47 | +gulp.task('copy-bower-components', function () { | |
48 | + gulp.src('./app/bower_components/**') | |
49 | + .pipe(gulp.dest('dist/bower_components')); | |
50 | +}); | |
51 | +gulp.task('copy-html-files', function () { | |
52 | + gulp.src('./app/**/*.html') | |
53 | + .pipe(gulp.dest('dist/')); | |
54 | +}); | |
8 | 55 | gulp.task('connect', function () { |
9 | 56 | connect.server({ |
10 | 57 | root: 'app/', |
11 | 58 | port: 8888 |
12 | 59 | }); |
13 | 60 | }); |
61 | +gulp.task('connectDist', function () { | |
62 | + connect.server({ | |
63 | + root: 'dist/', | |
64 | + port: 9999 | |
65 | + }); | |
66 | +}); | |
67 | + | |
68 | + | |
69 | +// default task | |
70 | +gulp.task('default', | |
71 | + ['lint', 'connect'] | |
72 | +); | |
73 | +gulp.task('build', function() { | |
74 | + runSequence( | |
75 | + ['clean'], | |
76 | + ['lint', 'minify-css', 'minify-js', 'copy-html-files', 'copy-bower-components', 'copy-fonts', 'copy-images', 'connectDist'] | |
77 | + ); | |
78 | +}); | ... | ... |
package.json
... | ... | @@ -14,7 +14,11 @@ |
14 | 14 | "gulp-clean": "^0.3.2", |
15 | 15 | "gulp-connect": "^5.0.0", |
16 | 16 | "gulp-jshint": "^2.0.4", |
17 | + "gulp-load-plugins": "^1.5.0", | |
17 | 18 | "gulp-minify-css": "^1.2.4", |
18 | - "gulp-uglify": "^2.0.1" | |
19 | + "gulp-uglify": "^2.0.1", | |
20 | + "jshint": "^2.9.4", | |
21 | + "karma": "^1.7.0", | |
22 | + "run-sequence": "^1.2.2" | |
19 | 23 | } |
20 | 24 | } | ... | ... |