Simplify lab trial dispatch and fix per-jaw pricing

This commit is contained in:
egecankomur
2026-10-10 14:52:05 +03:00
parent f44e07f378
commit d20d44a1f3
6 changed files with 204 additions and 74 deletions
+23 -2
View File
@@ -47,8 +47,8 @@ const visibleProstheticTypes = <ProstheticType>[
extension JobStatusExt on JobStatus {
String get label => switch (this) {
JobStatus.pending => 'Bekliyor',
JobStatus.inProgress => 'İşlemde',
JobStatus.pending => 'Üretim aşamasında · Kabul bekliyor',
JobStatus.inProgress => 'Üretim aşamasında',
JobStatus.sent => 'Gönderildi',
JobStatus.delivered => 'Teslim Alındı',
JobStatus.cancelled => 'İptal',
@@ -556,6 +556,27 @@ class Job {
bool get isLastStep =>
currentStep != null && currentStep == stepTemplate.last;
JobStep labDispatchStep({required bool finish}) {
if (status != JobStatus.inProgress || location != JobLocation.atLab) {
throw StateError('İş üretim aşamasında ve laboratuvarda olmalıdır.');
}
if (finish) return JobStep.cilaBitim;
if (!provaRequired) {
throw StateError('Provasız iş provaya gönderilemez.');
}
const trialSteps = {
JobStep.altYapiProva,
JobStep.ustYapiProva,
JobStep.mumProva,
JobStep.dislerProva,
JobStep.dayanakProva,
JobStep.kronProva,
};
if (trialSteps.contains(currentStep)) return currentStep!;
return stepTemplate.where(trialSteps.contains).firstOrNull ??
JobStep.altYapiProva;
}
/// The next step after currentStep in this job's template, or null if done.
JobStep? get nextStep {
if (currentStep == null) return stepTemplate.firstOrNull;