subscription.vue 14 KB

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