Apply clinic lab workflow feedback
This commit is contained in:
@@ -28,6 +28,7 @@ class LabJobsRepository {
|
||||
perPage: limit,
|
||||
filter: filterParts.join(' && '),
|
||||
expand: _listExpand,
|
||||
sort: '-created',
|
||||
);
|
||||
return (result.items.map((r) => Job.fromJson(r.toJson())).toList()
|
||||
..sort((a, b) => b.dateCreated.compareTo(a.dateCreated)));
|
||||
@@ -44,6 +45,7 @@ class LabJobsRepository {
|
||||
perPage: limit,
|
||||
filter: filterParts.join(' && '),
|
||||
expand: _listExpand,
|
||||
sort: location == null ? '-created' : null,
|
||||
);
|
||||
return (result.items.map((r) => Job.fromJson(r.toJson())).toList()
|
||||
..sort((a, b) {
|
||||
@@ -89,9 +91,12 @@ class LabJobsRepository {
|
||||
|
||||
final isFinal = currentStep == JobStep.cilaBitim;
|
||||
final nextStep = job.nextStep;
|
||||
final shouldStayAtLabAfterMeasure = !job.provaRequired &&
|
||||
currentStep == JobStep.olcuKontrol &&
|
||||
nextStep == JobStep.cilaBitim;
|
||||
final patch = isFinal
|
||||
? {'status': 'sent', 'location': 'at_clinic'}
|
||||
: currentStep.requiresClinicApproval
|
||||
: currentStep.requiresClinicApproval && !shouldStayAtLabAfterMeasure
|
||||
? {'location': 'at_clinic'}
|
||||
: {
|
||||
'current_step': nextStep?.value,
|
||||
@@ -104,7 +109,9 @@ class LabJobsRepository {
|
||||
jobId: jobId,
|
||||
clinicTenantId: job.clinicTenantId,
|
||||
labTenantId: job.labTenantId,
|
||||
action: currentStep.requiresClinicApproval || isFinal
|
||||
action: (currentStep.requiresClinicApproval &&
|
||||
!shouldStayAtLabAfterMeasure) ||
|
||||
isFinal
|
||||
? JobHistoryAction.handedToClinic
|
||||
: JobHistoryAction.stepCompleted,
|
||||
step: currentStep,
|
||||
|
||||
Reference in New Issue
Block a user