<script>
import CronTasks from '@organisms/Cron/Cron.vue'
import {useStore} from 'vuex'
import ApiOfCron from "@api/ApiOfCron"
import ServiceOfCron from "@services/ServiceOfCron"

export default {
  name: 'CronPage',
  components: {
    CronTasks
  },
  setup() {
    // const url = import.meta.env.VITE_API_ADDR
    const url = import.meta.env.VITE_SCAND_API_ADDR
    const store = useStore()
    
    const apiOfCron = new ApiOfCron(url)
    const serviceOfCron = new ServiceOfCron(apiOfCron, store)

    return {serviceOfCron}
  },
  computed: {
    tasks () {
      return [1,2,3,4]
    }
  },
  methods: {
  }
}

</script>

<template>
  <CronTasks :serviceOfCron="serviceOfCron" />
  <!-- <div class="flex flex-col gap-3 bg-light h-full w-full col-span-12 rounded-xl p-2">
    <TaskModal taskId="new">
      <template #button>
        <button class="cursor-pointer bg-primary hover:bg-transparent text-white font-semibold hover:text-primary py-1 text-ssm px-4 border border-primary  rounded-lg text-center transition_up w-[200px]">
          Добавить задачу
        </button>
      </template>
    </TaskModal>
    <div
      id="phx-F6ih6f3ULA2TYReS-4-0"
      data-phx-component="4"
      class="flex flex-col gap-2"
    >
      <div>
        <button
          type="button"
          class="hidden"
          phx-click="[[&quot;toggle&quot;,{&quot;display&quot;:null,&quot;ins&quot;:[[],[],[]],&quot;outs&quot;:[[],[],[]],&quot;time&quot;:200,&quot;to&quot;:&quot;#period_table_modal&quot;}]]"
        />
        <div
          id="period_table_modal"
          class="fixed z-[10000] inset-0 hidden"
          phx-remove="[[&quot;transition&quot;,{&quot;time&quot;:200,&quot;to&quot;:null,&quot;transition&quot;:[[&quot;fade-out&quot;],[],[]]}]]"
        >
          VModal container
          <div class="h-screen flex items-center justify-center p-4">
            Overlay
            <div
              class="absolute z-0 inset-0 bg-gray-500 opacity-75"
              aria-hidden="true"
            />
            VModal box
            <div
              class="relative max-h-full overflow-y-auto bg-white rounded-lg shadow-xl "
              role="dialog"
              aria-modal="true"
              tabindex="0"
              autofocus=""
              phx-window-keydown="[[&quot;hide&quot;,{&quot;time&quot;:200,&quot;to&quot;:&quot;#period_table_modal&quot;,&quot;transition&quot;:[[&quot;ease-in&quot;,&quot;duration-200&quot;],[&quot;opacity-100&quot;],[&quot;opacity-0&quot;]]}],[&quot;dispatch&quot;,{&quot;event&quot;:&quot;click&quot;,&quot;to&quot;:&quot;#period_table_modal-return&quot;}]]"
              phx-click-away="[[&quot;hide&quot;,{&quot;time&quot;:200,&quot;to&quot;:&quot;#period_table_modal&quot;,&quot;transition&quot;:[[&quot;ease-in&quot;,&quot;duration-200&quot;],[&quot;opacity-100&quot;],[&quot;opacity-0&quot;]]}],[&quot;dispatch&quot;,{&quot;event&quot;:&quot;click&quot;,&quot;to&quot;:&quot;#period_table_modal-return&quot;}]]"
              phx-key="escape"
            >
              <button
                type="button"
                class="absolute top-2 right-2 text-gray-400 flex space-x-1 items-center"
                aria_label="close modal"
                phx-click="[[&quot;hide&quot;,{&quot;time&quot;:200,&quot;to&quot;:&quot;#period_table_modal&quot;,&quot;transition&quot;:[[&quot;ease-in&quot;,&quot;duration-200&quot;],[&quot;opacity-100&quot;],[&quot;opacity-0&quot;]]}],[&quot;dispatch&quot;,{&quot;event&quot;:&quot;click&quot;,&quot;to&quot;:&quot;#period_table_modal-return&quot;}]]"
              >
                <span class="text-sm">(esc)</span>
                <i class="ri ri-close-line text-2xl" />
              </button>

              <div class="min-w-[350px] min-h-[400px] py">
                <div class=" p-4 font-bold" />

                <div
                  id="logs_loader"
                  style="display: none; width: 95vw; height: 95vh;"
                  class="w-full h-full"
                >
                  <div
                    style=""
                    class="h-full absolute inset-0 flex flex-row items-center grow transition items-center justify-center appear_from_opacity-3 z-30 rounded p-2"
                  >
                    <div class="flex flex-row items-center grow transition items-center justify-center rounded shadow bg-white h-full">
                      <div
                        type-node="loader"
                        class="flex gap-3 items-center justify-center "
                      >
                        <span class="text-slate-600 text-md font-medium">Загрузка</span>
                        <div role="status">
                          <svg
                            aria-hidden="true"
                            class="mr-2 w-6 h-6 text-gray-300 animate-spin dark:text-gray-400 fill-slate-700"
                            viewBox="0 0 100 101"
                            fill="none"
                            xmlns="http://www.w3.org/2000/svg"
                          >
                            <path
                              d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
                              fill="currentColor"
                            />
                            <path
                              d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
                              fill="currentFill"
                            />
                          </svg>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="flex flex-col gap-2 px-4 pb-4">
                  <div class="flex gap-2 items-end">
                    <div class="relative ">
                      <label
                        for=""
                        class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300 text-left "
                      >
                        Название
                      </label>
                      <input
                        id="period_view_name"
                        class="bg-gray-50 border border-gray-300  text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full py-1 pl-2 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 "
                        placeholder="Название"
                        name=""
                        type="text"
                        value=""
                        disabled=""
                        autocomplete="off"
                      >
                    </div>
                    <div
                      id="display_modal_period"
                      phx-hook="TimeConvert"
                    />
                  </div>
                  <div
                    id="period_report"
                    style="width: 95vw"
                    phx-hook="MakeTabulator"
                  />
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <Task
        v-for="_i in tasks"
        :key="`${_i}_key`"
        :index="_i"
      />
    </div>
  </div> -->
</template>
