105 lines
2.1 KiB
Vue
105 lines
2.1 KiB
Vue
<script setup>
|
|
import { onMounted, toRef, ref, watch } from 'vue';
|
|
import axios from 'axios';
|
|
import SkeletonSummary from 'components/ui/SkeletonSummary.vue';
|
|
|
|
const props = defineProps({
|
|
id: {
|
|
type: Number,
|
|
required: true,
|
|
},
|
|
});
|
|
|
|
onMounted(() => fetch());
|
|
|
|
const entity = ref();
|
|
const entityId = toRef(props, 'id');
|
|
|
|
async function fetch() {
|
|
const id = entityId.value;
|
|
const { data } = await axios.get(`Clients/${id}/summary`);
|
|
entity.value = data;
|
|
}
|
|
|
|
watch(entityId, async () => {
|
|
entity.value = null;
|
|
fetch();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="summary container">
|
|
<q-card>
|
|
<skeleton-summary v-if="!entity" />
|
|
<template v-if="entity">
|
|
<div class="header bg-primary q-pa-sm q-mb-md">
|
|
<slot name="header" :entity="entity"> {{ entity.id }} - {{ entity.name }} </slot>
|
|
</div>
|
|
<div class="row q-pa-md q-col-gutter-md q-mb-md">
|
|
<slot name="body" :entity="entity" />
|
|
</div>
|
|
</template>
|
|
</q-card>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
.summary.container {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.summary {
|
|
.q-card {
|
|
width: 100%;
|
|
max-width: 1200px;
|
|
}
|
|
|
|
.negative {
|
|
color: red;
|
|
}
|
|
.q-list {
|
|
.q-item__label--header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
a {
|
|
color: $primary;
|
|
}
|
|
}
|
|
}
|
|
.row {
|
|
flex-wrap: wrap;
|
|
|
|
.col {
|
|
min-width: 250px;
|
|
}
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
font-size: 18px;
|
|
}
|
|
|
|
#slider-container {
|
|
max-width: 80%;
|
|
margin: 0 auto;
|
|
|
|
.q-slider {
|
|
.q-slider__marker-labels:nth-child(1) {
|
|
transform: none;
|
|
}
|
|
.q-slider__marker-labels:nth-child(2) {
|
|
transform: none;
|
|
left: auto !important;
|
|
right: 0%;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.q-dialog .summary {
|
|
max-width: 1200px;
|
|
}
|
|
</style>
|