subscription.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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 :multiple="true" v-model="openedPanels">
  9. <UiExpansionPanel title="informations" icon="fas fa-info">
  10. <v-container fluid class="container">
  11. <v-row>
  12. <v-table>
  13. <tbody>
  14. <tr>
  15. <td v-if="smAndUp">{{ $t('client_id') }}</td>
  16. <td class="py-2">
  17. <h5 v-if="!smAndUp" class="text-decoration-underline py-2">{{ $t('client_id') }}</h5>
  18. <span>{{ dolibarrAccount ? dolibarrAccount.clientNumber : '-' }}</span>
  19. </td>
  20. </tr>
  21. <tr>
  22. <td v-if="smAndUp">{{ $t('version') }}</td>
  23. <td class="py-2">
  24. <h5 v-if="!smAndUp" class="text-decoration-underline py-2">{{ $t('version') }}</h5>
  25. <span>{{ dolibarrAccount ? $t(dolibarrAccount.product) : '-' }}</span>
  26. </td>
  27. </tr>
  28. <tr v-if="dolibarrAccount && dolibarrAccount.contract">
  29. <td v-if="smAndUp">{{ $t('services') }}</td>
  30. <td class="py-2">
  31. <h5 v-if="!smAndUp" class="text-decoration-underline py-2">{{ $t('services') }}</h5>
  32. <div
  33. v-for="line in dolibarrAccount.contract.lines"
  34. :key="line.id"
  35. >
  36. {{ line.serviceLabel }} - {{ $t('until') }} :
  37. {{ $d(line.dateEnd) }}
  38. </div>
  39. </td>
  40. </tr>
  41. <tr v-if="$can('manage', 'texto')">
  42. <td v-if="smAndUp">{{ $t('remaining_sms_credit') }}</td>
  43. <td class="py-2">
  44. <h5 v-if="!smAndUp" class="text-decoration-underline py-2">{{ $t('remaining_sms_credit') }}</h5>
  45. <span v-if="!mobytPending && mobytStatus !== null && mobytStatus.active">
  46. {{ mobytStatus.money.toLocaleString($i18n.locale, { style: 'currency', currency: 'EUR' }) }}
  47. {{ $t('convert_price_to_sms', { nb_sms: mobytStatus.amount }) }}
  48. </span>
  49. </td>
  50. </tr>
  51. </tbody>
  52. </v-table>
  53. </v-row>
  54. </v-container>
  55. </UiExpansionPanel>
  56. <UiExpansionPanel v-if="showDolibarrPanel" title="bills" icon="fas fa-file">
  57. <v-container fluid class="container">
  58. <v-row>
  59. <v-table>
  60. <thead>
  61. <tr>
  62. <th>{{ $t('reference') }}</th>
  63. <th>{{ $t('date') }}</th>
  64. <th>{{ $t('taxExcludedAmount') }}</th>
  65. <th>{{ $t('status') }}</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <tr
  70. v-for="bill in dolibarrAccount.bills"
  71. :key="bill.id"
  72. >
  73. <td>{{ bill.ref }}</td>
  74. <td>{{ $d(bill.date) }}</td>
  75. <td>{{ bill.taxExcludedAmount.toLocaleString($i18n.locale, { style: 'currency', currency: 'EUR' }) }}</td>
  76. <td>{{ bill.paid === true ? $t('paid') : $t('unpaid') }}</td>
  77. </tr>
  78. </tbody>
  79. </v-table>
  80. </v-row>
  81. </v-container>
  82. </UiExpansionPanel>
  83. <UiExpansionPanel title="more_features" icon="fas fa-plus">
  84. <v-container id="products-section" fluid class="container">
  85. <v-row>
  86. <!-- Opentalent Artist Premium -->
  87. <v-col v-if="organizationProfile.isArtistProduct" :cols="colWidth">
  88. <v-row>
  89. {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  90. </v-row>
  91. <v-row class="align-end">
  92. <nuxt-img src="/images/Artist-Square.jpg" />
  93. </v-row>
  94. <v-row>
  95. <p>
  96. {{ $t('get_more_functionalities_with_version') }} <b>{{ $t('PRODUCT_ARTIST_PREMIUM') }}</b>
  97. </p>
  98. <!-- Cmf member -->
  99. <div v-if="organizationProfile.isCmf" cols="3">
  100. <p>
  101. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(7.25, 'EUR') }) }}&nbsp*</b>
  102. </p>
  103. <div><i>*&nbsp{{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(87.00, 'EUR') }) }}</i></div>
  104. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(168.00, 'EUR') }) }})</i></div>
  105. </div>
  106. <!-- Not a cmf member -->
  107. <div v-else>
  108. <p>
  109. <b>{{ $t('for_only_x_eur_ttc_by_month', { price: formatCurrency(14.00, 'EUR') }) }}&nbsp*</b>
  110. </p>
  111. <p>
  112. <i>
  113. *&nbsp{{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(168.00, 'EUR') }) }}
  114. </i>
  115. </p>
  116. </div>
  117. <p class="mt-3">
  118. <a href="/resources/Fiche_produit_Opentalent_Artist.pdf" target="_blank">
  119. {{ $t('product_sheet') }} {{ $t('PRODUCT_ARTIST_PREMIUM') }}
  120. </a>
  121. </p>
  122. <p v-if="organizationProfile.isCmf" class="mt-3">
  123. <a href="/resources/BDC_Artist_Premium_CMF.pdf">
  124. <b>{{ $t('download_cmf_order_form') }}</b>
  125. </a>
  126. </p>
  127. <p v-else class="mt-3">
  128. <a href="/resources/BDC_Artist_Premium_Public.pdf">
  129. <b>{{ $t('download_order_form') }}</b>
  130. </a>
  131. </p>
  132. </v-row>
  133. </v-col>
  134. <!-- Opentalent School Premium -->
  135. <v-col v-if="organizationProfile.isArtist" :cols="colWidth">
  136. <v-row>
  137. {{ $t('PRODUCT_SCHOOL') }}
  138. </v-row>
  139. <v-row class="align-end">
  140. <nuxt-img src="/images/School-Square.jpg" />
  141. </v-row>
  142. <v-row>
  143. <p>
  144. {{ $t('switch_to_version') }} <b>{{ $t('PRODUCT_SCHOOL_PREMIUM') }}</b> {{ $t('and_benefit') }} :
  145. </p>
  146. <ul class="mb-2">
  147. <li>{{ $t('of_accounts_for_teachers_and_students') }}</li>
  148. <li>{{ $t('of_a_complete_website') }}</li>
  149. </ul>
  150. <!-- Cmf member -->
  151. <div v-if="organizationProfile.isCmf">
  152. <p><b>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(26.50, 'EUR') }) }}&nbsp*</b></p>
  153. <div><i>* {{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(318.00, 'EUR') }) }}</i></div>
  154. <div><i>{{ $t('version_x_up_to_x_students', { product: $t('PRODUCT_SCHOOL_PREMIUM'), max_students: '69' }) }}</i></div>
  155. <div><i>{{ $t('excluding_license_and_training_fees') }}.</i></div>
  156. <div><i>{{ $t('only_for_cmf_members') }} ({{ $t('public_price_x_ttc_a_year', { price: formatCurrency(529.20, 'EUR') }) }})</i></div>
  157. </div>
  158. <!-- Not cmf member -->
  159. <div v-else>
  160. <p>{{ $t('starting_from_x_eur_ttc_per_month', { price: formatCurrency(44.10, 'EUR') }) }}&nbsp*</p>
  161. <div><i>*&nbsp{{ $t('yearly_paid_giving_x_eur_ttc_per_year', { price: formatCurrency(529.20, '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>
  165. <p class="mt-4">
  166. <a href="/resources/Fiche_produit_Opentalent_School.pdf" target="_blank">
  167. {{ $t('product_sheet') }} {{ $t('PRODUCT_SCHOOL') }}
  168. </a>
  169. </p>
  170. <p>
  171. {{ $t('contact_us_at') }} <a href="tel:+33972126017">0 972 126 017</a>, {{ $t('or_by_mail_at') }}
  172. <a href="mailto:contact@opentalent.fr">contact@opentalent.fr</a>
  173. </p>
  174. </v-row>
  175. </v-col>
  176. <!-- SMS -->
  177. <v-col :cols="colWidth">
  178. <v-row>
  179. {{ $t('sms') }}
  180. </v-row>
  181. <v-row class="align-end">
  182. <nuxt-img src="/images/sms.png" :height="140" :width="175"/>
  183. </v-row>
  184. <v-row>
  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') }) }}&nbsp*</b></p>
  189. <p><i>*&nbsp{{ $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') }) }}&nbsp*</b></p>
  201. <p><i>*&nbsp{{ $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. </v-row>
  209. </v-col>
  210. <!-- Custom domain -->
  211. <v-col :cols="colWidth">
  212. <v-row>
  213. {{ $t('website') }}
  214. </v-row>
  215. <v-row class="align-end">
  216. <nuxt-img src="/images/nom_de_domaine.png" :height="160" />
  217. </v-row>
  218. <v-row>
  219. <v-col>
  220. <p>
  221. <b>{{ $t('get_your_own_domain_and_up_to_five_emails_for_only_x_eur_ttc_per_year', { price: formatCurrency(44.00, 'EUR') }) }}</b>
  222. </p>
  223. <p>{{ $t('example') }} :</p>
  224. <table>
  225. <tbody>
  226. <tr>
  227. <td class="pa-2" style="width: 190px;">
  228. {{ $t('domain_name') }} :
  229. </td>
  230. <td>
  231. <i>{{ $t('dummy_domain_name') }}</i>
  232. </td>
  233. </tr>
  234. <tr>
  235. <td class="pa-2">{{ $t('associated_mail_address') }} : </td>
  236. <td>
  237. <i>{{ $t('dummy_email_address') }}</i>
  238. </td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. <p>
  243. <a href="/resources/BDC_Nom_de_domaine.pdf" target="_blank">
  244. <b>{{ $t('download_order_form') }}</b>
  245. </a>
  246. </p>
  247. </v-col>
  248. </v-row>
  249. </v-col>
  250. </v-row>
  251. </v-container>
  252. </UiExpansionPanel>
  253. </v-expansion-panels>
  254. </v-col>
  255. </LayoutContainer>
  256. </template>
  257. <script setup lang="ts">
  258. import {useAbility} from "@casl/vue";
  259. import {useOrganizationProfileStore} from "~/stores/organizationProfile";
  260. import {useEntityFetch} from "~/composables/data/useEntityFetch";
  261. import DolibarrAccount from "~/models/Organization/DolibarrAccount";
  262. import MobytUserStatus from "~/models/Organization/MobytUserStatus";
  263. import type {Ref} from "@vue/reactivity";
  264. import {useDisplay} from "vuetify";
  265. const ability = useAbility()
  266. if(!ability.can('display', 'subscription_page')) {
  267. throw new Error('Forbidden')
  268. }
  269. const showDolibarrPanel = computed(() => !dolibarrPending.value && dolibarrAccount.value && dolibarrAccount.value.bills.length > 0)
  270. const { smAndUp } = useDisplay()
  271. // On déplie les expansion panels dans le onMounted en attendant la résolution du bug : https://github.com/vuetifyjs/vuetify/issues/16427#issuecomment-1380927133
  272. // TODO: quand le bug ci dessus est résolu, remplacer par `const openedPanels: Ref<Array<string>> = ref(['informations', 'bills', 'more_features'])`
  273. const openedPanels: Ref<Array<string>> = ref([])
  274. onMounted(() => {
  275. openedPanels.value = ['informations', 'bills', 'more_features']
  276. })
  277. const i18n = useI18n()
  278. const organizationProfile = useOrganizationProfileStore()
  279. if (organizationProfile.id === null) {
  280. throw new Error("Missing organization's id")
  281. }
  282. const { fetch } = useEntityFetch()
  283. const { data: dolibarrAccount, pending: dolibarrPending } = fetch(DolibarrAccount, organizationProfile.id)
  284. const mobytFetch = ability.can('manage', 'texto') ?
  285. fetch(MobytUserStatus, organizationProfile.id) :
  286. { data: ref(false), pending: ref(false) }
  287. const { data: mobytStatus, pending: mobytPending } = mobytFetch
  288. const formatCurrency = (value: Number, currency: string): string => {
  289. return value.toLocaleString(i18n.locale.value, { style: 'currency', currency: currency })
  290. }
  291. // Compute the number of columns of the more_features pannel
  292. const nbCols = 2 + (organizationProfile.isArtist ? 1 : 0) + (organizationProfile.isArtistProduct ? 1 : 0)
  293. const colWidth = 12 / nbCols
  294. </script>
  295. <style scoped lang="scss">
  296. #products-section {
  297. width: 100%;
  298. .v-col {
  299. min-width: 260px;
  300. border: solid 1px rgb(var(--v-theme-on-primary));
  301. .v-row:nth-child(1) {
  302. //background: rgb(var(--v-theme-neutral-soft));
  303. height: 64px;
  304. color: rgb(var(--v-theme-on-neutral-soft));
  305. //font-size: 15px;
  306. font-weight: bold;
  307. border-bottom: solid 1px rgb(var(--v-theme-neutral));
  308. }
  309. .v-row:nth-child(2) {
  310. height: 230px;
  311. display: flex;
  312. justify-content: center;
  313. border-bottom: solid 1px rgb(var(--v-theme-neutral));
  314. }
  315. .v-row:nth-child(3) {
  316. }
  317. }
  318. .v-col:not(:first-child) {
  319. border-left: none;
  320. }
  321. img {
  322. max-height: 90%;
  323. max-width: 90%;
  324. }
  325. .v-row {
  326. padding: 12px 18px;
  327. vertical-align: top;
  328. border-bottom: solid 1px rgb(var(--v-theme-on-primary));
  329. }
  330. .v-row:last-child {
  331. border: none;
  332. }
  333. p {
  334. margin-bottom: 12px;
  335. }
  336. ul {
  337. padding-left: 24px;
  338. }
  339. }
  340. </style>