fixed photo is not save the correct if new person and partner also the change name
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<div class="flex items-end justify-end mt-4">
|
<div class="flex items-end justify-end mt-4">
|
||||||
@if (files)
|
@if (files)
|
||||||
{
|
{
|
||||||
<button pButton pRipple type="button" icon="pi pi-upload" label="Add Photo" class="p-button-sm mr-2"
|
<button pButton pRipple type="button" icon="pi pi-upload" label="Save" class="p-button-sm mr-2"
|
||||||
(click)="upload($event)"></button>
|
(click)="upload($event)"></button>
|
||||||
}
|
}
|
||||||
<button pButton pRipple type="button" icon="pi pi-times" label="Cancel" class="p-button-sm"
|
<button pButton pRipple type="button" icon="pi pi-times" label="Cancel" class="p-button-sm"
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ export class AddPhoto implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//new cleaner
|
//new photo
|
||||||
const ward:LookupEdit = {
|
const ward:LookupEdit = {
|
||||||
id: -1, description: '', codeId: maxcodeId, type: this.selType, active: true,
|
id, description: '', codeId: maxcodeId, type: this.selType, active: true,
|
||||||
|
|
||||||
};
|
};
|
||||||
this.assignValue(ward);
|
this.assignValue(ward);
|
||||||
@@ -157,7 +157,14 @@ export class AddPhoto implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
upload(e: Event): void {
|
upload(e: Event): void {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
if (this.files.length > 0)
|
||||||
|
{
|
||||||
this.ref.close(this.files);
|
this.ref.close(this.files);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.messageService.add({severity: 'error', summary: 'No File to upload file', detail: 'select file first then upload file'});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel(e: Event): void {
|
cancel(e: Event): void {
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ assignValue(item:Person): void {
|
|||||||
if (x.statusCode >= 1)
|
if (x.statusCode >= 1)
|
||||||
{
|
{
|
||||||
item.id = x.data;
|
item.id = x.data;
|
||||||
|
this._id = item.id;
|
||||||
// this.messageService.add({severity:'success', summary: 'Save user', detail: item.firstName + " " + item.lastName });
|
// this.messageService.add({severity:'success', summary: 'Save user', detail: item.firstName + " " + item.lastName });
|
||||||
//this.router.navigate([this.returnUrl]);
|
//this.router.navigate([this.returnUrl]);
|
||||||
console.log("the person after save", item);
|
console.log("the person after save", item);
|
||||||
@@ -715,7 +716,7 @@ getPhotoListforSave(): PersonPhotoDto[] {
|
|||||||
let result: PersonPhotoDto[] =[];
|
let result: PersonPhotoDto[] =[];
|
||||||
for (let i = 0; i < this.photoList.length; i++)
|
for (let i = 0; i < this.photoList.length; i++)
|
||||||
{
|
{
|
||||||
if (this.photoList[i].id < 0)
|
if (this.photoList[i].id < 1)
|
||||||
{
|
{
|
||||||
result.push(this.photoList[i]);
|
result.push(this.photoList[i]);
|
||||||
}
|
}
|
||||||
@@ -732,7 +733,7 @@ savePhotoList(list: PersonPhotoDto[], item:Person): void {
|
|||||||
if (file)
|
if (file)
|
||||||
formData.append("files", file, file.name);
|
formData.append("files", file, file.name);
|
||||||
}
|
}
|
||||||
formData.append('personId', this._id.toString());
|
formData.append('personId', item.id.toString());
|
||||||
|
|
||||||
const personPhoto$ = this.personService.savePersonPhotoList(formData);
|
const personPhoto$ = this.personService.savePersonPhotoList(formData);
|
||||||
this.subscription.add(personPhoto$.subscribe(
|
this.subscription.add(personPhoto$.subscribe(
|
||||||
|
|||||||
Reference in New Issue
Block a user