subscription.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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 :multiple="true" v-model="openedPanels">
  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>{{ $t('client_id') }}</td>
  16. <td>{{ dolibarrAccount ? dolibarrAccount.clientNumber : '-' }}</td>
  17. </tr>
  18. <tr>
  19. <td>{{ $t('version') }}</td>
  20. <td>{{ dolibarrAccount ? $t(dolibarrAccount.product) : '-' }}</td>
  21. </tr>
  22. <tr v-if="dolibarrAccount && dolibarrAccount.contract">
  23. <td>{{ $t('services') }}</td>
  24. <td class="py-2">
  25. <div
  26. v-for="line in dolibarrAccount.contract.lines"
  27. :key="line.id"
  28. >
  29. {{ line.serviceLabel }} - {{ $t('until') }} :
  30. {{ $d(line.dateEnd) }}
  31. </div>
  32. </td>
  33. </tr>
  34. <tr v-if="$can('manage', 'texto')">
  35. <td>{{ $t('remaining_sms_credit') }}</td>
  36. <td>
  37. <span v-if="!mobytPending && mobytStatus !== null && mobytStatus.active">
  38. {{ mobytStatus.money.toLocaleString($i18n.locale, { style: 'currency', currency: 'EUR' }) }}
  39. {{ $t('convert_price_to_sms', { nb_sms: mobytStatus.amount }) }}
  40. </span>
  41. </td>
  42. </tr>
  43. </tbody>
  44. </v-table>
  45. </v-row>
  46. </v-container>
  47. </UiExpansionPanel>
  48. <UiExpansionPanel v-if="showDolibarrPanel" title="bills" icon="fas fa-file">
  49. <v-container fluid class="container">
  50. <v-row>
  51. <v-table>
  52. <thead>
  53. <tr>
  54. <th>{{ $t('reference') }}</th>
  55. <th>{{ $t('date') }}</th>
  56. <th>{{ $t('taxExcludedAmount') }}</th>
  57. <th>{{ $t('status') }}</th>
  58. </tr>
  59. </thead>
  60. <tbody>
  61. <tr
  62. v-for="bill in dolibarrAccount.bills"
  63. :key="bill.id"
  64. >
  65. <td>{{ bill.ref }}</td>
  66. <td>{{ $d(bill.date) }}</td>
  67. <td>{{ bill.taxExcludedAmount.toLocaleString($i18n.locale, { style: 'currency', currency: 'EUR' }) }}</td>
  68. <td>{{ bill.paid === true ? $t('paid') : $t('unpaid') }}</td>
  69. </tr>
  70. </tbody>
  71. </v-table>
  72. </v-row>
  73. </v-container>
  74. </UiExpansionPanel>
  75. <UiExpansionPanel title="more_features" icon="fas fa-plus">
  76. <v-container id="products-section" fluid class="container">
  77. <v-row>
  78. <v-table>
  79. <template #default>
  80. <thead>
  81. <tr>
  82. <th v-if="organizationProfile.isArtistProduct">
  83. {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  84. </th>
  85. <th v-if="organizationProfile.isArtist">
  86. {{ $t('PRODUCT_SCHOOL') }}
  87. </th>
  88. <th>
  89. {{ $t('sms') }}
  90. </th>
  91. <th>
  92. {{ $t('website') }}
  93. </th>
  94. </tr>
  95. </thead>
  96. <tbody>
  97. <tr class="center-td-content">
  98. <td v-if="organizationProfile.isArtistProduct">
  99. <nuxt-img src="/images/Artist-Square.jpg" />
  100. </td>
  101. <td v-if="organizationProfile.isArtist">
  102. <nuxt-img src="/images/School-Square.jpg" />
  103. </td>
  104. <td>
  105. <nuxt-img src="/images/sms_big.png" />
  106. </td>
  107. <td>
  108. <nuxt-img src="/images/nom-de-domaine.jpg" />
  109. </td>
  110. </tr>
  111. <tr>
  112. <!-- Opentalent Artist Premium -->
  113. <td v-if="organizationProfile.isArtistProduct">
  114. <p>
  115. {{ $t('get_more_functionalities_with_version') }} <b>{{ $t('PRODUCT_ARTIST_PREMIUM') }}</b>
  116. </p>
  117. <!-- Cmf member -->
  118. <div v-if="organizationProfile.isCmf">
  119. <p>
  120. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(7.25, 'EUR') }) }} *</b>
  121. </p>
  122. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(87.00, 'EUR') }) }}</i></div>
  123. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(168.00, 'EUR') }) }})</i></div>
  124. </div>
  125. <!-- Not a cmf member -->
  126. <div v-else>
  127. <p>
  128. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(14.00, 'EUR') }) }} *</b>
  129. </p>
  130. <p>
  131. <i>
  132. * {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(168.00, 'EUR') }) }}
  133. </i>
  134. </p>
  135. </div>
  136. <p class="mt-3">
  137. <a href="/resources/Fiche_produit_Opentalent_Artist.pdf" target="_blank">
  138. {{ $t('product_sheet') }} {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  139. </a>
  140. </p>
  141. <p v-if="organizationProfile.isCmf" class="mt-3">
  142. <a href="/resources/BDC_Artist_Premium_CMF.pdf">
  143. <b>{{ $t('download_cmf_order_form') }}</b>
  144. </a>
  145. </p>
  146. <p v-else class="mt-3">
  147. <a href="/resources/BDC_Artist_Premium_Public.pdf">
  148. <b>{{ $t('download_order_form') }}</b>
  149. </a>
  150. </p>
  151. </td>
  152. <!-- Opentalent School Premium -->
  153. <td v-if="organizationProfile.isArtist">
  154. <p>
  155. {{ $t('switch_to_version') }} <b>{{ $t('PRODUCT_SCHOOL_PREMIUM') }}</b> {{ $t('and_benefit') }} :
  156. </p>
  157. <ul class="mb-2">
  158. <li>{{ $t('of_accounts_for_teachers_and_students') }}</li>
  159. <li>{{ $t('of_a_complete_website') }}</li>
  160. </ul>
  161. <!-- Cmf member -->
  162. <div v-if="organizationProfile.isCmf">
  163. <p><b>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(26.50, 'EUR') }) }} *</b></p>
  164. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(318.00, 'EUR') }) }}</i></div>
  165. <div><i>{{ $t('version_x_up_to_x_students', { product: $t('PRODUCT_SCHOOL_PREMIUM'), max_students: '69' }) }}</i></div>
  166. <div><i>{{ $t('excluding_license_and_training_fees') }}.</i></div>
  167. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(529.20, 'EUR') }) }})</i></div>
  168. </div>
  169. <!-- Not cmf member -->
  170. <div v-else>
  171. <p>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(44.10, 'EUR') }) }} *</p>
  172. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(529.20, 'EUR') }) }}</i></div>
  173. <div><i>{{ $t('version_x_up_to_x_students', { product: $t('PRODUCT_SCHOOL_PREMIUM'), max_students: '69' }) }}</i></div>
  174. <div><i>{{ $t('excluding_license_and_training_fees') }}.</i></div>
  175. </div>
  176. <p class="mt-4">
  177. <a href="/resources/Fiche_produit_Opentalent_School.pdf" target="_blank">
  178. {{ $t('product_sheet') }} {{ $t('PRODUCT_SCHOOL') }}
  179. </a>
  180. </p>
  181. <p>
  182. {{ $t('contact_us_at') }} <a href="tel:+33972126017">0 972 126 017</a>, {{ $t('or_by_mail_at') }}
  183. <a href="mailto:contact@opentalent.fr">contact@opentalent.fr</a>
  184. </p>
  185. </td>
  186. <!-- SMS -->
  187. <td>
  188. <p><b>{{ $t('send_sms') }} {{ $t('to_your_members_from_app') }}</b></p>
  189. <!-- Cmf member -->
  190. <div v-if="organizationProfile.isCmf">
  191. <p><b>{{ $t('starting_from_x_eur_ttc_per_sms', { price: formatCurrency(0.10, 'EUR') }) }} *</b></p>
  192. <p><i>* {{ $t('for_x_sms', { amount: '5000' }) }}</i></p>
  193. <p>
  194. <b>
  195. <a href="/resources/BDC_SMS_CMF.pdf" target="_blank">
  196. {{ $t('download_cmf_order_form') }}
  197. </a>
  198. </b>
  199. </p>
  200. </div>
  201. <!-- Not cmf member -->
  202. <div v-else>
  203. <p><b>{{ $t('starting_from_x_eur_ttc_per_sms', { price: formatCurrency(0.12, 'EUR') }) }} *</b></p>
  204. <p><i>* {{ $t('for_x_sms', { amount: '5000' }) }}</i></p>
  205. <p>
  206. <a href="/resources/BDC_SMS_Public.pdf" target="_blank">
  207. <b>{{ $t('download_order_form') }}</b>
  208. </a>
  209. </p>
  210. </div>
  211. </td>
  212. <!-- Custom domain -->
  213. <td>
  214. <p>
  215. <b>{{ $t('get_your_own_domain_and_up_to_five_emails_for_only_x_eur_ttc_per_month', { price: formatCurrency(34.80, 'EUR') }) }}</b>
  216. </p>
  217. <p>{{ $t('example') }} :</p>
  218. <table>
  219. <tbody>
  220. <tr>
  221. <td style="width: 190px;">
  222. {{ $t('domain_name') }} :
  223. </td>
  224. <td>
  225. <i>{{ $t('dummy_domain_name') }}</i>
  226. </td>
  227. </tr>
  228. <tr>
  229. <td>{{ $t('associated_mail_address') }} : </td>
  230. <td>
  231. <i>{{ $t('dummy_email_address') }}</i>
  232. </td>
  233. </tr>
  234. </tbody>
  235. </table>
  236. <p>
  237. <a href="/resources/BDC_Nom_de_domaine.pdf" target="_blank">
  238. <b>{{ $t('download_order_form') }}</b>
  239. </a>
  240. </p>
  241. </td>
  242. </tr>
  243. </tbody>
  244. </template>
  245. </v-table>
  246. </v-row>
  247. </v-container>
  248. </UiExpansionPanel>
  249. </v-expansion-panels>
  250. </v-col>
  251. </LayoutContainer>
  252. </template>
  253. <script setup lang="ts">
  254. import {useAbility} from "@casl/vue";
  255. import {useOrganizationProfileStore} from "~/stores/organizationProfile";
  256. import {useEntityFetch} from "~/composables/data/useEntityFetch";
  257. import {DolibarrAccount} from "~/models/Organization/DolibarrAccount";
  258. import {MobytUserStatus} from "~/models/Organization/MobytUserStatus";
  259. import {Ref} from "@vue/reactivity";
  260. import {useAbilityUtils} from "~/composables/utils/useAbilityUtils";
  261. import {useAccessProfileStore} from "~/stores/accessProfile";
  262. const ability = useAbility()
  263. onBeforeMount(() => {
  264. if(!ability.can('display', 'subscription_page'))
  265. return navigateTo('/error')
  266. })
  267. const showDolibarrPanel = computed(() => !dolibarrPending.value && dolibarrAccount.value && dolibarrAccount.value.bills.length > 0)
  268. // On ouvre les panneaux dans le onMounted en attendant la résolution du bug : https://github.com/vuetifyjs/vuetify/issues/16427#issuecomment-1380927133
  269. // TODO: quand le bug ci dessus est résolu, remplacer par `const openedPanels: Ref<Array<string>> = ref(['informations', 'bills', 'more_features'])`
  270. const openedPanels: Ref<Array<string>> = ref([])
  271. onMounted(() => {
  272. openedPanels.value = ['informations', 'bills', 'more_features']
  273. })
  274. const i18n = useI18n()
  275. const organizationProfile = useOrganizationProfileStore()
  276. if (organizationProfile.id === null) {
  277. throw new Error("Missing organization's id")
  278. }
  279. const { fetch } = useEntityFetch()
  280. const { data: dolibarrAccount, pending: dolibarrPending } = fetch(DolibarrAccount, organizationProfile.id)
  281. if (organizationProfile.hasModule('Sms')) {
  282. const {data: mobytStatus, pending: mobytPending} = fetch(MobytUserStatus, organizationProfile.id)
  283. } else {
  284. const mobytStatus = ref(null)
  285. const mobytPending = ref(false)
  286. }
  287. const formatCurrency = (value: Number, currency: string): string => {
  288. return value.toLocaleString(i18n.locale.value, { style: 'currency', currency: currency })
  289. }
  290. </script>
  291. <style>
  292. #products-section table {
  293. table-layout: fixed;
  294. width: 100%;
  295. }
  296. #products-section table img {
  297. max-height: 250px;
  298. max-width: 100%;
  299. }
  300. #products-section tr.center-td-content td {
  301. text-align: center;
  302. }
  303. #products-section td {
  304. padding: 12px 18px;
  305. vertical-align: top;
  306. }
  307. #products-section p {
  308. margin-bottom: 12px;
  309. }
  310. #products-section ul {
  311. padding-left: 24px;
  312. }
  313. .theme--light.v-data-table > .v-data-table__wrapper > table > tbody > tr:hover:not(.v-data-table__expanded__content):not(.v-data-table__empty-wrapper) {
  314. background:none;
  315. }
  316. .products-pictures img {
  317. width: 70%;
  318. }
  319. </style>