2024-03-28 18:14:30 +01:00
|
|
|
<template>
|
2024-04-15 19:39:03 +02:00
|
|
|
<IntegrationWrapper
|
|
|
|
|
v-model="props.integrationData"
|
|
|
|
|
:integration="props.integration"
|
|
|
|
|
:form="form"
|
|
|
|
|
>
|
2024-08-29 13:28:02 +02:00
|
|
|
<div class="mb-4">
|
|
|
|
|
<p class="text-gray-500 mb-4">
|
|
|
|
|
Adds new entry to spreadsheets on each form submission.
|
|
|
|
|
</p>
|
|
|
|
|
<FlatSelectInput
|
2024-06-05 15:35:46 +02:00
|
|
|
v-if="providers.length"
|
|
|
|
|
v-model="integrationData.oauth_id"
|
|
|
|
|
name="provider"
|
|
|
|
|
:options="providers"
|
2024-08-29 13:28:02 +02:00
|
|
|
:disable-options="disableProviders"
|
|
|
|
|
disable-options-tooltip="Re-connect account to fix permissions"
|
2024-07-17 14:22:54 +02:00
|
|
|
display-key="email"
|
2024-06-05 15:35:46 +02:00
|
|
|
option-key="id"
|
|
|
|
|
emit-key="id"
|
|
|
|
|
:required="true"
|
|
|
|
|
label="Select Google Account"
|
|
|
|
|
>
|
|
|
|
|
<template #help>
|
|
|
|
|
<InputHelp>
|
|
|
|
|
<span>
|
|
|
|
|
<NuxtLink
|
2024-08-29 13:28:02 +02:00
|
|
|
class="text-blue-500"
|
2024-06-05 15:35:46 +02:00
|
|
|
:to="{ name: 'settings-connections' }"
|
|
|
|
|
>
|
|
|
|
|
Click here
|
|
|
|
|
</NuxtLink>
|
|
|
|
|
to connect another account.
|
|
|
|
|
</span>
|
|
|
|
|
</InputHelp>
|
|
|
|
|
</template>
|
2024-08-29 13:28:02 +02:00
|
|
|
</FlatSelectInput>
|
2024-06-05 15:35:46 +02:00
|
|
|
|
|
|
|
|
<v-button
|
|
|
|
|
v-else
|
|
|
|
|
color="white"
|
|
|
|
|
:loading="providersStore.loading"
|
|
|
|
|
@click.prevent="connect"
|
|
|
|
|
>
|
|
|
|
|
Connect Google account
|
|
|
|
|
</v-button>
|
2024-03-28 18:14:30 +01:00
|
|
|
</div>
|
|
|
|
|
</IntegrationWrapper>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2024-08-29 13:28:02 +02:00
|
|
|
import FlatSelectInput from '~/components/forms/FlatSelectInput.vue'
|
2024-07-17 14:22:54 +02:00
|
|
|
import IntegrationWrapper from './components/IntegrationWrapper.vue'
|
2024-03-28 18:14:30 +01:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
integration: { type: Object, required: true },
|
|
|
|
|
form: { type: Object, required: true },
|
|
|
|
|
integrationData: { type: Object, required: true },
|
2024-07-17 14:22:54 +02:00
|
|
|
formIntegrationId: { type: Number, required: false, default: null }
|
2024-03-28 18:14:30 +01:00
|
|
|
})
|
2024-06-05 15:35:46 +02:00
|
|
|
|
|
|
|
|
const providersStore = useOAuthProvidersStore()
|
|
|
|
|
const providers = computed(() => providersStore.getAll.filter(provider => provider.provider == 'google'))
|
2024-08-29 13:28:02 +02:00
|
|
|
const disableProviders = computed(() => providersStore.getAll.filter(provider => !provider.scopes.includes(providersStore.googleDrivePermission)).map((provider) => provider.id))
|
2024-06-05 15:35:46 +02:00
|
|
|
|
2024-07-17 14:22:54 +02:00
|
|
|
function connect () {
|
2024-06-05 15:35:46 +02:00
|
|
|
providersStore.connect('google', true)
|
|
|
|
|
}
|
2024-03-28 18:14:30 +01:00
|
|
|
</script>
|