subscription.vue 14 KB

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