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

const tab = ref('opportunity')
const tabs = ref([
  {value: 'opportunity', text: 'Opportunity'},
  {value: 'translation', text: 'Translation'}
])

const openTab = async (val) => {
  if(tab.value !== val) {
    tab.value = val
    sessionStorage.setItem('sales_campaign_detail_record', tab.value)
  }
}
onMounted(() => {
  const getSessionStorageTab = sessionStorage.getItem('sales_campaign_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)" />
    <PartnersPartnerDetailRecordLocation v-if="tab === 'location'" :action="action" :info="info" />
    <PartnersPartnerDetailRecordUser v-else-if="tab === 'user'" :action="action" :info="info" />
  </div>
</template>