<template>
  <div class="card ">
    <div class="card-body ">
      <h2 class="card-title">사용자권한관리</h2>
      <p class="require"><img :src="require" alt=""> 필수입력</p>
          <form class="row g-3 pt-3  needs-validation detail" @submit.prevent="handleSubmit"
            style="margin-bottom: 3rem;">
            <div class="col-12">
          <div class="col-12 border-x">
            <label for="where" class="form-label">상위코드</label>
            <input type="text" class="form-control" id="where" v-model="where"  readonly />
          </div>
          <div class="col-12 border-x">
            <label for="where" class="form-label">상위코드 명</label>
            <input type="text" class="form-control" id="where" v-model="where" readonly/>
          </div>
  
       </div>
       <div class="col-12">
          <div class="col-12 border-x">
            <label for="where" class="form-label">코드</label>
            <input type="text" class="form-control" id="where" v-model="where"readonly />
          </div>
          <div class="col-12 border-x">
            <label for="where" class="form-label">코드명</label>
            <input type="text" class="form-control" id="where" v-model="where" readonly/>
          </div>
  
       </div>

            <div class="col-12 chuljang ">
              <label for="prvonsh" class="form-label">설명</label>
              <input type="text" class="form-control textarea" id="reason" v-model="reason" readonly/>
            </div>
            <div class="col-12 border-x input-radio">
              <label for="prvonsh" class="form-label">사용여부</label>
                <input type="text" class="form-control" id="where" v-model="where" readonly/>
            </div>


          </form>
          <div class="buttons">
        <button type="submit" class="btn sm btn-red">삭제</button>
        <button type="submit" class="btn sm secondary">수정</button>
        <button type="reset" class="btn sm tertiary">목록</button>
      </div>
    </div>

  </div>

</template>

<script>
import GoogleCalendar from "../../../component/GoogleCalendar.vue"
import { SearchOutlined } from '@ant-design/icons-vue';
export default {
  data() {
    return {
      require: "/client/resources/img/require.png",
      h3icon: "/client/resources/img/h3icon.png",
      photoicon: "/client/resources/img/photo_icon.png",
      img1: "/client/resources/img/img.png",
      icon1: "/client/resources/img/icon.png",
      dateicon: "/client/resources/img/date.png",
      startbtn: "/client/resources/img/start.png",
      stopbtn: "/client/resources/img/stop.png",
      moreicon: "/client/resources/img/more.png",
      today: new Date().toLocaleDateString('ko-KR', {
        year: 'numeric',
        month: '2-digit',
        day: '2-digit',
        weekday: 'short',
      }),
      time: this.getCurrentTime(),
      listData: Array.from({ length: 20 }, (_, i) => ({
        department: `부서 ${i + 1}`,
        name: `이름 ${i + 1}`,
        position: `직급 ${i + 1}`
      }))
    }
  },
  components: {
    SearchOutlined
  },
  methods: {
    formatBudget(amount) {
      return new Intl.NumberFormat().format(amount) + ' 원';
    },
    isPastPeriod(period) {
      // 예: '2025-05-01 ~ 2025-05-03' → 종료일 추출
      const endDateStr = period.split('~')[1]?.trim();
      if (!endDateStr) return false;

      const endDate = new Date(endDateStr);
      const today = new Date();

      // 현재 날짜보다 과거면 true
      return endDate < today;
    },
    getStatusClass(status) {
      return status === 'active' ? 'status-active' : 'status-inactive';
    },
    getStatusClass(status) {
      if (status === '미진행') return 'status-pending';
      if (status === '진행중') return 'status-approved';

      // Default empty string
      return '';
    },
    getCurrentTime() {
      const now = new Date();
      const hours = String(now.getHours()).padStart(2, '0');
      const minutes = String(now.getMinutes()).padStart(2, '0');
      const seconds = String(now.getSeconds()).padStart(2, '0');
      return `${hours}:${minutes}:${seconds}`;
    },
    getCategoryClass(category) {
      switch (category) {
        case '용역': return 'category-service';
        case '내부': return 'category-internal';
        case '국가과제': return 'category-government';
        default: return '';
      }
    },
  },
  watch: {

  },
  computed: {

  },
  mounted() {
    console.log('main mounted');
    setInterval(() => {
      this.time = this.getCurrentTime();
    }, 1000);
  }
}
</script>
<style scoped>
tr {
  cursor: pointer;
}
</style>