Fixed account updating and display name for org

This commit is contained in:
piratefinn 2017-09-04 17:26:01 +01:00
parent 7bdcc5fb7e
commit 098b93f837
4 changed files with 37 additions and 3 deletions

View file

@ -73,6 +73,37 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card-block">
<div class="form-group row">
<label class="col-md-3 form-control-label" for="text-input"><strong>Industry Sector</strong></label>
<div class="col-md-9">
<select required class="form-control" type="text" formControlName="sector">
<option value=''>Select Organisation Sector</option>
<option value='A'>Agriculture, Forestry & Fishing</option>
<option value='B'>Mining & Quarrying</option>
<option value='C'>Manufacturing</option>
<option value='D'>Electricity, Gas, Steam & Air Conditioning</option>
<option value='E'>Water & Waste Management</option>
<option value='F'>Construction</option>
<option value='G'>Wholesale & Retail Trade</option>
<option value='H'>Transportation & Storage</option>
<option value='I'>Accomodation & Food Services</option>
<option value='J'>Information & Communication</option>
<option value='K'>Financial & Insurance Activities</option>
<option value='L'>Real Estate</option>
<option value='M'>Professional, Scientfic & Technical</option>
<option value='N'>Administrative & Support Services</option>
<option value='O'>Public Administration, Defence & Social Security</option>
<option value='P'>Education</option>
<option value='Q'>Human Health & Social Work</option>
<option value='R'>Arts, Entertainment & Recreation</option>
<option value='S'>Other Service Activities</option>
<option value='T'>Household Domestic Business</option>
</select>
<span class="help-block">Alter this if your business sector has changed.</span>
</div>
</div>
</div>
<div class="card-block"> <div class="card-block">
<div class="form-group row"> <div class="form-group row">
<label class="col-md-3 form-control-label" for="text-input"><strong>City/Town Location</strong></label> <label class="col-md-3 form-control-label" for="text-input"><strong>City/Town Location</strong></label>

View file

@ -31,6 +31,7 @@ export class AccountEditComponent implements OnInit {
name : ['', [Validators.required]], name : ['', [Validators.required]],
street_name : ['', [Validators.required]], street_name : ['', [Validators.required]],
town : ['', [Validators.required]], town : ['', [Validators.required]],
sector : ['', [Validators.required]],
}); });
this.settingCustomerForm = this.formBuilder.group({ this.settingCustomerForm = this.formBuilder.group({
full_name : ['', [Validators.required]], full_name : ['', [Validators.required]],
@ -53,12 +54,13 @@ export class AccountEditComponent implements OnInit {
name: result.name, name: result.name,
street_name: result.street_name, street_name: result.street_name,
town: result.town, town: result.town,
sector: result.sector,
}); });
this.settingCustomerForm.patchValue({ this.settingCustomerForm.patchValue({
full_name: result.full_name, full_name: result.full_name,
display_name: result.display_name, display_name: result.display_name,
}); });
this.api.setUserInfo( result.email, result.display_name ); this.api.setUserInfo( result.email, result.display_name || result.name );
}, },
error => { error => {
console.log( error._body ); console.log( error._body );
@ -95,6 +97,7 @@ export class AccountEditComponent implements OnInit {
name: settingOrganisationForm.name, name: settingOrganisationForm.name,
street_name: settingOrganisationForm.street_name, street_name: settingOrganisationForm.street_name,
town: settingOrganisationForm.town, town: settingOrganisationForm.town,
sector: settingOrganisationForm.sector,
}; };
// data.append('form', JSON.stringify(submitData)); // data.append('form', JSON.stringify(submitData));

View file

@ -41,7 +41,7 @@ export class FeedbackComponent {
this.feedbackForm.patchValue({ this.feedbackForm.patchValue({
email: result.email, email: result.email,
}); });
this.api.setUserInfo( result.email, result.display_name ); this.api.setUserInfo( result.email, result.display_name || result.name );
}, },
error => { error => {
console.log( error._body ); console.log( error._body );

View file

@ -64,7 +64,7 @@ export class ApiService {
this.setSessionKey(result.session_key); this.setSessionKey(result.session_key);
this.setUserInfo( this.setUserInfo(
result.email, result.email,
result.display_name result.display_name || result.name
); );
this.setUserType(result.user_type) this.setUserType(result.user_type)
} }