Procházet zdrojové kódy

Adds SMS credits purchase option

Allows users to buy SMS credits via a link to a purchase order,
adapting the displayed text and file based on the organization type
(CMF or Public) and the presence of the SMS module.
Olivier Massot před 10 měsíci
rodič
revize
f4bc3e9e10
3 změnil soubory, kde provedl 28 přidání a 5 odebrání
  1. 2 0
      i18n/lang/fr.json
  2. 16 2
      pages/parameters/sms.vue
  3. 10 3
      pages/subscription.vue

+ 2 - 0
i18n/lang/fr.json

@@ -70,6 +70,8 @@
   "of_accounts_for_teachers_and_students": "de comptes pour vos professeurs et élèves",
   "of_a_complete_website": "d'un site internet complet",
   "send_sms": "Envoyez des SMS",
+  "buy_sms_credits": "Acheter des crédits SMS",
+  "buy_more_sms_credits": "Acheter plus de crédits SMS",
   "to_your_members_from_app": "à vos membres / élèves depuis votre logiciel",
   "starting_from_x_eur_ttc_per_sms": "A partir de {price} TTC / sms",
   "for_x_sms": "pour {amount} SMS",

+ 16 - 2
pages/parameters/sms.vue

@@ -18,6 +18,21 @@
               {{ $t('smsSenderName') }} : <b>{{ parameters.smsSenderName }}</b>
             </div>
           </v-col>
+          <v-col cols="12">
+            <v-btn
+              class="theme-info btn"
+              :href="
+                runtimeConfig.public.fileStorageBaseUrl +
+                '/Bon_de_commande/' +
+                (organizationProfile.isCmf
+                  ? 'SMS_CMF.pdf'
+                  : 'SMS_Public.pdf')
+              "
+              target="_blank"
+            >
+              {{ $t('buy_more_sms_credits') }}
+            </v-btn>
+          </v-col>
         </v-row>
       </UiForm>
     </LayoutParametersSection>
@@ -34,9 +49,8 @@ definePageMeta({
 })
 
 const i18n = useI18n()
-
+const runtimeConfig = useRuntimeConfig()
 const { fetch } = useEntityFetch()
-
 const organizationProfile = useOrganizationProfileStore()
 
 if (organizationProfile.parametersId === null) {

+ 10 - 3
pages/subscription.vue

@@ -408,13 +408,18 @@ Page 'Mon abonnement'
                       class="theme-primary btn"
                       :href="
                         runtimeConfig.public.fileStorageBaseUrl +
+                        '/Bon_de_commande/' +
                         (organizationProfile.isCmf
-                          ? '/Bon_de_commande/Achat_SMS_CMF.pdf'
-                          : '/Bon_de_commande/Achat_SMS_Public.pdf')
+                          ? hasSmsModule
+                            ? 'SMS_CMF.pdf'
+                            : 'Achat_SMS_CMF.pdf'
+                          : hasSmsModule
+                            ? 'SMS_Public.pdf'
+                            : 'Achat_SMS_Public.pdf')
                       "
                       target="_blank"
                     >
-                      acheter des credits SMS
+                      {{ hasSmsModule ? $t('buy_more_sms_credits') : $t('buy_sms_credits') }}
                       <i class="fa-solid fa-greater-than small" />
                     </v-btn>
                   </template>
@@ -497,6 +502,8 @@ const showDialogTrialStopConfirmation: Ref<boolean> = ref(false)
 const openedPanels: Ref<Array<string>> = initPanel()
 const organizationProfile = getOrganizationProfile()
 const accessProfileStore = useAccessProfileStore()
+// Check if organization has SMS module
+const hasSmsModule = computed(() => organizationProfile.hasModule('Sms'))
 
 const { data: dolibarrAccount, pending: dolibarrPending } = fetch(
   DolibarrAccount,