Commit cac967b5 by Ooh-Ao

หน้าข้อมูลพนักงาน

parent 3adaa773
...@@ -10,11 +10,13 @@ import { HomeAdminComponent } from './home-admin/home-admin.component'; ...@@ -10,11 +10,13 @@ import { HomeAdminComponent } from './home-admin/home-admin.component';
import { TransectionProductManagementComponent } from './transection-product-management/transection-product-management.component'; import { TransectionProductManagementComponent } from './transection-product-management/transection-product-management.component';
import { HistoryProductComponent } from './history-product/history-product.component'; import { HistoryProductComponent } from './history-product/history-product.component';
import { AdminRoutingModule } from './admin.routing'; import { AdminRoutingModule } from './admin.routing';
import { SharedModule } from '../shared/sharedmodule';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
AdminRoutingModule AdminRoutingModule,
SharedModule
], ],
declarations: [AdminComponent, UserManagementComponent, ProjectManagementComponent, ProductManagementComponent, ProjectEmployeeManagementComponent, ProjectProductManagementComponent, HomeAdminComponent, TransectionProductManagementComponent, HistoryProductComponent] declarations: [AdminComponent, UserManagementComponent, ProjectManagementComponent, ProductManagementComponent, ProjectEmployeeManagementComponent, ProjectProductManagementComponent, HomeAdminComponent, TransectionProductManagementComponent, HistoryProductComponent]
}) })
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { environment } from 'src/environments/environment';
import { HttpClient } from '@angular/common/http';
import { HttpErrorResponse } from '@angular/common/http';
import { UserService } from 'src/app/services/user.service'; import { UserService } from 'src/app/services/user.service';
import { UserProfileModel } from 'src/app/models/user.model'; import { UserProfileModel } from 'src/app/models/user.model';
...@@ -56,45 +53,36 @@ export class UserManagementComponent { ...@@ -56,45 +53,36 @@ export class UserManagementComponent {
} }
} }
// memberlist: any[] = []; detailEmp(emp: UserProfileModel) {
this.selectedUser = emp
}
// ngOnInit(): void { // url = '';
// // จำลองข้อมูลตัวอย่าง // onSelectFile(event: any) {
// this.memberlist = [ // if (event.target && event.target.files && event.target.files[0]) {
// { id: 1, member_firstname: 'Alice', member_lastname: 'Smith', role: 'Admin' }, // const reader = new FileReader();
// { id: 2, member_firstname: 'Bob', member_lastname: 'Johnson', role: 'User' },
// { id: 3, member_firstname: 'Charlie', member_lastname: 'Brown', role: 'Manager' } // reader.readAsDataURL(event.target.files[0]); // read file as data URL
// ];
// } // reader.onload = (event: any) => {
// constructor(private http: HttpClient) {} // // called once readAsDataURL is completed
// this.url1 = event.target.result;
// ngOnInit() { // };
// this.http.get<any[]>(environment.api + '/users')
// .subscribe(
// (data) => {
// this.memberlist = data;
// console.log('Data loaded:', this.memberlist);
// },
// (error) => {
// console.error('Error fetching data', error);
// }
// );
// } // }
// deleteMember(userId: number): void {
// if (confirm('Are you sure you want to delete this member?')) {
// this.http.delete(`${environment.api}/users/${userId}`).subscribe(
// (result: any) => {
// const index = this.memberlist.findIndex(user => user.user_id === userId);
// if (index !== -1) {
// this.memberlist.splice(index, 1);
// } // }
// console.log(result);
// }, // url1 = '';
// (error: HttpErrorResponse) => { // onSelectFile2(event: any) {
// alert(error.message); // if (event.target && event.target.files && event.target.files[0]) {
// const reader = new FileReader();
// reader.readAsDataURL(event.target.files[0]); // read file as data URL
// reader.onload = (event: any) => {
// // called once readAsDataURL is completed
// this.url = event.target.result;
// };
// }
// } // }
// );
// }}}
} }
...@@ -5,6 +5,9 @@ export class UserProfileModel extends BaseModel { ...@@ -5,6 +5,9 @@ export class UserProfileModel extends BaseModel {
user_id: string; user_id: string;
first_name: string; first_name: string;
last_name: string; last_name: string;
picture: string;
phone: string = "-";
position: string = "-";
email: string; email: string;
role: string; role: string;
constructor( constructor(
...@@ -15,7 +18,10 @@ export class UserProfileModel extends BaseModel { ...@@ -15,7 +18,10 @@ export class UserProfileModel extends BaseModel {
this.user_id = data?.user_id!; this.user_id = data?.user_id!;
this.first_name = data?.first_name! this.first_name = data?.first_name!
this.last_name = data?.last_name! this.last_name = data?.last_name!
this.picture = data?.picture!
this.phone = data?.phone ? data.phone : this.phone
this.email = data?.email! this.email = data?.email!
this.position = data?.position ? data.position : this.position
this.role = data?.role! this.role = data?.role!
} }
} }
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