<template>
  <details open class="form-table-style mb30">
    <summary
      :class="{
        'point-font2': pageRole == 'adm',
        'point-font': pageRole == 'government',
      }"
    >
      <p class="summary-style pl10">관내사업장</p>
    </summary>
    <div class="pt10 pb10">
      <table class="form-table2 mb10">
        <colgroup>
          <col width="15%" />
        </colgroup>
        <tbody>
          <tr>
            <th
              :class="{
                'point-font2': pageRole == 'adm',
                'point-font': pageRole == 'government',
              }"
            >
              사업장명
            </th>
            <td v-for="(bplc, index) of data" :key="index">
              {{ bplc.bplcNm }}
            </td>
          </tr>
          <tr>
            <th
              :class="{
                'point-font2': pageRole == 'adm',
                'point-font': pageRole == 'government',
              }"
            >
              주생산품
            </th>
            <td v-for="(bplc, index) of data" :key="index">
              {{ bplc.mainPrdt }}
            </td>
          </tr>
          <tr>
            <th
              :class="{
                'point-font2': pageRole == 'adm',
                'point-font': pageRole == 'government',
              }"
            >
              주소
            </th>
            <td v-for="(bplc, index) of data" :key="index">
              {{ bplc.bplcAddr }}
            </td>
          </tr>
          <tr>
            <th
              :class="{
                'point-font2': pageRole == 'adm',
                'point-font': pageRole == 'government',
              }"
            >
              대지면적
            </th>
            <td v-for="(bplc, index) of data" :key="index">
              {{ bplc.bplcSiar }}
              <template v-for="(item, idx) in codeList" :key="idx">
                <span v-if="item.cd == bplc.bplcSiarUnit">
                  {{ item.cdNm }}
                </span>
              </template>
            </td>
          </tr>
          <tr>
            <th
              :class="{
                'point-font2': pageRole == 'adm',
                'point-font': pageRole == 'government',
              }"
            >
              공장면적
            </th>
            <td v-for="(bplc, index) of data" :key="index">
              {{ bplc.fctryArea }}
              <template v-for="(item, idx) in codeList" :key="idx">
                <span v-if="item.cd == bplc.fctryAreaUnit">
                  {{ item.cdNm }}
                </span>
              </template>
            </td>
          </tr>
          <tr>
            <th
              :class="{
                'point-font2': pageRole == 'adm',
                'point-font': pageRole == 'government',
              }"
            >
              종업원수
            </th>
            <td v-for="(bplc, index) of data" :key="index">
              {{ bplc.wrkrCnt != null ? bplc.wrkrCnt + " 명" : "0 명" }}
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </details>
</template>

<script>
export default {
  props: {
    data: {
      type: Array,
    },
    pageRole: {
      type: String,
      default: "government",
    },
    codeList: {
      type: Array,
    },
  },
};
</script>