Commit 21993aa7 by DESKTOP-E3GSHH7\myhr

อัพโหลดรูปหน้าจัดการสมาชิก

parent a9294f38
......@@ -221,7 +221,7 @@
<span class="avatar avatar-xxl avatar-rounded">
<img [src]="selectModel.getPicture()" alt="" id="profile-img">
<span class="badge rounded-full bg-primary avatar-badge">
<input ng2FileSelect [uploader]="uploaderProfile" type="file" name="photo"
<input (click)="triggerFileInput()" ng2FileSelect [uploader]="uploaderProfile" type="file" name="photo"
class="absolute w-full h-full opacity-[0]" id="profile-change">
<i class="fe fe-camera text-[.625rem]"></i>
</span>
......
......@@ -32,6 +32,7 @@ import { TokenService } from "../../../../shared/services/token.service";
export class UserSettingComponent {
@ViewChild('closeModal') public childModal?: ElementRef;
@ViewChild('modalDetail') public modalDetail?: ElementRef;
@ViewChild('profileChangeInput') profileChangeInputRef!: ElementRef;
action = "new";
allSelected = false;
someSelected = false;
......@@ -68,7 +69,7 @@ export class UserSettingComponent {
uploadConfig() {
this.uploaderProfile = new FileUploader({
url: environment.baseUrl + "/api/upload-image",
url: environment.baseUrl + "/files/upload-image",
isHTML5: true,
authToken: this.tokenService.getToken()!,
});
......@@ -107,7 +108,7 @@ export class UserSettingComponent {
if (item.isSuccess) {
const res = JSON.parse(response);
console.log("res", res);
this.selectModel.picture = res.filename
this.selectModel.picture = res.resultObject;
swal(res.message, "บันทึกสำเร็จ", "success");
} else {
......@@ -301,5 +302,9 @@ export class UserSettingComponent {
filterEmp(empId: string) {
this.selectModel = this.empList.filter(e => e.candidateId == empId)[0]
}
triggerFileInput(): void {
if (this.profileChangeInputRef) {
this.profileChangeInputRef.nativeElement.click();
}
}
}
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