60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
|
|
import { computed } from 'vue'
|
||
|
|
import { HERMES_SIMPLE_TASKS } from '../../utils/hermesEmployeeSettingsModel.js'
|
||
|
|
|
||
|
|
export default {
|
||
|
|
name: 'HermesEmployeeSettingsPanel',
|
||
|
|
props: {
|
||
|
|
hermesForm: {
|
||
|
|
type: Object,
|
||
|
|
required: true
|
||
|
|
}
|
||
|
|
},
|
||
|
|
emits: ['toggle-master', 'toggle-flag', 'toggle-task', 'update-task-time'],
|
||
|
|
setup(props) {
|
||
|
|
const TASK_METADATA = {
|
||
|
|
knowledgeAggregation: { icon: 'mdi-sync', color: 'indigo' },
|
||
|
|
ruleReviewDigest: { icon: 'mdi-bell-ring-outline', color: 'warning' },
|
||
|
|
riskSummary: { icon: 'mdi-shield-search', color: 'danger' },
|
||
|
|
archiveDigest: { icon: 'mdi-archive-outline', color: 'info' },
|
||
|
|
dailyStats: { icon: 'mdi-chart-line', color: 'success' },
|
||
|
|
monthlyStats: { icon: 'mdi-chart-bar', color: 'primary' },
|
||
|
|
yearlyStats: { icon: 'mdi-chart-pie', color: 'secondary' }
|
||
|
|
}
|
||
|
|
|
||
|
|
function getTaskIcon(taskId) {
|
||
|
|
return TASK_METADATA[taskId]?.icon || 'mdi-cog-outline'
|
||
|
|
}
|
||
|
|
|
||
|
|
function getTaskColorClass(taskId) {
|
||
|
|
return TASK_METADATA[taskId]?.color || 'default'
|
||
|
|
}
|
||
|
|
|
||
|
|
function isTaskOn(taskId) {
|
||
|
|
return Boolean(
|
||
|
|
props.hermesForm?.masterEnabled &&
|
||
|
|
props.hermesForm?.capabilities?.[taskId] &&
|
||
|
|
props.hermesForm?.schedules?.[taskId]?.enabled
|
||
|
|
)
|
||
|
|
}
|
||
|
|
|
||
|
|
function taskTime(taskId) {
|
||
|
|
return props.hermesForm?.schedules?.[taskId]?.time || '09:00'
|
||
|
|
}
|
||
|
|
|
||
|
|
const activeTasksCount = computed(() => {
|
||
|
|
return HERMES_SIMPLE_TASKS.filter(task => isTaskOn(task.id)).length
|
||
|
|
})
|
||
|
|
|
||
|
|
return {
|
||
|
|
HERMES_SIMPLE_TASKS,
|
||
|
|
isTaskOn,
|
||
|
|
taskTime,
|
||
|
|
getTaskIcon,
|
||
|
|
getTaskColorClass,
|
||
|
|
activeTasksCount
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|