diff --git a/frontend/src/app/features/calculator/calculator-page.component.html b/frontend/src/app/features/calculator/calculator-page.component.html index e2c8597..3de51d9 100644 --- a/frontend/src/app/features/calculator/calculator-page.component.html +++ b/frontend/src/app/features/calculator/calculator-page.component.html @@ -2,15 +2,16 @@

{{ 'CALC.TITLE' | translate }}

{{ 'CALC.SUBTITLE' | translate }}

- @if (orderSuccess()) { - {{ 'USER_DETAILS.ORDER_SUCCESS' | translate }} - } @if (error()) { {{ 'CALC.ERROR_GENERIC' | translate }} } -@if (step() === 'details' && result()) { +@if (step() === 'success') { +
+ +
+} @else if (step() === 'details' && result()) {
('easy'); - step = signal<'upload' | 'quote' | 'details'>('upload'); + step = signal<'upload' | 'quote' | 'details' | 'success'>('upload'); loading = signal(false); uploadProgress = signal(0); @@ -34,6 +35,7 @@ export class CalculatorPageComponent { constructor(private estimator: QuoteEstimatorService, private router: Router) {} onCalculate(req: QuoteRequest) { + // ... (logic remains the same, simplified for diff) this.currentRequest = req; this.loading.set(true); this.uploadProgress.set(0); @@ -78,12 +80,14 @@ export class CalculatorPageComponent { onSubmitOrder(orderData: any) { console.log('Order Submitted:', orderData); this.orderSuccess.set(true); - this.step.set('upload'); // Reset to start, or show success page? - // For now, let's show success message and reset - setTimeout(() => { - this.orderSuccess.set(false); - }, 5000); - this.result.set(null); + this.step.set('success'); + } + + onNewQuote() { + this.step.set('upload'); + this.result.set(null); + this.orderSuccess.set(false); + this.mode.set('easy'); // Reset to default } private currentRequest: QuoteRequest | null = null; diff --git a/frontend/src/app/features/contact/components/contact-form/contact-form.component.html b/frontend/src/app/features/contact/components/contact-form/contact-form.component.html index 23bba83..b0f7bed 100644 --- a/frontend/src/app/features/contact/components/contact-form/contact-form.component.html +++ b/frontend/src/app/features/contact/components/contact-form/contact-form.component.html @@ -1,15 +1,5 @@ @if (sent()) { -
-
- - - - -
-

{{ 'CONTACT.SUCCESS_TITLE' | translate }}

-

{{ 'CONTACT.SUCCESS_DESC' | translate }}

- {{ 'CONTACT.SEND_ANOTHER' | translate }} -
+ } @else {
diff --git a/frontend/src/app/features/contact/components/contact-form/contact-form.component.scss b/frontend/src/app/features/contact/components/contact-form/contact-form.component.scss index e8437e2..76186ad 100644 --- a/frontend/src/app/features/contact/components/contact-form/contact-form.component.scss +++ b/frontend/src/app/features/contact/components/contact-form/contact-form.component.scss @@ -132,40 +132,4 @@ app-input.col { width: 100%; } &:hover { background: red; } } -/* Success State */ -.success-state { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - text-align: center; - padding: var(--space-8) var(--space-4); - gap: var(--space-4); - min-height: 300px; /* Ensure visual balance */ - - .success-icon { - width: 64px; - height: 64px; - color: var(--color-success, #10b981); - margin-bottom: var(--space-2); - - svg { - width: 100%; - height: 100%; - } - } - - h3 { - font-size: 1.5rem; - font-weight: 600; - color: var(--color-text); - margin: 0; - } - - p { - color: var(--color-text-muted); - max-width: 400px; - margin-bottom: var(--space-4); - line-height: 1.5; - } -} +/* Success State styles moved to shared component */ diff --git a/frontend/src/app/features/contact/components/contact-form/contact-form.component.ts b/frontend/src/app/features/contact/components/contact-form/contact-form.component.ts index f46b7da..30eec60 100644 --- a/frontend/src/app/features/contact/components/contact-form/contact-form.component.ts +++ b/frontend/src/app/features/contact/components/contact-form/contact-form.component.ts @@ -12,10 +12,12 @@ interface FilePreview { type: 'image' | 'pdf' | '3d' | 'other'; } +import { SuccessStateComponent } from '../../../../shared/components/success-state/success-state.component'; + @Component({ selector: 'app-contact-form', standalone: true, - imports: [CommonModule, ReactiveFormsModule, TranslateModule, AppInputComponent, AppButtonComponent], + imports: [CommonModule, ReactiveFormsModule, TranslateModule, AppInputComponent, AppButtonComponent, SuccessStateComponent], templateUrl: './contact-form.component.html', styleUrl: './contact-form.component.scss' }) diff --git a/frontend/src/app/shared/components/success-state/success-state.component.html b/frontend/src/app/shared/components/success-state/success-state.component.html new file mode 100644 index 0000000..d118121 --- /dev/null +++ b/frontend/src/app/shared/components/success-state/success-state.component.html @@ -0,0 +1,26 @@ +
+
+ + + + +
+ + @switch (context()) { + @case ('contact') { +

{{ 'CONTACT.SUCCESS_TITLE' | translate }}

+

{{ 'CONTACT.SUCCESS_DESC' | translate }}

+ {{ 'CONTACT.SEND_ANOTHER' | translate }} + } + @case ('calc') { +

{{ 'CALC.ORDER_SUCCESS_TITLE' | translate }}

+

{{ 'CALC.ORDER_SUCCESS_DESC' | translate }}

+ {{ 'CALC.NEW_QUOTE' | translate }} + } + @case ('shop') { +

{{ 'SHOP.SUCCESS_TITLE' | translate }}

+

{{ 'SHOP.SUCCESS_DESC' | translate }}

+ {{ 'SHOP.CONTINUE' | translate }} + } + } +
diff --git a/frontend/src/app/shared/components/success-state/success-state.component.scss b/frontend/src/app/shared/components/success-state/success-state.component.scss new file mode 100644 index 0000000..dc86115 --- /dev/null +++ b/frontend/src/app/shared/components/success-state/success-state.component.scss @@ -0,0 +1,36 @@ +.success-state { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + padding: var(--space-8) var(--space-4); + gap: var(--space-4); + min-height: 300px; /* Ensure visual balance */ + + .success-icon { + width: 64px; + height: 64px; + color: var(--color-success, #10b981); + margin-bottom: var(--space-2); + + svg { + width: 100%; + height: 100%; + } + } + + h3 { + font-size: 1.5rem; + font-weight: 600; + color: var(--color-text); + margin: 0; + } + + p { + color: var(--color-text-muted); + max-width: 400px; + margin-bottom: var(--space-4); + line-height: 1.5; + } +} diff --git a/frontend/src/app/shared/components/success-state/success-state.component.ts b/frontend/src/app/shared/components/success-state/success-state.component.ts new file mode 100644 index 0000000..3cf4048 --- /dev/null +++ b/frontend/src/app/shared/components/success-state/success-state.component.ts @@ -0,0 +1,18 @@ +import { Component, input, output } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { AppButtonComponent } from '../app-button/app-button.component'; + +export type SuccessContext = 'contact' | 'calc' | 'shop'; + +@Component({ + selector: 'app-success-state', + standalone: true, + imports: [CommonModule, TranslateModule, AppButtonComponent], + templateUrl: './success-state.component.html', + styleUrl: './success-state.component.scss' +}) +export class SuccessStateComponent { + context = input.required(); + action = output(); +} diff --git a/frontend/src/assets/i18n/en.json b/frontend/src/assets/i18n/en.json index a44cb04..fd65237 100644 --- a/frontend/src/assets/i18n/en.json +++ b/frontend/src/assets/i18n/en.json @@ -61,6 +61,9 @@ "ORDER": "Order Now", "CONSULT": "Request Consultation", "ERROR_GENERIC": "An error occurred while calculating the quote.", + "NEW_QUOTE": "Calculate New Quote", + "ORDER_SUCCESS_TITLE": "Order Submitted Successfully", + "ORDER_SUCCESS_DESC": "We have received your order details. You will receive a confirmation email shortly with the payment details.", "BENEFITS_TITLE": "Why choose us?", "BENEFITS_1": "Automatic quote with instant cost and time", "BENEFITS_2": "Selected materials and quality control", diff --git a/frontend/src/assets/i18n/it.json b/frontend/src/assets/i18n/it.json index 70a7190..0f1221b 100644 --- a/frontend/src/assets/i18n/it.json +++ b/frontend/src/assets/i18n/it.json @@ -40,6 +40,9 @@ "ORDER": "Ordina Ora", "CONSULT": "Richiedi Consulenza", "ERROR_GENERIC": "Si è verificato un errore durante il calcolo del preventivo.", + "NEW_QUOTE": "Calcola Nuovo Preventivo", + "ORDER_SUCCESS_TITLE": "Ordine Inviato con Successo", + "ORDER_SUCCESS_DESC": "Abbiamo ricevuto i dettagli del tuo ordine. Riceverai a breve una email di conferma con i dettagli per il pagamento.", "BENEFITS_TITLE": "Perché scegliere noi?", "BENEFITS_1": "Preventivo automatico con costo e tempo immediati", "BENEFITS_2": "Materiali selezionati e qualità controllata",