subscription.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  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.5, '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(90.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(216.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(18.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(216.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. target="_blank"
  221. >
  222. <b>{{ $t('download_cmf_order_form') }}</b>
  223. </a>
  224. </p>
  225. <p v-else class="mt-3">
  226. <a
  227. :href="
  228. runtimeConfig.public.fileStorageBaseUrl +
  229. '/Bon_de_commande/Opentalent_Artist_CMF.pdf'
  230. "
  231. target="_blank"
  232. >
  233. <b>{{ $t('download_order_form') }}</b>
  234. </a>
  235. </p>
  236. </v-row>
  237. </v-col>
  238. <!-- Opentalent School Premium -->
  239. <v-col v-if="organizationProfile.isArtist" :cols="colWidth">
  240. <v-row>
  241. {{ $t('PRODUCT_SCHOOL') }}
  242. </v-row>
  243. <v-row class="align-end">
  244. <nuxt-img src="/images/Opentalent_School.png" />
  245. </v-row>
  246. <v-row>
  247. <p>
  248. {{ $t('switch_to_version') }}
  249. <b>{{ $t('PRODUCT_SCHOOL_PREMIUM') }}</b>
  250. {{ $t('and_benefit') }} :
  251. </p>
  252. <ul class="mb-2">
  253. <li>{{ $t('of_accounts_for_teachers_and_students') }}</li>
  254. <li>{{ $t('of_a_complete_website') }}</li>
  255. </ul>
  256. <!-- Cmf member -->
  257. <div v-if="organizationProfile.isCmf">
  258. <p>
  259. <b
  260. >{{
  261. i18n.t('starting_from_x_eur_ttc_per_month', {
  262. price: formatCurrency(30.5, 'EUR'),
  263. })
  264. }}&nbsp;*</b
  265. >
  266. </p>
  267. <div>
  268. <i
  269. >*
  270. {{
  271. i18n.t('yearly_paid_giving_x_eur_ttc_per_year', {
  272. price: formatCurrency(366.0, 'EUR'),
  273. })
  274. }}</i
  275. >
  276. </div>
  277. <div>
  278. <i>{{
  279. i18n.t('version_x_up_to_x_students', {
  280. product: $t('PRODUCT_SCHOOL_PREMIUM'),
  281. max_students: '69',
  282. })
  283. }}</i>
  284. </div>
  285. <div>
  286. <i>{{ $t('excluding_license_and_training_fees') }}.</i>
  287. </div>
  288. <div>
  289. <i
  290. >{{ $t('only_for_cmf_members') }} ({{
  291. i18n.t('public_price_x_ttc_a_year', {
  292. price: formatCurrency(607.2, 'EUR'),
  293. })
  294. }})</i
  295. >
  296. </div>
  297. </div>
  298. <!-- Not cmf member -->
  299. <div v-else>
  300. <p>
  301. {{
  302. i18n.t('starting_from_x_eur_ttc_per_month', {
  303. price: formatCurrency(50.6, 'EUR'),
  304. })
  305. }}&nbsp;*
  306. </p>
  307. <div>
  308. <i
  309. >*&nbsp;{{
  310. i18n.t('yearly_paid_giving_x_eur_ttc_per_year', {
  311. price: formatCurrency(607.2, 'EUR'),
  312. })
  313. }}</i
  314. >
  315. </div>
  316. <div>
  317. <i>{{
  318. i18n.t('version_x_up_to_x_students', {
  319. product: $t('PRODUCT_SCHOOL_PREMIUM'),
  320. max_students: '69',
  321. })
  322. }}</i>
  323. </div>
  324. <div>
  325. <i>{{ $t('excluding_license_and_training_fees') }}.</i>
  326. </div>
  327. </div>
  328. <p class="mt-4">
  329. <a
  330. :href="
  331. runtimeConfig.public.fileStorageBaseUrl +
  332. '/Fiche_produit/Fiche_produit_Opentalent_School.pdf'
  333. "
  334. target="_blank"
  335. >
  336. {{ $t('product_sheet') }} {{ $t('PRODUCT_SCHOOL') }}
  337. </a>
  338. </p>
  339. <p>
  340. {{ $t('contact_us_at') }}
  341. <a href="tel:+33972126017">0 972 126 017</a>,
  342. {{ $t('or_by_mail_at') }}
  343. <a href="mailto:contact@opentalent.fr"
  344. >contact@opentalent.fr</a
  345. >
  346. </p>
  347. </v-row>
  348. </v-col>
  349. <!-- SMS -->
  350. <v-col :cols="colWidth">
  351. <v-row>
  352. {{ $t('sms') }}
  353. </v-row>
  354. <v-row class="align-end">
  355. <nuxt-img src="/images/sms.png" :height="140" :width="175" />
  356. </v-row>
  357. <v-row>
  358. <p>
  359. <b
  360. >{{ $t('send_sms') }}
  361. {{ $t('to_your_members_from_app') }}</b
  362. >
  363. </p>
  364. <!-- Cmf member -->
  365. <div v-if="organizationProfile.isCmf">
  366. <p>
  367. <b
  368. >{{
  369. i18n.t('starting_from_x_eur_ttc_per_sms', {
  370. price: formatCurrency(0.11, 'EUR'),
  371. })
  372. }}&nbsp;*</b
  373. >
  374. </p>
  375. <p>
  376. <i
  377. >*&nbsp;{{ i18n.t('for_x_sms', { amount: '5000' }) }}</i
  378. >
  379. </p>
  380. <p>
  381. <b>
  382. <a
  383. :href="
  384. runtimeConfig.public.fileStorageBaseUrl +
  385. '/Bon_de_commande/Achat_SMS_CMF.pdf'
  386. "
  387. target="_blank"
  388. >
  389. {{ i18n.t('download_cmf_order_form') }}
  390. </a>
  391. </b>
  392. </p>
  393. </div>
  394. <!-- Not cmf member -->
  395. <div v-else>
  396. <p>
  397. <b
  398. >{{
  399. i18n.t('starting_from_x_eur_ttc_per_sms', {
  400. price: formatCurrency(0.13, 'EUR'),
  401. })
  402. }}&nbsp;*</b
  403. >
  404. </p>
  405. <p>
  406. <i
  407. >*&nbsp;{{ i18n.t('for_x_sms', { amount: '5000' }) }}</i
  408. >
  409. </p>
  410. <p>
  411. <a
  412. :href="
  413. runtimeConfig.public.fileStorageBaseUrl +
  414. '/Bon_de_commande/Achat_SMS_Public.pdf'
  415. "
  416. target="_blank"
  417. >
  418. <b>{{ $t('download_order_form') }}</b>
  419. </a>
  420. </p>
  421. </div>
  422. </v-row>
  423. </v-col>
  424. <!-- Custom domain -->
  425. <v-col :cols="colWidth">
  426. <v-row>
  427. {{ $t('website') }}
  428. </v-row>
  429. <v-row class="align-end">
  430. <nuxt-img src="/images/nom_de_domaine.png" :height="160" />
  431. </v-row>
  432. <v-row>
  433. <v-col>
  434. <p>
  435. <b>{{
  436. i18n.t(
  437. 'get_your_own_domain_and_up_to_five_emails_for_only_x_eur_ttc_per_year',
  438. { price: formatCurrency(46.8, 'EUR') },
  439. )
  440. }}</b>
  441. </p>
  442. <p>{{ $t('example') }} :</p>
  443. <table>
  444. <tbody>
  445. <tr>
  446. <td class="pa-2" style="width: 190px">
  447. {{ $t('domain_name') }}&nbsp;:
  448. </td>
  449. <td>
  450. <i>{{ $t('dummy_domain_name') }}</i>
  451. </td>
  452. </tr>
  453. <tr>
  454. <td class="pa-2">
  455. {{ $t('associated_mail_address') }}&nbsp;:
  456. </td>
  457. <td>
  458. <i>{{ $t('dummy_email_address') }}</i>
  459. </td>
  460. </tr>
  461. </tbody>
  462. </table>
  463. <p>
  464. <a
  465. :href="
  466. runtimeConfig.public.fileStorageBaseUrl +
  467. '/Bon_de_commande/Nom_de_domaine.pdf'
  468. "
  469. target="_blank"
  470. >
  471. <b>{{ $t('download_order_form') }}</b>
  472. </a>
  473. </p>
  474. </v-col>
  475. </v-row>
  476. </v-col>
  477. </v-row>
  478. </v-container>
  479. </UiExpansionPanel>
  480. </v-expansion-panels>
  481. </v-col>
  482. </LayoutContainer>
  483. </template>
  484. <script setup lang="ts">
  485. import { useAbility } from '@casl/vue'
  486. import type { Ref } from 'vue'
  487. import { useDisplay } from 'vuetify'
  488. import type { AsyncData } from '#app'
  489. import { useOrganizationProfileStore } from '~/stores/organizationProfile'
  490. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  491. import DolibarrAccount from '~/models/Organization/DolibarrAccount'
  492. import MobytUserStatus from '~/models/Organization/MobytUserStatus'
  493. const ability = useAbility()
  494. const runtimeConfig = useRuntimeConfig()
  495. definePageMeta({
  496. name: 'subscription_page',
  497. })
  498. const showDolibarrPanel = computed(
  499. () =>
  500. !dolibarrPending.value &&
  501. dolibarrAccount.value &&
  502. dolibarrAccount.value.bills.length > 0,
  503. )
  504. const { smAndUp } = useDisplay()
  505. // 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
  506. // TODO: quand le bug ci dessus est résolu, remplacer par `const openedPanels: Ref<Array<string>> = ref(['informations', 'bills', 'more_features'])`
  507. const openedPanels: Ref<Array<string>> = ref([])
  508. onMounted(() => {
  509. openedPanels.value = ['informations', 'bills', 'more_features']
  510. })
  511. const i18n = useI18n()
  512. const organizationProfile = useOrganizationProfileStore()
  513. if (organizationProfile.id === null) {
  514. throw new Error("Missing organization's id")
  515. }
  516. const { fetch } = useEntityFetch()
  517. const { data: dolibarrAccount, pending: dolibarrPending } = fetch(
  518. DolibarrAccount,
  519. organizationProfile.id,
  520. )
  521. let mobytStatus: Ref<MobytUserStatus | null>
  522. let mobytPending: Ref<boolean>
  523. if (ability.can('manage', 'texto')) {
  524. const fetchMobytStatus = () => {
  525. const { data, pending } = fetch(
  526. MobytUserStatus,
  527. organizationProfile!.id!,
  528. ) as AsyncData<MobytUserStatus | null, Error | null>
  529. mobytStatus = data
  530. mobytPending = pending
  531. }
  532. fetchMobytStatus()
  533. } else {
  534. mobytStatus = ref(null)
  535. mobytPending = ref(false)
  536. }
  537. const formatCurrency = (value: number, currency: string): string => {
  538. return value.toLocaleString(i18n.locale.value, {
  539. style: 'currency',
  540. currency,
  541. })
  542. }
  543. // Compute the number of columns of the more_features pannel
  544. const nbCols =
  545. 2 +
  546. (organizationProfile.isArtist ? 1 : 0) +
  547. (organizationProfile.isArtistProduct ? 1 : 0)
  548. const colWidth = 12 / nbCols
  549. </script>
  550. <style scoped lang="scss">
  551. #products-section {
  552. width: 100%;
  553. .v-col {
  554. min-width: 260px;
  555. border: solid 1px rgb(var(--v-theme-on-primary));
  556. .v-row:nth-child(1) {
  557. //background: rgb(var(--v-theme-neutral-soft));
  558. height: 64px;
  559. color: rgb(var(--v-theme-on-neutral-soft));
  560. //font-size: 15px;
  561. font-weight: bold;
  562. border-bottom: solid 1px rgb(var(--v-theme-neutral));
  563. }
  564. .v-row:nth-child(2) {
  565. height: 230px;
  566. display: flex;
  567. justify-content: center;
  568. border-bottom: solid 1px rgb(var(--v-theme-neutral));
  569. }
  570. .v-row:nth-child(3) {
  571. }
  572. }
  573. .v-col:not(:first-child) {
  574. border-left: none;
  575. }
  576. img {
  577. max-height: 90%;
  578. max-width: 90%;
  579. }
  580. .v-row {
  581. padding: 12px 18px;
  582. vertical-align: top;
  583. border-bottom: solid 1px rgb(var(--v-theme-on-primary));
  584. }
  585. .v-row:last-child {
  586. border: none;
  587. }
  588. p {
  589. margin-bottom: 12px;
  590. }
  591. ul {
  592. padding-left: 24px;
  593. }
  594. }
  595. </style>