Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature existing client view #96

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions client/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ angular.module('client-recon', [
'ui.router',
'client-recon.dashboard',
'client-recon.appState',
'client-recon.services'
'client-recon.services',
'client-recon.client-profile',
'client-recon.client-profile.bio',
'client-recon.new-client',
//'client-recon.client-feed',

])
.config(function ($stateProvider, $httpProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
Expand All @@ -15,9 +20,32 @@ angular.module('client-recon', [
controllerAs: 'dashboard',
controller: 'DashboardController'
})
.state('/client-profile', {
templateUrl: 'app/client-profile/client-profile.html',
controllerAs: 'client-profile',
controller: 'clientProfileController'
.state('client-profile', {
url: '/client-profile',
templateUrl: 'app/client-profile/client-profile.html',
controllerAs: 'clientProfile',
controller: 'ClientProfileController'
})
.state('client-profile.bio',{
parent:'client-profile',
views:{
'bio':{
templateUrl: 'app/client-profile/bio/bio.html',
controllerAs: 'bio',
controller: 'BioController'
}//,
// 'feed':{
// templateUrl: 'app/client-profile/bio/bio.html',
// controllerAs: 'bio',
// controller: 'BioController'
// }
}
})
.state('new-client', {
url: '/new-client',
templateUrl: 'app/new-client/new-client.html',
controllerAs: 'newClientCtrl',
controller: 'NewClientController'
});

});
10 changes: 10 additions & 0 deletions client/app/client-profile/bio/bio.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="bio-container">
<h3 class="bio-name"> {{ bio.data.currentClient.client_name }} </h3>
<ul>
<li class="bio-list-item"> Location {{bio.data.currentClient.zipcode}} </li>
<li class="bio-list-item"> Birthday: {{bio.data.currentClient.birthday}} </li>
<li class="bio-list-item"> Company: {{bio.data.currentClient.company}}
<!--Add list items here as more things populate -->
</ul>
<a ui-sref="new-client">Edit</a>
</div>
5 changes: 5 additions & 0 deletions client/app/client-profile/bio/bioController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
angular.module('client-recon.client-profile.bio', [])
.controller('BioController', function ($scope, AppState, $state) {
var bio = this;
bio.data = AppState.state;
});
2 changes: 2 additions & 0 deletions client/app/client-profile/client-profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div ui-view="bio"></div>
<div ui-view ="feed"></div>
3 changes: 3 additions & 0 deletions client/app/client-profile/clientProfileController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
angular.module('client-recon.client-profile', [])
.controller('ClientProfileController', function ($scope, ClientsApi, AppState, $state) {
});
4 changes: 1 addition & 3 deletions client/app/dashboard/dashboardController.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ angular.module('client-recon.dashboard', [])
dashboard.currentClient = dashboard.data.clients[index];
AppState.state.currentClient = dashboard.currentClient;
console.log(AppState.state.currentClient);

//uncomment the below when client-profile view created.
//$state.go('client-profile');
$state.go('client-profile.bio');
}

initializeClients();
Expand Down
4 changes: 2 additions & 2 deletions client/app/new-client/newClientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ angular.module('client-recon.new-client', [])
var newClient = this.data;

this.postClient = function () {

ClientsApi.addOne( ***** User ID *******,newClient).then(function(res){
//DETECT USER ID FROM APP STATE
ClientsApi.addOne( 1,newClient).then(function(res){
// CALLED AFTER SUCCESSFUL POST
successfulPost = true;
newClient.name = '';
Expand Down
5 changes: 4 additions & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
<!-- vendor libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.js"></script>

<!-- <script src="bower_components/angular/angular.js"></script> -->
<!-- <script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script> -->

<!-- application modules -->
<script src="app/dashboard/dashboardController.js"></script>
<script src="app/client-profile/clientProfileController.js"></script>
<script src="app/client-profile/bio/bioController.js"></script>
<script src="app/new-client/newClientController.js"></script>
<!-- application services -->
<script src="app/services/appState.js"></script>
<script src="app/services/clientApi.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion server/controllers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
module.exports = {
dashboard: require('./dashboard-controller'),
user: require('./user-controller'),
client: require('/client-controller')
client: require('./client-controller')
}