feat(back-end and front-end) cad bill with order

This commit is contained in:
2026-03-04 12:03:09 +01:00
parent 0f2f2bc7a9
commit 1b3f0b16ff
43 changed files with 1594 additions and 150 deletions

View File

@@ -48,6 +48,7 @@ export class CalculatorPageComponent implements OnInit {
loading = signal(false);
uploadProgress = signal(0);
result = signal<QuoteResult | null>(null);
cadSessionLocked = signal(false);
error = signal<boolean>(false);
errorKey = signal<string>('CALC.ERROR_GENERIC');
isZeroQuoteError = computed(
@@ -100,6 +101,8 @@ export class CalculatorPageComponent implements OnInit {
this.error.set(false);
this.errorKey.set('CALC.ERROR_GENERIC');
this.result.set(result);
const isCadSession = data?.session?.status === 'CAD_ACTIVE';
this.cadSessionLocked.set(isCadSession);
this.step.set('quote');
// 2. Determine Mode (Heuristic)
@@ -206,6 +209,7 @@ export class CalculatorPageComponent implements OnInit {
this.error.set(false);
this.errorKey.set('CALC.ERROR_GENERIC');
this.result.set(null);
this.cadSessionLocked.set(false);
this.orderSuccess.set(false);
// Auto-scroll on mobile to make analysis visible
@@ -270,10 +274,10 @@ export class CalculatorPageComponent implements OnInit {
onProceed() {
const res = this.result();
if (res && res.sessionId) {
this.router.navigate(
['/', this.languageService.selectedLang(), 'checkout'],
{ queryParams: { session: res.sessionId } },
);
const segments = this.cadSessionLocked()
? ['/', this.languageService.selectedLang(), 'checkout', 'cad']
: ['/', this.languageService.selectedLang(), 'checkout'];
this.router.navigate(segments, { queryParams: { session: res.sessionId } });
} else {
console.error('No session ID found in quote result');
// Fallback or error handling
@@ -343,6 +347,7 @@ export class CalculatorPageComponent implements OnInit {
onNewQuote() {
this.step.set('upload');
this.result.set(null);
this.cadSessionLocked.set(false);
this.orderSuccess.set(false);
this.mode.set('easy'); // Reset to default
}