ActivityYear.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <main class="d-flex">
  3. <span class="mr-2 ot-dark_grey--text font-weight-bold">{{ $t(label) }} : </span>
  4. <UiXeditableText
  5. class="activity-year-input"
  6. type="number"
  7. :data="activityYear"
  8. @update="updateActivityYear"
  9. >
  10. <template #xeditable.read="{inputValue}">
  11. <v-icon aria-hidden="false" class="ot-green--text" x-small>
  12. fas fa-edit
  13. </v-icon>
  14. <strong class="ot-green--text"> {{ inputValue }} <span v-if="yearPlusOne">/ {{ parseInt(inputValue) + 1 }}</span></strong>
  15. </template>
  16. </UiXeditableText>
  17. </main>
  18. </template>
  19. <script lang="ts">
  20. import {useOrganizationProfileStore} from "~/store/profile/organization";
  21. const organizationProfile = useOrganizationProfileStore()
  22. const yearPlusOne: boolean = !organizationProfile.isManagerProduct()
  23. const label: string = organizationProfile.isSchool() ? 'schooling_year' : organizationProfile.isArtist() ? 'season_year' : 'cotisation_year'
  24. const updateActivityYear = async (newDate:number) => {
  25. markAsNotDirty()
  26. setActivityYear(newDate)
  27. await updateMyProfile()
  28. window.location.reload()
  29. }
  30. </script>
  31. <style lang="scss">
  32. .activity-year-input{
  33. max-height: 20px;
  34. input{
  35. font-size: 14px;
  36. width: 55px !important;
  37. }
  38. }
  39. </style>