All files / src/components/UI/feedback statistik-like.vue

0% Statements 0/31
0% Branches 0/4
0% Functions 0/15
0% Lines 0/31

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                                                                                                                                                                                                                     
<template>
    <pattern-card-feed
        :title="'Средняя оценка'"
    >
        <template v-slot:filling_feedback>
            <div v-if="rating.length!=0" class="pt-1">
                <v-row no-gutters>
                    <v-col class="text-h4 font-weight-medium">
                        {{avgcriteria}}
                    </v-col>
                </v-row>
                <v-row
                    class="align-center flex-column scoreheight"
                    no-gutters
                >
                    <div class="flex-column d-flex  pa-0"
                        v-for="(x, key) in rating"
                        :key = key
                    >
                        <v-col lg=1 class="text-subtitle-1 font-weight-regular cursor-default w100 pa-0">
                            <v-tooltip
                                :text=x.name
                                location="left"
                            >
                                <template v-slot:activator="{ props }">
                                    <v-icon
                                    class="pb-4 pr-3"
                                        v-bind="props"
                                        size="small"
                                        :color="x.color"
                                        :icon="x.ico"
                                    />
                                </template>
                            </v-tooltip>
                       
                            <!-- {{x.name}} -->
                       
                            <v-rating
                                v-model="x.ratings"
                                :hover="typeof(key) == 'number'"
                                half-increments
                                readonly
                                :size="25"
                                color="yellow"
                                :density="'comfortable'"
                            />
                        </v-col>
                    </div>
                </v-row>
            </div>
            <div class="d-flex flex-column" v-else>
                <v-row
                    class="align-center flex-column scoreheight gap mt-n2"
                    no-gutters
                >
                    <v-col class="text-h6 pt-8 text-grey text-center align-self-center text--lighten-1 font-weight-light"
                    >
                        За выбранный период оценок нет
                    </v-col>
                </v-row>
            </div>  
        </template>
    </pattern-card-feed>
</template>

<script>
import PatternCardFeed from '@/components/UI/aboutportal/pattern-card-feed.vue'
import { computed } from 'vue'
 
export default {
 
    props: {
        rating: {
            type: Object,
            default: () => {}
        },
    },
 
    components: { 
        PatternCardFeed,
    },
 
    setup(props) {

        const avgcriteria = computed({
                get() {
                    let avgcrit = 0
                    props.rating.forEach((e)=> {
                        avgcrit += e.ratings
                    })
                return parseFloat(avgcrit/props.rating.length).toFixed(2)
                }
            })
    
        return {
            avgcriteria
        }
    }
 
   
 
}
</script>

<style>
 
</style>