const AgentRow = { props: ['agent', 'dates', 'isCompact', 'weekendsAreWorkingDays'], template: `
{{ agent.name }}
{{ agent.role }}
`, setup(props) { const canWork = (date) => { return props.weekendsAreWorkingDays || !ValidationUtils.isWeekend(date); }; const getShifts = (agent, date) => { return store.getAgentShifts(agent.id, date); }; const getShiftColor = (shiftCode) => { // Map codes to colors const map = { 'm': 'green', 'a': 'blue', 'e': 'pink', 't': 'orange', 'v': 'purple' }; return map[shiftCode] || 'grey'; }; const getShiftLabel = (shiftCode) => { const map = { 'm': 'MORNING', 'a': 'HOTLINE', // As per original design calls Afternoon 'HOTLINE' 'e': 'EOD', 't': 'TRAINING', 'v': 'VACATION' }; return map[shiftCode] || shiftCode; }; const getCellClasses = (agent, date, i) => { const shifts = getShifts(agent, date); const hasConflict = !!ValidationUtils.hasConflict(shifts); return [ props.isCompact ? 'cell-compact' : '', (agent.id + i) === 42 ? 'bg-amber-1' : '', // Keep random lock for demo !canWork(date) ? 'bg-weekend cursor-not-allowed' : 'cursor-pointer', hasConflict ? 'bg-red-1' : '' ]; }; const handleCellClick = (agent, date) => { if (!canWork(date)) return; store.openAssignment(agent, date); }; const openProfile = (agent) => { store.openProfile(agent); }; return { getCellClasses, handleCellClick, openProfile, canWork, getShifts, getShiftColor, getShiftLabel, ValidationUtils }; } };