subscription.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <!--
  2. Page 'Mon abonnement'
  3. @see https://ressources.opentalent.fr/display/SPEC/Mon+abonnement
  4. -->
  5. <template>
  6. <LayoutContainer>
  7. <v-col cols="12" sm="12" md="12">
  8. <v-expansion-panels v-model="openedPanels" :multiple="true">
  9. <UiExpansionPanel title="informations" icon="fas fa-info">
  10. <v-container fluid class="container">
  11. <v-row>
  12. <v-table>
  13. <tbody>
  14. <tr>
  15. <td v-if="smAndUp">{{ $t('client_id') }}</td>
  16. <td class="py-2">
  17. <h5
  18. v-if="!smAndUp"
  19. class="text-decoration-underline py-2"
  20. >
  21. {{ $t('client_id') }}
  22. </h5>
  23. <span>{{
  24. dolibarrAccount ? dolibarrAccount.clientNumber : '-'
  25. }}</span>
  26. </td>
  27. </tr>
  28. <tr>
  29. <td v-if="smAndUp">{{ $t('version') }}</td>
  30. <td class="py-2">
  31. <h5
  32. v-if="!smAndUp"
  33. class="text-decoration-underline py-2"
  34. >
  35. {{ $t('version') }}
  36. </h5>
  37. <span>{{
  38. dolibarrAccount ? $t(dolibarrAccount.product) : '-'
  39. }}</span>
  40. </td>
  41. </tr>
  42. <tr v-if="dolibarrAccount && dolibarrAccount.contract">
  43. <td v-if="smAndUp">{{ $t('services') }}</td>
  44. <td class="py-2">
  45. <h5
  46. v-if="!smAndUp"
  47. class="text-decoration-underline py-2"
  48. >
  49. {{ $t('services') }}
  50. </h5>
  51. <div
  52. v-for="line in dolibarrAccount.contract.lines"
  53. :key="line.id"
  54. >
  55. {{ line.serviceLabel }} - {{ $t('until') }} :
  56. {{ $d(line.dateEnd) }}
  57. </div>
  58. </td>
  59. </tr>
  60. <tr v-if="ability.can('manage', 'texto')">
  61. <td v-if="smAndUp">{{ $t('remaining_sms_credit') }}</td>
  62. <td class="py-2">
  63. <h5
  64. v-if="!smAndUp"
  65. class="text-decoration-underline py-2"
  66. >
  67. {{ $t('remaining_sms_credit') }}
  68. </h5>
  69. <span
  70. v-if="
  71. !mobytPending &&
  72. mobytStatus !== null &&
  73. mobytStatus.active
  74. "
  75. >
  76. {{
  77. mobytStatus.money.toLocaleString($i18n.locale, {
  78. style: 'currency',
  79. currency: 'EUR',
  80. })
  81. }}
  82. {{
  83. i18n.t('convert_price_to_sms', {
  84. nb_sms: mobytStatus.amount,
  85. })
  86. }}
  87. </span>
  88. </td>
  89. </tr>
  90. </tbody>
  91. </v-table>
  92. </v-row>
  93. </v-container>
  94. </UiExpansionPanel>
  95. <UiExpansionPanel
  96. v-if="showDolibarrPanel"
  97. title="bills"
  98. icon="fas fa-file"
  99. >
  100. <v-container :fluid="true" class="container">
  101. <v-row>
  102. <v-table v-if="dolibarrAccount !== null">
  103. <thead>
  104. <tr>
  105. <th>{{ $t('reference') }}</th>
  106. <th>{{ $t('date') }}</th>
  107. <th>{{ $t('taxExcludedAmount') }}</th>
  108. <th>{{ $t('status') }}</th>
  109. </tr>
  110. </thead>
  111. <tbody>
  112. <tr v-for="bill in dolibarrAccount.bills" :key="bill.id">
  113. <td>{{ bill.ref }}</td>
  114. <td>{{ $d(bill.date) }}</td>
  115. <td>
  116. {{
  117. bill.taxExcludedAmount.toLocaleString($i18n.locale, {
  118. style: 'currency',
  119. currency: 'EUR',
  120. })
  121. }}
  122. </td>
  123. <td>
  124. {{ bill.paid === true ? $t('paid') : $t('unpaid') }}
  125. </td>
  126. </tr>
  127. </tbody>
  128. </v-table>
  129. </v-row>
  130. </v-container>
  131. </UiExpansionPanel>
  132. <UiExpansionPanel title="more_features" icon="fas fa-plus">
  133. <v-container id="products-section" :fluid="true" class="container">
  134. <v-row>
  135. <!-- Opentalent Artist Premium -->
  136. <v-col
  137. v-if="organizationProfile.isArtistProduct"
  138. :cols="colWidth"
  139. >
  140. <v-row>
  141. {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  142. </v-row>
  143. <v-row class="align-end">
  144. <nuxt-img src="/images/Opentalent_Artist.png" />
  145. </v-row>
  146. <v-row>
  147. <p>
  148. {{ $t('get_more_functionalities_with_version') }}
  149. <b>{{ $t('PRODUCT_ARTIST_PREMIUM') }}</b>
  150. </p>
  151. <!-- Cmf member -->
  152. <div v-if="organizationProfile.isCmf">
  153. <p>
  154. <b
  155. >{{
  156. i18n.t('for_only_x_eur_ttc_by_month', {
  157. price: formatCurrency(7.25, 'EUR'),
  158. })
  159. }}&nbsp;*</b
  160. >
  161. </p>
  162. <div>
  163. <i
  164. >*&nbsp;{{
  165. i18n.t('yearly_paid_giving_x_eur_ttc_per_year', {
  166. price: formatCurrency(87.0, 'EUR'),
  167. })
  168. }}</i
  169. >
  170. </div>
  171. <div>
  172. <i
  173. >{{ $t('only_for_cmf_members') }} ({{
  174. i18n.t('public_price_x_ttc_a_year', {
  175. price: formatCurrency(168.0, 'EUR'),
  176. })
  177. }})</i
  178. >
  179. </div>
  180. </div>
  181. <!-- Not a cmf member -->
  182. <div v-else>
  183. <p>
  184. <b
  185. >{{
  186. i18n.t('for_only_x_eur_ttc_by_month', {
  187. price: formatCurrency(14.0, 'EUR'),
  188. })
  189. }}&nbsp;*</b
  190. >
  191. </p>
  192. <p>
  193. <i>
  194. *&nbsp;{{
  195. i18n.t('yearly_paid_giving_x_eur_ttc_per_year', {
  196. price: formatCurrency(168.0, 'EUR'),
  197. })
  198. }}
  199. </i>
  200. </p>
  201. </div>
  202. <p class="mt-3">
  203. <a
  204. :href="
  205. runtimeConfig.public.fileStorageBaseUrl +
  206. '/Fiche_produit/Fiche_produit_Opentalent_Artist.pdf'
  207. "
  208. target="_blank"
  209. >
  210. {{ $t('product_sheet') }}
  211. {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  212. </a>
  213. </p>
  214. <p v-if="organizationProfile.isCmf" class="mt-3">
  215. <a
  216. :href="
  217. runtimeConfig.public.fileStorageBaseUrl +
  218. '/Bon_de_commande/Opentalent_Artist_CMF.pdf'
  219. "
  220. >
  221. <b>{{ $t('download_cmf_order_form') }}</b>
  222. </a>
  223. </p>
  224. <p v-else class="mt-3">
  225. <a
  226. :href="
  227. runtimeConfig.public.fileStorageBaseUrl +
  228. '/Bon_de_commande/Opentalent_Artist_CMF.pdf'
  229. "
  230. target="_blank"
  231. >
  232. <b>{{ $t('download_order_form') }}</b>
  233. </a>
  234. </p>
  235. </v-row>
  236. </v-col>
  237. <!-- Opentalent School Premium -->
  238. <v-col v-if="organizationProfile.isArtist" :cols="colWidth">
  239. <v-row>
  240. {{ $t('PRODUCT_SCHOOL') }}
  241. </v-row>
  242. <v-row class="align-end">
  243. <nuxt-img src="/images/Opentalent_School.png" />
  244. </v-row>
  245. <v-row>
  246. <p>
  247. {{ $t('switch_to_version') }}
  248. <b>{{ $t('PRODUCT_SCHOOL_PREMIUM') }}</b>
  249. {{ $t('and_benefit') }} :
  250. </p>
  251. <ul class="mb-2">
  252. <li>{{ $t('of_accounts_for_teachers_and_students') }}</li>
  253. <li>{{ $t('of_a_complete_website') }}</li>
  254. </ul>
  255. <!-- Cmf member -->
  256. <div v-if="organizationProfile.isCmf">
  257. <p>
  258. <b
  259. >{{
  260. i18n.t('starting_from_x_eur_ttc_per_month', {
  261. price: formatCurrency(26.5, 'EUR'),
  262. })
  263. }}&nbsp;*</b
  264. >
  265. </p>
  266. <div>
  267. <i
  268. >*
  269. {{
  270. i18n.t('yearly_paid_giving_x_eur_ttc_per_year', {
  271. price: formatCurrency(318.0, 'EUR'),
  272. })
  273. }}</i
  274. >
  275. </div>
  276. <div>
  277. <i>{{
  278. i18n.t('version_x_up_to_x_students', {
  279. product: $t('PRODUCT_SCHOOL_PREMIUM'),
  280. max_students: '69',
  281. })
  282. }}</i>
  283. </div>
  284. <div>
  285. <i>{{ $t('excluding_license_and_training_fees') }}.</i>
  286. </div>
  287. <div>
  288. <i
  289. >{{ $t('only_for_cmf_members') }} ({{
  290. i18n.t('public_price_x_ttc_a_year', {
  291. price: formatCurrency(529.2, 'EUR'),
  292. })
  293. }})</i
  294. >
  295. </div>
  296. </div>
  297. <!-- Not cmf member -->
  298. <div v-else>
  299. <p>
  300. {{
  301. i18n.t('starting_from_x_eur_ttc_per_month', {
  302. price: formatCurrency(44.1, 'EUR'),
  303. })
  304. }}&nbsp;*
  305. </p>
  306. <div>
  307. <i
  308. >*&nbsp;{{
  309. i18n.t('yearly_paid_giving_x_eur_ttc_per_year', {
  310. price: formatCurrency(529.2, 'EUR'),
  311. })
  312. }}</i
  313. >
  314. </div>
  315. <div>
  316. <i>{{
  317. i18n.t('version_x_up_to_x_students', {
  318. product: $t('PRODUCT_SCHOOL_PREMIUM'),
  319. max_students: '69',
  320. })
  321. }}</i>
  322. </div>
  323. <div>
  324. <i>{{ $t('excluding_license_and_training_fees') }}.</i>
  325. </div>
  326. </div>
  327. <p class="mt-4">
  328. <a
  329. :href="
  330. runtimeConfig.public.fileStorageBaseUrl +
  331. '/Fiche_produit/Fiche_produit_Opentalent_School.pdf'
  332. "
  333. target="_blank"
  334. >
  335. {{ $t('product_sheet') }} {{ $t('PRODUCT_SCHOOL') }}
  336. </a>
  337. </p>
  338. <p>
  339. {{ $t('contact_us_at') }}
  340. <a href="tel:+33972126017">0 972 126 017</a>,
  341. {{ $t('or_by_mail_at') }}
  342. <a href="mailto:contact@opentalent.fr"
  343. >contact@opentalent.fr</a
  344. >
  345. </p>
  346. </v-row>
  347. </v-col>
  348. <!-- SMS -->
  349. <v-col :cols="colWidth">
  350. <v-row>
  351. {{ $t('sms') }}
  352. </v-row>
  353. <v-row class="align-end">
  354. <nuxt-img src="/images/sms.png" :height="140" :width="175" />
  355. </v-row>
  356. <v-row>
  357. <p>
  358. <b
  359. >{{ $t('send_sms') }}
  360. {{ $t('to_your_members_from_app') }}</b
  361. >
  362. </p>
  363. <!-- Cmf member -->
  364. <div v-if="organizationProfile.isCmf">
  365. <p>
  366. <b
  367. >{{
  368. i18n.t('starting_from_x_eur_ttc_per_sms', {
  369. price: formatCurrency(0.1, 'EUR'),
  370. })
  371. }}&nbsp;*</b
  372. >
  373. </p>
  374. <p>
  375. <i
  376. >*&nbsp;{{ i18n.t('for_x_sms', { amount: '5000' }) }}</i
  377. >
  378. </p>
  379. <p>
  380. <b>
  381. <a
  382. :href="
  383. runtimeConfig.public.fileStorageBaseUrl +
  384. '/Bon_de_commande/Achat_SMS_CMF.pdf'
  385. "
  386. target="_blank"
  387. >
  388. {{ i18n.t('download_cmf_order_form') }}
  389. </a>
  390. </b>
  391. </p>
  392. </div>
  393. <!-- Not cmf member -->
  394. <div v-else>
  395. <p>
  396. <b
  397. >{{
  398. i18n.t('starting_from_x_eur_ttc_per_sms', {
  399. price: formatCurrency(0.12, 'EUR'),
  400. })
  401. }}&nbsp;*</b
  402. >
  403. </p>
  404. <p>
  405. <i
  406. >*&nbsp;{{ i18n.t('for_x_sms', { amount: '5000' }) }}</i
  407. >
  408. </p>
  409. <p>
  410. <a
  411. :href="
  412. runtimeConfig.public.fileStorageBaseUrl +
  413. '/Bon_de_commande/Achat_SMS_Public.pdf'
  414. "
  415. target="_blank"
  416. >
  417. <b>{{ $t('download_order_form') }}</b>
  418. </a>
  419. </p>
  420. </div>
  421. </v-row>
  422. </v-col>
  423. <!-- Custom domain -->
  424. <v-col :cols="colWidth">
  425. <v-row>
  426. {{ $t('website') }}
  427. </v-row>
  428. <v-row class="align-end">
  429. <nuxt-img src="/images/nom_de_domaine.png" :height="160" />
  430. </v-row>
  431. <v-row>
  432. <v-col>
  433. <p>
  434. <b>{{
  435. i18n.t(
  436. 'get_your_own_domain_and_up_to_five_emails_for_only_x_eur_ttc_per_year',
  437. { price: formatCurrency(44.0, 'EUR') },
  438. )
  439. }}</b>
  440. </p>
  441. <p>{{ $t('example') }} :</p>
  442. <table>
  443. <tbody>
  444. <tr>
  445. <td class="pa-2" style="width: 190px">
  446. {{ $t('domain_name') }}&nbsp;:
  447. </td>
  448. <td>
  449. <i>{{ $t('dummy_domain_name') }}</i>
  450. </td>
  451. </tr>
  452. <tr>
  453. <td class="pa-2">
  454. {{ $t('associated_mail_address') }}&nbsp;:
  455. </td>
  456. <td>
  457. <i>{{ $t('dummy_email_address') }}</i>
  458. </td>
  459. </tr>
  460. </tbody>
  461. </table>
  462. <p>
  463. <a
  464. :href="
  465. runtimeConfig.public.fileStorageBaseUrl +
  466. '/Bon_de_commande/Nom_de_domaine.pdf'
  467. "
  468. target="_blank"
  469. >
  470. <b>{{ $t('download_order_form') }}</b>
  471. </a>
  472. </p>
  473. </v-col>
  474. </v-row>
  475. </v-col>
  476. </v-row>
  477. </v-container>
  478. </UiExpansionPanel>
  479. </v-expansion-panels>
  480. </v-col>
  481. </LayoutContainer>
  482. </template>
  483. <script setup lang="ts">
  484. import { useAbility } from '@casl/vue'
  485. import type { Ref } from 'vue'
  486. import { useDisplay } from 'vuetify'
  487. import type { AsyncData } from '#app'
  488. import { useOrganizationProfileStore } from '~/stores/organizationProfile'
  489. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  490. import DolibarrAccount from '~/models/Organization/DolibarrAccount'
  491. import MobytUserStatus from '~/models/Organization/MobytUserStatus'
  492. const ability = useAbility()
  493. const runtimeConfig = useRuntimeConfig()
  494. definePageMeta({
  495. name: 'subscription_page',
  496. })
  497. const showDolibarrPanel = computed(
  498. () =>
  499. !dolibarrPending.value &&
  500. dolibarrAccount.value &&
  501. dolibarrAccount.value.bills.length > 0,
  502. )
  503. const { smAndUp } = useDisplay()
  504. // 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
  505. // TODO: quand le bug ci dessus est résolu, remplacer par `const openedPanels: Ref<Array<string>> = ref(['informations', 'bills', 'more_features'])`
  506. const openedPanels: Ref<Array<string>> = ref([])
  507. onMounted(() => {
  508. openedPanels.value = ['informations', 'bills', 'more_features']
  509. })
  510. const i18n = useI18n()
  511. const organizationProfile = useOrganizationProfileStore()
  512. if (organizationProfile.id === null) {
  513. throw new Error("Missing organization's id")
  514. }
  515. const { fetch } = useEntityFetch()
  516. const { data: dolibarrAccount, pending: dolibarrPending } = fetch(
  517. DolibarrAccount,
  518. organizationProfile.id,
  519. )
  520. let mobytStatus: Ref<MobytUserStatus | null>
  521. let mobytPending: Ref<boolean>
  522. if (ability.can('manage', 'texto')) {
  523. const fetchMobytStatus = () => {
  524. const { data, pending } = fetch(
  525. MobytUserStatus,
  526. organizationProfile!.id!,
  527. ) as AsyncData<MobytUserStatus | null, Error | null>
  528. mobytStatus = data
  529. mobytPending = pending
  530. }
  531. fetchMobytStatus()
  532. } else {
  533. mobytStatus = ref(null)
  534. mobytPending = ref(false)
  535. }
  536. const formatCurrency = (value: number, currency: string): string => {
  537. return value.toLocaleString(i18n.locale.value, {
  538. style: 'currency',
  539. currency,
  540. })
  541. }
  542. // Compute the number of columns of the more_features pannel
  543. const nbCols =
  544. 2 +
  545. (organizationProfile.isArtist ? 1 : 0) +
  546. (organizationProfile.isArtistProduct ? 1 : 0)
  547. const colWidth = 12 / nbCols
  548. </script>
  549. <style scoped lang="scss">
  550. #products-section {
  551. width: 100%;
  552. .v-col {
  553. min-width: 260px;
  554. border: solid 1px rgb(var(--v-theme-on-primary));
  555. .v-row:nth-child(1) {
  556. //background: rgb(var(--v-theme-neutral-soft));
  557. height: 64px;
  558. color: rgb(var(--v-theme-on-neutral-soft));
  559. //font-size: 15px;
  560. font-weight: bold;
  561. border-bottom: solid 1px rgb(var(--v-theme-neutral));
  562. }
  563. .v-row:nth-child(2) {
  564. height: 230px;
  565. display: flex;
  566. justify-content: center;
  567. border-bottom: solid 1px rgb(var(--v-theme-neutral));
  568. }
  569. .v-row:nth-child(3) {
  570. }
  571. }
  572. .v-col:not(:first-child) {
  573. border-left: none;
  574. }
  575. img {
  576. max-height: 90%;
  577. max-width: 90%;
  578. }
  579. .v-row {
  580. padding: 12px 18px;
  581. vertical-align: top;
  582. border-bottom: solid 1px rgb(var(--v-theme-on-primary));
  583. }
  584. .v-row:last-child {
  585. border: none;
  586. }
  587. p {
  588. margin-bottom: 12px;
  589. }
  590. ul {
  591. padding-left: 24px;
  592. }
  593. }
  594. </style>