/* Technician mobile view */
function TechJobCard({ job, onStatus, onOpenPhoto }){
const [open,setOpen] = React.useState(false);
const jt = CK.jobType(job.jobType);
const done = job.status==='completed';
return (
{job.customer}
{job.urgency==='urgent' && }
{job.slot}
{job.addr}
{jt?.th}
{itemsShort(job.items)}
{job.routeNote &&
{job.routeNote}
}
{/* quick actions */}
{open && (
เปลี่ยนสถานะงาน
)}
);
}
function MyTasksScreen(){
const { jobs, setStatus, device } = useCK();
const isMobile = device==='mobile';
const team = CK.TEAMS[0]; // current technician = ทีม A
const [date,setDate] = React.useState(CK.TODAY);
const mine = sortQueue(jobs.filter(j=>j.team===team.id && j.date===date));
const done = mine.filter(j=>j.status==='completed').length;
const inprog = mine.filter(j=>j.status==='inprogress').length;
const banner = (
{team.name}
{CK.thDate(date,{withDow:true})}·{team.zone}
{mine.length-done}
คงเหลือ
);
if (!isMobile) {
return (
งานของฉัน
{banner}
{mine.length===0
?
:
{mine.map(j=>)}
}
);
}
return (
{banner}
{mine.length===0 ?
: mine.map(j=>)}
);
}
Object.assign(window, { MyTasksScreen, TechJobCard });