Commit 6b82e1aa by DESKTOP-E0VCCBD\zedan

update

parent f40cbcd3
......@@ -68,13 +68,13 @@ User.beforeUpdate(async (user, options) => {
// console.log("Table(s) created successfully!");
// // ตัวอย่างการทดสอบสร้าง User ทันที (ถ้าต้องการ)
// const newUser = await User.create({
// first_name: "Jane",
// last_name: "Doe",
// email: "jane@example.com",
// password: "123456", // จะถูก hash จาก hook ใน model
// role: "employee",
// });
// const newUser = await User.create({
// first_name: "Jane",
// last_name: "Doe",
// email: "jane@example.com",
// password: "123456", // จะถูก hash จาก hook ใน model
// role: "employee",
// });
// console.log("New user created:", newUser.user_id);
// } catch (error) {
......
......@@ -27,14 +27,14 @@ export class LoginPageComponent {
}
ngOnInit(): void {
this.loginForm = this.formBuilder.group({
username: ['spruko@admin.com', [Validators.required]],
password: ['sprukoadmin', Validators.required],
username: ['emp@example.com', [Validators.required]],
password: ['1234', Validators.required],
});
}
// firebase
email = 'spruko@admin.com';
password = 'sprukoadmin';
email = 'emp@example.com';
password = '1234';
errorMessage = ''; // validation _error handle
_error: { name: string; message: string } = { name: '', message: '' }; // for firbase _error handle
......
<p>borrow-product-emp works!</p>
<div class="grid grid-cols-12 gap-6">
<div class="col-span-12">
<div class="box">
<div class="box-header flex justify-between">
<h2 class="text-lg font-semibold">ข้อมูลการเบิก</h2>
</div>
<div class="box-body">
<table class="ti-custom-table ti-custom-table-head w-full">
<thead class="bg-gray-100">
<tr>
<th>Name</th>
<th>Order ID</th>
<th>Project</th>
<th>Status</th>
<th class="text-end">Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of transactions">
<td>{{ item.name }}</td>
<td>{{ item.id }}</td>
<td>{{ item.project }}</td>
<td>
<span class="badge px-3 py-1 rounded-md" [ngClass]="getStatusClass(item.status)">
{{ item.status }}
</span>
</td>
<td class="text-end">
<a routerLink="/page/ecommerce/borrow" class="text-primary hover:text-primary">Details</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
......@@ -7,4 +7,25 @@ import { Component } from '@angular/core';
})
export class BorrowProductEmpComponent {
activeTab: string = 'borrow'; // กำหนดแท็บเริ่มต้น
itemtype: any = [];
transactions = [
{ id: '#52225', name: 'John Brown', project: 'Project1', status: 'Pending', type: 'borrow' },
{ id: '#52400', name: 'Jim Green', project: 'Project2', status: 'Approved', type: 'return' },
{ id: '#52100', name: 'Joe Black', project: 'Project3', status: 'Not Approved', type: 'history' }
];
setActiveTab(tab: string) {
this.activeTab = tab;
}
getStatusClass(status: string) {
return {
'bg-yellow-100 text-yellow-800': status === 'Pending',
'bg-green-100 text-green-800': status === 'Approved',
'bg-red-100 text-red-800': status === 'Not Approved'
};
}
}
<p>emp-information works!</p>
<div class="relative">
<!-- Start::main-content -->
<div class="main-content m-12">
<!-- Profile Section -->
<div class="grid grid-cols-12 gap-6">
<!-- Profile Card -->
<div class="col-span-12 lg:col-span-4">
<div class="box p-6 text-center">
<img [src]="member?.profile_picture || 'assets/default-profile.png'"
alt="Profile Picture" class="w-32 h-32 mx-auto rounded-full shadow-md">
<h3 class="text-xl font-semibold mt-4">{{ member?.member_firstname }} {{ member?.member_lastname }}</h3>
<p class="text-gray-500">{{ member?.member_position }}</p>
<button class="mt-4 ti-btn ti-btn-primary">Edit Profile</button>
</div>
</div>
<!-- General Info -->
<div class="col-span-12 lg:col-span-8">
<div class="box">
<div class="box-header flex justify-between">
<h5 class="box-title">ข้อมูลพนักงาน</h5>
</div>
<div class="box-body">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div><strong>วันเกิด:</strong> {{ member?.member_date | date:'dd MMMM yyyy' }}</div>
<div><strong>เพศ:</strong> {{ member?.member_gender }}</div>
<div><strong>เบอร์โทร:</strong> {{ member?.member_phone }}</div>
<div><strong>ตำแหน่ง:</strong> {{ member?.member_position }}</div>
<div class="md:col-span-2"><strong>ที่อยู่:</strong> {{ member?.member_address }}</div>
</div>
</div>
</div>
</div>
</div>
<!-- Bio Section -->
<div class="box mt-6">
<div class="box-header flex justify-between">
<h5 class="box-title">เกี่ยวกับพนักงาน</h5>
</div>
<div class="box-body">
<p class="text-gray-700">{{ member?.bio || 'ไม่มีข้อมูล' }}</p>
</div>
</div>
</div>
<!-- End::main-content -->
</div>
......@@ -7,4 +7,21 @@ import { Component } from '@angular/core';
})
export class EmpInformationComponent {
member: any;
constructor() {}
ngOnInit(): void {
// ✅ ข้อมูลจำลองของสมาชิก
this.member = {
member_firstname: 'John',
member_lastname: 'Doe',
member_date: new Date(1990, 4, 15), // 15 พฤษภาคม 1990
member_phone: '081-234-5678',
member_address: '123 หมู่ 4 ถนนหลัก ตำบลกลาง อำเภอเมือง จังหวัดกรุงเทพ 10100',
member_gender: 'Male',
member_position: 'Software Engineer'
};
}
}
<p>history-emp works!</p>
<div class="grid grid-cols-12 gap-6">
<div class="col-span-12">
<div class="box">
<div class="box-header flex justify-between">
<h2 class="text-lg font-semibold">ประวัติการทำรายการ</h2>
</div>
<div class="box-body">
<table class="ti-custom-table ti-custom-table-head w-full">
<thead class="bg-gray-100">
<tr>
<th>Name</th>
<th>Order ID</th>
<th>Project</th>
<th>Status</th>
<th class="text-end">Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of transactions">
<td>{{ item.name }}</td>
<td>{{ item.id }}</td>
<td>{{ item.project }}</td>
<td>
<span class="badge px-3 py-1 rounded-md" [ngClass]="getStatusClass(item.status)">
{{ item.status }}
</span>
</td>
<td class="text-end">
<a routerLink="/page/ecommerce/borrow" class="text-primary hover:text-primary">Details</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
......@@ -6,5 +6,25 @@ import { Component } from '@angular/core';
styleUrls: ['./history-emp.component.scss']
})
export class HistoryEmpComponent {
activeTab: string = 'borrow'; // กำหนดแท็บเริ่มต้น
itemtype: any = [];
transactions = [
{ id: '#52225', name: 'John Brown', project: 'Project1', status: 'Pending', type: 'borrow' },
{ id: '#52400', name: 'Jim Green', project: 'Project2', status: 'Approved', type: 'return' },
{ id: '#52100', name: 'Joe Black', project: 'Project3', status: 'Not Approved', type: 'history' }
];
setActiveTab(tab: string) {
this.activeTab = tab;
}
getStatusClass(status: string) {
return {
'bg-yellow-100 text-yellow-800': status === 'Pending',
'bg-green-100 text-green-800': status === 'Approved',
'bg-red-100 text-red-800': status === 'Not Approved'
};
}
}
<p>return-product-emp works!</p>
<div class="grid grid-cols-12 gap-6">
<div class="col-span-12">
<div class="box">
<div class="box-header flex justify-between">
<h2 class="text-lg font-semibold">ข้อมูลการคืน</h2>
</div>
<div class="box-body">
<table class="ti-custom-table ti-custom-table-head w-full">
<thead class="bg-gray-100">
<tr>
<th>Name</th>
<th>Order ID</th>
<th>Project</th>
<th>Status</th>
<th class="text-end">Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of transactions">
<td>{{ item.name }}</td>
<td>{{ item.id }}</td>
<td>{{ item.project }}</td>
<td>
<span class="badge px-3 py-1 rounded-md" [ngClass]="getStatusClass(item.status)">
{{ item.status }}
</span>
</td>
<td class="text-end">
<a routerLink="/page/ecommerce/borrow" class="text-primary hover:text-primary">Details</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
......@@ -6,5 +6,25 @@ import { Component } from '@angular/core';
styleUrls: ['./return-product-emp.component.scss']
})
export class ReturnProductEmpComponent {
activeTab: string = 'borrow'; // กำหนดแท็บเริ่มต้น
itemtype: any = [];
transactions = [
{ id: '#52225', name: 'John Brown', project: 'Project1', status: 'Pending', type: 'borrow' },
{ id: '#52400', name: 'Jim Green', project: 'Project2', status: 'Approved', type: 'return' },
{ id: '#52100', name: 'Joe Black', project: 'Project3', status: 'Not Approved', type: 'history' }
];
setActiveTab(tab: string) {
this.activeTab = tab;
}
getStatusClass(status: string) {
return {
'bg-yellow-100 text-yellow-800': status === 'Pending',
'bg-green-100 text-green-800': status === 'Approved',
'bg-red-100 text-red-800': status === 'Not Approved'
};
}
}
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