forked from CharlottesWebpack/job-tracker
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Profile](CLIENT/SERVER): refactor profile page and functions {IA}
- Loading branch information
Showing
9 changed files
with
133 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
<div class="container" ng-model="data"> | ||
<div class="model" id="password_model"> | ||
<div class="model-header"> | ||
<h3>Change Password <span class="extra-title muted"></span></h3> | ||
</div> | ||
<div ng-show="passwordError" class="alert alert-danger col-sm-12"> | ||
{{passwordError}} | ||
</div> | ||
|
||
<div class="control-group"> | ||
<label for="new_password" class="control-label">New Password</label> | ||
<div class="controls"> | ||
<input type="password" name="new_password" ng-minlength="6" ng-model="data.password"> | ||
</div> | ||
</div> | ||
<div class="control-group"> | ||
<label for="confirm_password" class="control-label">Confirm Password</label> | ||
<div class="controls"> | ||
<input type="password" name="confirm_password" ng-minlength="6" ng-model="data.confirmpassword"> | ||
</div> | ||
<br> | ||
</div> | ||
<!-- --> | ||
<!-- TO BE REDONE --> | ||
<div class="container" ng-model="data"> | ||
<div class="model" id="password_model"> | ||
<div class="model-header"> | ||
<h3>Change Password <span class="extra-title muted"></span></h3> | ||
</div> | ||
<div ng-show="passwordError" class="alert alert-danger col-sm-12"> | ||
{{passwordError}} | ||
</div> | ||
<div class="control-group"> | ||
<label for="new_password" class="control-label">New Password</label> | ||
<div class="controls"> | ||
<input type="password" name="new_password" ng-minlength="6" ng-model="data.password"> | ||
</div> | ||
<div class="model-footer"> | ||
<button href="#" class="btn btn-default" data-dismiss="model" aria-hidden="true" ng-click='cancel()'>cancel</button> | ||
<button href="#" class="btn btn-primary" id="password_model_save" ng-click='click()'>Save changes</button> | ||
</div> | ||
<div class="control-group"> | ||
<label for="confirm_password" class="control-label">Confirm Password</label> | ||
<div class="controls"> | ||
<input type="password" name="confirm_password" ng-minlength="6" ng-model="data.confirmpassword"> | ||
</div> | ||
<br> | ||
</div> | ||
</div> | ||
<div class="model-footer"> | ||
<button href="#" class="btn btn-default" data-dismiss="model" aria-hidden="true" ng-click='cancel()'>cancel</button> | ||
<button href="#" class="btn btn-primary" id="password_model_save" ng-click='click()'>Save changes</button> | ||
</div> | ||
</div> | ||
</div> |
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,70 @@ | ||
<div class="container"> | ||
<h1>Profile</h1> | ||
<hr> | ||
<div class="row"> | ||
<div class="col-md-3"> | ||
<div class="text-center"> | ||
<br> | ||
<br> | ||
<br> | ||
<br> | ||
<button type="button" class="btn btn-default" ng-click="editProfile()">Edit Profile</button> | ||
<br> | ||
<br> | ||
<button type="button" class="btn btn-default" ng-click="changePassword()">Change Password</button> | ||
<br> | ||
<br> | ||
<button type="button" class="btn btn-default" ng-click="deleteProfile()">Delete Account</button> | ||
<br> | ||
<br> | ||
<nav-bar></nav-bar> | ||
<div class="container-fluid"> | ||
<div class="row col-sm-12"> | ||
<!-- --> | ||
<!-- Change Password --> | ||
<!-- --> | ||
<!-- <div class="col-sm-5 col-sm-offset-2"> --> | ||
<!-- <change-password ng-show="showChangePassword"></change-password> --> | ||
<!-- </div> --> | ||
<!-- Show/Edit Profile --> | ||
<div > | ||
<br/> | ||
<br/> | ||
<form editable-form name="editProfileForm" type="form" onaftersave="updateProfile()"> | ||
<div class="col-sm-5 col-sm-offset-2" ng-hide="showChangePassword"> | ||
<div class="form-group col-lg-10"> | ||
<label class="control-label">Username:</label> | ||
<span editable-text="user.username">{{ user.username || "--" }}</span> | ||
</div> | ||
</div> | ||
<div class="col-md-9 personal-info"> | ||
<div class="alert alert-info alert-dismissable"> | ||
<a class="panel-close close" data-dismiss="alert">×</a> | ||
<i class="fa fa-coffee"></i> | ||
<div class="form-group col-lg-10"> | ||
<label class="control-label">First name</label> | ||
<span editable-text="user.firstname">{{ user.firstname || '--' }}</span> | ||
</div> | ||
<h3>Personal info</h3> | ||
<table class='table'> | ||
<tbody> | ||
<tr> | ||
<td> | ||
<div>First Name</din> | ||
</td> | ||
<td> | ||
<div>{{userDetails.firstname}}</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div>Last Name</din> | ||
</td> | ||
<td> | ||
<div>{{userDetails.lastname}}</din> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div>Email_Id</din> | ||
</td> | ||
<td> | ||
<div>{{userDetails.emailid}}</din> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div>Date Of Birth</din> | ||
</td> | ||
<td> | ||
<div>{{userDetails.dob}}</din> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<div>Job Status</din> | ||
</td> | ||
<td> | ||
<div>{{userDetails.jobstatus}}</din> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<hr> | ||
<div class="form-group col-lg-10"> | ||
<label class="control-label">Username:</label> | ||
<span editable-text="user.lastname">{{ user.lastname || '--' }}</span> | ||
</div> | ||
<div class="form-group col-lg-10"> | ||
<label class="control-label">Email:</label> | ||
<span editable-text="user.email">{{ user.email || '--' }}</span> | ||
</div> | ||
<div class="form-group col-lg-10"> | ||
<label class="control-label">Phone number:</label> | ||
<span editable-text="user.phone">{{ user.phone || '--' }}</span> | ||
</div> | ||
<div class="form-group col-lg-10"> | ||
<label class="control-label">Job Status:</label> | ||
<span editable-select="user.jobStatus" e-ng-options="s.value as s.text for s in jobStatuses">{{ showJobStatus() || "--" }}</span> | ||
</div> | ||
<br/> | ||
</div> <!-- col-sm-5 col-sm-offset-2"--> | ||
|
||
<div class="col-sm-3 col-sm-offset-1"> | ||
<br/> | ||
<br/> | ||
<button type="button" class="btn btn-default col-md-8" ng-click="editProfileForm.$show()" ng-show="!editProfileForm.$visible"> | ||
Edit Profile | ||
</button> | ||
<span ng-show="editProfileForm.$visible"> | ||
<button type="submit" class="btn btn-primary" ng-disabled="editProfileForm.$waiting"> | ||
Save | ||
</button> | ||
<button type="button" class="btn btn-default" ng-disabled="editProfileForm.$waiting" ng-click="editProfileForm.$cancel()"> | ||
Cancel | ||
</button> | ||
</span> | ||
<br/> | ||
<br/> | ||
<button class="btn btn-default col-md-8" ng-click="showChangePassword = !showChangePassword">Change Password</button> | ||
<br/> | ||
<br/> | ||
<button class="btn btn-default col-md-8" ng-click="deleteProfile()">Delete Account</button> | ||
<br/> | ||
<br/> | ||
</div> <!-- col-sm-3 col-sm-offset-1 --> | ||
</form> | ||
</div> | ||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,35 @@ | ||
angular.module('jobTracker.profile', []) | ||
.controller('profileController', function($scope, AuthFactory, $location, $rootScope) { | ||
$scope.userDetails = $rootScope.userDetails | ||
$scope.editProfile = function() { | ||
$location.path('/editProfile'); | ||
} | ||
.controller('profileController', function($scope, AuthFactory, $location, $filter) { | ||
$scope.navButton = "Sign Out"; | ||
$scope.getUser = function (){ | ||
AuthFactory.getProfile() | ||
.then((res) => { | ||
$scope.user = res; | ||
}); | ||
} | ||
|
||
$scope.changePassword = function() { | ||
$location.path('/changePassword'); | ||
} | ||
$scope.jobStatuses = [ | ||
{value: 1, text: "Actively looking for a job"}, | ||
{value: 2, text: "Found a job"}, | ||
{value: 3, text: "Not actively looking for a job"} | ||
]; | ||
$scope.showJobStatus = function() { | ||
var selected = $filter('filter')($scope.jobStatuses, {value: $scope.user.jobStatus}); | ||
return selected[0].text; | ||
}; | ||
$scope.updateProfile = function() { | ||
console.log("update profile called"); | ||
AuthFactory.updateAccount($scope.user); | ||
}; | ||
|
||
$scope.deleteProfile = function() { | ||
AuthFactory.deleteProfile($scope.userDetails) | ||
} | ||
|
||
|
||
|
||
}); | ||
$scope.deleteProfile = function() { | ||
AuthFactory.deleteAccount() | ||
.then(() => { | ||
$location.path('/'); | ||
}) | ||
}; | ||
$scope.logout = function() { | ||
AuthFactory.logout(); | ||
}; | ||
$scope.getUser(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
angular.module('jobTracker.profileDir', []) | ||
.directive('changePassword', function(){ | ||
return { | ||
transclude: true, | ||
restrict: 'E', | ||
templateUrl: 'app/profile/changePassword.html' | ||
} | ||
}) |