Browse Source

freemium archi

Vincent 5 months ago
parent
commit
5a4b432a1f

+ 19 - 0
config/abilities/pages/freemium.yaml

@@ -0,0 +1,19 @@
+freemium_dashboard_page:
+  action: 'display'
+  conditions:
+    - { function: organizationHasAnyModule, parameters: ['Freemium'] }
+
+freemium_organization_page:
+  action: 'display'
+  conditions:
+    - { function: organizationHasAnyModule, parameters: ['Freemium'] }
+
+freemium_event_create_page:
+  action: 'display'
+  conditions:
+    - { function: organizationHasAnyModule, parameters: ['Freemium'] }
+
+freemium_event_edit_page:
+  action: 'display'
+  conditions:
+    - { function: organizationHasAnyModule, parameters: ['Freemium'] }

+ 0 - 15
config/abilities/pages/myAccount.yaml

@@ -104,18 +104,3 @@ my_settings_page:
   action: 'display'
   conditions:
     - { function: organizationHasAnyModule, parameters: ['GeneralConfig'] }
-
-freemium_organization_page:
-  action: 'display'
-  conditions:
-    - { function: organizationHasAnyModule, parameters: ['Freemium'] }
-
-freemium_subscription_page:
-  action: 'display'
-  conditions:
-    - { function: organizationHasAnyModule, parameters: ['Freemium'] }
-
-freemium_events_page:
-  action: 'display'
-  conditions:
-    - { function: organizationHasAnyModule, parameters: ['Freemium'] }

+ 2 - 1
i18n/lang/fr.json

@@ -1,4 +1,5 @@
 {
+  "freemium_event_create_page": "Créer un nouvel événement",
   "search_gps_button": "Mettre à jour les coordonnées géographique.",
   "invalid_phone_number": "Numéro de téléphone non valide (exemple {example})",
   "tel": "Téléphone",
@@ -7,7 +8,7 @@
   "general_informations": "Informations générales",
   "freemium_organization_page": "Fiche de ma structure",
   "freemium_profile_page": "Mon profile",
-  "freemium_events_page": "Mes événements",
+  "freemium_dashboard_page": "Bienvenue sur votre compte Opentalent",
   "freemium_page": "Freemium",
   "i_subscribe": "Je m'abonne",
   "price_include_cmf": "Inclus avec votre adhésion CMF",

+ 22 - 18
pages/freemium/events.vue → pages/freemium/dashboard.vue

@@ -5,8 +5,8 @@
       <v-col cols="12" md="8">
         <v-card>
           <v-tabs v-model="tab">
-            <v-tab value="future">À venir</v-tab>
-            <v-tab value="past">Passés</v-tab>
+            <v-tab value="future">Mes événements à venir</v-tab>
+            <v-tab value="past">Mes événements passés</v-tab>
           </v-tabs>
 
           <v-tabs-window v-model="tab">
@@ -31,7 +31,7 @@
           </v-tabs-window>
 
           <v-card-actions>
-            <v-btn color="primary" @click="addEvent">Ajouter un événement</v-btn>
+            <v-btn color="primary" to="events/new">Ajouter un événement</v-btn>
           </v-card-actions>
         </v-card>
       </v-col>
@@ -41,12 +41,11 @@
         <v-card>
           <v-card-title>Structure</v-card-title>
           <v-card-text>
-            <div><strong>Nom:</strong> {{ structure.name }}</div>
-            <div><strong>Adresse:</strong> {{ structure.address }}</div>
-            <div><strong>Email:</strong> {{ structure.email }}</div>
+            <div><strong>Nom:</strong> {{ organization?.name }}</div>
+            <div><strong>Email:</strong> {{ organization?.email }}</div>
           </v-card-text>
           <v-card-actions>
-            <v-btn color="secondary" @click="editStructure">Modifier la structure</v-btn>
+            <v-btn color="secondary" to="organization">Modifier la structure</v-btn>
           </v-card-actions>
         </v-card>
       </v-col>
@@ -56,14 +55,29 @@
 
 <script setup lang="ts">
 
+import {useAp2iRequestService} from "~/composables/data/useAp2iRequestService";
+
 definePageMeta({
-  name: 'freemium_events_page',
+  name: 'freemium_dashboard_page',
 })
 
 import { ref } from 'vue'
+import {useEntityFetch} from "~/composables/data/useEntityFetch";
+import Organization from "~/models/Freemium/Organization";
+import type {AsyncData} from "#app";
 
 const tab = ref(null)
 
+
+const {apiRequestService, pending} = useAp2iRequestService()
+
+const { fetch } = useEntityFetch()
+
+const { data: organization } = fetch(
+  Organization
+) as AsyncData<Organization | null, Error | null>
+
+
 // Pagination state
 const upcomingPage = ref(1)
 const pastPage = ref(1)
@@ -91,12 +105,6 @@ const pastEvents = ref<Event[]>([{
   'image': "https://musiquesenstock.fr/wp-content/uploads/MES2025_AFF_H-1024x695.jpg"
 }])
 
-const structure = ref({
-  name: 'École de musique Demo',
-  address: '123 rue de la Musique',
-  email: 'contact@musique.fr'
-})
-
 function loadNextUpcoming() {
   upcomingPage.value++
   fetchUpcoming()
@@ -142,10 +150,6 @@ function addEvent() {
   console.log('add new event')
 }
 
-function editStructure() {
-  // TODO: navigate to edit structure page
-  console.log('edit structure')
-}
 </script>
 
 <style scoped>

+ 34 - 0
pages/freemium/events/new.vue

@@ -0,0 +1,34 @@
+<template>
+  <div>
+    <LayoutCommonSection>
+      <UiFormCreation
+        :model="ResidenceArea"
+        go-back-route="/parameters/residence_areas"
+      >
+        <template #default="{ entity }">
+          <v-container :fluid="true" class="container">
+            <v-row>
+              <v-col cols="12" sm="6">
+                <UiInputText
+                  v-model="entity.label"
+                  field="label"
+                  type="string"
+                  :rules="rules()"
+                />
+              </v-col>
+            </v-row>
+          </v-container>
+        </template>
+      </UiFormCreation>
+    </LayoutCommonSection>
+  </div>
+</template>
+
+<script setup lang="ts">
+import ResidenceArea from '~/models/Billing/ResidenceArea'
+
+definePageMeta({
+  name: 'freemium_event_create_page',
+})
+
+</script>

+ 77 - 87
pages/freemium/organization.vue

@@ -1,128 +1,118 @@
 <template>
-      <UiForm v-if="organization" v-model="organization">
+      <UiFormEdition :model="Organization">
+        <template #default="{ entity : organization }">
+          <div v-if="organization">
+            <LayoutCommonSection>
+              <v-row>
+                <v-col cols="12">
+                  <h4 class="mb-8">{{ $t('general_informations') }}</h4>
 
-        <LayoutCommonSection>
-          <v-row>
-            <v-col cols="12">
-              <h4 class="mb-8">{{ $t('general_informations') }}</h4>
+                  <UiInputText v-model="organization.name" field="name" :rules="getAsserts('name')" />
 
-              <UiInputText v-model="organization.name" field="name" :rules="getAsserts('name')" />
+                  <UiInputTextArea v-model="organization.description" field="description"  />
 
-              <UiInputTextArea v-model="organization.description" field="description"  />
+                  <UiInputImage
+                    v-model="organization.logo"
+                    field="logo"
+                    :width="120"
+                    :cropping-enabled="true"
+                  />
+                </v-col>
 
-              <UiInputImage
-                v-model="organization.logo"
-                field="logo"
-                :width="120"
-                :cropping-enabled="true"
-              />
-            </v-col>
+              </v-row>
+            </LayoutCommonSection>
 
-          </v-row>
-        </LayoutCommonSection>
+            <LayoutCommonSection>
+              <v-row>
+                <v-col cols="12">
+                  <h4 class="mb-8">{{ $t('coordinate') }}</h4>
 
-        <LayoutCommonSection>
-          <v-row>
-            <v-col cols="12">
-              <h4 class="mb-8">{{ $t('coordinate') }}</h4>
+                  <UiInputText v-model="organization.email" field="email" :rules="getAsserts('email')" />
 
-              <UiInputText v-model="organization.email" field="email" :rules="getAsserts('email')" />
+                  <UiInputPhone v-model="organization.tel" field="tel"/>
 
-              <UiInputPhone v-model="organization.tel" field="tel"/>
+                </v-col>
+              </v-row>
+            </LayoutCommonSection>
 
-            </v-col>
-          </v-row>
-        </LayoutCommonSection>
+            <LayoutCommonSection>
+              <v-row>
+                <v-col cols="12">
+                  <h4 class="mb-8">{{ $t('postal_address') }}</h4>
 
-        <LayoutCommonSection>
-          <v-row>
-            <v-col cols="12">
-              <h4 class="mb-8">{{ $t('postal_address') }}</h4>
+                  <UiInputText v-model="organization.streetAddress" field="streetAddress" />
 
-              <UiInputText v-model="organization.streetAddress" field="streetAddress" />
+                  <UiInputText v-model="organization.streetAddressSecond" field="streetAddressSecond" />
 
-              <UiInputText v-model="organization.streetAddressSecond" field="streetAddressSecond" />
+                  <UiInputText v-model="organization.streetAddressThird" field="streetAddressThird" />
 
-              <UiInputText v-model="organization.streetAddressThird" field="streetAddressThird" />
+                  <UiInputText v-model="organization.postalCode" field="postalCode" />
 
-              <UiInputText v-model="organization.postalCode" field="postalCode" />
+                  <UiInputText v-model="organization.addressCity" field="addressCity" />
 
-              <UiInputText v-model="organization.addressCity" field="addressCity" />
+                  <UiInputAutocompleteApiResources
+                    v-model="organization.addressCountry"
+                    field="addressCountry"
+                    :model="Country"
+                    listValue="id"
+                    listLabel="name"
+                  />
 
-              <UiInputAutocompleteApiResources
-                v-model="organization.addressCountry"
-                field="addressCountry"
-                :model="Country"
-                listValue="id"
-                listLabel="name"
-                />
+                  <client-only>
+                    <UiMapLeaflet
+                      v-model:latitude="organization.latitude"
+                      v-model:longitude="organization.longitude"
+                      :streetAddress="organization.streetAddress"
+                      :streetAddressSecond="organization.streetAddressSecond"
+                      :streetAddressThird="organization.streetAddressThird"
+                      :postalCode="organization.postalCode"
+                      :addressCity="organization.addressCity"
+                      :addressCountryId="organization.addressCountry"
+                      :searchButton="true"
+                    ></UiMapLeaflet>
+                  </client-only>
 
-              <client-only>
-                <UiMapLeaflet
-                  v-model:latitude="organization.latitude"
-                  v-model:longitude="organization.longitude"
-                  :streetAddress="organization.streetAddress"
-                  :streetAddressSecond="organization.streetAddressSecond"
-                  :streetAddressThird="organization.streetAddressThird"
-                  :postalCode="organization.postalCode"
-                  :addressCity="organization.addressCity"
-                  :addressCountryId="organization.addressCountry"
-                  :searchButton="true"
-                ></UiMapLeaflet>
-              </client-only>
+                </v-col>
+              </v-row>
+            </LayoutCommonSection>
 
-            </v-col>
-          </v-row>
-        </LayoutCommonSection>
+            <LayoutCommonSection>
+              <v-row>
+                <v-col cols="12">
 
-        <LayoutCommonSection>
-          <v-row>
-            <v-col cols="12">
+                  <h4 class="mb-8">{{ $t('communication_params') }}</h4>
 
-              <h4 class="mb-8">{{ $t('communication_params') }}</h4>
+                  <UiInputText v-model="organization.facebook" field="facebook" />
 
-              <UiInputText v-model="organization.facebook" field="facebook" />
+                  <UiInputText v-model="organization.twitter" field="twitter" />
 
-              <UiInputText v-model="organization.twitter" field="twitter" />
+                  <UiInputText v-model="organization.youtube" field="youtube" />
 
-              <UiInputText v-model="organization.youtube" field="youtube" />
+                  <UiInputText v-model="organization.instagram" field="instagram" />
 
-              <UiInputText v-model="organization.instagram" field="instagram" />
-
-              <UiInputCheckbox
-                v-model="organization.portailVisibility"
-                field="portailVisibility"
-              />
-            </v-col>
-          </v-row>
-        </LayoutCommonSection>
-
-      </UiForm>
+                  <UiInputCheckbox
+                    v-model="organization.portailVisibility"
+                    field="portailVisibility"
+                  />
+                </v-col>
+              </v-row>
+            </LayoutCommonSection>
+          </div>
+        </template>
+      </UiFormEdition>
 
 </template>
 
 <script setup lang="ts">
 
-import {useEntityFetch} from "~/composables/data/useEntityFetch";
-import type {AsyncData} from "#app";
 import Organization from "~/models/Freemium/Organization";
 import {getAssertUtils} from "~/services/asserts/getAssertUtils";
 import Country from "~/models/Core/Country";
-import {useAp2iRequestService} from "~/composables/data/useAp2iRequestService";
 
 definePageMeta({
   name: 'freemium_organization_page',
 })
 
-const {apiRequestService, pending} = useAp2iRequestService()
-
-
-const { fetch } = useEntityFetch()
-
-const { data: organization } = fetch(
-  Organization
-) as AsyncData<Organization | null, Error | null>
-
 const getAsserts = (key) => getAssertUtils(Organization.getAsserts(), key)
 
 </script>

+ 0 - 13
pages/freemium/subscription.vue

@@ -1,13 +0,0 @@
-<template>
-  <div class="d-flex flex-column align-center">
-    <h2 class="ma-4">Présentation produits</h2>
-  </div>
-</template>
-
-<script setup lang="ts">
-
-definePageMeta({
-  name: 'freemium_subscription_page',
-})
-
-</script>