<template>
    <BasicModal v-bind="$attrs" @register="registerModal" width="1200px" :showOkBtn="false" :title="processName">
        <initiatesProjectsApproval :record="record" @close="exit" v-if="record.stage=='creatProjectinfo'"/>
        <uploadfileApproval :record="record" @close="exit"  v-if="record.stage=='supervisionFile'"/>
        <projectPlanApproval :record="record" @close="exit"  v-if="record.stage=='createPlaninfo'"/>
        <planFileApproval :record="record" @close="exit"  v-if="planfileNames.includes(record.stage)"/>
        <fieldChangeApproval :record="record" @close="exit"  v-if="record.stage=='fieldChange'"/>
        <contractApproval :record="record" @close="exit"  v-if="record.stage=='createContract'"/>
        <uploadURTfileApproval :record="record" @close="exit"  v-if="record.stage=='createURT'"/>
        <MergeProjectApprova :record="record" @close="exit"  v-if="record.stage=='MergeProject'"/>         
        <SplitProjectApprova :record="record" @close="exit"  v-if="record.stage=='SplitProject'"/> 
    </BasicModal>
</template>
<script lang="ts" name="ApprovalPageModel" setup>
import {ref} from "vue"
import { BasicModal, useModalInner } from '@/components/Modal';

import initiatesProjectsApproval from "../initiatesProjectsApproval.vue"
import planFileApproval from '@/views/ProcessApprovalSubPage/planFileApproval.vue'
import uploadfileApproval from '../uploadfileApproval.vue'
import projectPlanApproval from '../projectPlanApproval.vue'
import fieldChangeApproval from '../fieldChangeApproval.vue'
import contractApproval from '../contractApproval.vue'
import uploadURTfileApproval from '../uploadURTfileApproval.vue'
import MergeProjectApprova from '../MergeProjectApprova.vue'
import SplitProjectApprova from '../SplitProjectApprova.vue'

const planfileNames = ["feasibilityReportPreparation","jointTechnicalReview","centralizedCheck","createPlaninfoFile","bidDocumentsPreparation"]
const [registerModal, { closeModal }] = useModalInner(init);
defineProps(["record"])

let processName= ref()
let emit = defineEmits(["close"])
function exit(){
    closeModal()
    console.log("ApprovalPageModel")
    emit("close")
}
function init(initData){
    processName.value=initData.record.processName
}

</script>
<style></style>
  