subscription.vue 14 KB

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