feat: admin panel enrichment
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
.brief-wizard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.wizard-progress-track {
|
||||
height: 4px;
|
||||
border-radius: 999px;
|
||||
background: rgba(148, 163, 184, 0.25);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.wizard-progress-fill {
|
||||
height: 100%;
|
||||
width: 0;
|
||||
border-radius: inherit;
|
||||
background: linear-gradient(90deg, var(--accent-blue), #5b7cff);
|
||||
transition: width 0.3s ease;
|
||||
}
|
||||
|
||||
.wizard-stepper {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 0.75rem;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.wizard-stepper-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.wizard-stepper-number {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
border-radius: 999px;
|
||||
border: 2px solid rgba(148, 163, 184, 0.35);
|
||||
font-size: 0.85rem;
|
||||
font-weight: 700;
|
||||
background: #fff;
|
||||
transition: var(--transition-fast);
|
||||
}
|
||||
|
||||
.wizard-stepper-label {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.wizard-stepper-item.is-active .wizard-stepper-number,
|
||||
.wizard-stepper-item.is-complete .wizard-stepper-number {
|
||||
border-color: var(--accent-blue);
|
||||
background: rgba(48, 81, 255, 0.1);
|
||||
color: var(--accent-blue);
|
||||
}
|
||||
|
||||
.wizard-stepper-item.is-active {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.wizard-stepper-item.is-complete .wizard-stepper-label {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.wizard-panel-header {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.wizard-panel-eyebrow {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--accent-blue);
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.wizard-panel-title {
|
||||
font-size: 1.35rem;
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
|
||||
.wizard-panel-subtitle {
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.wizard-actions {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 0.75rem;
|
||||
padding-top: 0.5rem;
|
||||
border-top: 1px solid rgba(148, 163, 184, 0.2);
|
||||
}
|
||||
|
||||
.wizard-actions .btn-primary,
|
||||
.wizard-actions .btn-ghost {
|
||||
min-width: 7.5rem;
|
||||
}
|
||||
|
||||
.wizard-actions .btn-primary {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.brief-wizard [data-wizard-submit][hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.wizard-review {
|
||||
margin-top: 1.5rem;
|
||||
padding: 1.25rem;
|
||||
border-radius: var(--radius-md);
|
||||
background: rgba(48, 81, 255, 0.04);
|
||||
border: 1px solid rgba(48, 81, 255, 0.12);
|
||||
}
|
||||
|
||||
.wizard-review-title {
|
||||
font-size: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.wizard-review-list {
|
||||
display: grid;
|
||||
gap: 0.85rem;
|
||||
}
|
||||
|
||||
.wizard-review-list dt {
|
||||
font-size: 0.75rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.wizard-review-list dd {
|
||||
margin: 0.2rem 0 0;
|
||||
color: var(--text-primary);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.wizard-stepper {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.wizard-actions {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
.wizard-actions .btn-primary,
|
||||
.wizard-actions .btn-ghost {
|
||||
width: 100%;
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
@@ -394,6 +394,23 @@ h1, h2, h3, h4, h5, h6 {
|
||||
padding: 0.5rem 1.25rem;
|
||||
}
|
||||
|
||||
.nav-logout-form {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.nav-link-button {
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.nav-link-button:hover,
|
||||
.nav-link-button:focus-visible {
|
||||
color: var(--accent-blue);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.nav-arrow {
|
||||
transition: transform var(--navbar-expand-duration) var(--navbar-expand-ease);
|
||||
}
|
||||
@@ -936,6 +953,39 @@ h1, h2, h3, h4, h5, h6 {
|
||||
border-radius: var(--radius-pill);
|
||||
}
|
||||
|
||||
.project-card-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
margin: 0.5rem 0 0;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.project-card-links {
|
||||
list-style: none;
|
||||
margin: 0.5rem 0 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.project-card-links a {
|
||||
font-size: 0.8rem;
|
||||
color: var(--accent-blue);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.project-card-attachments {
|
||||
list-style: none;
|
||||
margin: 0.5rem 0 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 0.25rem;
|
||||
font-size: 0.78rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
Experience / Benefits
|
||||
============================================================ */
|
||||
@@ -3838,3 +3888,385 @@ a.citation-count-badge:hover {
|
||||
height: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
.container--narrow {
|
||||
max-width: 720px;
|
||||
}
|
||||
|
||||
.portal-card {
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.portal-footer-text,
|
||||
.portal-intro {
|
||||
margin-top: 1.25rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
.portal-footer-text a,
|
||||
.portal-link {
|
||||
color: var(--accent-blue);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.portal-footer-text a:hover,
|
||||
.portal-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.form-grid--2 {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.form-errors {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0.85rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: rgba(239, 68, 68, 0.1);
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.flash-messages {
|
||||
position: sticky;
|
||||
top: 72px;
|
||||
z-index: 90;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
.flash-message {
|
||||
max-width: 960px;
|
||||
margin: 0 auto;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.flash-message--success,
|
||||
.flash-message--info {
|
||||
background: rgba(16, 185, 129, 0.12);
|
||||
color: #047857;
|
||||
border: 1px solid rgba(16, 185, 129, 0.25);
|
||||
}
|
||||
|
||||
.flash-message--error {
|
||||
background: rgba(239, 68, 68, 0.12);
|
||||
color: #b91c1c;
|
||||
border: 1px solid rgba(239, 68, 68, 0.25);
|
||||
}
|
||||
|
||||
.page-hero-content--row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.portal-table-wrap {
|
||||
overflow-x: auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.portal-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.portal-table th,
|
||||
.portal-table td {
|
||||
padding: 1rem 1.25rem;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid rgba(148, 163, 184, 0.2);
|
||||
}
|
||||
|
||||
.portal-table th {
|
||||
font-size: 0.78rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.status-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.2rem 0.65rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
background: rgba(59, 130, 246, 0.12);
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.status-pill--submitted { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }
|
||||
.status-pill--under_review { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }
|
||||
.status-pill--quoted { background: rgba(245, 158, 11, 0.15); color: #b45309; }
|
||||
.status-pill--accepted { background: rgba(16, 185, 129, 0.15); color: #047857; }
|
||||
.status-pill--declined { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
|
||||
.status-pill--in_progress { background: rgba(6, 182, 212, 0.15); color: #0e7490; }
|
||||
.status-pill--delivered { background: rgba(34, 197, 94, 0.15); color: #15803d; }
|
||||
.status-pill--closed { background: rgba(107, 114, 128, 0.15); color: #374151; }
|
||||
|
||||
.portal-empty {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.portal-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
margin-top: 1.5rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.portal-detail-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.portal-section-title {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.portal-subtitle {
|
||||
margin-top: 1.25rem;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.portal-body-text {
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.portal-meta-list {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.portal-meta-list dt {
|
||||
font-size: 0.78rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.portal-meta-list dd {
|
||||
margin: 0.15rem 0 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.portal-actions {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.portal-attachment-list ul {
|
||||
margin: 0.5rem 0 0;
|
||||
padding-left: 1.2rem;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.form-grid--2,
|
||||
.portal-detail-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.social-auth {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.social-auth-label {
|
||||
margin: 0 0 0.75rem;
|
||||
font-size: 0.86rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.social-auth-buttons {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.social-auth-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.65rem;
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid rgba(148, 163, 184, 0.35);
|
||||
background: #ffffff;
|
||||
color: var(--text-primary);
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.social-auth-btn:hover {
|
||||
border-color: var(--accent-blue);
|
||||
box-shadow: 0 0 0 3px rgba(48, 81, 255, 0.1);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.social-auth-btn--google .social-auth-icon {
|
||||
color: #ea4335;
|
||||
}
|
||||
|
||||
.social-auth-btn--github .social-auth-icon {
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.social-auth-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 1.35rem;
|
||||
height: 1.35rem;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.portal-divider {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
margin: 1.25rem 0;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
|
||||
.portal-divider::before,
|
||||
.portal-divider::after {
|
||||
content: "";
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: rgba(148, 163, 184, 0.35);
|
||||
}
|
||||
|
||||
.social-oauth-card {
|
||||
display: grid;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.social-oauth-provider {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
padding: 1rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: rgba(48, 81, 255, 0.04);
|
||||
border: 1px solid rgba(48, 81, 255, 0.12);
|
||||
}
|
||||
|
||||
.social-oauth-provider--google {
|
||||
background: rgba(234, 67, 53, 0.06);
|
||||
border-color: rgba(234, 67, 53, 0.18);
|
||||
}
|
||||
|
||||
.social-oauth-provider--github {
|
||||
background: rgba(36, 41, 47, 0.05);
|
||||
border-color: rgba(36, 41, 47, 0.15);
|
||||
}
|
||||
|
||||
.social-oauth-provider-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 3rem;
|
||||
height: 3rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 800;
|
||||
background: #ffffff;
|
||||
border: 1px solid rgba(148, 163, 184, 0.35);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.social-oauth-provider--google .social-oauth-provider-icon {
|
||||
color: #ea4335;
|
||||
}
|
||||
|
||||
.social-oauth-provider--github .social-oauth-provider-icon {
|
||||
color: #24292f;
|
||||
}
|
||||
|
||||
.social-oauth-provider-title {
|
||||
margin: 0 0 0.35rem;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
.social-oauth-provider-copy {
|
||||
margin: 0;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.5;
|
||||
font-size: 0.92rem;
|
||||
}
|
||||
|
||||
.social-oauth-steps {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: 0.55rem;
|
||||
}
|
||||
|
||||
.social-oauth-steps li {
|
||||
position: relative;
|
||||
padding-left: 1.35rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.social-oauth-steps li::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0.55rem;
|
||||
width: 0.45rem;
|
||||
height: 0.45rem;
|
||||
border-radius: 999px;
|
||||
background: var(--accent-blue);
|
||||
}
|
||||
|
||||
.social-oauth-form {
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.social-oauth-continue {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.social-oauth-redirect {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.social-oauth-spinner {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
margin: 0 auto 1rem;
|
||||
border-radius: 999px;
|
||||
border: 3px solid rgba(48, 81, 255, 0.15);
|
||||
border-top-color: var(--accent-blue);
|
||||
animation: social-oauth-spin 0.9s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes social-oauth-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
'use strict';
|
||||
|
||||
function initBriefWizard() {
|
||||
const form = document.querySelector('[data-brief-wizard]');
|
||||
if (!form) return;
|
||||
|
||||
const panels = Array.from(form.querySelectorAll('[data-wizard-panel]'));
|
||||
const indicators = Array.from(form.querySelectorAll('[data-wizard-step-indicator]'));
|
||||
const prevBtn = form.querySelector('[data-wizard-prev]');
|
||||
const nextBtn = form.querySelector('[data-wizard-next]');
|
||||
const submitBtn = form.querySelector('[data-wizard-submit]');
|
||||
const progressFill = form.querySelector('[data-wizard-progress-fill]');
|
||||
const reviewBlock = form.querySelector('[data-wizard-review]');
|
||||
const totalSteps = panels.length;
|
||||
let currentStep = Number(form.dataset.initialStep || '1');
|
||||
|
||||
if (currentStep < 1 || currentStep > totalSteps) {
|
||||
currentStep = 1;
|
||||
}
|
||||
|
||||
function getPanel(step) {
|
||||
return form.querySelector(`[data-wizard-panel="${step}"]`);
|
||||
}
|
||||
|
||||
function getFields(step) {
|
||||
const panel = getPanel(step);
|
||||
if (!panel) return [];
|
||||
const fieldNames = (panel.dataset.stepFields || '').split(',').filter(Boolean);
|
||||
return fieldNames
|
||||
.map((name) => {
|
||||
if (name === 'attachments') {
|
||||
return form.querySelector('#id_attachments');
|
||||
}
|
||||
return form.querySelector(`[name="${name}"]`);
|
||||
})
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function stepForField(field) {
|
||||
if (!field || !field.name) return 1;
|
||||
for (const panel of panels) {
|
||||
const fieldNames = (panel.dataset.stepFields || '').split(',').filter(Boolean);
|
||||
if (fieldNames.includes(field.name)) {
|
||||
return Number(panel.dataset.wizardPanel);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
function isFieldValid(field) {
|
||||
if (!field) return true;
|
||||
if (field.disabled) return true;
|
||||
if (field.type === 'file') return true;
|
||||
if (field.required && !String(field.value || '').trim()) {
|
||||
field.reportValidity();
|
||||
return false;
|
||||
}
|
||||
if (!field.checkValidity()) {
|
||||
field.reportValidity();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function validateStep(step) {
|
||||
const fields = getFields(step);
|
||||
return fields.every((field) => isFieldValid(field));
|
||||
}
|
||||
|
||||
function validateAllRequired() {
|
||||
const requiredFields = Array.from(
|
||||
form.querySelectorAll('input, select, textarea')
|
||||
).filter((field) => field.required && !field.disabled);
|
||||
for (const field of requiredFields) {
|
||||
if (!isFieldValid(field)) {
|
||||
setStep(stepForField(field));
|
||||
field.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function optionLabel(select) {
|
||||
if (!select || select.tagName !== 'SELECT') return '—';
|
||||
const option = select.options[select.selectedIndex];
|
||||
if (!option || !option.value) return 'Not specified';
|
||||
return option.textContent.trim();
|
||||
}
|
||||
|
||||
function updateReview() {
|
||||
if (!reviewBlock) return;
|
||||
|
||||
const title = form.querySelector('#id_title');
|
||||
const category = form.querySelector('#id_category');
|
||||
const description = form.querySelector('#id_description');
|
||||
const budget = form.querySelector('#id_budget_range');
|
||||
const deadline = form.querySelector('#id_desired_deadline');
|
||||
const links = form.querySelector('#id_reference_links');
|
||||
const attachments = form.querySelector('#id_attachments');
|
||||
|
||||
const setReview = (name, value) => {
|
||||
const target = reviewBlock.querySelector(`[data-review-field="${name}"]`);
|
||||
if (target) target.textContent = value || '—';
|
||||
};
|
||||
|
||||
setReview('title', title ? title.value.trim() : '—');
|
||||
setReview('category', optionLabel(category));
|
||||
setReview('description', description && description.value.trim() ? description.value.trim() : 'Not specified');
|
||||
setReview('budget_range', optionLabel(budget));
|
||||
setReview('desired_deadline', deadline && deadline.value ? deadline.value : 'Not specified');
|
||||
setReview('reference_links', links && links.value.trim() ? links.value.trim() : 'None');
|
||||
|
||||
if (attachments && attachments.files && attachments.files.length) {
|
||||
const names = Array.from(attachments.files).map((file) => file.name).join(', ');
|
||||
setReview('attachments', names);
|
||||
} else {
|
||||
setReview('attachments', 'None');
|
||||
}
|
||||
}
|
||||
|
||||
function setStep(step) {
|
||||
currentStep = step;
|
||||
|
||||
panels.forEach((panel) => {
|
||||
const panelStep = Number(panel.dataset.wizardPanel);
|
||||
const isActive = panelStep === step;
|
||||
panel.classList.toggle('is-active', isActive);
|
||||
panel.hidden = !isActive;
|
||||
});
|
||||
|
||||
indicators.forEach((indicator) => {
|
||||
const indicatorStep = Number(indicator.dataset.wizardStepIndicator);
|
||||
indicator.classList.toggle('is-active', indicatorStep === step);
|
||||
indicator.classList.toggle('is-complete', indicatorStep < step);
|
||||
});
|
||||
|
||||
if (progressFill && totalSteps > 1) {
|
||||
const progress = ((step - 1) / (totalSteps - 1)) * 100;
|
||||
progressFill.style.width = `${progress}%`;
|
||||
}
|
||||
|
||||
if (prevBtn) prevBtn.hidden = step === 1;
|
||||
if (nextBtn) nextBtn.hidden = step === totalSteps;
|
||||
if (submitBtn) submitBtn.hidden = step !== totalSteps;
|
||||
if (reviewBlock) reviewBlock.hidden = step !== totalSteps;
|
||||
|
||||
if (step === totalSteps) {
|
||||
updateReview();
|
||||
}
|
||||
}
|
||||
|
||||
if (prevBtn) {
|
||||
prevBtn.addEventListener('click', () => {
|
||||
if (currentStep > 1) {
|
||||
setStep(currentStep - 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (nextBtn) {
|
||||
nextBtn.addEventListener('click', () => {
|
||||
if (!validateStep(currentStep)) return;
|
||||
if (currentStep < totalSteps) {
|
||||
setStep(currentStep + 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
form.addEventListener('submit', (event) => {
|
||||
if (currentStep !== totalSteps) {
|
||||
event.preventDefault();
|
||||
if (validateStep(currentStep) && currentStep < totalSteps) {
|
||||
setStep(currentStep + 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!validateAllRequired()) {
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
form.querySelectorAll('input, select, textarea').forEach((field) => {
|
||||
field.addEventListener('keydown', (event) => {
|
||||
if (event.key === 'Enter' && field.tagName !== 'TEXTAREA' && currentStep !== totalSteps) {
|
||||
event.preventDefault();
|
||||
if (validateStep(currentStep) && currentStep < totalSteps) {
|
||||
setStep(currentStep + 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
field.addEventListener('input', () => {
|
||||
if (currentStep === totalSteps) {
|
||||
updateReview();
|
||||
}
|
||||
});
|
||||
field.addEventListener('change', () => {
|
||||
if (currentStep === totalSteps) {
|
||||
updateReview();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setStep(currentStep);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', initBriefWizard);
|
||||
Reference in New Issue
Block a user