| 1 |
<template> |
| 2 |
<!-- Add scenario-specific class for styling --> |
| 3 |
<IvyDialog |
| 4 |
v-model="dialogVisible" |
| 5 |
:show-close="true" |
| 6 |
width="468px" |
| 7 |
align-center |
| 8 |
:class="{ 'ivyforms-pro-upgrade-dialog--scenario-1': isScenario1 }" |
| 9 |
> |
| 10 |
<!-- Body content with icon, title and subtitle --> |
| 11 |
<div class="ivyforms-pro-upgrade-dialog__body"> |
| 12 |
<!-- Pro Icon --> |
| 13 |
<div |
| 14 |
class="ivyforms-pro-upgrade-dialog__icon ivyforms-flex ivyforms-align-items-center ivyforms-justify-content-center ivyforms-mb-16" |
| 15 |
> |
| 16 |
<IvyIcon |
| 17 |
:name="dialogData.iconName || 'pro-lightning'" |
| 18 |
type="fill-duo" |
| 19 |
size="l" |
| 20 |
outer-size="40px" |
| 21 |
category="global" |
| 22 |
color="var(--map-accent-amber-symbol-0)" |
| 23 |
/> |
| 24 |
</div> |
| 25 |
|
| 26 |
<h3 v-if="dialogData.title" class="ivyforms-pro-upgrade-dialog__title medium-18"> |
| 27 |
{{ dialogData.title }} |
| 28 |
</h3> |
| 29 |
<p v-if="dialogData.subtitle" class="ivyforms-pro-upgrade-dialog__subtitle regular-14"> |
| 30 |
{{ dialogData.subtitle }} |
| 31 |
</p> |
| 32 |
</div> |
| 33 |
|
| 34 |
<!-- Footer with buttons --> |
| 35 |
<template #footer> |
| 36 |
<div |
| 37 |
class="ivyforms-pro-upgrade-dialog__footer ivyforms-flex ivyforms-gap-12 ivyforms-justify-content-center ivyforms-flex-direction-row" |
| 38 |
> |
| 39 |
<IvyButtonAction |
| 40 |
v-if="dialogData.buttons?.confirm" |
| 41 |
priority="secondary" |
| 42 |
size="d" |
| 43 |
full-width |
| 44 |
@click="handleConfirm" |
| 45 |
> |
| 46 |
{{ dialogData.buttons.confirm.text }} |
| 47 |
</IvyButtonAction> |
| 48 |
<IvyButtonAction |
| 49 |
v-if="dialogData.buttons?.close" |
| 50 |
:priority="dialogData.buttons.close.type || 'tertiary'" |
| 51 |
size="d" |
| 52 |
full-width |
| 53 |
@click="handleClose" |
| 54 |
> |
| 55 |
{{ dialogData.buttons.close.text }} |
| 56 |
</IvyButtonAction> |
| 57 |
</div> |
| 58 |
</template> |
| 59 |
</IvyDialog> |
| 60 |
</template> |
| 61 |
|
| 62 |
<script setup lang="ts"> |
| 63 |
import { storeToRefs } from 'pinia' |
| 64 |
import { computed } from 'vue' |
| 65 |
import { useProUpgradeDialogStore } from '@/stores/proUpgradeDialogStore' |
| 66 |
import IvyDialog from '@/views/_components/dialog/IvyDialog.vue' |
| 67 |
import IvyButtonAction from '@/views/_components/button/IvyButtonAction.vue' |
| 68 |
import IvyIcon from '@/views/_components/icon/IvyIcon.vue' |
| 69 |
|
| 70 |
const proUpgradeStore = useProUpgradeDialogStore() |
| 71 |
const { dialogVisible, dialogData } = storeToRefs(proUpgradeStore) |
| 72 |
|
| 73 |
// Scenario 1: Pro not installed (has two buttons - close and confirm) |
| 74 |
// Scenario 2: Pro installed but not activated (has only confirm button) |
| 75 |
const isScenario1 = computed(() => { |
| 76 |
return !!(dialogData.value.buttons?.close && dialogData.value.buttons?.confirm) |
| 77 |
}) |
| 78 |
|
| 79 |
const handleClose = () => { |
| 80 |
if (dialogData.value.buttons?.close?.function) { |
| 81 |
dialogData.value.buttons.close.function() |
| 82 |
} |
| 83 |
dialogVisible.value = false |
| 84 |
} |
| 85 |
|
| 86 |
const handleConfirm = () => { |
| 87 |
if (dialogData.value.buttons?.confirm?.function) { |
| 88 |
dialogData.value.buttons.confirm.function() |
| 89 |
} |
| 90 |
dialogVisible.value = false |
| 91 |
} |
| 92 |
</script> |
| 93 |
|
| 94 |
<style lang="scss" scoped> |
| 95 |
.ivyforms-pro-upgrade-dialog { |
| 96 |
&__body { |
| 97 |
text-align: center; |
| 98 |
} |
| 99 |
|
| 100 |
&__title { |
| 101 |
margin: 0 0 12px 0; |
| 102 |
color: var(--map-base-text-0); |
| 103 |
font-size: 18px; |
| 104 |
font-weight: 500; |
| 105 |
line-height: 1.4; |
| 106 |
} |
| 107 |
|
| 108 |
&__subtitle { |
| 109 |
margin: 0; |
| 110 |
color: var(--map-base-text--1); |
| 111 |
font-size: 14px; |
| 112 |
line-height: 1.5; |
| 113 |
} |
| 114 |
|
| 115 |
&__footer { |
| 116 |
@media (max-width: 480px) { |
| 117 |
flex-direction: column; |
| 118 |
} |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
// Scenario 1 (Pro not installed) - CSS for dialog body and footer |
| 123 |
.ivyforms-pro-upgrade-dialog--scenario-1 { |
| 124 |
:deep(.el-dialog__body) { |
| 125 |
.ivyforms-dialog__body { |
| 126 |
padding: 0 !important; |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
:deep(.el-dialog__footer) { |
| 131 |
border-top: none !important; |
| 132 |
justify-content: center !important; |
| 133 |
} |
| 134 |
} |
| 135 |
|
| 136 |
// Ensure dialog appears above modals (IvyModal has z-index: 10000) |
| 137 |
:deep(.el-overlay) { |
| 138 |
z-index: 10001 !important; |
| 139 |
} |
| 140 |
</style> |
| 141 |
|