subscription.vue 15 KB

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