CreateButton.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!--
  2. Bouton Créer du header de l'application
  3. -->
  4. <template>
  5. <main>
  6. <v-btn
  7. v-if="asIcon"
  8. :elevation="0"
  9. class="theme-primary"
  10. :icon="true"
  11. size="small"
  12. @click="show"
  13. >
  14. <v-icon>fas fa-plus</v-icon>
  15. </v-btn>
  16. <v-btn
  17. v-else
  18. :elevation="2"
  19. class="theme-x-create-btn"
  20. @click="show"
  21. >
  22. <span>{{ $t('create') }}</span>
  23. </v-btn>
  24. <LayoutDialog :show="showing" :max-width="850" >
  25. <template #dialogType>{{ $t('creative_assistant') }}</template>
  26. <template #dialogTitle>
  27. <span v-if="type === 'home'">{{ $t('what_do_you_want_to_create') }}</span>
  28. <span v-else-if="type === 'access'">{{ $t('what_type_of_contact_do_you_want_to_create') }}</span>
  29. <span v-else-if="type === 'event'">{{ $t('what_do_you_want_to_add_to_your_planning') }}</span>
  30. <span v-else-if="type === 'message'">{{ $t('what_do_you_want_to_send') }}</span>
  31. </template>
  32. <template #dialogText>
  33. <LayoutHeaderUniversalCreationGenerateCardsSteps
  34. :step="step"
  35. @updateStep="updateStep"
  36. />
  37. </template>
  38. <template #dialogBtn>
  39. <div class="text-center">
  40. <v-btn class="theme-neutral-soft" @click="close" >
  41. {{ $t('cancel') }}
  42. </v-btn>
  43. <v-btn v-if="step > 1" class="theme-neutral-soft" @click="reset" >
  44. {{ $t('previous_step') }}
  45. </v-btn>
  46. </div>
  47. </template>
  48. </LayoutDialog>
  49. </main>
  50. </template>
  51. <script setup lang="ts">
  52. import {Ref, ref} from "@vue/reactivity";
  53. import {useDisplay} from "vuetify";
  54. const showing: Ref<Boolean> = ref(false);
  55. const step: Ref<Number> = ref(1);
  56. const type: Ref<String> = ref('home');
  57. const updateStep = ({stepChoice, typeChoice}: any) =>{
  58. step.value = stepChoice
  59. type.value = typeChoice
  60. }
  61. const reset = () => {
  62. step.value = 1
  63. type.value = 'home'
  64. }
  65. const show = () => {
  66. reset()
  67. showing.value = true
  68. }
  69. const close = () => {
  70. showing.value = false
  71. }
  72. const { mdAndDown: asIcon } = useDisplay()
  73. </script>