import { NDatePicker, NRadioButton, NRadioGroup, NButton } from 'naive-ui'
import { useRouter } from 'vue-router'
import GanttCom from '../GanttEdit'

export default defineComponent({
  setup() {
    const range = ref()
    const value = ref('day')

    const addEvent = () => {
      console.log('tianjia --- event')
    }
    const addTask = () => {
      console.log('tianjiarenwu')
    }

    const router = useRouter()
    const ok = () => {
      router.push('/gantt')
    }
    return () => (
      <>
        <div class="flex gap-2">
          <NDatePicker v-model:value={range.value} type="daterange" clearable />
          <NRadioGroup v-model:value={value.value} name="radiobuttongroup">
            <NRadioButton value="hour" label="日" />
            <NRadioButton value="day" label="月" />
          </NRadioGroup>
          <div class="ml-auto flex gap-2">
            <NButton type="primary" onClick={addEvent}>
              添加事件
            </NButton>
            {/* <NButton type="primary" onClick={addTask}>
              添加任务
            </NButton> */}
            <NButton type="primary" onClick={ok}>
              完成编辑
            </NButton>
          </div>
        </div>
        <GanttCom scale={value.value} />
      </>
    )
  },
})
