Просмотр исходного кода

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 11 месяцев назад
Родитель
Сommit
f4bc3e9e10
3 измененных файлов с 28 добавлено и 5 удалено
  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_accounts_for_teachers_and_students": "de comptes pour vos professeurs et élèves",
   "of_a_complete_website": "d'un site internet complet",
   "of_a_complete_website": "d'un site internet complet",
   "send_sms": "Envoyez des SMS",
   "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",
   "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",
   "starting_from_x_eur_ttc_per_sms": "A partir de {price} TTC / sms",
   "for_x_sms": "pour {amount} SMS",
   "for_x_sms": "pour {amount} SMS",

+ 16 - 2
pages/parameters/sms.vue

@@ -18,6 +18,21 @@
               {{ $t('smsSenderName') }} : <b>{{ parameters.smsSenderName }}</b>
               {{ $t('smsSenderName') }} : <b>{{ parameters.smsSenderName }}</b>
             </div>
             </div>
           </v-col>
           </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>
         </v-row>
       </UiForm>
       </UiForm>
     </LayoutParametersSection>
     </LayoutParametersSection>
@@ -34,9 +49,8 @@ definePageMeta({
 })
 })
 
 
 const i18n = useI18n()
 const i18n = useI18n()
-
+const runtimeConfig = useRuntimeConfig()
 const { fetch } = useEntityFetch()
 const { fetch } = useEntityFetch()
-
 const organizationProfile = useOrganizationProfileStore()
 const organizationProfile = useOrganizationProfileStore()
 
 
 if (organizationProfile.parametersId === null) {
 if (organizationProfile.parametersId === null) {

+ 10 - 3
pages/subscription.vue

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