<template>
  <div class="eibs-tab">
    <!-- left -->
    <c-col :span="11">
      <!-- <c-col :span="24">
        <c-col :span="18">
          <el-form-item label="Reference" prop="ledgrp.rec.ownref">
            <c-input
              v-model="model.ledgrp.rec.ownref"
              maxlength="16"
              placeholder="Please input Reference"
              style="width: 95%"
              :disabled="true"
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="6">
          <c-button
            size="small"
            type="primary"
            @click="onSeainf"
            icon="el-icon-search"
          ></c-button>
          <c-button
            size="small"
            type="primary"
            :disabled="
              model.ledgrp.ben.pts.adrblk && !model.ledgrp.rec.ownref
                ? false
                : true
            "
            @click="onLetpButgetref"
          >
            Get
          </c-button>
        </c-col>
      </c-col> -->
      <c-col :span="24">
        <c-col :span="20">
          <el-form-item
            label="Reference"
            prop="ledgrp.rec.ownref"
            style="width: 100%"
          >
            <c-input
              v-model="model.ledgrp.rec.ownref"
              maxlength="16"
              placeholder="Please input Reference"
              style="width: 95%"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <!-- <c-col :span="1" style="text-align: right"> -->
        <c-col :span="1">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 10px 0 0; padding: 0 12px"
            size="small"
            type="primary"
          >
            <span
              style="font-size: 15px; font-family: '宋体'; font-weight: bold"
              >i</span
            >
          </c-button>
          <!-- </el-form-item> -->
        </c-col>
        <c-col :span="2" :offset="1" style="text-align: right">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 0"
            size="small"
            type="primary"
            :disabled="this.flag"
          >
            Get
          </c-button>
          <!-- </el-form-item> -->
        </c-col>
        <!-- </c-col> -->
      </c-col>
      <c-col :span="24">
        <el-form-item label="Form of L/C" prop="ledgrp.rec.lcrtyp">
          <c-select
            v-model="model.ledgrp.rec.lcrtyp"
            style="width: 100%"
            placeholder="Please select Form of L/C"
            :code="codes.lcrtyp1"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <c-col :span="23">
          <el-form-item
            label="Responsible User"
            prop="letp.usr.extkey"
            style="width: 100%"
          >
            <c-input
              v-model="model.letp.usr.extkey"
              maxlength="16"
              placeholder="Please input Reference"
              style="width: 95%"
              disabled
            ></c-input>
          </el-form-item>
        </c-col>
        <!-- <c-col :span="1" style="text-align: right"> -->
        <c-col :span="1">
          <!-- <el-form-item label="" label-width="5px"> -->
          <c-button
            style="margin: 0 10px 0 0; padding: 0 12px"
            size="small"
            type="primary"
          >
            <span
              style="font-size: 15px; font-family: '宋体'; font-weight: bold"
              >i</span
            >
          </c-button>
          <!-- </el-form-item> -->
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Nominal Amount" prop="ledgrp.cbs.nom1.cur">
            <c-select
              v-model="model.ledgrp.cbs.nom1.cur"
              style="width: 100%"
              placeholder="Please select cur"
              :code="codes.curtxt1"
            >
            </c-select>
          </el-form-item>
        </c-col>


        <c-col :span="12">
          <el-form-item label="" label-width="20px" prop="ledgrp.cbs.nom1.amt">
            <c-input-currency
              v-model="model.ledgrp.cbs.nom1.amt"
              style="width: 100%"
              placeholder="Please input Nominal Amount"
            ></c-input-currency>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="14">
          <el-form-item label="Amount Tolerance +/-" prop="ledgrp.rec.nomtop">
            <c-input
              v-model="model.ledgrp.rec.nomtop"
              placeholder="Please input Amount Tolerance +/-"
            ></c-input>
          </el-form-item>
        </c-col>
        <c-col :span="10">
          <el-form-item label="" label-width="20px" prop="ledgrp.rec.nomton">
            <c-input
              v-model="model.ledgrp.rec.nomton"
              style="width: 100%"
              placeholder="Please input Amount Tolerance - Negative"
            ></c-input>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <el-form-item label="Amount Specification" prop="ledgrp.rec.nomspc">
          <c-select
            v-model="model.ledgrp.rec.nomspc"
            style="width: 100%"
            placeholder="Please select Amount Specification"
            :code="codes.nomspc"
            :disabled="true"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Maximum Amount" prop="ledgrp.cbs.max.cur">
            <c-select
              v-model="model.ledgrp.cbs.max.cur"
              style="width: 100%"
              placeholder="Please select cur"
              disabled
              :code="codes.curtxt1"
            >
            </c-select>
          </el-form-item>
        </c-col>

        <c-col :span="12">
          <el-form-item label="" label-width="20px" prop="ledgrp.cbs.max.amt">
            <c-input-currency
              v-model="model.ledgrp.cbs.max.amt"
              placeholder="Please input Maximum Amount"
              disabled
            ></c-input-currency>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Issued on" prop="ledgrp.rec.opndat">
            <c-date-picker
              type="date"
              v-model="model.ledgrp.rec.opndat"
              style="width: 100%"
              placeholder="Please select Issued on"
            ></c-date-picker>
          </el-form-item>
        </c-col>
        <c-col :span="12">
          <el-form-item
            label="Date Pre-advised"
            label-width="130px"
            prop="ledgrp.rec.preadvdt"
          >
            <c-date-picker
              type="date"
              v-model="model.ledgrp.rec.preadvdt"
              style="width: 100%"
              placeholder="Please select Date Pre-advised"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="Shipment Date" prop="ledgrp.rec.shpdat">
            <c-date-picker
              type="date"
              v-model="model.ledgrp.rec.shpdat"
              style="width: 100%"
              placeholder="Please select Shipment Date"
            ></c-date-picker>
          </el-form-item>
        </c-col>

        <c-col :span="12">
          <el-form-item
            label="Released on"
            label-width="130px"
            prop="ledgrp.rec.advdat"
          >
            <c-date-picker
              type="date"
              v-model="model.ledgrp.rec.advdat"
              style="width: 100%"
              placeholder="Please select Released on"
              disabled
            ></c-date-picker>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <el-form-item label="Expiring on" prop="ledgrp.rec.expdat">
          <c-date-picker
            type="date"
            v-model="model.ledgrp.rec.expdat"
            style="width: 100%"
            placeholder="Please select Expiring on"
          ></c-date-picker>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="in (Place)/counters of" prop="ledgrp.rec.expplc">
          <c-input
            v-model="model.ledgrp.rec.expplc"
            maxlength="29"
            placeholder="Please input in (Place)/counters of"
          ></c-input>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="Confirmation Instruct" prop="ledgrp.rec.cnfdet">
          <c-select
            v-model="model.ledgrp.rec.cnfdet"
            style="width: 100%"
            placeholder="Please select Confirmation Instruct"
            :code="codes.cnfins"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="Applicable Rules" prop="ledgrp.rec.apprul">
          <c-select
            v-model="model.ledgrp.rec.apprul"
            style="width: 100%"
            placeholder="Please select Applicable Rules"
            :code="codes.apprul"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item
          label="Other Applicable Rules"
          prop="ledgrp.rec.apprultxt"
        >
          <c-input
            v-model="model.ledgrp.rec.apprultxt"
            maxlength="35"
            placeholder="Please input Other Applicable Rules"
            :disabled="model.ledgrp.rec.apprul === 'OTHR' ? false : true"
          ></c-input>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="Partial Shipment" prop="ledgrp.rec.shppar">
          <c-select
            v-model="model.ledgrp.rec.shppar"
            style="width: 100%"
            placeholder="Please select Partial Shipment"
            :code="codes.shptrss18"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <el-form-item label="Transshipment" prop="ledgrp.rec.shptrss18">
          <c-select
            v-model="model.ledgrp.rec.shptrss18"
            style="width: 100%"
            placeholder="Please select Transshipment"
            :code="codes.shptrss18"
          >
          </c-select>
        </el-form-item>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="" prop="letp.aamp.aammod.addamtflg">
          <c-checkbox :disabled="true" v-model="model.ledgrp.rec.collflg"
            >Collateralized L/C</c-checkbox
          >
          </el-form-item>
        </c-col>

        <c-col :span="12">
          <el-form-item label="" prop="letp.aamp.aammod.addamtflg">
            <c-checkbox v-model="model.letp.aamp.aammod.addamtflg">Add. Amount</c-checkbox>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="" prop="ledgrp.rec.inctrf">
          <c-checkbox v-model="model.ledgrp.rec.inctrf" disabled>Incoming Transfer</c-checkbox>
        </el-form-item>
        </c-col>
        

        <c-col :span="12">
          <el-form-item label="" prop="ledgrp.rec.resflg">
            <c-checkbox v-model="resflg">Reserved Contract</c-checkbox>
          </el-form-item>
        </c-col>
      </c-col>
    </c-col>

    <!-- right -->
    <c-col :span="11" :offset="1">
      <c-col :span="24">
        <el-form-item label="Name" prop="ledgrp.rec.nam">
          <c-input
            v-model="model.ledgrp.rec.nam"
            maxlength="40"
            placeholder="Please input Name"
            disabled
          ></c-input>
        </el-form-item>
      </c-col>

      <c-ptap
        :model="model"
        :argadr="{
          title: 'Beneficiary',
          grp: 'ledgrp',
          rol: 'ben',
        }"
        :disabled="true"
        @onSeainf="onSeainf"
        @onAplpDet="onBenpDet"
      >
      </c-ptap>

      <c-ptap
        :model="model"
        :argadr="{
          title: 'Issuer',
          grp: 'ledgrp',
          rol: 'iss',
        }"
        :disabled="true"
        @onSeainf="onSeainf"
        @onAplpDet="onIsspDet"
      >
      </c-ptap>

      <c-ptap
        :model="model"
        :argadr="{
          title: 'Applicant',
          grp: 'ledgrp',
          rol: 'apl',
        }"
        :disabled="true"
        @onSeainf="onSeainf"
        @onAplpDet="onAplpDet"
      >
      </c-ptap>

      <c-col :span="24">
        <c-col :span="12">
          <el-form-item label="" prop="ledgrp.rec.revflg">
            <c-checkbox v-model="model.ledgrp.rec.revflg">Revolving Flag</c-checkbox>
          </el-form-item>
        </c-col>

        <!-- Authorization to Debit -->
        <c-col :span="12">
          <el-form-item label="" prop="ledgrp.rec.dbtflg">
            <c-checkbox v-model="dbtflg">Authorization to Debit</c-checkbox>
          </el-form-item>
        </c-col>
      </c-col>

      <c-col :span="24">
        <!-- Non-Bank Issuer -->
        <c-col :span="12">
          <el-form-item label="" prop="ledgrp.rec.nonban">
            <c-checkbox v-model="nonban">Non-Bank Issuer</c-checkbox>
          </el-form-item>
        </c-col>

        <!-- Test Key Unconfirmity -->
        <c-col :span="12">
          <el-form-item label="" prop="ledgrp.rec.teskeyunc">
            <c-checkbox v-model="teskeyunc"
              >Test Key Unconfirmity</c-checkbox
            >
          </el-form-item>
        </c-col>
      </c-col>
    </c-col>
  </div>
</template>
<script>
import Api from "~/service/Api";
import commonProcess from "~/mixin/commonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Letopn/Event";
import Ptap from "~/views/Public/Ptap";
// import Amtpanl from "~/views/Public/Amtpanl";

export default {
  components: { "c-ptap": Ptap },
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [commonProcess],
  data() {
    return {};
  },
  computed: {
    flag() {
      return this.model.mtabut.coninf.usr.extkey == "";
    },
    // addamtflg: {
    //   get() {
    //     return this.model.letp.aamp.aammod.addamtflg != "";
    //   },
    //   set(val) {
    //     this.model.letp.aamp.aammod.addamtflg = val ? "X" : "";
    //   },
    // },
    resflg: {
      get() {
        return this.model.ledgrp.rec.resflg != "";
      },
      set(val) {
        this.model.ledgrp.rec.resflg = val ? "X" : "";
      },
    },
    // revflg: {
    //   get() {
    //     return this.model.ledgrp.rec.revflg != "";
    //   },
    //   set(val) {
    //     this.model.ledgrp.rec.revflg = val ? "X" : "";
    //   },
    // },
    dbtflg: {
      get() {
        return this.model.ledgrp.rec.dbtflg != "";
      },
      set(val) {
        this.model.ledgrp.rec.dbtflg = val ? "X" : "";
      },
    },
    nonban: {
      get() {
        return this.model.ledgrp.rec.nonban != "";
      },
      set(val) {
        this.model.ledgrp.rec.nonban = val ? "X" : "";
      },
    },
    teskeyunc: {
      get() {
        return this.model.ledgrp.rec.teskeyunc != "";
      },
      set(val) {
        this.model.ledgrp.rec.teskeyunc = val ? "X" : "";
      },
    },
  },
  methods: {
    ...Event,
    // @change="apprulChange"
    // apprulChange(v) {
    //   if (v !== "OTHR") {
    //     this.model.ledgrp.rec.apprultxt = "";
    //   }
    // },
  },
  created: function () {},
};
</script>
<style>
</style>
