Commit a270464a authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174486 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 14e1725b
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<span class="name-span">{{address?.firstName}} {{address?.lastName}}</span> <span class="name-span">{{address?.firstName}} {{address?.lastName}}</span>
</div> </div>
<div> <div>
<span class="address-span">{{address?.addr1}}, {{address?.addr2}}, {{address?.addr3}}, {{address?.city}}, </span> <span class="address-span">{{address?.addr1}} {{ getSeparator(address?.addr1) }} {{address?.addr2}} {{ getSeparator(address?.addr2) }} {{address?.addr3}} {{ getSeparator(address?.addr3) }} {{address?.city}} {{ getSeparator(address?.city) }} </span>
<span class="address-span">{{address?.stateDescr}} - {{address?.pinCode}} - {{address?.countDescr}}. </span> <span class="address-span">{{address?.stateDescr}} - {{address?.pinCode}} - {{address?.countDescr}}. </span>
</div> </div>
<div> <div>
......
...@@ -5,7 +5,6 @@ import { AppState } from '../ecm-store/reducers'; ...@@ -5,7 +5,6 @@ import { AppState } from '../ecm-store/reducers';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { ProfileActions} from '../ecm-store/actions'; import { ProfileActions} from '../ecm-store/actions';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { UserAddressService } from './ecm-user-address.service';
import { AdressAction} from '../ecm-store/actions'; import { AdressAction} from '../ecm-store/actions';
@Component({ @Component({
...@@ -16,12 +15,6 @@ import { AdressAction} from '../ecm-store/actions'; ...@@ -16,12 +15,6 @@ import { AdressAction} from '../ecm-store/actions';
export class UserAddressComponent implements OnInit { export class UserAddressComponent implements OnInit {
@ViewChildren(AddressEditor) addressEditors: QueryList<AddressEditor> @ViewChildren(AddressEditor) addressEditors: QueryList<AddressEditor>
// addressList: Address[]= [
// new Address('Priyanka', 'Borate', 'Priyanka@gmail.com', 'Nilkanth Kingdom', 'Vidyavihar', 'Near Vidyavihar Bus Stop', 'Mumbai', '400090', 'Maharashtra', '9876543210', 'R', 'D','India'),
// new Address('Chitranga', 'Tandel', 'Chitra@gmail.com', 'Nilkanth Kingdom', 'Vidyavihar', 'Near Vidyavihar Bus Stop', 'Mumbai', '400090', 'Maharashtra', '9876543210', 'R', 'D','India')
// ];
addressList : any; addressList : any;
newAddress: Address = new Address(); newAddress: Address = new Address();
...@@ -41,6 +34,9 @@ export class UserAddressComponent implements OnInit { ...@@ -41,6 +34,9 @@ export class UserAddressComponent implements OnInit {
if( address.isDefault == 'Y' ){ if( address.isDefault == 'Y' ){
this.updateDefaultStatus(address); this.updateDefaultStatus(address);
} }
address.userName = address.firstName + " " + address.lastName;
console.log('On Save Click the userAddress name is ', this.addressList, address);
//Call POST service (address) //Call POST service (address)
this.store.dispatch(this.addressActions.updateAddress(address)); this.store.dispatch(this.addressActions.updateAddress(address));
} }
...@@ -55,11 +51,18 @@ export class UserAddressComponent implements OnInit { ...@@ -55,11 +51,18 @@ export class UserAddressComponent implements OnInit {
if( address.isDefault == 'Y' ){ if( address.isDefault == 'Y' ){
this.updateDefaultStatus(address); this.updateDefaultStatus(address);
} }
address.userName = address.firstName + " " + address.lastName;
console.log('On Add new Click the userAddress name is ', address.userName);
this.addressList.push( address ); this.addressList.push( address );
console.log('On Save Click From Add New ', address); console.log('On Save Click From Add New ', address);
this.store.dispatch(this.addressActions.addNewAdddress(address)); this.store.dispatch(this.addressActions.addNewAdddress(address));
} }
deleteUserAddress(address: Address){
this.store.dispatch(this.addressActions.deleteAddressSuccess(address));
}
onDiscard(editorId: string) onDiscard(editorId: string)
{ {
console.log('On Discard Click ', editorId); console.log('On Discard Click ', editorId);
...@@ -80,16 +83,22 @@ export class UserAddressComponent implements OnInit { ...@@ -80,16 +83,22 @@ export class UserAddressComponent implements OnInit {
} }
getMaxLineNo() : number { getMaxLineNo() : number {
let lineNo = this.addressList.length + 1; let maxLineNo = 0;
//TODO : when Delete gets functional
return lineNo; for( let address of this.addressList){
let addrLineNo : number = Number(address.lineNo);
if(addrLineNo > maxLineNo){
maxLineNo = addrLineNo;
}
}
console.log('maxLineno--',maxLineNo);
return maxLineNo + 1;
} }
updateDefaultStatus(address:Address){ updateDefaultStatus(address:Address){
let _address :Address; let _address :Address;
for( _address of this.addressList){ for( _address of this.addressList){
if( _address.lineNo == address.lineNo ) if( _address.lineNo == address.lineNo )
{ {
_address.isDefault = 'Y'; _address.isDefault = 'Y';
......
<div class="user-profile-info"> <div class="user-profile-info">
<span class="profile-info">Profile Info</span> <span class="profile-info">Profile Info</span>
</div> </div>
<profile-screen [editMode] = "editMode" [profileData]='profileData'></profile-screen> <profile-screen #editScreen [editMode] = "editMode" [profileData]='profileData'></profile-screen>
<div class="user-info-edit" *ngIf="editMode == 'V' "> <div class="user-info-edit" *ngIf="editMode == 'V' ">
<button md-button class="edit-button" (click)="edit();" > <button md-button class="edit-button" (click)="edit();" >
<i class="material-icons edit-icon-change">edit</i> Edit <i class="material-icons edit-icon-change">edit</i> Edit
</button> </button>
</div> </div>
<div class="save-cancel-button" *ngIf="editMode == 'E' "> <div class="save-cancel-button" *ngIf="editMode == 'E' ">
<button md-button class="cancel-profile-button" (click)="cancel(); " > <button md-button class="cancel-profile-button" (click)="cancel(); " >
Cancel Cancel
</button> </button>
<button md-button class="save-profile-button" (click)="save(); " > <button md-button class="save-profile-button" *ngIf="editForm" [disabled]="!editForm.valid" (click)="save(); " >
Save Save
</button> </button>
</div> </div>
import { Component, OnInit, Output, EventEmitter, ViewEncapsulation, Input, ElementRef } from '@angular/core'; import { Component, OnInit, Output, EventEmitter, ViewEncapsulation, Input, ElementRef, ViewChild } from '@angular/core';
import { Profile } from './profile.model'; import { Profile } from './profile.model';
import { IScreenEditor } from '../screen-editor'; import { IScreenEditor } from '../screen-editor';
import { ProfileScreenComponent } from './profile-screen/profile-screen.component';
@Component({ @Component({
selector: 'profile-manager', selector: 'profile-manager',
...@@ -17,6 +18,9 @@ export class ProfileEditor implements OnInit { ...@@ -17,6 +18,9 @@ export class ProfileEditor implements OnInit {
@Input() editMode : string = 'V'; @Input() editMode : string = 'V';
@Input() profileData : Profile; @Input() profileData : Profile;
@ViewChild('editScreen') editScreen: ProfileScreenComponent;
public editForm;
oldProfile : Profile ; oldProfile : Profile ;
constructor() { } constructor() { }
...@@ -24,6 +28,11 @@ export class ProfileEditor implements OnInit { ...@@ -24,6 +28,11 @@ export class ProfileEditor implements OnInit {
ngOnInit() { ngOnInit() {
} }
ngAfterViewChecked(): void {
if( this.editMode == 'E' ) {
this.editForm = this.editScreen.userProfieForm;
}
}
edit() { edit() {
this.oldProfile = this.simpleClone( this.profileData ); this.oldProfile = this.simpleClone( this.profileData );
......
...@@ -32,28 +32,29 @@ ...@@ -32,28 +32,29 @@
<ng-template #interactiveTemplate> <ng-template #interactiveTemplate>
<div class="row totalProfile"> <div class="row totalProfile">
<form #userProfile="ngForm">
<div class="small-6 medium-6 large-4 columns"> <div class="small-6 medium-6 large-4 columns">
<bb-textbox [required]="true" [placeholder]="'First Name'" [(ngModel)]="profileData.firstName"></bb-textbox> <bb-textbox [required]="true" [placeholder]="'First Name'" [(ngModel)]="profileData.firstName" name= "firstName"></bb-textbox>
</div> </div>
<div class="small-6 medium-6 large-4 columns"> <div class="small-6 medium-6 large-4 columns">
<bb-textbox [required]="true" [placeholder]="'Last Name'" [(ngModel)]="profileData.lastName"></bb-textbox> <bb-textbox [required]="true" [placeholder]="'Last Name'" [(ngModel)]="profileData.lastName" name= "lastName"></bb-textbox>
</div> </div>
<div class="small-12 medium-12 large-4 columns"> <div class="small-12 medium-12 large-4 columns">
<bb-email [placeholder]="'Email ID'" [required]="true" validator="true" [invalidMessage]="'Please enter valid email'" [requiredMessage]="'Email cannot be blank'" [(ngModel)]="profileData.emailId"></bb-email> <bb-email [placeholder]="'Email ID'" [required]="true" validator="true" [invalidMessage]="'Please enter valid email'" [requiredMessage]="'Email cannot be blank'" [(ngModel)]="profileData.emailId" name= "emailId"></bb-email>
</div> </div>
<div class="small-6 medium-6 large-4 columns"> <div class="small-6 medium-6 large-4 columns">
<bb-textbox [required]="true" [placeholder]="'Mobile Number'" [(ngModel)]="profileData.contactNo"></bb-textbox> <bb-textbox [required]="true" [placeholder]="'Mobile Number'" [(ngModel)]="profileData.contactNo" name= "contactNo"></bb-textbox>
</div> </div>
<div class="small-6 medium-6 large-4 columns"> <div class="small-6 medium-6 large-4 columns">
<md-input-container> <md-input-container>
<input mdInput [(ngModel)]="profileData.birthDate" <input mdInput [(ngModel)]="profileData.birthDate" name= "birthDate"
[placeholder]="'Date of Birth'" [placeholder]="'Date of Birth'"
(click)="birthDatePicker.open();" /> (click)="birthDatePicker.open();" />
<input type="hidden" [(ngModel)]="birthDate" <input type="hidden" [(ngModel)]="birthDate" name= "hiddenDob"
[mdDatepicker]="birthDatePicker" /> [mdDatepicker]="birthDatePicker" />
<md-datepicker #birthDatePicker></md-datepicker> <md-datepicker #birthDatePicker></md-datepicker>
</md-input-container> </md-input-container>
...@@ -61,11 +62,12 @@ ...@@ -61,11 +62,12 @@
<div class="small-12 medium-12 large-4 columns"> <div class="small-12 medium-12 large-4 columns">
<span class="user-gender">Gender</span> <span class="user-gender">Gender</span>
<md-radio-group class="gender" [(ngModel)]="profileData.gender" style="display: block;"> <md-radio-group class="gender" [(ngModel)]="profileData.gender" name= "gender" style="display: block;">
<md-radio-button class="male-user" value="M">Male</md-radio-button> <md-radio-button class="male-user" value="M">Male</md-radio-button>
<md-radio-button class="female-user" value="F" >Female</md-radio-button> <md-radio-button class="female-user" value="F" >Female</md-radio-button>
</md-radio-group> </md-radio-group>
</div> </div>
</form>
</div> </div>
</ng-template> </ng-template>
......
import { Component, OnInit, OnChanges, DoCheck, Input, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, OnChanges, DoCheck, Input, ViewEncapsulation, ViewChild } from '@angular/core';
import { DatePipe } from '@angular/common'; import { DatePipe } from '@angular/common';
import { Profile } from '../profile.model'; import { Profile } from '../profile.model';
import { FormControl } from '@angular/forms';
import { NgForm, NgModel, FormBuilder, FormGroup, NgModelGroup, Validators } from '@angular/forms';
@Component({ @Component({
selector: 'profile-screen', selector: 'profile-screen',
...@@ -12,6 +14,7 @@ export class ProfileScreenComponent implements OnInit, DoCheck, OnChanges { ...@@ -12,6 +14,7 @@ export class ProfileScreenComponent implements OnInit, DoCheck, OnChanges {
@Input() editMode : string = 'V'; @Input() editMode : string = 'V';
@Input() profileData : Profile; @Input() profileData : Profile;
@ViewChild('userProfile') userProfieForm: NgForm;
birthDate: string; birthDate: string;
constructor() { } constructor() { }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment