MobytStatus.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <v-col cols="12" lg="12">
  3. <strong>{{ $t('remaining_sms_credit') }}</strong> -
  4. <span
  5. v-if="
  6. mobytPendingStatus == FETCHING_STATUS.SUCCESS &&
  7. mobytStatus !== null &&
  8. mobytStatus.active
  9. "
  10. >
  11. {{
  12. mobytStatus.money.toLocaleString($i18n.locale, {
  13. style: 'currency',
  14. currency: 'EUR',
  15. })
  16. }}
  17. {{
  18. i18n.t('convert_price_to_sms', {
  19. nb_sms: mobytStatus.amount,
  20. })
  21. }}
  22. </span>
  23. </v-col>
  24. </template>
  25. <script setup lang="ts">
  26. import type { AsyncData } from '#app'
  27. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  28. import { useOrganizationProfileStore } from '~/stores/organizationProfile'
  29. import MobytUserStatus from '~/models/Organization/MobytUserStatus'
  30. import { FETCHING_STATUS } from '~/types/enum/data'
  31. const { fetch } = useEntityFetch()
  32. const i18n = useI18n()
  33. const organizationProfile = useOrganizationProfileStore()
  34. const { data: mobytStatus, status: mobytPendingStatus } = fetch(
  35. MobytUserStatus,
  36. organizationProfile.id,
  37. ) as AsyncData<MobytUserStatus | null, Error | null>
  38. </script>
  39. <style scoped lang="scss"></style>