/* Manager screens: Dashboard, Management */
// ---------- mini charts ----------
function BarH({ data, color='#dc2626', unit='งาน', money }){
const max = Math.max(1, ...data.map(d=>d.value));
return (
{isMobile ?
จัดการระบบ
:
}
{tabs.map(([k,l,ic])=>(
))}
{tab==='branches' && (
สาขาทั้งหมด ({CK.BRANCHES.length})
toast('เปิดฟอร์มเพิ่มสาขา')}>เพิ่มสาขา
| รหัส | ชื่อสาขา | เบอร์โทร | ที่อยู่ | สถานะ | |
{CK.BRANCHES.map(b=>(
| {b.code} |
{b.name} |
{b.phone} |
{b.addr} |
{b.active?เปิดใช้งาน:ปิด} |
|
))}
)}
{tab==='users' && (
ผู้ใช้งาน ({CK.USERS.length})
toast('เปิดฟอร์มเพิ่มผู้ใช้')}>เพิ่มผู้ใช้
| ชื่อ | สิทธิ์ | สาขา | เบอร์โทร | สถานะ | |
{CK.USERS.map(u=>{ const b=CK.branch(u.branch);
return (
|
{CK.ROLES[u.role].label} |
{b?b.code:'—'} |
{u.phone} |
{u.active?active:inactive} |
|
);
})}
)}
{tab==='jobtypes' && (
{CK.JOB_TYPES.map(t=>(
{t.th}
น้ำหนักคิว {t.unit} unit/ชิ้น
))}
toast('เพิ่มประเภทงาน')} className="p-4 flex items-center justify-center gap-2 text-slate-400 hover:text-brand-600 hover:ring-brand-300 ring-dashed">เพิ่มประเภทงาน
)}
{tab==='capacity' && (
ตั้งค่าความจุงานรายวัน
น้ำหนักงาน: ติดตั้งแอร์ = 1 unit · แอร์ 4 ทิศทาง = 2 unit · ล้างแอร์ = 0.5 unit · ถอดแอร์ = 0.5 unit · งานต่างอำเภอไกล +0.5 unit
{Object.keys(cap).filter(d=>d>=CK.TODAY).slice(0,14).map(d=>{
const c = cap[d];
return (
{CK.thDate(d,{withDow:true})}
รับสูงสุด
{c.max}
unit
);
})}
{ Object.assign(CK.CAPACITY,cap); toast('บันทึกความจุคิวแล้ว','success'); }}>บันทึก
)}
);
}
Object.assign(window, { DashboardScreen, ManageScreen, BarH, Donut });