<template>
  <div>
    <functionBar class="F_bar" />
    <b-container fluid>
    <div style="margin-top: 80px">
    <b-row style="margin-top: 11px">
      <b-col cols="12">
            <div style="width: 800px; margin-left: 350px; color: black" >
                <b-form-group
                  label="關鍵字:"
                  label-for="filter-input"
                  label-cols="2"
                  label-align="right"
                  label-size="1px"
                >
                  <b-input-group size="1px">
                    <b-form-input
                      id="filter-input"
                      v-model="filter"
                      type="search"
                      placeholder="請輸入關鍵字"
                    ></b-form-input>
                  </b-input-group>
                </b-form-group>
              </div>
            </b-col>
        </b-row>
    <div>
    <b-row>
      <b-col>
        <!-- TABLE -->
        <b-table
        :items="fullList"
        :fields="fields"
        :filter="filter"
        thead-class="thClass"
        class="text-center"
        responsive="sm"
        striped
        bordered
        fixed
        :per-page="perPage"
        :current-page="currentPage"
        >
        <!-- HEAD -->
        <template #head()="{label}">
          <span style="font-weight: normal; color: white; font-size: 15px">{{
            label
          }}</span>
        </template>
        <!-- BODY -->
        <!-- 期別 -->
        <template #cell(period)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 日期 -->
          <template #cell(date)="data">
            {{ data.value }}
          </template>
          <!-- 估驗金額 -->
          <template #cell(estimated_amount)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 累積估驗金額 -->
          <template #cell(cumulative_estimated_amount)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 扣保留款 -->
          <template #cell(withhold_deposit)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 累積保留款 -->
          <template #cell(cumulative_retention_money)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 扣回預付款 -->
          <template #cell(withhold_advance_payment)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 累積扣回預付款 -->
          <template #cell(cumulative_withhold_advance_payment)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 物價指數調整款 -->
          <template #cell(price_index_adjustment)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 累積物價指數調整款 -->
          <template #cell(cumulative_price_index_adjustment)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 扣物價指數保留款 -->
          <template #cell(deduction_of_price_index_retention)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 累積扣物價指數保留款 -->
          <template #cell(cumulative_deduction_of_price_index_retention)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 實付金額 -->
          <template #cell(actual_payment_amount)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 累積實付金額 -->
          <template #cell(cumulative_actual_payment_amount)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 說明 -->
          <template #cell(illustration)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
          <!-- 電子檔 -->
          <template #cell(electronic_file)="data">
            <span style="font-weight: normal; color: black; font-size: 15px">
              {{ data.value }}
            </span>
          </template>
        </b-table>
        <!-- 分頁符號 -->
        <b-pagination
          v-model="currentPage"
          pills
          :total-rows="rows"
          :per-page="perPage"
          aria-controls="my-table"
          style="margin-top:-30px"
        >
        </b-pagination>
        </b-col>
      </b-row>
    </div>
    </div>
    </b-container>
  </div>
</template>
<script>
import functionBar from '@/views/ConstructionSupervision/MainPage/functionBar.vue'

export default {
  data () {
    return {
      filter: null,
      keywords: [],
      selected: [], // Must be an array reference!
      perPage: 12,
      currentPage: 1,
      fields: [
        {
          key: 'period',
          label: '期別',
          sortable: true,
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '20px' }
        },
        {
          key: 'date',
          label: '日期',
          sortable: true,
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '60px' }
        },
        { key: 'estimated_amount',
          label: '估驗金額(A)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'cumulative_estimated_amount',
          label: '累積估驗金額(A)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'withhold_deposit',
          label: '扣保留款(B)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'cumulative_retention_money',
          label: '累積保留款(B)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'withhold_advance_payment',
          label: '扣回預付款(C)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'cumulative_withhold_advance_payment',
          label: '累積扣回預付款(C)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'price_index_adjustment',
          label: '物價指數調整款(D)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'cumulative_price_index_adjustment',
          label: '累積物價指數調整款(D)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'deduction_of_price_index_retention',
          label: '扣物價指數保留款(E)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'cumulative_deduction_of_price_index_retention',
          label: '累積扣物價指數保留款(E)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'actual_payment_amount',
          label: '實付金額(F)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'cumulative_actual_payment_amount',
          label: '累積實付金額(F)',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '80px' }
        },
        { key: 'illustration',
          label: '說明',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '40px' }
        },
        { key: 'electronic_file',
          label: '電子檔',
          tdClass: 'align-middle',
          thStyle: { background: '#1d325f', color: '#ffffff', width: '40px' }
        }
      ],
      fullList: []
    }
  },
  components: {
    functionBar
  },
  computed: {
    rows () {
      return this.fullList.length
    }
  }
}
</script>
<style>
.thClass {
  font-size: 16px;
  background-color: #1d325f;
  color: white;
}
.table td, .table th {
    white-space: normal !important;
    vertical-align: middle !important;
}
</style>
<style scoped>
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 20px;
  margin-top: 20px;
  color: #383838;
}
.text-center {
  color: #f7fafc;
  width: 100%;
  height: 100%;
  padding-left: 5%;
  padding-right: 5%;
  margin-top: -10px;
}
/deep/ .align-middle {
  max-width: 200px;
  white-space: normal !important;
}
/deep/ .truncate {
  width: 50px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
