|
@@ -156,6 +156,8 @@
|
|
|
:rules="[validateRequired]"
|
|
:rules="[validateRequired]"
|
|
|
label="Type de la structure*"
|
|
label="Type de la structure*"
|
|
|
:items="structureTypes"
|
|
:items="structureTypes"
|
|
|
|
|
+ item-value="value"
|
|
|
|
|
+ item-title="title"
|
|
|
required
|
|
required
|
|
|
/>
|
|
/>
|
|
|
</v-col>
|
|
</v-col>
|
|
@@ -165,11 +167,15 @@
|
|
|
:rules="[validateRequired]"
|
|
:rules="[validateRequired]"
|
|
|
label="Statut juridique*"
|
|
label="Statut juridique*"
|
|
|
:items="legalStatuses"
|
|
:items="legalStatuses"
|
|
|
|
|
+ item-value="value"
|
|
|
|
|
+ item-title="title"
|
|
|
required
|
|
required
|
|
|
/>
|
|
/>
|
|
|
</v-col>
|
|
</v-col>
|
|
|
</v-row>
|
|
</v-row>
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
<h2 class="section-title">Représentée par</h2>
|
|
<h2 class="section-title">Représentée par</h2>
|
|
|
|
|
|
|
|
<!-- Representative function -->
|
|
<!-- Representative function -->
|
|
@@ -241,7 +247,7 @@
|
|
|
<v-checkbox
|
|
<v-checkbox
|
|
|
v-model="trialRequest.legalRepresentative"
|
|
v-model="trialRequest.legalRepresentative"
|
|
|
:rules="[validateCheckbox]"
|
|
:rules="[validateCheckbox]"
|
|
|
- label="J'agis en tant que représentant légal de l'association.*"
|
|
|
|
|
|
|
+ label="J'agis en tant que représentant légal de l'association ou de la structure.*"
|
|
|
required
|
|
required
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
@@ -337,32 +343,24 @@
|
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
|
import type { Ref } from 'vue'
|
|
import type { Ref } from 'vue'
|
|
|
import { reactive } from 'vue'
|
|
import { reactive } from 'vue'
|
|
|
|
|
+import { useRuntimeConfig } from '#app'
|
|
|
import type { TrialRequest } from '~/types/interface'
|
|
import type { TrialRequest } from '~/types/interface'
|
|
|
|
|
+import { STRUCTURE_TYPE, LEGAL_STATUS } from '~/types/types'
|
|
|
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
|
|
|
|
|
const form: Ref<HTMLElement | null> = ref(null)
|
|
const form: Ref<HTMLElement | null> = ref(null)
|
|
|
|
|
|
|
|
// Structure types and legal statuses
|
|
// Structure types and legal statuses
|
|
|
-const structureTypes: Array<string> = [
|
|
|
|
|
- 'Orchestre',
|
|
|
|
|
- 'Chorale',
|
|
|
|
|
- 'Compagnie de théâtre',
|
|
|
|
|
- 'Compagnie de danse',
|
|
|
|
|
- 'Compagnie de cirque',
|
|
|
|
|
- 'Autre',
|
|
|
|
|
-]
|
|
|
|
|
-
|
|
|
|
|
-const legalStatuses: Array<string> = [
|
|
|
|
|
- 'Association loi 1901',
|
|
|
|
|
- 'SARL',
|
|
|
|
|
- 'SAS',
|
|
|
|
|
- 'EURL',
|
|
|
|
|
- 'Auto-entrepreneur',
|
|
|
|
|
- 'Établissement public',
|
|
|
|
|
- 'Collectivité territoriale',
|
|
|
|
|
- 'Autre',
|
|
|
|
|
-]
|
|
|
|
|
|
|
+const structureTypes = Object.values(STRUCTURE_TYPE).map((item) => ({
|
|
|
|
|
+ value: item.key,
|
|
|
|
|
+ title: item.label,
|
|
|
|
|
+})).sort((a, b) => (a.title > b.title ? 1 : -1))
|
|
|
|
|
+
|
|
|
|
|
+const legalStatuses = Object.values(LEGAL_STATUS).map((item) => ({
|
|
|
|
|
+ value: item.key,
|
|
|
|
|
+ title: item.label,
|
|
|
|
|
+})).sort((a, b) => (a.title > b.title ? 1 : -1))
|
|
|
|
|
|
|
|
// Trial request data
|
|
// Trial request data
|
|
|
const trialRequest = reactive<TrialRequest>({
|
|
const trialRequest = reactive<TrialRequest>({
|
|
@@ -372,8 +370,8 @@ const trialRequest = reactive<TrialRequest>({
|
|
|
postalCode: '',
|
|
postalCode: '',
|
|
|
city: '',
|
|
city: '',
|
|
|
structureEmail: '',
|
|
structureEmail: '',
|
|
|
- structureType: '',
|
|
|
|
|
- legalStatus: '',
|
|
|
|
|
|
|
+ structureType: 'ARTISTIC_PRACTICE_ONLY',
|
|
|
|
|
+ legalStatus: 'ASSOCIATION_LAW_1901',
|
|
|
siren: '',
|
|
siren: '',
|
|
|
representativeFirstName: '',
|
|
representativeFirstName: '',
|
|
|
representativeLastName: '',
|
|
representativeLastName: '',
|
|
@@ -418,12 +416,26 @@ const submit = async (): Promise<void> => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
- // Here you would normally send the data to your backend
|
|
|
|
|
- // For now, we'll just simulate a successful submission
|
|
|
|
|
- console.log('Trial request submitted:', trialRequest)
|
|
|
|
|
|
|
+ const config = useRuntimeConfig()
|
|
|
|
|
+ const apiUrl = `${config.public.apiBaseUrl}/trial/artists_premium`
|
|
|
|
|
+
|
|
|
|
|
+ console.log('Sending trial request to:', apiUrl)
|
|
|
|
|
+
|
|
|
|
|
+ // Send the data to the API
|
|
|
|
|
+ const response = await fetch(apiUrl, {
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ 'Content-Type': 'application/json',
|
|
|
|
|
+ },
|
|
|
|
|
+ body: JSON.stringify(trialRequest),
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ if (!response.ok) {
|
|
|
|
|
+ throw new Error(`API request failed with status ${response.status}`)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // Simulate API call delay
|
|
|
|
|
- await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
|
|
|
|
|
+ const data = await response.json()
|
|
|
|
|
+ console.log('Trial request submitted successfully:', data)
|
|
|
|
|
|
|
|
trialRequestSent.value = true
|
|
trialRequestSent.value = true
|
|
|
errorMsg.value = null
|
|
errorMsg.value = null
|
|
@@ -431,6 +443,7 @@ const submit = async (): Promise<void> => {
|
|
|
// Scroll to top to show confirmation message
|
|
// Scroll to top to show confirmation message
|
|
|
setTimeout(() => router.push({ path: '', hash: '#anchor' }), 30)
|
|
setTimeout(() => router.push({ path: '', hash: '#anchor' }), 30)
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
|
|
+ console.error('Error submitting trial request:', e)
|
|
|
errorMsg.value =
|
|
errorMsg.value =
|
|
|
"Une erreur s'est produite lors de l'activation de votre essai. Veuillez réessayer plus tard ou nous contacter directement."
|
|
"Une erreur s'est produite lors de l'activation de votre essai. Veuillez réessayer plus tard ou nous contacter directement."
|
|
|
}
|
|
}
|