All files / src/components/calendar_of_events/UI_calendar dialogCreate.vue

0% Statements 0/30
0% Branches 0/14
0% Functions 0/14
0% Lines 0/30

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101                                                                                                                                                                                                         
<template>
  <v-card min-height="436" class="pa-3">
    <v-card-title class="pr-0 pl-2 d-flex justify-space-between">
      {{ title }}
      <v-icon
        icon="mdi-close cursor-pointer"
        size="small"
        color="grey"
        @click="$emit('closeDialog')"
      />
    </v-card-title>
    <v-form ref="form_valid" @submit.prevent="transformation">
      <v-card-text class="d-flex px-3">
        <slot name="card_text"></slot>
      </v-card-text>
      <v-card-actions class="justify-end">
        <v-btn
          v-if="!newOrOld"
          icon="mdi-delete"
          variant="tonal"
          rounded
          size="36px"
          @click="$emit('delObject')"
        />
        <!-- <v-btn
          class="text-subtitle-1"
          elevation="0"
          width="150"
          @click="clearValidation"
          color="btn_gray"
          variant="flat"
          >резет</v-btn
        > -->
        <!-- <v-btn @click="clearFormValidation"></v-btn> -->
        <v-btn
          class="text-subtitle-1"
          elevation="0"
          width="150"
          @click="$emit('closeDialog')"
          color="btn_gray"
          variant="flat"
          >Отменить</v-btn
        >

        <v-btn
          class="text-subtitle-1 font-weight-regular"
          color="btn_text"
          variant="flat"
          elevation="0"
          width="150"
          type="transformation"
        >
          {{ newOrOld ? "Создать" : "Редактировать" }}
        </v-btn>
      </v-card-actions>
    </v-form>
  </v-card>
</template>

<script>
import { ref } from "vue";
 
export default {
  props: {
    title: {
      type: String,
      default: "",
    },
 
    newOrOld: {
      type: Boolean,
      default: false,
    },
  },
 
  setup(props, { emit }) {
    const form_valid = ref(null);

    const transformation = () => {
      emit("postData", form_valid.value.isValid);
    };
 
    const clearFormValidation = () => {

      if (!!form_valid.value) {
        form_valid.value.resetValidation();
      }
    };
 
    return {
      form_valid,
      transformation,
 
      clearFormValidation,
    };
  },
};
</script>

<style></style>