new field and enums values for break in shiftrole

This commit is contained in:
José Salazar
2026-02-12 14:54:29 -05:00
parent 4e873fff26
commit 57b63b85ef
7 changed files with 110 additions and 12 deletions

View File

@@ -140,6 +140,7 @@ class ClientCreateOrderRepositoryImpl
.endTime(_toTimestamp(normalizedEnd))
.hours(hours)
.breakType(_breakDurationFromValue(position.lunchBreak))
.isBreakPaid(_isBreakPaid(position.lunchBreak))
.totalValue(totalValue)
.execute());
}
@@ -172,15 +173,25 @@ class ClientCreateOrderRepositoryImpl
dc.BreakDuration _breakDurationFromValue(String value) {
switch (value) {
case 'MIN_10':
return dc.BreakDuration.MIN_10;
case 'MIN_15':
return dc.BreakDuration.MIN_15;
case 'MIN_30':
return dc.BreakDuration.MIN_30;
case 'MIN_45':
return dc.BreakDuration.MIN_45;
case 'MIN_60':
return dc.BreakDuration.MIN_60;
default:
return dc.BreakDuration.NO_BREAK;
}
}
bool _isBreakPaid(String value) {
return value == 'MIN_10' || value == 'MIN_15';
}
DateTime _parseTime(DateTime date, String time) {
if (time.trim().isEmpty) {
throw Exception('Shift time is missing.');

View File

@@ -243,13 +243,24 @@ class OneTimeOrderPositionCard extends StatelessWidget {
onUpdated(position.copyWith(lunchBreak: val));
}
},
items: <String>['NO_BREAK', 'MIN_15', 'MIN_30'].map((
items: <String>[
'NO_BREAK',
'MIN_10',
'MIN_15',
'MIN_30',
'MIN_45',
'MIN_60',
].map((
String value,
) {
final String label = switch (value) {
'NO_BREAK' => 'No Break',
'MIN_15' => '15 min',
_ => '30 min',
'MIN_10' => '10 min (Paid)',
'MIN_15' => '15 min (Paid)',
'MIN_30' => '30 min (Unpaid)',
'MIN_45' => '45 min (Unpaid)',
'MIN_60' => '60 min (Unpaid)',
_ => value,
};
return DropdownMenuItem<String>(
value: value,