@@ -103,21 +92,21 @@
Estimated Cost
- {{ quoteResult.cost.total | currency:'EUR' }}
+ {{ quoteResult?.cost?.total | currency:'EUR' }}
Print Time
- {{ quoteResult.print_time_formatted }}
+ {{ quoteResult?.print_time_formatted }}
Material Weight
- {{ quoteResult.material_grams | number:'1.0-0' }}g
+ {{ quoteResult?.material_grams | number:'1.0-0' }}g
Printer
- {{ quoteResult.printer }}
+ {{ quoteResult?.printer }}
@@ -126,11 +115,11 @@
Infill
- {{ params.infill }}%
+ {{ params.infill_density }}%
Layer Height
- {{ params.layerHeight }}mm
+ {{ params.layer_height || 'Standard' }}
diff --git a/frontend/src/app/quote/advanced-quote/advanced-quote.component.ts b/frontend/src/app/quote/advanced-quote/advanced-quote.component.ts
index 1c97a6e..8939999 100644
--- a/frontend/src/app/quote/advanced-quote/advanced-quote.component.ts
+++ b/frontend/src/app/quote/advanced-quote/advanced-quote.component.ts
@@ -1,4 +1,4 @@
-import { Component, inject } from '@angular/core';
+import { Component, inject, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterLink } from '@angular/router';
import { FormsModule } from '@angular/forms';
@@ -12,7 +12,7 @@ import { StlViewerComponent } from '../../common/stl-viewer/stl-viewer.component
templateUrl: './advanced-quote.component.html',
styleUrls: ['./advanced-quote.component.scss']
})
-export class AdvancedQuoteComponent {
+export class AdvancedQuoteComponent implements OnInit {
printService = inject(PrintService);
selectedFile: File | null = null;
@@ -20,15 +20,29 @@ export class AdvancedQuoteComponent {
isCalculating = false;
quoteResult: any = null;
+ // Available Profiles
+ machines: string[] = [];
+ filaments: string[] = [];
+ qualities: string[] = [];
+
// Parameters
params = {
- layerHeight: '0.20',
- infill: 15,
- walls: 2,
- topBottom: 3,
- material: 'PLA'
+ machine: 'bambu_a1',
+ filament: 'pla_basic',
+ quality: 'standard',
+ layer_height: null,
+ infill_density: 15,
+ support_enabled: false
};
+ ngOnInit() {
+ this.printService.getProfiles().subscribe(data => {
+ this.machines = data.machines;
+ this.filaments = data.filaments;
+ this.qualities = data.processes;
+ });
+ }
+
onDragOver(event: DragEvent) {
event.preventDefault();
event.stopPropagation();
@@ -77,10 +91,25 @@ export class AdvancedQuoteComponent {
this.isCalculating = true;
// Use PrintService
- this.printService.calculateQuote(this.selectedFile, this.params)
+ this.printService.calculateQuote(this.selectedFile, {
+ machine: this.params.machine,
+ filament: this.params.filament,
+ quality: this.params.quality,
+ infill_density: this.params.infill_density,
+ // Optional mappings if user selected overrides
+ // layer_height: this.params.layer_height,
+ // support_enabled: this.params.support_enabled
+ })
.subscribe({
next: (res) => {
- this.quoteResult = res;
+ console.log('API Response:', res);
+ if (res.success) {
+ this.quoteResult = res.data;
+ console.log('Quote Result set to:', this.quoteResult);
+ } else {
+ console.error('API succeeded but returned error flag:', res.error);
+ alert('Error: ' + res.error);
+ }
this.isCalculating = false;
},
error: (err) => {