subscription.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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" v-if="!dolibarrAccountFetch.pending && dolibarrAccount && dolibarrAccount.bills">
  47. <v-container fluid class="container">
  48. <v-row>
  49. <v-simple-table>
  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. </v-row>
  71. </v-container>
  72. </UiExpansionPanel>
  73. <UiExpansionPanel id="more_features" icon="fa-plus">
  74. <v-container id="products-section" fluid class="container">
  75. <v-row>
  76. <v-simple-table>
  77. <template #default>
  78. <thead>
  79. <tr>
  80. <th v-if="organizationProfile.isArtistProduct()">
  81. {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  82. </th>
  83. <th v-if="organizationProfile.isArtist()">
  84. {{ $t('PRODUCT_SCHOOL') }}
  85. </th>
  86. <th>
  87. {{ $t('sms') }}
  88. </th>
  89. <th>
  90. {{ $t('website') }}
  91. </th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <tr class="center-td-content">
  96. <td v-if="organizationProfile.isArtistProduct()">
  97. <nuxt-img src="/images/Artist-Square.jpg" />
  98. </td>
  99. <td v-if="organizationProfile.isArtist()">
  100. <nuxt-img src="/images/School-Square.jpg" />
  101. </td>
  102. <td>
  103. <nuxt-img src="/images/sms_big.png" />
  104. </td>
  105. <td>
  106. <nuxt-img src="/images/nom-de-domaine.jpg" />
  107. </td>
  108. </tr>
  109. <tr>
  110. <!-- Opentalent Artist Premium -->
  111. <td v-if="organizationProfile.isArtistProduct()">
  112. <p>
  113. {{ $t('get_more_functionalities_with_version') }} <b>{{ $t('PRODUCT_ARTIST_PREMIUM') }}</b>
  114. </p>
  115. <!-- Cmf member -->
  116. <div v-if="organizationProfile.isCmf()">
  117. <p>
  118. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(7.25, 'EUR') }) }} *</b>
  119. </p>
  120. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(87.00, 'EUR') }) }}</i></div>
  121. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(168.00, 'EUR') }) }})</i></div>
  122. </div>
  123. <!-- Not a cmf member -->
  124. <div v-else>
  125. <p>
  126. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(14.00, 'EUR') }) }} *</b>
  127. </p>
  128. <p>
  129. <i>
  130. * {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(168.00, 'EUR') }) }}
  131. </i>
  132. </p>
  133. </div>
  134. <p class="mt-3">
  135. <a href="https://www.opentalent.fr/uploads/opentalent/ficheproduit_Opentalentartist.pdf" target="_blank">
  136. {{ $t('product_sheet') }} {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  137. </a>
  138. </p>
  139. <p v-if="organizationProfile.isCmf()" class="mt-3">
  140. <a href="">
  141. <b>{{ $t('download_cmf_order_form') }}</b>
  142. </a>
  143. </p>
  144. <p v-else class="mt-3">
  145. <a href="">
  146. <b>{{ $t('download_order_form') }}</b>
  147. </a>
  148. </p>
  149. </td>
  150. <!-- Opentalent School Premium -->
  151. <td v-if="organizationProfile.isArtist()">
  152. <p>
  153. {{ $t('switch_to_version') }} <b>{{ $t('PRODUCT_SCHOOL_PREMIUM') }}</b> {{ $t('and_benefit') }} :
  154. </p>
  155. <ul class="mb-2">
  156. <li>{{ $t('of_accounts_for_teachers_and_students') }}</li>
  157. <li>{{ $t('of_a_complete_website') }}</li>
  158. </ul>
  159. <!-- Cmf member -->
  160. <div v-if="organizationProfile.isCmf()">
  161. <p><b>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(26.50, 'EUR') }) }} *</b></p>
  162. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(318.00, 'EUR') }) }}</i></div>
  163. <div><i>{{ $t('version_x_up_to_x_students', { product: $t('PRODUCT_SCHOOL_PREMIUM'), max_students: '69' }) }}</i></div>
  164. <div><i>{{ $t('excluding_license_and_training_fees') }}.</i></div>
  165. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(529.20, 'EUR') }) }})</i></div>
  166. </div>
  167. <!-- Not cmf member -->
  168. <div v-else>
  169. <p>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(44.10, 'EUR') }) }} *</p>
  170. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(529.20, 'EUR') }) }}</i></div>
  171. <div><i>{{ $t('version_x_up_to_x_students', { product: $t('PRODUCT_SCHOOL_PREMIUM'), max_students: '69' }) }}</i></div>
  172. <div><i>{{ $t('excluding_license_and_training_fees') }}.</i></div>
  173. </div>
  174. <p class="mt-4">
  175. <a href="https://www.opentalent.fr/uploads/opentalent/ficheproduit_Opentalentschool" target="_blank">
  176. {{ $t('product_sheet') }} {{ $t('PRODUCT_SCHOOL') }}
  177. </a>
  178. </p>
  179. <p>
  180. {{ $t('contact_us_at') }} <a href="tel:+33972126017">0 972 126 017</a>, {{ $t('or_by_mail_at') }}
  181. <a href="mailto:contact@opentalent.fr">contact@opentalent.fr</a>
  182. </p>
  183. </td>
  184. <!-- SMS -->
  185. <td>
  186. <p><b>{{ $t('send_sms') }} {{ $t('to_your_members_from_app') }}</b></p>
  187. <!-- Cmf member -->
  188. <div v-if="organizationProfile.isCmf()">
  189. <p><b>{{ $t('starting_from_x_eur_ttc_per_sms', { price: formatCurrency(0.10, 'EUR') }) }} *</b></p>
  190. <p><i>* {{ $t('for_x_sms', { amount: '5000' }) }}</i></p>
  191. <p>
  192. <b>
  193. <a href="https://www.opentalent.fr/uploads/opentalent/Bon_commande_SMS_ouverture-CMF.pdf" target="_blank">
  194. {{ $t('download_cmf_order_form') }}
  195. </a>
  196. </b>
  197. </p>
  198. </div>
  199. <!-- Not cmf member -->
  200. <div v-else>
  201. <p><b>{{ $t('starting_from_x_eur_ttc_per_sms', { price: formatCurrency(0.12, 'EUR') }) }} *</b></p>
  202. <p><i>* {{ $t('for_x_sms', { amount: '5000' }) }}</i></p>
  203. <p>
  204. <a href="https://www.opentalent.fr/uploads/opentalent/Bon_commande_SMS_ouverture-public.pdf" target="_blank">
  205. <b>{{ $t('download_order_form') }}</b>
  206. </a>
  207. </p>
  208. </div>
  209. </td>
  210. <!-- Custom domain -->
  211. <td>
  212. <p>
  213. <b>{{ $t('get_your_own_domain_and_up_to_five_emails_for_only_x_eur_ttc_per_month', { price: formatCurrency(34.80, 'EUR') }) }}</b>
  214. </p>
  215. <p>{{ $t('example') }} :</p>
  216. <table>
  217. <tbody>
  218. <tr>
  219. <td style="width: 150px;">
  220. {{ $t('domain_name') }} :
  221. </td>
  222. <td>
  223. <i>{{ $t('dummy_domain_name') }}</i>
  224. </td>
  225. </tr>
  226. <tr>
  227. <td>{{ $t('associated_mail_address') }} : </td>
  228. <td>
  229. <i>{{ $t('dummy_email_address') }}</i>
  230. </td>
  231. </tr>
  232. </tbody>
  233. </table>
  234. </td>
  235. </tr>
  236. </tbody>
  237. </template>
  238. </v-simple-table>
  239. </v-row>
  240. </v-container>
  241. </UiExpansionPanel>
  242. </v-expansion-panels>
  243. </v-col>
  244. </LayoutContainer>
  245. </template>
  246. <script lang="ts">
  247. import { defineComponent, useFetch, useContext, ref, Ref } from '@nuxtjs/composition-api'
  248. import { $organizationProfile } from '~/services/profile/organizationProfile'
  249. import { QUERY_TYPE } from '~/types/enums'
  250. import { ApiResponse, DolibarrAccount } from '~/types/interfaces'
  251. import {trimEnd} from "lodash";
  252. export default defineComponent({
  253. name: 'Subscription',
  254. setup () {
  255. const { store, $dataProvider } = useContext()
  256. const organizationProfile = ref($organizationProfile(store))
  257. const id: number = store.state.profile.organization.id
  258. const dolibarrAccount: Ref<DolibarrAccount | null> = ref(null)
  259. console.log(organizationProfile.value)
  260. console.log(organizationProfile.value.isArtist())
  261. console.log(organizationProfile.value.isArtistProduct())
  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>