Commit ad210ef1 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174224 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ec58f044
......@@ -14,7 +14,7 @@
<span class="name-span">{{address?.firstName}} {{address?.lastName}}</span>
</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>
</div>
<div>
......
......@@ -5,7 +5,6 @@ import { AppState } from '../ecm-store/reducers';
import { Store } from '@ngrx/store';
import { ProfileActions} from '../ecm-store/actions';
import { Observable } from 'rxjs/Observable';
import { UserAddressService } from './ecm-user-address.service';
import { AdressAction} from '../ecm-store/actions';
@Component({
......@@ -16,12 +15,6 @@ import { AdressAction} from '../ecm-store/actions';
export class UserAddressComponent implements OnInit {
@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;
newAddress: Address = new Address();
......@@ -41,6 +34,9 @@ export class UserAddressComponent implements OnInit {
if( address.isDefault == 'Y' ){
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)
this.store.dispatch(this.addressActions.updateAddress(address));
}
......@@ -55,11 +51,18 @@ export class UserAddressComponent implements OnInit {
if( address.isDefault == 'Y' ){
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 );
console.log('On Save Click From Add New ', address);
this.store.dispatch(this.addressActions.addNewAdddress(address));
}
deleteUserAddress(address: Address){
this.store.dispatch(this.addressActions.deleteAddressSuccess(address));
}
onDiscard(editorId: string)
{
console.log('On Discard Click ', editorId);
......@@ -80,16 +83,22 @@ export class UserAddressComponent implements OnInit {
}
getMaxLineNo() : number {
let lineNo = this.addressList.length + 1;
//TODO : when Delete gets functional
return lineNo;
let maxLineNo = 0;
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){
let _address :Address;
for( _address of this.addressList){
if( _address.lineNo == address.lineNo )
{
_address.isDefault = 'Y';
......
<div class="user-profile-info">
<span class="profile-info">Profile Info</span>
</div>
<profile-screen [editMode] = "editMode" [profileData]='profileData'></profile-screen>
<div class="user-profile-info">
<span class="profile-info">Profile Info</span>
</div>
<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();" >
<i class="material-icons edit-icon-change">edit</i> Edit
</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(); " >
Cancel
</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
</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 { IScreenEditor } from '../screen-editor';
import { ProfileScreenComponent } from './profile-screen/profile-screen.component';
@Component({
selector: 'profile-manager',
......@@ -17,6 +18,9 @@ export class ProfileEditor implements OnInit {
@Input() editMode : string = 'V';
@Input() profileData : Profile;
@ViewChild('editScreen') editScreen: ProfileScreenComponent;
public editForm;
oldProfile : Profile ;
constructor() { }
......@@ -24,6 +28,11 @@ export class ProfileEditor implements OnInit {
ngOnInit() {
}
ngAfterViewChecked(): void {
if( this.editMode == 'E' ) {
this.editForm = this.editScreen.userProfieForm;
}
}
edit() {
this.oldProfile = this.simpleClone( this.profileData );
......
......@@ -32,28 +32,29 @@
<ng-template #interactiveTemplate>
<div class="row totalProfile">
<form #userProfile="ngForm">
<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 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 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 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 class="small-6 medium-6 large-4 columns">
<md-input-container>
<input mdInput [(ngModel)]="profileData.birthDate"
<input mdInput [(ngModel)]="profileData.birthDate" name= "birthDate"
[placeholder]="'Date of Birth'"
(click)="birthDatePicker.open();" />
<input type="hidden" [(ngModel)]="birthDate"
<input type="hidden" [(ngModel)]="birthDate" name= "hiddenDob"
[mdDatepicker]="birthDatePicker" />
<md-datepicker #birthDatePicker></md-datepicker>
</md-input-container>
......@@ -61,11 +62,12 @@
<div class="small-12 medium-12 large-4 columns">
<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="female-user" value="F" >Female</md-radio-button>
</md-radio-group>
</div>
</form>
</div>
</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 { Profile } from '../profile.model';
import { FormControl } from '@angular/forms';
import { NgForm, NgModel, FormBuilder, FormGroup, NgModelGroup, Validators } from '@angular/forms';
@Component({
selector: 'profile-screen',
......@@ -12,6 +14,7 @@ export class ProfileScreenComponent implements OnInit, DoCheck, OnChanges {
@Input() editMode : string = 'V';
@Input() profileData : Profile;
@ViewChild('userProfile') userProfieForm: NgForm;
birthDate: string;
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