<?php
/*
 * @Overview 현장작업자용 실적 등록 팝업
 * @History 2024-04-25 / 최승연 / 최초작성
 */
include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
?>
<!-- 현장작업자 팝업 -->
<div id="popup_field">
  <div class="awn-popup-confirm custom-popup free-height">
    <div class="awn-popup-search mb-block btn-ksmain-inject-block">
      <!-- form 시작 -->
      <form name="frmWorkData" method="post" class="flexcol" @submit.prevent>
        <div class="form-button-container flexrow flexbetween gap10">

          <div class="form-button-box flexrow gap06 flex-3 min-width-572">
            <button type="button" v-for="(tab, idx) in tabs1" :key="idx" :class="{ on : activeTab === tab}"
              @click="popDrawSTD(`${tab}`)">{{ tab }}</button>
          </div>

          <div class="form-button-box flexrow gap06 flex-5 flexend">
            <button type="button" v-for="(tab, idx) in tabs2" :key="idx"
              :disabled="( (tab.id === 'isNoRun' || tab.id ==='isDone' ) && formData['RUNSTOP_GB'] !== 'R' ) || ( tab.id === 'isRun' && (formData['RUNSTOP_GB'] === 'R' ||  ( formData.ORD_QTY <= formData.PRD_TOT ) ) )"
              :class="{ on : activeTab === tab.name }" @click="showComponent(tab.id, tab.name)" class="gap10">
              <i v-if="tab.id=='isRun'" class="bi bi-play-fill"></i>
              <i v-if="tab.id=='isNoRun'" class="bi bi-pause-fill"></i>
              {{ tab.name }}
            </button>
          </div>

        </div>

        <!-- form 내용 -->
        <div class="form-contents">
          <div class="info-container flexcol flexbetween gap10">

            <!-- 작업자, 설비 -->
            <div class="flex-1 form-box flexrow">

              <div class="formdata flexcol gap06 flexcenter flex-1">
                <div class="input-container flexrow">
                  <div class="input-box flex-1 width-half">
                    <label for="WO_NO">생산오더</label>
                    <input v-model="formData.WO_NO" type="text" id="WO_NO" name="WO_NO"
                      class="form-control form-control-sm" readonly />
                  </div>
                  <div class="input-box flex-1 width-half">
                    <label for="OP_STATUS">상태</label>
                    <input v-model="OP_STATUS[formData.OP_STATUS]" type="text" id="OP_STATUS" name="OP_STATUS"
                      class="form-control form-control-sm" :class="{ 
                            'yellow-back': formData.OP_STATUS === 'R',
                            'blue-back': formData.OP_STATUS === 'F',
                            'orange-back': formData.OP_STATUS === 'D',
                            'gray-back': formData.OP_STATUS === 'P',
                            'white-font': formData.OP_STATUS === 'P',
                            'red-back': formData.OP_STATUS === 'S',
                           }" readonly />
                  </div>
                </div>
                <div class="input-container flexrow gap06">
                  <div class="input-box flex-1">
                    <label for="OP_CD">공정</label>
                    <input v-model="formData.OP_CD" type="text" id="OP_CD" name="OP_CD"
                      class="form-control form-control-sm" readonly />
                  </div>
                </div>
                <div class="input-container flexrow">
                  <div class="input-box flex-1 width-half">
                    <label for="EMP_NO">사번</label>
                    <input v-model="formData.EMP_NO" type="text" id="EMP_NO" name="EMP_NO"
                      class="form-control form-control-sm" @keydown.enter="callEMP" @change="callEMP">
                  </div>
                  <div class="input-box flex-1 width-half">
                    <label for="EMP_NM">작업자</label>
                    <input v-model="formData.EMP_NM" type="text" id="EMP_NM" name="EMP_NM" readonly
                      class="form-control form-control-sm" />
                  </div>
                </div>
              </div>

              <div class="tabledata flexrow flexfillcenter flex-5 gap20">
                <div class="table-box height-full flex-5" id="isWorker" v-if="isComponent['isFacility']">
                  <div class="hy-table height-18 width-half" id="isWorker_table"></div>
                </div>
                <div class="table-box height-full flex-5" id="isOperHst" v-if="isComponent['isRun']">
                  <div class="hy-table height-18 width-half" id="isOperHst_table"></div>
                </div>

                <div class="formdata flexcol gap06 flexfillcenter flexcenter flex-3">
                  <div class="input-container flexrow">
                    <div class="input-box flex-1 width-half">
                      <label for="FACLT_CD">설비코드</label>
                      <input v-model="formData.FACLT_CD" type="text" id="FACLT_CD" name="FACLT_CD"
                        class="form-control form-control-sm" @keydown.enter="callFACLT" @change="callFACLT">
                    </div>
                    <div class="input-box flex-1 width-half">
                      <label for="FACLT_NM">설비명</label>
                      <input v-model="formData.FACLT_NM" type="text" id="FACLT_NM" name="FACLT_NM" readonly
                        class="form-control form-control-sm" />
                    </div>
                  </div>
                  <div class="input-container flexrow">
                    <div class="input-box flex-1">
                      <label for="OPER_ST_TM">최초시작시간</label>
                      <input v-model="formData.OPER_ST_TM" type="text" id="OPER_ST_TM" name="OPER_ST_TM"
                        class="form-control form-control-sm" readonly />
                    </div>
                  </div>
                  <div class="input-container flexrow">
                    <div class="input-box flex-1">
                      <label for="OPER_ED_TM">최근종료시간</label>
                      <input v-model="formData.OPER_ED_TM" type="text" id="OPER_ED_TM" name="OPER_ED_TM"
                        class="form-control form-control-sm" readonly />
                    </div>
                  </div>

                </div>

                <div class="table-box height-full flex-9 width-half" id="isFacility" v-if="isComponent['isFacility']">
                  <div class="hy-table height-18 width-half" id="isFacility_table"></div>
                </div>

                <div class="table-box height-full flex-9 width-half" id="isRun" v-if="isComponent['isRun']">
                  <div class="hy-table height-18 width-half" id="isRun_table"></div>
                </div>
              </div>

            </div>

            <!-- 실적등록 -->
            <div class="flex-2 form-box flexrow">

              <div class="formdata flexcol gap06 flexcenter flex-1">
                <div class="input-container flexrow gap06">
                  <div class="input-box flex-1">
                    <label for="ITEM_CD">품목</label>
                    <input v-model="formData.ITEM_CD" type="text" id="ITEM_CD" name="ITEM_CD"
                      class="form-control form-control-sm" readonly />
                  </div>
                </div>
                <div class="input-container flexrow gap06">
                  <div class="input-box flex-1">
                    <label for="ITEM_NM">품명</label>
                    <input v-model="formData.ITEM_NM" type="text" id="ITEM_NM" name="ITEM_NM"
                      class="form-control form-control-sm" readonly />
                  </div>
                </div>
                <div class="input-container flexrow">
                  <div class="input-box flex-1 width-half">
                    <label for="">지시수량</label>
                    <input v-model="formData.ORD_QTY" type="text" id="ORD_QTY" name="ORD_QTY"
                      class="form-control form-control-sm" readonly />
                  </div>
                  <div class="input-box flex-1 width-half">
                    <label for="">이전양품수량</label>
                    <input v-model="formData.PRV_QTY" type="text" id="PRV_QTY" name="PRV_QTY"
                      class="form-control form-control-sm" readonly />
                  </div>
                </div>

                <div class="input-container flexrow">
                  <div class="input-box flex-1 width-half">
                    <label for="PRD_TOT">양품수량</label>
                    <input v-model="formData.PRD_TOT" type="text" id="PRD_TOT" name="PRD_TOT"
                      class="form-control form-control-sm" readonly />
                  </div>
                  <div class="input-box flex-1 width-half">
                    <label for="DEF_TOT">불량수량</label>
                    <input v-model="formData.DEF_TOT" type="text" id="DEF_TOT" name="DEF_TOT"
                      class="form-control form-control-sm" readonly />
                    <!-- <span><i class="fa-solid fa-arrow-pointer"></i></span> -->
                  </div>
                </div>
              </div>

              <div class="tabledata flexrow flexfillcenter flex-5 gap20">
                <div class="table-box height-full flex-1 width-half" id="isProd">
                  <div class="table-title flexrow flexbetween">
                    <p>양품수량</p>
                    <!-- 버튼 -->
                    <div class="button-box">
                      <div class="put-btn point-btn">
                        저장
                      </div>
                    </div>
                    <!-- 버튼 종료 // -->

                  </div>
                  <div class="hy-table width-half height-18" id="isProd_table"></div>
                </div>
                <div class="table-box height-full flex-1 width-half" id="isDef">
                  <div class="table-title flexrow flexbetween">
                    <p>불량수량</p>
                    <!-- 버튼 -->
                    <div class="button-box">
                      <div class="put-btn point-btn">
                        저장
                      </div>
                    </div>
                    <!-- 버튼 종료 // -->

                  </div>
                  <div class="hy-table width-half height-18" id="isDef_table"></div>
                </div>
              </div>

            </div>

            <!-- 검사실적 -->
            <div class="flex-3 form-box flexrow">

              <div class="tabledata flexcol flexfillcenter">
                <?php include _SVC_PATH_ . '/site/sts_order_prod/popComponent/isInsp.php' ?>
              </div>

            </div>

          </div>

        </div>
      </form>
    </div>
  </div>
</div>

<script src="../../base/item/item.js"></script>

