Commit 21993aa7 by DESKTOP-E3GSHH7\myhr

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

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