subscription.vue 20 KB

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