feat(election): candidate photos/symbols, voting interface, withdrawal, live vote counts

- Candidate board: show client profile photos and election symbols via CBS ContentStore
  (lazy-fetch base64 via GET /election/{id}/candidate/{id}/symbol), zoom/drag viewer
- Candidate board: live vote count badge per candidate (VOTING_OPEN/CLOSED only)
- Election dashboard: total voters/votes chips on VOTING_OPEN election cards
- Voting interface: fix candidates not loading (paged response .content extraction),
  lazy-load candidate photos and symbols, gold-bordered symbol on ballot card
- Nomination withdrawal: implement withdraw button in nomination-detail and nomination-list
- ImagePreviewDialogComponent: DomSanitizer support for data: URLs
- election.service: uploadCandidateSymbol (FormData), getCandidateSymbol, getClientImage,
  getVoteSummary methods
- main.scss: ipd-dialog / ipd-backdrop styles for image preview dialog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-06-26 18:38:11 +05:30
co-authored by Claude Sonnet 4.6
parent 9e33392b01
commit f1b829a100
19 changed files with 1217 additions and 182 deletions
@@ -85,6 +85,7 @@
color: #718096;
font-size: 13px;
cursor: pointer;
transition: all 0.15s;
&.active {
background: #2563eb;
@@ -122,7 +123,7 @@
.candidates-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 16px;
}
@@ -130,12 +131,17 @@
background: #fff;
border-radius: 14px;
box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
padding: 20px;
padding: 18px 16px 14px;
position: relative;
transition: box-shadow 0.2s;
transition:
box-shadow 0.2s,
transform 0.15s;
cursor: pointer;
text-align: center;
&:hover {
box-shadow: 0 4px 16px rgb(0 0 0 / 12%);
box-shadow: 0 6px 20px rgb(0 0 0 / 14%);
transform: translateY(-2px);
}
&.inactive {
@@ -144,114 +150,177 @@
.serial-badge {
position: absolute;
top: 12px;
right: 12px;
top: 10px;
right: 10px;
background: #eff6ff;
color: #2563eb;
padding: 2px 10px;
padding: 2px 8px;
border-radius: 10px;
font-size: 12px;
font-size: 11px;
font-weight: 700;
}
}
.clickable-photo {
cursor: zoom-in;
transition: opacity 0.15s;
&:hover {
opacity: 0.85;
}
}
.candidate-avatar {
display: flex;
justify-content: center;
margin-bottom: 16px;
margin-bottom: 12px;
img {
width: 80px;
height: 80px;
width: 72px;
height: 72px;
border-radius: 50%;
object-fit: cover;
border: 3px solid #e2e8f0;
}
.avatar-placeholder {
width: 80px;
height: 80px;
width: 72px;
height: 72px;
border-radius: 50%;
background: linear-gradient(135deg, #2563eb, #1e40af);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 32px;
font-size: 28px;
font-weight: 700;
}
}
.candidate-info {
text-align: center;
.candidate-name {
font-size: 14px;
font-weight: 600;
color: #2d3748;
margin-bottom: 4px;
line-height: 1.3;
}
h4 {
font-size: 16px;
font-weight: 600;
color: #2d3748;
margin: 0 0 6px;
}
.vote-count-badge {
display: inline-flex;
align-items: center;
gap: 3px;
background: #eff6ff;
color: #1d4ed8;
border: 1px solid #bfdbfe;
border-radius: 20px;
padding: 2px 8px;
font-size: 11px;
font-weight: 700;
margin: 0 auto 8px;
.symbol {
mat-icon {
font-size: 12px;
color: #718096;
margin-bottom: 8px;
height: 12px;
width: 12px;
}
}
.meta-row {
display: flex;
justify-content: center;
gap: 6px;
flex-wrap: wrap;
margin-bottom: 8px;
.symbol-area {
display: flex;
flex-direction: column;
align-items: center;
gap: 6px;
margin-bottom: 10px;
span {
font-size: 12px;
background: #f7fafc;
padding: 2px 8px;
border-radius: 10px;
color: #718096;
display: inline-flex;
align-items: center;
gap: 2px;
.symbol-thumb {
width: 64px;
height: 64px;
object-fit: contain;
border-radius: 50%;
background: #fff;
padding: 6px;
border: 3px solid #f59e0b;
box-shadow:
0 0 0 3px #fef3c7,
0 4px 12px rgb(245 158 11 / 25%);
transition:
transform 0.2s ease,
box-shadow 0.2s ease;
mat-icon {
font-size: 12px;
height: 12px;
width: 12px;
}
&:hover {
transform: scale(1.12);
box-shadow:
0 0 0 3px #fde68a,
0 6px 18px rgb(245 158 11 / 40%);
}
}
.brief-profile {
font-size: 12px;
.symbol-label {
font-size: 10px;
font-weight: 600;
color: #b45309;
letter-spacing: 0.4px;
text-transform: uppercase;
}
.no-symbol-text {
font-size: 11px;
color: #a0aec0;
line-height: 1.5;
text-align: center;
}
}
.btn-symbol-upload {
display: inline-flex;
align-items: center;
gap: 3px;
padding: 4px 10px;
border: 1px dashed #a0aec0;
border-radius: 6px;
background: #f8fafc;
color: #4a5568;
font-size: 11px;
cursor: pointer;
transition: all 0.15s;
mat-icon {
font-size: 13px;
height: 13px;
width: 13px;
}
&:hover {
border-color: #2563eb;
color: #2563eb;
background: #eff6ff;
}
&.uploading {
opacity: 0.6;
pointer-events: none;
}
}
.candidate-actions {
display: flex;
justify-content: center;
margin-top: 14px;
margin-top: 6px;
.btn-remove {
display: inline-flex;
align-items: center;
gap: 4px;
gap: 3px;
background: #fff5f5;
color: #e53e3e;
border: 1px solid #fed7d7;
padding: 5px 12px;
padding: 4px 10px;
border-radius: 6px;
font-size: 12px;
font-size: 11px;
cursor: pointer;
mat-icon {
font-size: 14px;
height: 14px;
width: 14px;
font-size: 13px;
height: 13px;
width: 13px;
}
&:hover {
@@ -262,12 +331,399 @@
.removed-badge {
background: #edf2f7;
color: #a0aec0;
padding: 5px 12px;
padding: 4px 10px;
border-radius: 6px;
font-size: 12px;
font-size: 11px;
}
}
// ── Candidate Detail Drawer ────────────────────────────────────
.drawer-overlay {
position: fixed;
inset: 0;
background: rgb(0 0 0 / 30%);
z-index: 999;
animation: fade-in 0.2s ease;
}
.candidate-drawer {
position: fixed;
top: 0;
right: 0;
width: 380px;
height: 100vh;
background: #fff;
z-index: 1000;
display: flex;
flex-direction: column;
box-shadow: -4px 0 24px rgb(0 0 0 / 15%);
animation: slide-in 0.25s ease;
overflow: hidden;
@media (width <= 480px) {
width: 100vw;
}
}
@keyframes slide-in {
from {
transform: translateX(100%);
}
to {
transform: translateX(0);
}
}
@keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.drawer-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid #f0f0f0;
background: #fafbfc;
flex-shrink: 0;
h3 {
font-size: 16px;
font-weight: 600;
margin: 0;
color: #2d3748;
}
.drawer-close {
background: none;
border: none;
cursor: pointer;
color: #718096;
display: flex;
align-items: center;
padding: 4px;
border-radius: 6px;
&:hover {
background: #f0f0f0;
color: #2d3748;
}
}
}
.drawer-body {
flex: 1;
overflow-y: auto;
padding: 20px;
}
.drawer-avatar-wrap {
display: flex;
justify-content: center;
position: relative;
margin-bottom: 14px;
.drawer-avatar-img {
width: 96px;
height: 96px;
border-radius: 50%;
object-fit: cover;
border: 3px solid #e2e8f0;
}
.drawer-avatar-placeholder {
width: 96px;
height: 96px;
border-radius: 50%;
background: linear-gradient(135deg, #2563eb, #1e40af);
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 36px;
font-weight: 700;
}
.drawer-serial {
position: absolute;
bottom: 0;
right: calc(50% - 60px);
background: #2563eb;
color: #fff;
padding: 2px 8px;
border-radius: 10px;
font-size: 11px;
font-weight: 700;
}
}
.drawer-name {
text-align: center;
font-size: 18px;
font-weight: 700;
color: #2d3748;
margin-bottom: 4px;
}
.drawer-post {
text-align: center;
font-size: 13px;
color: #718096;
margin-bottom: 8px;
}
.drawer-vote-count {
display: inline-flex;
align-items: center;
gap: 4px;
background: #eff6ff;
color: #1d4ed8;
border: 1px solid #bfdbfe;
border-radius: 20px;
padding: 4px 12px;
font-size: 13px;
font-weight: 700;
margin: 0 auto 14px;
mat-icon {
font-size: 14px;
height: 14px;
width: 14px;
}
}
.drawer-meta-row {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
font-size: 12px;
color: #718096;
margin-bottom: 20px;
mat-icon {
font-size: 15px;
height: 15px;
width: 15px;
color: #a0aec0;
}
}
.drawer-section {
margin-bottom: 20px;
}
.drawer-section-title {
display: flex;
align-items: center;
gap: 6px;
font-size: 12px;
font-weight: 600;
color: #a0aec0;
text-transform: uppercase;
letter-spacing: 0.6px;
margin-bottom: 10px;
padding-bottom: 6px;
border-bottom: 1px solid #f0f0f0;
mat-icon {
font-size: 15px;
height: 15px;
width: 15px;
}
}
.symbol-preview-area {
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
.symbol-seal-wrap {
position: relative;
display: flex;
align-items: center;
justify-content: center;
width: 144px;
height: 144px;
border-radius: 50%;
background: linear-gradient(135deg, #fef3c7, #fff);
border: 4px solid #f59e0b;
box-shadow:
0 0 0 6px #fef9e7,
0 8px 28px rgb(245 158 11 / 30%);
}
.symbol-preview-img {
width: 110px;
height: 110px;
object-fit: contain;
border-radius: 50%;
background: #fff;
padding: 10px;
}
.symbol-seal-label {
position: absolute;
bottom: -1px;
background: #f59e0b;
color: #fff;
font-size: 9px;
font-weight: 700;
letter-spacing: 1.2px;
text-transform: uppercase;
padding: 2px 10px;
border-radius: 10px;
}
.symbol-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
color: #a0aec0;
padding: 12px 0;
width: 144px;
height: 144px;
border-radius: 50%;
border: 3px dashed #e2e8f0;
justify-content: center;
mat-icon {
font-size: 36px;
height: 36px;
width: 36px;
}
span {
font-size: 11px;
}
}
}
.btn-upload-symbol {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 18px;
background: #2563eb;
color: #fff;
border-radius: 8px;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: background 0.15s;
mat-icon {
font-size: 16px;
height: 16px;
width: 16px;
}
&:hover {
background: #1d4ed8;
}
&.uploading {
background: #93c5fd;
pointer-events: none;
}
}
.drawer-profile-text {
font-size: 13px;
color: #4a5568;
line-height: 1.6;
margin: 0;
}
.drawer-info-grid {
display: flex;
flex-direction: column;
gap: 10px;
}
.info-item {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
.info-label {
color: #718096;
}
.info-value {
font-weight: 500;
color: #2d3748;
&.text-green {
color: #276749;
}
&.text-red {
color: #e53e3e;
}
}
.info-link {
color: #2563eb;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 2px;
font-weight: 500;
mat-icon {
font-size: 13px;
height: 13px;
width: 13px;
}
&:hover {
text-decoration: underline;
}
}
}
.btn-remove-full {
display: flex;
align-items: center;
justify-content: center;
gap: 6px;
width: 100%;
margin-top: 8px;
padding: 10px;
background: #fff5f5;
color: #e53e3e;
border: 1px solid #fed7d7;
border-radius: 8px;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: background 0.15s;
mat-icon {
font-size: 16px;
height: 16px;
width: 16px;
}
&:hover {
background: #fed7d7;
}
}
// ── Common states ──────────────────────────────────────────────
.loading-state,
.empty-state {
display: flex;
@@ -308,6 +764,8 @@
}
}
// ── Pagination ─────────────────────────────────────────────────
.pagination-bar {
display: flex;
align-items: center;