feat(web): java from python
This commit is contained in:
@@ -67,6 +67,33 @@ import { QuoteRequest } from '../../services/quote-estimator.service';
|
||||
></app-input>
|
||||
|
||||
@if (mode() === 'advanced') {
|
||||
<div class="grid">
|
||||
<app-select
|
||||
formControlName="color"
|
||||
[label]="'CALC.COLOR' | translate"
|
||||
[options]="colors"
|
||||
></app-select>
|
||||
|
||||
<app-select
|
||||
formControlName="infillPattern"
|
||||
[label]="'CALC.PATTERN' | translate"
|
||||
[options]="infillPatterns"
|
||||
></app-select>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
<app-input
|
||||
formControlName="infillDensity"
|
||||
type="number"
|
||||
[label]="'CALC.INFILL' | translate"
|
||||
></app-input>
|
||||
|
||||
<div class="checkbox-row">
|
||||
<input type="checkbox" formControlName="supportEnabled" id="support">
|
||||
<label for="support">{{ 'CALC.SUPPORT' | translate }}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-input
|
||||
formControlName="notes"
|
||||
[label]="'CALC.NOTES' | translate"
|
||||
@@ -127,6 +154,24 @@ import { QuoteRequest } from '../../services/quote-estimator.service';
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.checkbox-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-3);
|
||||
height: 100%;
|
||||
padding-top: var(--space-4);
|
||||
|
||||
input[type="checkbox"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
accent-color: var(--color-brand);
|
||||
}
|
||||
label {
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
`]
|
||||
})
|
||||
export class UploadFormComponent {
|
||||
@@ -146,10 +191,27 @@ export class UploadFormComponent {
|
||||
];
|
||||
|
||||
qualities = [
|
||||
{ label: 'Bozza (Veloce)', value: 'Draft' },
|
||||
{ label: 'Bozza (Fast)', value: 'Draft' },
|
||||
{ label: 'Standard', value: 'Standard' },
|
||||
{ label: 'Alta definizione', value: 'High' }
|
||||
];
|
||||
|
||||
colors = [
|
||||
{ label: 'Black', value: 'Black' },
|
||||
{ label: 'White', value: 'White' },
|
||||
{ label: 'Gray', value: 'Gray' },
|
||||
{ label: 'Red', value: 'Red' },
|
||||
{ label: 'Blue', value: 'Blue' },
|
||||
{ label: 'Green', value: 'Green' },
|
||||
{ label: 'Yellow', value: 'Yellow' }
|
||||
];
|
||||
infillPatterns = [
|
||||
{ label: 'Grid', value: 'grid' },
|
||||
{ label: 'Gyroid', value: 'gyroid' },
|
||||
{ label: 'Cubic', value: 'cubic' },
|
||||
{ label: 'Triangles', value: 'triangles' }
|
||||
];
|
||||
|
||||
acceptedFormats = '.stl,.3mf,.step,.stp,.obj,.amf,.ply,.igs,.iges';
|
||||
|
||||
constructor(private fb: FormBuilder) {
|
||||
@@ -158,7 +220,12 @@ export class UploadFormComponent {
|
||||
material: ['PLA', Validators.required],
|
||||
quality: ['Standard', Validators.required],
|
||||
quantity: [1, [Validators.required, Validators.min(1)]],
|
||||
notes: ['']
|
||||
notes: [''],
|
||||
// Advanced fields
|
||||
color: ['Black'],
|
||||
infillDensity: [20, [Validators.min(0), Validators.max(100)]],
|
||||
infillPattern: ['grid'],
|
||||
supportEnabled: [false]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ export interface QuoteRequest {
|
||||
quality: string;
|
||||
quantity: number;
|
||||
notes?: string;
|
||||
color?: string;
|
||||
infillDensity?: number;
|
||||
infillPattern?: string;
|
||||
supportEnabled?: boolean;
|
||||
mode: 'easy' | 'advanced';
|
||||
}
|
||||
|
||||
@@ -47,6 +51,13 @@ export class QuoteEstimatorService {
|
||||
formData.append('filament', this.mapMaterial(request.material));
|
||||
formData.append('quality', this.mapQuality(request.quality));
|
||||
|
||||
if (request.mode === 'advanced') {
|
||||
if (request.color) formData.append('material_color', request.color);
|
||||
if (request.infillDensity) formData.append('infill_density', request.infillDensity.toString());
|
||||
if (request.infillPattern) formData.append('infill_pattern', request.infillPattern);
|
||||
if (request.supportEnabled) formData.append('support_enabled', 'true');
|
||||
}
|
||||
|
||||
const headers: any = {};
|
||||
// @ts-ignore
|
||||
if (environment.basicAuth) {
|
||||
|
||||
Reference in New Issue
Block a user