From c555af3123373967abbbeb4f4f5ed2abd63966fc Mon Sep 17 00:00:00 2001 From: Rishav Date: Tue, 23 May 2017 21:47:33 +0530 Subject: [PATCH] price email, company status and contact view page implementation and gulp file implementation --- app/partials/ContactView/ContactView.controller.js | 17 ++++- app/partials/ContactView/ContactView.html | 34 +++++++--- app/partials/viewCompany/viewCompany.controller.js | 10 ++- app/partials/viewCompany/viewCompany.html | 2 +- app/partials/viewcontact/viewcontact.controller.js | 30 +++++++++ app/partials/viewcontact/viewcontact.html | 5 +- app/partials/viewcontact/viewcontact.service.js | 16 +++++ gulpfile.js | 73 ++++++++++++++++++++-- package.json | 6 +- 9 files changed, 172 insertions(+), 21 deletions(-) diff --git a/app/partials/ContactView/ContactView.controller.js b/app/partials/ContactView/ContactView.controller.js index 0b37c27..e4ccf47 100644 --- a/app/partials/ContactView/ContactView.controller.js +++ b/app/partials/ContactView/ContactView.controller.js @@ -5,7 +5,7 @@ .controller('ContactViewController', ['$scope', '$uibModal', 'ContactViewService', 'ViewCompanyService', function($scope, $uibModal, ContactViewService, ViewCompanyService) { $(function() { - $('#toggle-one12').bootstrapToggle(); + $('#toggle-one120').bootstrapToggle(); $('#toggle-two21').bootstrapToggle(); }) @@ -16,6 +16,21 @@ ContactViewService.getContacts().then(function(result) { console.log('==========',result); $scope.contactList = result; + for(var i=0; i<$scope.contactList.length; i++){ + console.log("adadas") + $scope.contactList[i].value = "" + console.log($scope.contactList[i].priceEmail) + if($scope.contactList[i].priceEmail == 'true'){ + console.log(aaya) + $scope.contactList[i].value = 'on'; + }else{ + console.log("nai") + $scope.contactList[i].value = 'off' + } + + $('#toggle-one12'+ [i]).bootstrapToggle($scope.contactList[i].value) + } + console.log($scope.contactList) }) diff --git a/app/partials/ContactView/ContactView.html b/app/partials/ContactView/ContactView.html index 07a0c91..e87cbc8 100644 --- a/app/partials/ContactView/ContactView.html +++ b/app/partials/ContactView/ContactView.html @@ -38,32 +38,41 @@ - + - + - + - + + + + + + + + + + - + - + - + @@ -75,8 +84,15 @@ {{contact.workPhone}} {{contact.mobilePhone}} {{contact.title}} - {{contact.username}} - {{contact.priceEmail}} + +
+
+ +
+
+ + {{contact.userName}} + {{contact.password}} diff --git a/app/partials/viewCompany/viewCompany.controller.js b/app/partials/viewCompany/viewCompany.controller.js index f07a284..1cf32d6 100644 --- a/app/partials/viewCompany/viewCompany.controller.js +++ b/app/partials/viewCompany/viewCompany.controller.js @@ -57,7 +57,7 @@ $('#company-one2').bootstrapToggle(value) }) - $(function() { + $scope.changeStatus = function(){ $('#company-one2').bootstrapToggle(); $('#company-one2').change(function() { $('#console-event').html('Toggle: ' + $(this).prop('checked')); @@ -65,10 +65,14 @@ console.log($scope.companyData.activate) var statusData = "status=" + $scope.companyData.activate; ViewCompanyService.changeStatus(companyId, statusData).then(function(result) { - + if(result.success){ + toastr.success(''+result.success+'', { + closeButton: true + }) + } }) }) - }) + } getContactList(); diff --git a/app/partials/viewCompany/viewCompany.html b/app/partials/viewCompany/viewCompany.html index 844d35e..3953b6d 100644 --- a/app/partials/viewCompany/viewCompany.html +++ b/app/partials/viewCompany/viewCompany.html @@ -137,7 +137,7 @@

Company Details

-
+
diff --git a/app/partials/viewcontact/viewcontact.controller.js b/app/partials/viewcontact/viewcontact.controller.js index e9fbffb..77ec34b 100644 --- a/app/partials/viewcontact/viewcontact.controller.js +++ b/app/partials/viewcontact/viewcontact.controller.js @@ -11,8 +11,10 @@ var contactId = $stateParams.id; $scope.contactDetail = {}; + var value = ""; ViewcontactService.getContact(contactId).then(function(result) { $scope.contactDetail = result; + checkValue($scope.contactDetail.priceEmail); }) $scope.contactIdList = {}; @@ -31,6 +33,7 @@ selectedId = $scope.contactIdList[index]; ViewcontactService.getContact(selectedId).then(function(result) { $scope.contactDetail = result; + checkValue($scope.contactDetail.priceEmail); }) } @@ -39,9 +42,36 @@ selectedId = $scope.contactIdList[index]; ViewcontactService.getContact(selectedId).then(function(result) { $scope.contactDetail = result; + checkValue($scope.contactDetail.priceEmail); }) } + function checkValue(priceEmail){ + if(priceEmail == true){ + value = 'on'; + }else{ + console.log("nai") + value = 'off' + } + $('#toggle-five').bootstrapToggle(value) + } + + $scope.changePriceEmail = function(){ + $('#toggle-five').bootstrapToggle(); + $('#toggle-five').change(function() { + $scope.activate = $(this).prop('checked'); + console.log($scope.activate) + var statusData = "status=" + $scope.activate; + ViewcontactService.changePriceEmail(contactId, statusData).then(function(result) { + if(result.success){ + toastr.success(''+result.success+'', { + closeButton: true + }) + } + }) + }) + } + setInterval(function(){ var checkMaxLength = $scope.contactIdList.length - one; if (index === checkMaxLength) { diff --git a/app/partials/viewcontact/viewcontact.html b/app/partials/viewcontact/viewcontact.html index 4e9378a..842d6b9 100644 --- a/app/partials/viewcontact/viewcontact.html +++ b/app/partials/viewcontact/viewcontact.html @@ -25,8 +25,9 @@

Contact Detail

-
-
+
+
+
diff --git a/app/partials/viewcontact/viewcontact.service.js b/app/partials/viewcontact/viewcontact.service.js index 5998772..b34fbd5 100644 --- a/app/partials/viewcontact/viewcontact.service.js +++ b/app/partials/viewcontact/viewcontact.service.js @@ -52,6 +52,22 @@ }) return deferred.promise; } + + this.changePriceEmail = function(contactId, data) { + var deferred = $q.defer(); + $http({ + method : 'PUT', + url : BASE_URL.url +'/company/contact/status/'+ contactId, + data : data, + headers : {'Content-Type': 'application/json'}, + }) + .then(function (result){ + deferred.resolve(result.data); + },function (result){ + deferred.resolve(result.data); + }) + return deferred.promise; + } } diff --git a/gulpfile.js b/gulpfile.js index 450ba86..757c6c0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,13 +1,78 @@ -// gulp -var gulp = require('gulp'); +/* jshint node:true */ +'use strict'; -// plugins +var gulp = require('gulp'); +var karma = require('karma').server; +var argv = require('yargs').argv; +var $ = require('gulp-load-plugins')(); var connect = require('gulp-connect'); +var jshint = require('gulp-jshint'); +var uglify = require('gulp-uglify'); +var minifyCSS = require('gulp-minify-css'); +var clean = require('gulp-clean'); +var runSequence = require('run-sequence'); - +gulp.task('lint', function() { + gulp.src(['./app/**/*.js', '!./app/bower_components/**']) + //.pipe(jshint()) + .pipe(jshint.reporter('default')) + //.pipe(jshint.reporter('fail')); +}); +gulp.task('clean', function() { + gulp.src('./dist/*') + .pipe(clean({force: true})); +}); +gulp.task('minify-css', function() { + var opts = {comments:true,spare:true,processImport: false}; + gulp.src(['./app/**/*.css', '!./app/bower_components/**']) + .pipe(minifyCSS(opts)) + .pipe(gulp.dest('./dist/')) +}); +gulp.task('minify-js', function() { + gulp.src(['./app/**/*.js', '!./app/bower_components/**']) + /*.pipe(uglify({ + // inSourceMap: + // outSourceMap: "app.js.map" + }))*/ + .pipe(gulp.dest('./dist/')) +}); +gulp.task('copy-images', function () { + gulp.src('./app/img/**') + .pipe(gulp.dest('dist/img')); +}); +gulp.task('copy-fonts', function () { + gulp.src('./app/font/**') + .pipe(gulp.dest('dist/font')); +}); +gulp.task('copy-bower-components', function () { + gulp.src('./app/bower_components/**') + .pipe(gulp.dest('dist/bower_components')); +}); +gulp.task('copy-html-files', function () { + gulp.src('./app/**/*.html') + .pipe(gulp.dest('dist/')); +}); gulp.task('connect', function () { connect.server({ root: 'app/', port: 8888 }); }); +gulp.task('connectDist', function () { + connect.server({ + root: 'dist/', + port: 9999 + }); +}); + + +// default task +gulp.task('default', + ['lint', 'connect'] +); +gulp.task('build', function() { + runSequence( + ['clean'], + ['lint', 'minify-css', 'minify-js', 'copy-html-files', 'copy-bower-components', 'copy-fonts', 'copy-images', 'connectDist'] + ); +}); diff --git a/package.json b/package.json index 163f125..a3b6750 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,11 @@ "gulp-clean": "^0.3.2", "gulp-connect": "^5.0.0", "gulp-jshint": "^2.0.4", + "gulp-load-plugins": "^1.5.0", "gulp-minify-css": "^1.2.4", - "gulp-uglify": "^2.0.1" + "gulp-uglify": "^2.0.1", + "jshint": "^2.9.4", + "karma": "^1.7.0", + "run-sequence": "^1.2.2" } } -- 2.0.0