<script setup>
defineProps({
  action: String,
  info: Object
})

const tab = ref('job_remuneration')
const tabs = ref([
  {value: 'job_remuneration', text: 'Job Position Remuneration'},
  {value: 'user_remuneration', text: 'User/Employee Remuneration'}
])

const openTab = async (val) => {
  if(tab.value !== val) {
    tab.value = val
    sessionStorage.setItem('remuneration_detail_record', tab.value)
  }
}
onMounted(() => {
  const getSessionStorageTab = sessionStorage.getItem('remuneration_detail_record')
  if(getSessionStorageTab) {
    openTab(getSessionStorageTab)
  }
})
</script>

<template>
  <div class="bt-2px_dashed_hexe2e2e2">
    <DetailRecordTab v-model="tab" :tabs="tabs" @handler="(val) => openTab(val.value)" />
    <PartnersRemunerationDetailRecordJob v-if="tab === 'job_remuneration'" :action="action" :info="info" />
    <PartnersRemunerationDetailRecordUser v-if="tab === 'user_remuneration'" :action="action" :info="info" />
  </div>
</template>