All files / src/components dialog-search.vue

0% Statements 0/51
0% Branches 0/6
0% Functions 0/25
0% Lines 0/51

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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131                                                                                                                                                                                                                                                                     
<template>
  <div>
    <v-card class="bg-white pa-1 px-0" width="550">
      <v-card
        class="mx-auto overflow-auto mx-0 px-0"
        width="550"
        height="600"
        flat
      >
        <v-card-title class="fixed-bar bg-white">
          <v-row class="bggrad">
            <v-col class="text-center text-black_and_white">
              {{ namepos }}
            </v-col>
          </v-row>
          <v-row>
            <v-col class="pa-0 mb-1">
              <v-divider class="" />
              <v-text-field
                v-model="searchname"
                clearable
                prepend-inner-icon="mdi-magnify"
                hide-details
                class="ma-0"
                label="Поиск"
                rows="1"
                no-resize
              />
            </v-col>
          </v-row>
        </v-card-title>

        <div v-for="(x, key) in result" :key="key" class="px-3 ddd">
          <v-list class="py-0">
            <v-list-subheader>{{ key }} </v-list-subheader>
          </v-list>
          <div v-for="item in x" :key="item">
            <list-user :author="item" />
            <!-- <vcard-user :author = item     /> -->
          </div>
        </div>
      </v-card>
      <v-divider class="" />
      <v-card-actions class="pb-0" style="place-content: end">
        <v-btn 
        color="more_details_btn" rounded="xl" @click="onSubmit">
          Закрыть
        </v-btn>
      </v-card-actions>
    </v-card>
  </div>
</template>
 
<script>
import { ref, onMounted, computed } from "vue";
import { checkremote } from "@/utils/universal_functions";
import { spravURL } from "@/utils/axios-api";
import { axiosApiInstance } from "@/utils/axios-api";
import VcardUser from "@/components/UI/fiousercard/vcardUser.vue";
 
export default {
  components: {
    VcardUser,
  },

  props: {
    idpos: {
      type: Number,
      default: "",
    },
    namepos: {
      type: String,
      default: "",
    },
  },

  setup(props, { emit }) {
    const t_dailyRound = ref({});
    // const result = ref({})
    const iduser = ref("");
    const searchname = ref("");

    const onSubmit = () => {
      emit("searchClose");
    };
 
    onMounted(() => {
      axiosApiInstance
        .get(`api/general_vacation/dailyload/?id=${props.idpos}`)
        .then((data) => {
          t_dailyRound.value = data.data.daily;
        });
    });

    const getcard = async (idus) => {
      iduser.value = idus;
    };
 
    const result = computed({
      get() {
        let ob = {};
        Object.keys(t_dailyRound.value).map((el1) => {
          let myarr = t_dailyRound.value[el1].filter((el) =>
            el.fio.toLowerCase().includes(searchname.value.toLowerCase())
          );

          if (myarr.length > 0) {
            ob[el1] = myarr;
          }
        });
        return ob;
      },
    });
 
    return {
      onSubmit,
      checkremote,
      searchname,
      spravURL,
      t_dailyRound,
      result,
 
      getcard,
      iduser,
    };
  },
};
</script>

<style></style>