subscription.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <!--
  2. Page 'Mon abonnement'
  3. @see https://ressources.opentalent.fr/display/SPEC/Mon+abonnement
  4. -->
  5. <template>
  6. <LayoutContainer>
  7. <v-expansion-panels v-model="openedPanels" :multiple="true">
  8. <UiExpansionPanel :title="$t('subscription_page')" icon="fas fa-info">
  9. <v-container fluid class="container">
  10. <v-row>
  11. <v-col cols="12" lg="6" sm="12">
  12. {{ $t('version') }} : <strong>{{ dolibarrAccount ? $t(dolibarrAccount.product) : '-' }}</strong>
  13. </v-col>
  14. <v-col cols="12" lg="6" sm="12">
  15. {{ $t('client_id') }} : {{ dolibarrAccount ? dolibarrAccount.clientNumber : '-' }}
  16. </v-col>
  17. </v-row>
  18. </v-container>
  19. </UiExpansionPanel>
  20. <UiExpansionPanel :title="$t('service_detail')" icon="fas fa-info"
  21. v-if="dolibarrAccount && dolibarrAccount.contract"
  22. >
  23. <v-container fluid class="container">
  24. <v-row>
  25. <v-col cols="12"
  26. lg="12"
  27. v-for="line in dolibarrAccount.contract.lines"
  28. :key="line.id"
  29. >
  30. <strong>{{ line.serviceLabel }}</strong> - {{ $t('until') }} : {{ $d(line.dateEnd) }}
  31. </v-col>
  32. <v-col cols="12" lg="12" v-if="ability.can('manage', 'texto')">
  33. <strong>{{ $t('remaining_sms_credit') }}</strong> -
  34. <span v-if="!mobytPending && mobytStatus !== null && mobytStatus.active">
  35. {{
  36. mobytStatus.money.toLocaleString($i18n.locale, {
  37. style: 'currency',
  38. currency: 'EUR',
  39. })
  40. }}
  41. {{
  42. i18n.t('convert_price_to_sms', {
  43. nb_sms: mobytStatus.amount,
  44. })
  45. }}
  46. </span>
  47. </v-col>
  48. </v-row>
  49. </v-container>
  50. </UiExpansionPanel>
  51. <UiExpansionPanel
  52. v-if="showDolibarrPanel"
  53. title="bills"
  54. icon="fas fa-file"
  55. >
  56. <v-container :fluid="true" class="container">
  57. <v-row>
  58. <v-table v-if="dolibarrAccount !== null">
  59. <thead>
  60. <tr>
  61. <th>{{ $t('reference') }}</th>
  62. <th>{{ $t('date') }}</th>
  63. <th>{{ $t('taxExcludedAmount') }}</th>
  64. <th>{{ $t('status') }}</th>
  65. </tr>
  66. </thead>
  67. <tbody>
  68. <tr v-for="bill in dolibarrAccount.bills" :key="bill.id">
  69. <td>{{ bill.ref }}</td>
  70. <td>{{ $d(bill.date) }}</td>
  71. <td>
  72. {{
  73. bill.taxExcludedAmount.toLocaleString($i18n.locale, {
  74. style: 'currency',
  75. currency: 'EUR',
  76. })
  77. }}
  78. </td>
  79. <td>
  80. {{ bill.paid === true ? $t('paid') : $t('unpaid') }}
  81. </td>
  82. </tr>
  83. </tbody>
  84. </v-table>
  85. </v-row>
  86. </v-container>
  87. </UiExpansionPanel>
  88. <UiExpansionPanel :title="$t('opentalent_offer')" icon="fas fa-plus" v-if="!organizationProfile.isManagerProduct">
  89. <v-container fluid class="container">
  90. <v-row class="offer_title" v-if="!md && mdAndUp && !organizationProfile.isSchool">
  91. <v-col cols="12" :lg="organizationProfile.isArtistPremiumProduct ? 3 : 6" sm="12">
  92. <span class="theme-artist">Pour les orchestres, chorales, compagnies et troupes artistiques</span>
  93. </v-col>
  94. <v-col cols="12" :lg="organizationProfile.isArtistPremiumProduct ? 3 : 5" sm="12" :offset="organizationProfile.isArtistPremiumProduct ? 0 : 1">
  95. <span class="theme-school">Pour les établissements d'enseignements artistiques*</span>
  96. </v-col>
  97. </v-row>
  98. <v-row class="card-container">
  99. <v-col lg="3" sm="12" md="6" v-if="organizationProfile.isArtistProduct">
  100. <PagesSubscriptionCard
  101. class="artistCard"
  102. title="Logiciel Artist Standard"
  103. :extraHeader="organizationProfile.isArtistProduct ? 'Votre version' : false"
  104. color="artist"
  105. :list="listCheck.artist"
  106. >
  107. <template #card.subTitle>
  108. <div class="priceBlock">
  109. <span class="price">{{formatCurrency(11, 'EUR')}}</span> TTC/mois
  110. </div>
  111. </template>
  112. <template #card.action>
  113. <v-btn
  114. class="theme-artist btn"
  115. href="https://logiciels.opentalent.fr/opentalent-artist"
  116. target="_blank"
  117. >
  118. En savoir plus <i class="fa-solid fa-greater-than small"></i>
  119. </v-btn>
  120. </template>
  121. </PagesSubscriptionCard>
  122. </v-col>
  123. <v-col lg="3" sm="12" md="6" v-if="organizationProfile.isArtist">
  124. <PagesSubscriptionCard
  125. class="artistCard"
  126. title="Logiciel Artist Premium*"
  127. :extraHeader="organizationProfile.isArtistPremiumProduct ? 'Votre version' : '1 mois d\'essai offert'"
  128. color="artist"
  129. :list="listCheck.artistPremium"
  130. >
  131. <template #card.subTitle>
  132. <div class="priceBlock">
  133. <span class="price">{{organizationProfile.isCmf ? formatCurrency(7.5, 'EUR') : formatCurrency(18.0, 'EUR')}}</span> TTC/mois
  134. </div>
  135. </template>
  136. <template #card.action>
  137. <v-row >
  138. <v-col cols="12" v-if="!organizationProfile.isArtistPremiumProduct && (accessProfileStore.isAdmin || accessProfileStore.isCaMember)">
  139. <v-btn
  140. class="btn trialBtn"
  141. href="https://logiciels.opentalent.fr/opentalent-artist"
  142. target="_blank"
  143. >
  144. Essayer la version premium <i class="fa-solid fa-greater-than small"></i>
  145. </v-btn>
  146. </v-col>
  147. <v-col cols="12" v-if="!organizationProfile.isArtistPremiumProduct && (accessProfileStore.isAdmin || accessProfileStore.isCaMember)">
  148. <v-btn
  149. class="theme-artist btn"
  150. href="https://logiciels.opentalent.fr/opentalent-artist"
  151. target="_blank"
  152. >
  153. Souscrire à l'offre <i class="fa-solid fa-greater-than small"></i>
  154. </v-btn>
  155. </v-col>
  156. <v-col cols="12">
  157. <v-btn
  158. class="theme-artist btn"
  159. href="https://logiciels.opentalent.fr/opentalent-artist"
  160. target="_blank"
  161. >
  162. En savoir plus <i class="fa-solid fa-greater-than small"></i>
  163. </v-btn>
  164. </v-col>
  165. <v-col cols="12">
  166. <span class="special_conditions">
  167. *Convient aux petites écoles sans besoins spécifiques de gestion pédagogique, de facturation, etc.
  168. Pour une solution complète optez pour Opentalent School
  169. </span>
  170. </v-col>
  171. </v-row>
  172. </template>
  173. </PagesSubscriptionCard>
  174. </v-col>
  175. <v-col lg="3" sm="12" md="6" :offset="!md && mdAndUp ? (organizationProfile.isSchool ? 4 : (organizationProfile.isArtistPremiumProduct ? 0 : 2)) : 0">
  176. <PagesSubscriptionCard
  177. class="schoolCard"
  178. :title="!organizationProfile.isSchool ? 'Logiciel School Standard / Premium' : (
  179. organizationProfile.isSchoolPremiumProduct ? 'Logiciel School Premium' : 'Logiciel School Standard'
  180. )"
  181. :subTitle="!organizationProfile.isSchool ? 'Sur devis' : ''"
  182. :extraHeader="organizationProfile.isSchool ? 'Votre version' : false"
  183. color="school"
  184. :list="listCheck.school"
  185. >
  186. <template #card.action>
  187. <v-row>
  188. <v-col cols="12">
  189. <v-btn
  190. class="theme-school btn"
  191. href="https://logiciels.opentalent.fr/opentalent-school"
  192. target="_blank"
  193. >
  194. En savoir plus <i class="fa-solid fa-greater-than small"></i>
  195. </v-btn>
  196. </v-col>
  197. <v-col cols="12">
  198. <span class="special_conditions">
  199. *Extranet disponible uniquement dans la version Opentalent School Premium
  200. </span>
  201. </v-col>
  202. </v-row>
  203. </template>
  204. </PagesSubscriptionCard>
  205. </v-col>
  206. </v-row>
  207. </v-container>
  208. </UiExpansionPanel>
  209. <UiExpansionPanel :title="$t('opentalent_options')" icon="fas fa-plus">
  210. <v-container fluid class="container card-container">
  211. <v-row cols="12" >
  212. <v-col lg="3" sm="12" md="6">
  213. <PagesSubscriptionCard
  214. class="optionsCard"
  215. title="SMS"
  216. sub-title="Option payante"
  217. color="primary"
  218. :list="listCheck.sms"
  219. >
  220. <template #card.action>
  221. <v-btn
  222. class="theme-primary btn"
  223. :href="
  224. runtimeConfig.public.fileStorageBaseUrl +
  225. (organizationProfile.isCmf ? '/Bon_de_commande/Achat_SMS_CMF.pdf' : '/Bon_de_commande/Achat_SMS_Public.pdf')
  226. "
  227. target="_blank"
  228. >
  229. acheter des credits SMS <i class="fa-solid fa-greater-than small"></i>
  230. </v-btn>
  231. </template>
  232. </PagesSubscriptionCard>
  233. </v-col>
  234. <v-col lg="3" sm="12" md="6">
  235. <PagesSubscriptionCard
  236. class="optionsCard"
  237. title="Nom de domaine"
  238. sub-title="Option payante"
  239. color="primary"
  240. :list="listCheck.domain"
  241. >
  242. <template #card.action>
  243. <v-btn
  244. class="theme-primary btn"
  245. :href="
  246. runtimeConfig.public.fileStorageBaseUrl +
  247. '/Bon_de_commande/Nom_de_domaine.pdf'
  248. "
  249. target="_blank"
  250. >
  251. souscrire à l'option <i class="fa-solid fa-greater-than small"></i>
  252. </v-btn>
  253. </template>
  254. </PagesSubscriptionCard>
  255. </v-col>
  256. </v-row>
  257. </v-container>
  258. </UiExpansionPanel>
  259. </v-expansion-panels>
  260. </LayoutContainer>
  261. </template>
  262. <script setup lang="ts">
  263. import {useAbility} from '@casl/vue'
  264. import type {Ref} from 'vue'
  265. import {useDisplay} from 'vuetify'
  266. import type {AsyncData} from '#app'
  267. import {useOrganizationProfileStore} from '~/stores/organizationProfile'
  268. import {useEntityFetch} from '~/composables/data/useEntityFetch'
  269. import DolibarrAccount from '~/models/Organization/DolibarrAccount'
  270. import MobytUserStatus from '~/models/Organization/MobytUserStatus'
  271. //meta
  272. definePageMeta({
  273. name: 'subscription_page',
  274. })
  275. //Get composables
  276. const ability = useAbility()
  277. const runtimeConfig = useRuntimeConfig()
  278. const {mdAndUp, md} = useDisplay()
  279. const {fetch} = useEntityFetch()
  280. const i18n = useI18n()
  281. //Init ref
  282. const openedPanels: Ref<Array<string>> = initPanel()
  283. const organizationProfile = getOrganizationProfile()
  284. const accessProfileStore = useAccessProfileStore()
  285. const {mobytStatus, mobytPending}: Record<Ref<MobytUserStatus | null>, Ref<boolean>> = getMobytInformations()
  286. const {data: dolibarrAccount, pending: dolibarrPending} = fetch(
  287. DolibarrAccount,
  288. organizationProfile.id,
  289. )
  290. const showDolibarrPanel = computed(
  291. () =>
  292. !dolibarrPending.value &&
  293. dolibarrAccount.value &&
  294. dolibarrAccount.value.bills.length > 0,
  295. )
  296. const formatCurrency = (value: number, currency: string): string => {
  297. return value.toLocaleString(i18n.locale.value, {
  298. style: 'currency',
  299. currency,
  300. })
  301. }
  302. const listCheck: Record<string, Array<string>> = {
  303. 'artist' : [
  304. '100 Mo de stockage',
  305. '75 comptes utilisateurs',
  306. 'Gestion de la structure',
  307. 'Site internet restreint',
  308. 'Options disponibles',
  309. ],
  310. 'artistPremium' : [
  311. '1Go de stockage',
  312. '150 comptes utilisateurs',
  313. 'Gestion de la structure',
  314. 'Site internet illimité',
  315. 'Options disponibles',
  316. ],
  317. 'school' : [
  318. '500 Mo ou 1Go de stockage',
  319. '3 comptes administrateurs',
  320. 'Extranet élèves, tuteurs, professeurs*',
  321. 'Gestion de la structure',
  322. 'Suivi pédagogique, facturation, ...',
  323. 'Site internet complet',
  324. 'Options adaptées à chaque structure',
  325. ],
  326. 'sms': [
  327. 'Envoyez des SMS depuis votre logiciel',
  328. 'Choisissez le nombre de crédits'
  329. ],
  330. 'domain':[
  331. 'Bénéficiez de votre propre nom de domaine',
  332. 'Et d\'une adresse mail personnalisée'
  333. ]
  334. }
  335. /**
  336. * Initialisation des panels ouverts
  337. */
  338. function initPanel(): Ref<Array<string>> {
  339. // On déplie les expansion panels dans le onMounted en attendant la résolution du bug : https://github.com/vuetifyjs/vuetify/issues/16427#issuecomment-1380927133
  340. // TODO: quand le bug ci dessus est résolu, remplacer par `const openedPanels: Ref<Array<string>> = ref(['informations', 'bills', 'more_features'])`
  341. const openedPanels: Ref<Array<string>> = ref([])
  342. onMounted(() => {
  343. openedPanels.value = [i18n.t('subscription_page'), i18n.t('opentalent_offer'), i18n.t('opentalent_options')]
  344. })
  345. return openedPanels
  346. }
  347. /**
  348. * Récupération de l'organization profile
  349. */
  350. function getOrganizationProfile() {
  351. const organizationProfile = useOrganizationProfileStore()
  352. if (organizationProfile.id === null) {
  353. throw new Error("Missing organization's id")
  354. }
  355. return organizationProfile
  356. }
  357. /**
  358. * Récupération des informations Mobyt
  359. */
  360. function getMobytInformations(): Record<Ref<MobytUserStatus | null>, Ref<boolean>> {
  361. let mobytStatus: Ref<MobytUserStatus | null> = ref(null)
  362. let mobytPending: Ref<boolean> = ref(false)
  363. if (ability.can('manage', 'texto')) {
  364. const {data, pending} = fetch(
  365. MobytUserStatus,
  366. organizationProfile!.id!,
  367. ) as AsyncData<MobytUserStatus | null, Error | null>
  368. mobytStatus = data
  369. mobytPending = pending
  370. }
  371. return {mobytStatus, mobytPending}
  372. }
  373. </script>
  374. <style scoped lang="scss">
  375. .offer_title{
  376. span{
  377. border-radius: 5px;
  378. display: block;
  379. font-weight: bold;
  380. text-align: center;
  381. padding: 5px;
  382. }
  383. }
  384. .card-container{
  385. .v-row {
  386. display: -webkit-box;
  387. display: -webkit-flex;
  388. display: -ms-flexbox;
  389. display: flex;
  390. flex-wrap: wrap;
  391. }
  392. .v-row > [class*='v-col-'] {
  393. display: flex;
  394. flex-direction: column;
  395. }
  396. .small{
  397. font-size:6px;
  398. padding-top: 5px;
  399. padding-left: 5px;
  400. }
  401. .priceBlock{
  402. text-align: center;
  403. font-size: 15px;
  404. font-weight: normal;
  405. .price{
  406. font-size: 30px;
  407. font-weight: bold;
  408. }
  409. }
  410. }
  411. .artistCard{
  412. :deep(.v-card-title){
  413. text-align: center;
  414. }
  415. }
  416. .special_conditions{
  417. font-size: 10px;
  418. }
  419. .trialBtn{
  420. color: #000;
  421. border: 1px solid rgb(var(--v-theme-artist));
  422. }
  423. .optionsCard{
  424. :deep(.margin-sup){
  425. margin-top: 0px;
  426. }
  427. }
  428. </style>