2023-12-09 15:47:03 +01:00
< template >
2024-08-23 12:23:01 +02:00
< VTransition >
< section
2024-04-15 19:39:03 +02:00
v - if = "hasCleanings && !hideWarning"
2024-08-23 12:23:01 +02:00
class = "flex gap-3 p-4 bg-blue-50 rounded-lg border border-blue-300 border-solid max-md:flex-wrap mb-2"
aria - labelledby = "notification-title"
2023-12-09 15:47:03 +01:00
>
2024-08-23 12:23:01 +02:00
< div class = "flex justify-center items-center self-start py-px" >
< Icon
name = "bi:stars"
class = "w-6 h-6 text-nt-blue"
/ >
< / div >
< div class = "flex flex-col flex-1 max-md:max-w-full" >
< div class = "flex flex-col text-sm leading-5 text-slate-900 max-md:max-w-full" >
< h5
id = "notification-title"
class = "font-medium max-md:max-w-full text-blue-500"
2024-04-15 19:39:03 +02:00
>
2024-08-23 12:23:01 +02:00
Upgrade to unlock all features
< / h5 >
< p class = "mt-2 max-md:max-w-full text-slate-500" >
< span v-if ="specifyFormOwner" > Only you are seeing this notification , as owner of the form. < / span > The
following features are disabled on the published form :
2023-12-09 15:47:03 +01:00
< / p >
2024-08-23 12:23:01 +02:00
< div
class = "text-slate-500"
2024-04-15 19:39:03 +02:00
v - html = "cleaningContent"
/ >
2023-12-09 15:47:03 +01:00
< / div >
2024-08-23 12:23:01 +02:00
< div class = "flex gap-0 self-start mt-2 text-xs font-medium leading-3 text-center" >
< UButton
v - track . form _cleanings _unlock _all _features
icon = "i-heroicons-check-badge-16-solid"
@ click . prevent = "onUpgradeClick"
>
< template v-if ="form.is_pro" >
Upgrade plan - Unlock all features
< / template >
< template v-else >
Start free trial - Unlock all features
< / template >
< / UButton >
< UButton
v - if = "specifyFormOwner"
variant = "link"
@ click . prevent = "hideWarning=true"
>
Dismiss
< / UButton >
< / div >
< / div >
< / section >
< / VTransition >
2023-12-09 15:47:03 +01:00
< / template >
2024-08-23 12:23:01 +02:00
2023-12-09 15:47:03 +01:00
< script >
2024-08-23 12:23:01 +02:00
import VTransition from '~/components/global/transitions/VTransition.vue'
2023-12-09 15:47:03 +01:00
export default {
2024-08-23 12:23:01 +02:00
name : 'FormCleanings' ,
components : { VTransition } ,
2023-12-09 15:47:03 +01:00
props : {
form : { type : Object , required : true } ,
specifyFormOwner : { type : Boolean , default : false } ,
2024-08-23 12:23:01 +02:00
hideable : { type : Boolean , default : false }
} ,
setup ( ) {
const subscriptionModalStore = useSubscriptionModalStore ( )
return {
subscriptionModalStore
}
2023-12-09 15:47:03 +01:00
} ,
2024-08-23 12:23:01 +02:00
data ( ) {
2023-12-09 15:47:03 +01:00
return {
collapseOpened : false ,
2024-08-23 12:23:01 +02:00
hideWarning : false
2023-12-09 15:47:03 +01:00
}
} ,
computed : {
2024-08-23 12:23:01 +02:00
hasCleanings ( ) {
2023-12-09 15:47:03 +01:00
return this . form . cleanings && Object . keys ( this . form . cleanings ) . length > 0
} ,
2024-08-23 12:23:01 +02:00
cleanings ( ) {
2023-12-09 15:47:03 +01:00
return this . form . cleanings
} ,
2024-08-23 12:23:01 +02:00
cleaningContent ( ) {
let message = ''
2023-12-09 15:47:03 +01:00
Object . keys ( this . cleanings ) . forEach ( ( key ) => {
let fieldName = key . charAt ( 0 ) . toUpperCase ( ) + key . slice ( 1 )
2024-08-23 12:23:01 +02:00
if ( fieldName !== 'Form' ) {
2023-12-09 15:47:03 +01:00
fieldName = '"' + fieldName + '" field'
}
2024-08-23 12:23:01 +02:00
let fieldInfo = '<br><span class="font-semibold">' + fieldName + '</span><br/><ul class=\'list-disc list-inside\'>'
2023-12-09 15:47:03 +01:00
this . cleanings [ key ] . forEach ( ( msg ) => {
2024-08-23 12:23:01 +02:00
if ( ! msg ) return
fieldInfo = fieldInfo + '<li>' + msg + '</li>'
2023-12-09 15:47:03 +01:00
} )
if ( fieldInfo ) {
2024-08-23 12:23:01 +02:00
message = message + fieldInfo + '</ul>'
2023-12-09 15:47:03 +01:00
}
} )
return message
2024-08-23 12:23:01 +02:00
}
2023-12-09 15:47:03 +01:00
} ,
methods : {
2024-08-23 12:23:01 +02:00
onUpgradeClick ( ) {
this . subscriptionModalStore . setModalContent ( 'Upgrade to unlock all features for your form' , 'Some features are disabled on the published form. Upgrade your plan to unlock these features and much more. Gain full access to all advanced features.' )
this . subscriptionModalStore . openModal ( )
}
}
2023-12-09 15:47:03 +01:00
}
< / script >