mirror of
https://origin.cursor.com/mrdevmx/panels.git
synced 2026-10-09 23:33:18 +00:00
181 lines
3.9 KiB
Vue
181 lines
3.9 KiB
Vue
<template>
|
|
<article class="badge" :class="{ 'badge-back-rot': side === 'back' && rotated, fluid }">
|
|
<template v-if="side === 'front'">
|
|
<div class="badge-logos">
|
|
<div class="logo-l">Construcciones<br />Arctec</div>
|
|
<div class="logo-r">{{ projectName }}</div>
|
|
</div>
|
|
<div class="badge-photo">
|
|
<img v-if="photoSrc" :src="photoSrc" alt="" @error="onPhotoError" />
|
|
<i v-else class="pi pi-user" />
|
|
</div>
|
|
<div class="badge-names">
|
|
<div>{{ firstName }}</div>
|
|
<div>{{ lastName }}</div>
|
|
</div>
|
|
<div class="badge-bar" :style="{ background: riskColor, color: riskText }">
|
|
{{ position }}
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<img v-if="qrSrc && !qrBroken" class="badge-qr" :src="qrSrc" alt="QR" @error="qrBroken = true" />
|
|
<div v-else class="badge-qr badge-qr-ph"><i class="pi pi-qrcode" /></div>
|
|
<div class="badge-meta">
|
|
<div>GRUPO SANGUINEO: {{ blood }}</div>
|
|
<div>CURP: {{ curp }}</div>
|
|
<div>NSS: {{ nss }}</div>
|
|
<div>NOMBRE: {{ full }}</div>
|
|
</div>
|
|
<div class="badge-project">
|
|
<div>{{ projectCode }}</div>
|
|
<div>{{ projectName }}</div>
|
|
</div>
|
|
</template>
|
|
</article>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
side: "front" | "back";
|
|
rotated?: boolean;
|
|
firstName: string;
|
|
lastName: string;
|
|
full: string;
|
|
position: string;
|
|
curp: string;
|
|
nss: string;
|
|
blood: string;
|
|
riskColor: string;
|
|
riskText: string;
|
|
projectName: string;
|
|
projectCode: string;
|
|
photoSrc?: string;
|
|
qrSrc?: string;
|
|
fluid?: boolean;
|
|
}>();
|
|
|
|
const photoBroken = ref(false);
|
|
const qrBroken = ref(false);
|
|
const photoSrc = computed(() => (photoBroken.value ? "" : props.photoSrc || ""));
|
|
function onPhotoError() {
|
|
photoBroken.value = true;
|
|
}
|
|
watch(() => props.photoSrc, () => {
|
|
photoBroken.value = false;
|
|
});
|
|
watch(() => props.qrSrc, () => {
|
|
qrBroken.value = false;
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
.badge {
|
|
width: 201px;
|
|
height: 315px;
|
|
background: #fff;
|
|
border: 2px solid #111;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
flex-direction: column;
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
color: #111;
|
|
overflow: hidden;
|
|
flex: none;
|
|
}
|
|
.badge-back-rot {
|
|
transform: rotate(180deg);
|
|
}
|
|
.badge-logos {
|
|
height: 16%;
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 4px;
|
|
padding: 6px 8px 2px;
|
|
align-items: center;
|
|
}
|
|
.logo-l {
|
|
font-size: 8px;
|
|
font-weight: 700;
|
|
line-height: 1.15;
|
|
text-transform: uppercase;
|
|
}
|
|
.logo-r {
|
|
font-size: 11px;
|
|
font-weight: 800;
|
|
color: #1a3f8c;
|
|
text-align: right;
|
|
text-transform: uppercase;
|
|
line-height: 1.1;
|
|
}
|
|
.badge-photo {
|
|
width: 52%;
|
|
aspect-ratio: 3.5 / 4.5;
|
|
border: 2.5px solid #111;
|
|
margin: 6px auto 0;
|
|
background: #e8edf3;
|
|
display: grid;
|
|
place-items: center;
|
|
overflow: hidden;
|
|
}
|
|
.badge-photo img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
.badge-photo i { font-size: 42px; color: #8a96a6; }
|
|
.badge-names {
|
|
text-align: center;
|
|
font-weight: 800;
|
|
text-transform: uppercase;
|
|
font-size: 13px;
|
|
letter-spacing: 0.02em;
|
|
margin-top: 10px;
|
|
line-height: 1.2;
|
|
padding: 0 6px;
|
|
}
|
|
.badge-bar {
|
|
margin: auto 4px 8px;
|
|
min-height: 28px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-weight: 800;
|
|
text-transform: uppercase;
|
|
font-size: 11px;
|
|
letter-spacing: 0.04em;
|
|
padding: 4px 6px;
|
|
text-align: center;
|
|
}
|
|
.badge-qr {
|
|
width: 50%;
|
|
aspect-ratio: 1;
|
|
margin: 14px auto 8px;
|
|
display: block;
|
|
}
|
|
.badge-qr-ph {
|
|
background: #f0f2f5;
|
|
display: grid;
|
|
place-items: center;
|
|
font-size: 36px;
|
|
color: #888;
|
|
}
|
|
.badge-meta {
|
|
font-size: 8px;
|
|
line-height: 1.45;
|
|
padding: 0 10px;
|
|
text-transform: uppercase;
|
|
}
|
|
.badge-project {
|
|
margin-top: auto;
|
|
padding: 0 10px 12px;
|
|
font-weight: 800;
|
|
font-size: 11px;
|
|
text-transform: uppercase;
|
|
line-height: 1.2;
|
|
}
|
|
.fluid {
|
|
width: 100%;
|
|
height: auto;
|
|
aspect-ratio: 6.7 / 10.5;
|
|
}
|
|
</style>
|