nidus-sync/ts/components/ReviewSiteColumnList.vue

64 lines
1.4 KiB
Vue
Raw Normal View History

2026-04-16 07:20:53 +00:00
<style scoped lang="scss">
.entry-item {
padding: 15px;
border-bottom: 1px solid #e9ecef;
cursor: pointer;
transition: background-color 0.2s;
}
.entry-item:hover {
background-color: #f8f9fa;
}
.entry-item.active {
background-color: #e7f3ff;
border-left: 4px solid #0d6efd;
}
</style>
2026-04-16 04:48:07 +00:00
<template>
2026-04-16 07:20:53 +00:00
<div class="p-3 border-bottom bg-primary text-white">
<h5 class="mb-0"><i class="bi bi-list-ul"></i> Sites</h5>
</div>
<div
v-for="site in sites"
:key="site.id"
class="entry-item"
:class="{ active: selectedSite?.id === site.id }"
@click="doClick(site)"
>
2026-04-16 07:55:08 +00:00
<div class="d-flex">
2026-04-16 07:20:53 +00:00
<div>
2026-04-17 03:10:08 +00:00
<i
class="bi"
:class="{
'bi-house-fill': site.leads.length > 0,
'bi-house': site.leads.length == 0,
}"
></i>
2026-04-16 07:20:53 +00:00
</div>
2026-04-16 07:55:08 +00:00
<strong>{{ formatAddress(site.address) }}</strong>
2026-04-16 07:20:53 +00:00
</div>
</div>
2026-04-16 04:48:07 +00:00
</template>
<script setup lang="ts">
2026-04-16 07:20:53 +00:00
import { Site } from "@/type/api";
import { formatAddress } from "@/format";
2026-04-16 04:48:07 +00:00
interface Emits {
2026-04-16 07:55:08 +00:00
(e: "doSiteDeselect", id: number): void;
(e: "doSiteSelect", id: number): void;
2026-04-16 04:48:07 +00:00
}
2026-04-16 07:20:53 +00:00
interface Props {
selectedSite: Site | undefined;
sites: Site[];
}
2026-04-16 04:48:07 +00:00
const emit = defineEmits<Emits>();
const props = withDefaults(defineProps<Props>(), {});
2026-04-16 07:20:53 +00:00
function doClick(site: Site) {
2026-04-16 07:55:08 +00:00
if (props.selectedSite && site.id == props.selectedSite.id) {
emit("doSiteDeselect", site.id);
} else {
emit("doSiteSelect", site.id);
}
2026-04-16 07:20:53 +00:00
}
2026-04-16 04:48:07 +00:00
</script>