feat(web) linked calculator and contact form
All checks were successful
Build, Test and Deploy / test-backend (push) Successful in 27s
Build, Test and Deploy / build-and-push (push) Successful in 24s
Build, Test and Deploy / deploy (push) Successful in 4s

This commit is contained in:
2026-02-05 11:42:48 +01:00
parent ab7b95a3d7
commit ce179cac62
4 changed files with 73 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import { AppAlertComponent } from '../../shared/components/app-alert/app-alert.c
import { UploadFormComponent } from './components/upload-form/upload-form.component';
import { QuoteResultComponent } from './components/quote-result/quote-result.component';
import { QuoteEstimatorService, QuoteRequest, QuoteResult } from './services/quote-estimator.service';
import { Router } from '@angular/router';
@Component({
selector: 'app-calculator-page',
@@ -56,7 +57,7 @@ import { QuoteEstimatorService, QuoteRequest, QuoteResult } from './services/quo
<small class="text-muted">Potrebbe richiedere qualche secondo.</small>
</app-card>
} @else if (result()) {
<app-quote-result [result]="result()!"></app-quote-result>
<app-quote-result [result]="result()!" (consult)="onConsult()"></app-quote-result>
} @else {
<app-card>
<h3>{{ 'CALC.BENEFITS_TITLE' | translate }}</h3>
@@ -146,9 +147,10 @@ export class CalculatorPageComponent {
result = signal<QuoteResult | null>(null);
error = signal<boolean>(false);
constructor(private estimator: QuoteEstimatorService) {}
constructor(private estimator: QuoteEstimatorService, private router: Router) {}
onCalculate(req: QuoteRequest) {
this.currentRequest = req; // Store request for consultation
this.loading.set(true);
this.error.set(false);
this.result.set(null);
@@ -164,4 +166,30 @@ export class CalculatorPageComponent {
}
});
}
private currentRequest: QuoteRequest | null = null;
onConsult() {
if (!this.currentRequest) return;
const req = this.currentRequest;
let details = `Richiesta Preventivo:\n`;
details += `- Materiale: ${req.material}\n`;
details += `- Qualità: ${req.quality}\n`;
details += `- Quantità: ${req.quantity}\n`;
if (req.mode === 'advanced') {
if (req.color) details += `- Colore: ${req.color}\n`;
if (req.infillDensity) details += `- Infill: ${req.infillDensity}%\n`;
}
if (req.notes) details += `\nNote: ${req.notes}`;
this.estimator.setPendingConsultation({
files: req.files,
message: details
});
this.router.navigate(['/contact']);
}
}