<template>
  <b-container>
    <div style="font-size: 25px; font-weight: bold">標案資料</div>
    <hr style="margin-top: 10px; margin-bottom: 15px" />
    <b-row style="margin-bottom: 10px">
      <div v-if="isAddProject" style="padding-left: 20px">
        <b-button class="btn" @click="addProject">儲存</b-button>
        <b-button class="btn" @click="cancelAddProject">取消</b-button>
      </div>
      <div v-else>
        <b-button @click="editSave()" class="btn" style="margin-left: 10px">
          <span v-if="isFix">編輯專案資料</span>
          <span v-else>儲存專案資料</span>
        </b-button>
      </div>
    </b-row>
    <div
      style="
        overflow-y: auto;
        overflow-x: hidden;
        height: 700px;
        margin-top: 0px;
      "
    >
      <!-- 標別 | 標案編號 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>標別：</span>
        </b-col>
        <b-col cols="4">
          <b-form-input
            :disabled="isFix"
            v-model="tender.tender"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-input>
        </b-col>
        <b-col cols="2" class="text">
          <span>標案編號：</span>
        </b-col>
        <b-col cols="4">
          <b-form-input
            v-model="tender.tenderNumber"
            :disabled="isFix"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-input>
        </b-col>
      </b-row>
      <!-- 工程名稱 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>工程名稱：</span>
        </b-col>
        <b-col cols="10">
          <b-form-input
            v-model="tender.project_name"
            :disabled="isFix"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-input>
        </b-col>
      </b-row>
      <!-- 承攬廠商 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>承攬廠商：</span>
        </b-col>
        <b-col cols="10">
          <b-form-input
          v-model="tender.owner"
            :disabled="isFix"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-input>
        </b-col>
      </b-row>
      <!-- 開工日期 | 預計竣工日期 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>開工日期：</span>
        </b-col>
        <b-col cols="4">
          <b-form-datepicker
            v-if="!isFix"
            v-model="tender.start_date"
            placeholder="請輸入日期"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-datepicker>
          <div v-else style="margin-top: 3px; padding-left: 10px">
            <span
              style="font-size: 18px; font-weight: 500; color: black"
            >{{ getFormattedDate(tender.start_date) }}</span>
          </div>
        </b-col>
        <b-col cols="2" class="text">
          <span>預計竣工日期：</span>
        </b-col>
        <b-col cols="4">
          <b-form-datepicker
          v-model="tender.scheduled_complete"
            v-if="!isFix"
            placeholder="請輸入日期"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-datepicker>
          <div v-else style="margin-top: 3px; padding-left: 10px">
            <span
              style="font-size: 18px; font-weight: 500; color: black"
            >{{ getFormattedDate(tender.scheduled_complete) }}</span>
          </div>
        </b-col>
      </b-row>
      <!-- 實際竣工日期 | 原契約工期 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>實際竣工日期：</span>
        </b-col>
        <b-col cols="4">
          <b-form-datepicker
          v-model="tender.actual_complete"
            v-if="!isFix"
            placeholder="請輸入日期"
            style="width: 95%; font-size: 18px; font-weight: 500"
            :input-attrs="{ readonly: true }"
          ></b-form-datepicker>
          <div v-else style="margin-top: 11px; padding-left: 10px">
            <span
              style="font-size: 18px; font-weight: 500; color: black"
            >{{ getFormattedDate(tender.actual_complete) }}</span>
          </div>
        </b-col>
        <b-col cols="2" class="text">
          <span>原契約工期：</span>
        </b-col>
        <b-col cols="4">
          <b-form-input
            :disabled="isFix"
            v-model="tender.contract_day"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-input>
        </b-col>
      </b-row>
      <!-- 契約金額 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>契約金額(NT$)：</span>
        </b-col>
        <b-col cols="4">
          <b-form-input
          v-if="tender.changeContract.length === 0"
            :disabled="isFix"
            v-model="tender.contract_amount"
            style="width: 95%; font-size: 18px; font-weight: 500"
          ></b-form-input>
          <div v-else style="padding-left: 10px; margin-top: 11px; font-size: 18px; font-weight: 500; color:black">
            <b-row>
              <b-col cols="6">
            <span>{{ tender.contract_amount }}</span>
              </b-col>
              <b-col cols="6">
                <b-icon
            class="w-15 p-1"
            icon="exclamation-triangle-fill"
            aria-hidden="true"
            v-b-popover.hover="'此已核定的契約工項已新增變更契約而無法再次編輯契約金額。請先連絡系統管理員，刪除在此契約核定後的變更契約，繼續編輯。'"
            style="height: 30px; width: auto; margin-left: 5px; color: red"
            size="sm"
          ></b-icon>
              </b-col>
            </b-row>
          </div>
        </b-col>
      </b-row>
      <!-- 工程概述 -->
      <b-row style="padding-top: 25px">
        <b-col cols="2" class="text">
          <span>工程概述：</span>
        </b-col>
        <b-col cols="10">
          <b-form-textarea
          v-model="tender.introduction"
            :disabled="isFix"
            rows="6"
            no-resize
            style="
              width: 95%;
              height: 150px;
              padding: 8px 12px 10px;
              font-size: 18px;
              font-weight: 500;
            "
          />
        </b-col>
      </b-row>
      <!-- 單位基本資料 -->
      <b-row style="padding-top: 15px">
        <div style="font-size: 20px; font-weight: bold; margin-left: 2%">
          單位基本資料：
        </div>
      </b-row>
      <b-row>
        <div
          style="margin-top: 10px; margin-left: 40px; width: 90%"
        >
            <!-- 主辦單位 -->
            <b-card
              no-body
              class="mb-1"
              v-for="(item, index) in this.tender.hostControl"
              :key="'info-' + index"
            >
              <div>
                <b-button
                  v-b-toggle="`Host`"
                  :disabled="Host.checked"
                  block
                  class="btn_module"
                >
                  主辦單位
                </b-button>
                <b-collapse :id="`Host`" style="padding: 0 15px 15px 15px">
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >基本資料</span
                    >
                  </div>
                  <b-row style="margin-bottom: 20px">
                    <b-col cols="12">
                      <b-row>
                        <b-col cols="6">
                          <span style="color: black; font-weight:700;">單位名稱：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.organizer"
                          ></b-form-input>
                          <span style="color: black; font-weight:700;">電子郵件：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.email"
                          ></b-form-input>
                          <span style="color: black; font-weight:700;">聯絡地點：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.address"
                          ></b-form-input>
                        </b-col>
                        <b-col cols="6">
                          <span style="color: black; font-weight:700;">聯絡人：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.contactPerson"
                          ></b-form-input>
                          <span style="color: black; font-weight:700;">聯絡電話：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.contactNumber"
                          ></b-form-input>
                        </b-col>
                      </b-row>
                    </b-col>
                  </b-row>
                </b-collapse>
              </div>
            </b-card>
            <!-- 設計單位 -->
            <b-card
              no-body
              class="mb-1 mt-4"
              v-for="(item, index) in this.tender.design_unit"
              :key="'info1-' + index"
            >
              <div>
                <b-button
                  v-b-toggle="`Design`"
                  :disabled="Design.checked"
                  block
                  class="btn_module"
                >
                  設計單位
                </b-button>
                <b-collapse
                  :id="`Design`"
                  style="padding: 0 15px 15px 15px"
                  class="mt-2"
                >
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >基本資料</span
                    >
                  </div>
                  <b-row style="margin-top: 10px">
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">單位名稱：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.organizer"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">電子郵件：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.email"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">聯絡地點：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.address"
                      ></b-form-input>
                    </b-col>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">聯絡人：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.contactPerson"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">聯絡電話：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.contactNumber"
                      ></b-form-input>
                    </b-col>
                  </b-row>
                </b-collapse>
              </div>
            </b-card>
        </div>
      </b-row>
      <!-- 選擇委託類型 -->
      <b-row style="padding-top: 15px">
        <div style="font-size: 20px; font-weight: bold; margin-left: 2%">
          選擇委託類型：
        </div>
      </b-row>
      <b-row>
        <div
          style="margin-top: 10px; margin-left: 40px; width: 90%"
        >
            <!-- 專案管理 -->
            <b-card
              no-body
              class="mb-1"
              v-for="(item, index) in this.tender.PCMControl"
              :key="'info-' + index"
            >
              <div>
                <b-button
                  v-b-toggle="`PCM`"
                  :disabled="PCM.checked"
                  block
                  class="btn_module"
                >
                  專案管理
                </b-button>
                <b-form-checkbox
                  v-model="PCM.checked"
                  :disabled="isFix"
                  name="check-button"
                  switch
                >
                  <b>
                    <span v-if="PCM.checked">已關閉</span>
                    <span v-else>已開啟</span>
                  </b>
                </b-form-checkbox>
                <b-collapse :id="`PCM`" style="padding: 0 15px 15px 15px">
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >基本資料</span
                    >
                  </div>
                  <b-row style="margin-bottom: 20px">
                    <b-col cols="12">
                      <b-row>
                        <b-col cols="6">
                          <span style="color: black; font-weight:700;">單位名稱：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.organizer"
                          ></b-form-input>
                          <span style="color: black; font-weight:700;">電子郵件：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.email"
                          ></b-form-input>
                         <span style="color: black; font-weight:700;">聯絡地點：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.address"
                          ></b-form-input>
                        </b-col>
                        <b-col cols="6">
                          <span style="color: black; font-weight:700;">聯絡人：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.contactPerson"
                          ></b-form-input>
                          <span style="color: black; font-weight:700;">聯絡電話：</span>
                          <b-form-input
                            :disabled="isFix"
                            style="width: 100%; font-size: 16px"
                            v-model="item.contactNumber"
                          ></b-form-input>
                        </b-col>
                      </b-row>
                    </b-col>
                  </b-row>
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >參數設置</span
                    >
                  </div>
                  <b-row>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">發文預設單位：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="PCM.issuer"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">發文預設字號：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="PCM.issue_text_number"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">輸出Title：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="PCM.title"
                      ></b-form-input>
                    </b-col>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">發文限辦天數：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="PCM.issueHandlingDay"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">收文限辦天數：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="PCM.receiveHandlingDay"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">輸出書函時，內部存檔用之名稱：</span
                      >
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="PCM.outputFileName"
                      ></b-form-input>
                    </b-col>
                  </b-row>
                </b-collapse>
              </div>
            </b-card>
            <!-- 監造工務管理 -->
            <b-card
              no-body
              class="mb-1"
              v-for="(item, index) in this.tender.CSControl"
              :key="'info1-' + index"
            >
              <div>
                <b-button
                  v-b-toggle="`CS`"
                  :disabled="CS.checked"
                  block
                  class="btn_module"
                >
                  監造工務管理
                </b-button>
                <b-form-checkbox
                  v-model="CS.checked"
                  :disabled="isFix"
                  name="check-button"
                  switch
                >
                  <b>
                    <span v-if="CS.checked">已關閉</span>
                    <span v-else>已開啟</span>
                  </b>
                </b-form-checkbox>
                <b-collapse
                  :id="`CS`"
                  style="padding: 0 15px 15px 15px"
                  class="mt-2"
                >
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >基本資料</span
                    >
                  </div>
                  <b-row style="margin-top: 10px">
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">單位名稱：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.organizer"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">電子郵件：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.email"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">聯絡地點：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.address"
                      ></b-form-input>
                    </b-col>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">聯絡人：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.contactPerson"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">聯絡電話：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.contactNumber"
                      ></b-form-input>
                    </b-col>
                  </b-row>
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >參數設置</span
                    >
                  </div>
                  <b-row>
                    <b-col cols="6">
                     <span style="color: black; font-weight:700;">發文預設單位：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="CS.issuer"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">發文預設字號：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="CS.issue_text_number"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">輸出Title：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="CS.title"
                      ></b-form-input>
                    </b-col>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">發文限辦天數：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="CS.issueHandlingDay"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">收文限辦天數：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="CS.receiveHandlingDay"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">輸出書函時，內部存檔用之名稱：</span
                      >
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="CS.outputFileName"
                      ></b-form-input>
                    </b-col>
                  </b-row>
                </b-collapse>
              </div>
            </b-card>
            <!-- 施工管理 -->
            <b-card
              no-body
              class="mb-1"
              v-for="(item, index) in this.tender.ManagementControl"
              :key="'info3-' + index"
            >
              <div>
                <b-button
                  v-b-toggle="`Management`"
                  :disabled="Management.checked"
                  block
                  class="btn_module"
                >
                  施工管理
                </b-button>
                <b-form-checkbox
                  v-model="Management.checked"
                  :disabled="isFix"
                  name="check-button"
                  switch
                >
                  <b>
                    <span v-if="Management.checked">已關閉</span>
                    <span v-else>已開啟</span>
                  </b>
                </b-form-checkbox>
                <b-collapse
                  :id="`Management`"
                  style="padding: 0 15px 15px 15px"
                  class="mt-2"
                >
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >基本資料</span
                    >
                  </div>
                  <b-row style="margin-top: 10px">
                    <b-col cols="6">
                       <span style="color: black; font-weight:700;">單位名稱：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.organizer"
                      ></b-form-input>
                     <span style="color: black; font-weight:700;">電子郵件：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.email"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">聯絡地點：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.address"
                      ></b-form-input>
                    </b-col>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">聯絡人：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.contactPerson"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">聯絡電話：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="item.contactNumber"
                      ></b-form-input>
                    </b-col>
                  </b-row>
                  <div class="infoTitle">
                    <span class="midText" style="font-weight: bold"
                      >參數設置</span
                    >
                  </div>
                  <b-row>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">發文預設單位：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="Management.issuer"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">發文預設字號：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="Management.issue_text_number"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">輸出Title：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="Management.title"
                      ></b-form-input>
                    </b-col>
                    <b-col cols="6">
                      <span style="color: black; font-weight:700;">發文限辦天數：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="Management.issueHandlingDay"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">收文限辦天數：</span>
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="Management.receiveHandlingDay"
                      ></b-form-input>
                      <span style="color: black; font-weight:700;">輸出書函時，內部存檔用之名稱：</span
                      >
                      <b-form-input
                        :disabled="isFix"
                        style="width: 100%; font-size: 16px"
                        v-model="Management.outputFileName"
                      ></b-form-input>
                    </b-col>
                  </b-row>
                </b-collapse>
              </div>
            </b-card>
        </div>
      </b-row>
    </div>
  </b-container>
</template>

<script>
import { mapState, mapActions } from 'vuex'
import moment from 'moment'

export default {
  props: ['isAddProject'],
  data () {
    return {
      PCM: {
        group: 'PCM',
        issuer: '',
        issue_text_number: '',
        title: '',
        issueHandlingDay: '',
        receiveHandlingDay: '',
        outputFileName: '',
        checked: false
      },
      CS: {
        group: 'CS',
        issuer: '',
        issue_text_number: '',
        title: '',
        issueHandlingDay: '',
        receiveHandlingDay: '',
        outputFileName: '',
        checked: false
      },
      Management: {
        group: 'Management',
        issuer: '',
        issue_text_number: '',
        title: '',
        issueHandlingDay: '',
        receiveHandlingDay: '',
        outputFileName: '',
        checked: false
      },
      Host: {
        group: 'Host',
        issuer: '',
        issue_text_number: '',
        title: '',
        issueHandlingDay: '',
        receiveHandlingDay: '',
        outputFileName: '',
        checked: false
      },
      Design: {
        group: 'Design',
        issuer: '',
        issue_text_number: '',
        title: '',
        issueHandlingDay: '',
        receiveHandlingDay: '',
        outputFileName: '',
        checked: false
      },
      the: [
        {
          group: '',
          issuer: '',
          issue_text_number: '',
          title: '',
          issueHandlingDay: '',
          receiveHandlingDay: '',
          outputFileName: '',
          checked: false
        }
      ],
      isFix: true
    }
  },
  methods: {
    ...mapActions('tenders', [
      'lookupTender',
      'post',
      'patch',
      'getTenderList'
    ]),
    async editSave () {
      if (!this.isFix) {
        let yes = confirm('確認修改專案資料?')
        if (yes) {
          this.isFix = true
          this.$emit('isCloseFalse')
          await this.patch({ tenderId: this.currentUser.defaultTender })
          alert('已修改專案資料!')
          await this.getTenderList()
        }
      } else {
        this.isFix = false
        this.$emit('isCloseTrue')
      }
    },
    async addProject () {
      var yes = confirm('確定新增標別?')
      if (yes) {
        await this.post()
        alert('新增成功 恭喜~~~~~')
        this.$emit('addProject')
      } else {
        alert('取消儲存')
      }
    },
    cancelAddProject () {
      let yes = confirm('確定要離開嗎???? 你確定?')
      if (yes) {
        alert('取消成功')
        this.$emit('cancelAddProject')
      }
    },
    addNewProject () {
      this.isFix = false
    },
    async dropdownSave () {
      await this.editSave()
    },
    getFormattedDate (date) {
      // 轉換日期格式
      let d = null
      if (date) {
        return moment(date).format('YYYY-MM-DD')
      } else {
        return d
      }
    }
  },
  async mounted () {
    await this.$store.dispatch('tenders/lookupTender', this.currentUser.defaultTender)
  },
  computed: {
    ...mapState({
      tender: (state) => state.tenders.tenders,
      currentUser: (state) => state.user.current
    })
  }
}
</script>

<style scoped>
.custom-switch {
  padding-left: 4rem;
  padding-top: 5px;
}
.btn_module {
  background-color: rgb(75, 102, 255);
  font-size: 16px;
  color: #ffffff;
  width: 100%;
}
.infoTitle {
  position: relative;
  margin-top: 20px;
  margin-bottom: 20px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  height: 2px;
  background-color: #1d325f;
  text-align: center;
  font-size: 20px;
  color: #1d325f;
}
.midText {
  position: absolute;
  left: 50%;
  background-color: #ffffff;
  padding: 0 10px 0 10px;
  transform: translateX(-50%) translateY(-50%);
}
.btn {
  background-color: rgb(75, 102, 255);
  font-size: 15px;
  padding-left: 13px;
  padding-right: 13px;
  padding-top: 7px;
  padding-bottom: 7px;
  color: #ffffff;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
  border: none;
}
.btn:hover {
  color: rgb(255, 255, 255);
  background-color: rgb(49, 68, 175);
  transform: translateY(0);
}
.text {
  padding-left: 30px;
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
}
.col-2 {
  padding-right: 0px;
}
.col-4 {
  padding-left: 0px;
}
.col-10 {
  padding-left: 0px;
}
.form-control {
  color: black !important;
}
.form-control:disabled {
  background-color: #ffffff;
  background: none;
  border: 0;
  color: black;
}
::-webkit-scrollbar {
  width: 3px;
}
::-webkit-scrollbar-track {
  border-radius: 10px;
  background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
  border-radius: 15px;
  background: #888;
}
::-webkit-scrollbar-thumb:hover {
  background: #555;
}
</style>
