subscription.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. <h3 class="mb-5">{{ $t('my_subscription') }}</h3>
  9. <v-expansion-panels focusable multiple :value="[0,1,2]">
  10. <UiExpansionPanel id="informations" icon="fa-info">
  11. <v-container fluid class="container">
  12. <v-row>
  13. <v-simple-table>
  14. <tbody>
  15. <tr>
  16. <td>{{ $t('client_id') }}</td>
  17. <td>{{ dolibarrAccount ? dolibarrAccount.clientNumber : '-' }}</td>
  18. </tr>
  19. <tr>
  20. <td>{{ $t('version') }}</td>
  21. <td>{{ dolibarrAccount ? $t(dolibarrAccount.product) : '-' }}</td>
  22. </tr>
  23. <tr v-if="dolibarrAccount && dolibarrAccount.contract">
  24. <td>{{ $t('services') }}</td>
  25. <td>
  26. <div
  27. v-for="line in dolibarrAccount.contract.lines"
  28. :key="line.id"
  29. style="list-style: none;"
  30. >
  31. {{ line.serviceLabel }}
  32. </div>
  33. </td>
  34. </tr>
  35. <tr>
  36. <td>{{ $t('remaining_sms_credit') }}</td>
  37. <td>
  38. <UiDisplayMobytStatus />
  39. </td>
  40. </tr>
  41. </tbody>
  42. </v-simple-table>
  43. </v-row>
  44. </v-container>
  45. </UiExpansionPanel>
  46. <UiExpansionPanel id="bills" icon="fa-file">
  47. <v-container fluid class="container">
  48. <v-row>
  49. <v-simple-table v-if="!dolibarrAccountFetch.pending && dolibarrAccount && dolibarrAccount.bills">
  50. <thead>
  51. <tr>
  52. <th>{{ $t('reference') }}</th>
  53. <th>{{ $t('date') }}</th>
  54. <th>{{ $t('taxExcludedAmount') }}</th>
  55. <th>{{ $t('status') }}</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. <tr
  60. v-for="bill in dolibarrAccount.bills"
  61. :key="bill.id"
  62. >
  63. <td>{{ bill.ref }}</td>
  64. <td>{{ $moment(bill.date).format($moment.localeData($i18n.locale).longDateFormat('L')) }}</td>
  65. <td>{{ bill.taxExcludedAmount.toLocaleString($i18n.locale, { style: 'currency', currency: 'EUR' }) }}</td>
  66. <td>{{ bill.status === 1 ? $t('paid') : $t('unpaid') }}</td>
  67. </tr>
  68. </tbody>
  69. </v-simple-table>
  70. <div v-else class="ma-2">
  71. <i>{{ $t('no_bill_to_display') }}</i>
  72. </div>
  73. </v-row>
  74. </v-container>
  75. </UiExpansionPanel>
  76. <UiExpansionPanel id="more_features" icon="fa-plus">
  77. <v-container id="products-section" fluid class="container">
  78. <v-row>
  79. <v-simple-table>
  80. <template #default>
  81. <thead>
  82. <tr>
  83. <th v-if="organizationProfile.isArtistProduct">
  84. {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  85. </th>
  86. <th v-if="organizationProfile.isArtist">
  87. {{ $t('PRODUCT_SCHOOL') }}
  88. </th>
  89. <th>
  90. {{ $t('sms') }}
  91. </th>
  92. <th>
  93. {{ $t('website') }}
  94. </th>
  95. </tr>
  96. </thead>
  97. <tbody>
  98. <tr class="center-td-content">
  99. <td v-if="organizationProfile.isArtistProduct">
  100. <nuxt-img src="/images/Artist-Square.jpg" />
  101. </td>
  102. <td v-if="organizationProfile.isArtist">
  103. <nuxt-img src="/images/School-Square.jpg" />
  104. </td>
  105. <td>
  106. <nuxt-img src="/images/sms_big.png" />
  107. </td>
  108. <td>
  109. <nuxt-img src="/images/nom-de-domaine.jpg" />
  110. </td>
  111. </tr>
  112. <tr>
  113. <!-- Opentalent Artist Premium -->
  114. <td v-if="organizationProfile.isArtistProduct">
  115. <p>
  116. {{ $t('get_more_functionalities_with_version') }} <b>{{ $t('PRODUCT_ARTIST_PREMIUM') }}</b>
  117. </p>
  118. <!-- Cmf member -->
  119. <div v-if="organizationProfile.isCmf">
  120. <p>
  121. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(7.25, 'EUR') }) }} *</b>
  122. </p>
  123. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(87.00, 'EUR') }) }}</i></div>
  124. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(168.00, 'EUR') }) }})</i></div>
  125. </div>
  126. <!-- Not a cmf member -->
  127. <div v-else>
  128. <p>
  129. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(14.00, 'EUR') }) }} *</b>
  130. </p>
  131. <p>
  132. <i>
  133. * {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(168.00, 'EUR') }) }}
  134. </i>
  135. </p>
  136. </div>
  137. <p class="mt-3">
  138. <a href="https://www.opentalent.fr/uploads/opentalent/ficheproduit_Opentalentartist.pdf" target="_blank">
  139. {{ $t('product_sheet') }} {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  140. </a>
  141. </p>
  142. <p v-if="organizationProfile.isCmf" class="mt-3">
  143. <a href="">
  144. <b>{{ $t('download_cmf_order_form') }}</b>
  145. </a>
  146. </p>
  147. <p v-else class="mt-3">
  148. <a href="">
  149. <b>{{ $t('download_order_form') }}</b>
  150. </a>
  151. </p>
  152. </td>
  153. <!-- Opentalent School Premium -->
  154. <td v-if="organizationProfile.isArtist">
  155. <p>
  156. {{ $t('switch_to_version') }} <b>{{ $t('PRODUCT_SCHOOL_PREMIUM') }}</b> {{ $t('and_benefit') }} :
  157. </p>
  158. <ul class="mb-2">
  159. <li>{{ $t('of_accounts_for_teachers_and_students') }}</li>
  160. <li>{{ $t('of_a_complete_website') }}</li>
  161. </ul>
  162. <!-- Cmf member -->
  163. <div v-if="organizationProfile.isCmf">
  164. <p><b>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(26.50, 'EUR') }) }} *</b></p>
  165. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(318.00, 'EUR') }) }}</i></div>
  166. <div><i>{{ $t('version_x_up_to_x_students', { product: $t('PRODUCT_SCHOOL_PREMIUM'), max_students: '69' }) }}</i></div>
  167. <div><i>{{ $t('excluding_license_and_training_fees') }}.</i></div>
  168. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(529.20, 'EUR') }) }})</i></div>
  169. </div>
  170. <!-- Not cmf member -->
  171. <div v-else>
  172. <p>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(44.10, 'EUR') }) }} *</p>
  173. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(529.20, '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>
  177. <p class="mt-4">
  178. <a href="https://www.opentalent.fr/uploads/opentalent/ficheproduit_Opentalentschool" target="_blank">
  179. {{ $t('product_sheet') }} {{ $t('PRODUCT_SCHOOL') }}
  180. </a>
  181. </p>
  182. <p>
  183. {{ $t('contact_us_at') }} <a href="tel:+33972126017">0 972 126 017</a>, {{ $t('or_by_mail_at') }}
  184. <a href="mailto:contact@opentalent.fr">contact@opentalent.fr</a>
  185. </p>
  186. </td>
  187. <!-- SMS -->
  188. <td>
  189. <p><b>{{ $t('send_sms') }} {{ $t('to_your_members_from_app') }}</b></p>
  190. <!-- Cmf member -->
  191. <div v-if="organizationProfile.isCmf">
  192. <p><b>{{ $t('starting_from_x_eur_ttc_per_sms', { price: formatCurrency(0.10, 'EUR') }) }} *</b></p>
  193. <p><i>* {{ $t('for_x_sms', { amount: '5000' }) }}</i></p>
  194. <p>
  195. <b>
  196. <a href="https://www.opentalent.fr/uploads/opentalent/Bon_commande_SMS_ouverture-CMF.pdf" target="_blank">
  197. {{ $t('download_cmf_order_form') }}
  198. </a>
  199. </b>
  200. </p>
  201. </div>
  202. <!-- Not cmf member -->
  203. <div v-else>
  204. <p><b>{{ $t('starting_from_x_eur_ttc_per_sms', { price: formatCurrency(0.12, 'EUR') }) }} *</b></p>
  205. <p><i>* {{ $t('for_x_sms', { amount: '5000' }) }}</i></p>
  206. <p>
  207. <a href="https://www.opentalent.fr/uploads/opentalent/Bon_commande_SMS_ouverture-public.pdf" target="_blank">
  208. <b>{{ $t('download_order_form') }}</b>
  209. </a>
  210. </p>
  211. </div>
  212. </td>
  213. <!-- Custom domain -->
  214. <td>
  215. <p>
  216. <b>{{ $t('get_your_own_domain_and_up_to_five_emails_for_only_x_eur_ttc_per_month', { price: formatCurrency(34.80, 'EUR') }) }}</b>
  217. </p>
  218. <p>{{ $t('example') }} :</p>
  219. <table>
  220. <tbody>
  221. <tr>
  222. <td style="width: 150px;">
  223. {{ $t('domain_name') }} :
  224. </td>
  225. <td>
  226. <i>{{ $t('dummy_domain_name') }}</i>
  227. </td>
  228. </tr>
  229. <tr>
  230. <td>{{ $t('associated_mail_address') }} : </td>
  231. <td>
  232. <i>{{ $t('dummy_email_address') }}</i>
  233. </td>
  234. </tr>
  235. </tbody>
  236. </table>
  237. </td>
  238. </tr>
  239. </tbody>
  240. </template>
  241. </v-simple-table>
  242. </v-row>
  243. </v-container>
  244. </UiExpansionPanel>
  245. </v-expansion-panels>
  246. </v-col>
  247. </LayoutContainer>
  248. </template>
  249. <script lang="ts">
  250. import { defineComponent, useFetch, useContext, ref, Ref } from '@nuxtjs/composition-api'
  251. import { $organizationProfile } from '~/services/profile/organizationProfile'
  252. import { QUERY_TYPE } from '~/types/enums'
  253. import { ApiResponse, DolibarrAccount } from '~/types/interfaces'
  254. import {trimEnd} from "lodash";
  255. export default defineComponent({
  256. name: 'Subscription',
  257. setup () {
  258. const { store, $dataProvider } = useContext()
  259. const organizationProfile = ref($organizationProfile(store))
  260. const id: number = store.state.profile.organization.id
  261. const dolibarrAccount: Ref<DolibarrAccount | null> = ref(null)
  262. // fetch the dolibarr account's data
  263. const { fetchState } = useFetch(async () => {
  264. try {
  265. const response: ApiResponse = await $dataProvider.invoke({
  266. type: QUERY_TYPE.DEFAULT,
  267. url: '/api/dolibarr/account/' + id
  268. })
  269. dolibarrAccount.value = response.data as DolibarrAccount
  270. } catch (Error) {
  271. // eslint-disable-next-line no-console
  272. console.error('Error: Dolibarr account not found')
  273. }
  274. })
  275. return {
  276. organizationProfile,
  277. dolibarrAccount,
  278. dolibarrAccountFetch: fetchState
  279. }
  280. },
  281. methods: {
  282. formatCurrency(value: Number, currency: string): string {
  283. return value.toLocaleString(this.$i18n.locale, { style: 'currency', currency: currency })
  284. }
  285. }
  286. })
  287. </script>
  288. <style>
  289. #products-section table {
  290. table-layout: fixed;
  291. width: 100%;
  292. }
  293. #products-section table img {
  294. max-height: 250px;
  295. max-width: 100%;
  296. }
  297. #products-section tr.center-td-content td {
  298. text-align: center;
  299. }
  300. #products-section td {
  301. padding: 12px 18px;
  302. vertical-align: top;
  303. }
  304. </style>