new field and enums values for break in shiftrole
This commit is contained in:
@@ -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.');
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user