Redesigned Vue Table Component
Here's a more visually appealing version of your table component with improved styling, better spacing, and a modern look:
<template>
<div class="container-fluid">
<div class="card shadow-sm">
<div class="card-body p-4">
<div class="table-responsive">
<table class="table table-hover table-striped align-middle">
<table-header />
<tbody>
<tr class="text-center">
<td class="fw-medium">{{ rep.first_name }} {{ rep.last_name }}</td>
<td>
<span class="badge bg-primary rounded-pill">SBO</span>
</td>
<td>{{ assignedSchoolCount | formatNumber(false) }}</td>
<td>{{ summary.previous_year_adoption.qty ?? 0 | formatNumber(false) }}</td>
<td>{{ summary.previous_year_adoption.value ?? 0 | formatNumber(false) }}</td>
<td>{{ summary.previous_year_sales.qty ?? 0 | formatNumber(false) }}</td>
<td>{{ summary.previous_year_sales.value ?? 0 | formatNumber(false) }}</td>
<td>{{ summary.bfr.school_count ?? 0 | formatNumber(false) }}</td>
<td>{{ summary.bfr.bfr_delivered_qty ?? 0 | formatNumber(false) }}</td>
<td>
<div class="d-flex flex-column gap-1">
<div class="p-2 bg-light rounded">
<small class="text-muted">No. of Schools:</small>
<div class="fw-bold">{{ summary.current_year_adoption.total_adoption_count ?? 0 | formatNumber(false) }}</div>
</div>
<div class="p-2 bg-light rounded">
<small class="text-muted">Value:</small>
<div class="fw-bold">{{ summary.current_year_adoption.net_amount ?? 0 | formatNumber(false) }}</div>
</div>
<div class="p-2 bg-light rounded">
<small class="text-muted">Qty:</small>
<div class="fw-bold">{{ summary.current_year_adoption.qty ?? 0 | formatNumber(false) }}</div>
</div>
</div>
</td>
<td>
<div class="d-flex flex-column">
<span class="text-success fw-bold">
{{ calculateConversionRate() }}%
</span>
<small class="text-muted">from BFR to Adoption</small>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
methods: {
calculateConversionRate() {
const bfrCount = this.summary.bfr.school_count || 0;
const adoptionCount = this.summary.current_year_adoption.total_adoption_count || 0;
if (bfrCount === 0) return 0;
return Math.round((adoptionCount / bfrCount) * 100);
}
}
}
</script>
<style scoped>
.card {
border-radius: 10px;
border: none;
}
.table {
--bs-table-bg: #ffffff;
--bs-table-striped-bg: rgba(0, 0, 0, 0.02);
--bs-table-hover-bg: rgba(0, 0, 0, 0.04);
}
th {
background-color: #f8f9fa;
font-weight: 600;
color: #495057;
vertical-align: middle !important;
}
td {
vertical-align: middle !important;
}
.bg-light {
background-color: rgba(0, 0, 0, 0.02) !important;
}
</style>