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,
|
||||
|
||||
@@ -279,6 +279,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
||||
.endTime(_toTimestamp(normalizedEnd))
|
||||
.hours(hours)
|
||||
.breakType(_breakDurationFromValue(lunchBreak))
|
||||
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||
.totalValue(totalValue)
|
||||
.execute();
|
||||
}
|
||||
@@ -527,10 +528,16 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
||||
final dc.BreakDuration? value =
|
||||
breakType is dc.Known<dc.BreakDuration> ? breakType.value : null;
|
||||
switch (value) {
|
||||
case dc.BreakDuration.MIN_10:
|
||||
return 'MIN_10';
|
||||
case dc.BreakDuration.MIN_15:
|
||||
return 'MIN_15';
|
||||
case dc.BreakDuration.MIN_30:
|
||||
return 'MIN_30';
|
||||
case dc.BreakDuration.MIN_45:
|
||||
return 'MIN_45';
|
||||
case dc.BreakDuration.MIN_60:
|
||||
return 'MIN_60';
|
||||
case dc.BreakDuration.NO_BREAK:
|
||||
case null:
|
||||
return 'NO_BREAK';
|
||||
@@ -539,15 +546,25 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
dc.OrderType _orderTypeFromValue(String? value) {
|
||||
switch (value) {
|
||||
case 'PERMANENT':
|
||||
@@ -1053,15 +1070,28 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
||||
),
|
||||
const SizedBox(height: UiConstants.space1),
|
||||
_buildDropdownField(
|
||||
hint: 'None',
|
||||
hint: 'No Break',
|
||||
value: pos['lunch_break'],
|
||||
items: <String>['NO_BREAK', 'MIN_15', 'MIN_30'],
|
||||
items: <String>[
|
||||
'NO_BREAK',
|
||||
'MIN_10',
|
||||
'MIN_15',
|
||||
'MIN_30',
|
||||
'MIN_45',
|
||||
'MIN_60',
|
||||
],
|
||||
itemBuilder: (dynamic value) {
|
||||
switch (value.toString()) {
|
||||
case 'MIN_10':
|
||||
return '10 min (Paid)';
|
||||
case 'MIN_15':
|
||||
return '15 min';
|
||||
return '15 min (Paid)';
|
||||
case 'MIN_30':
|
||||
return '30 min';
|
||||
return '30 min (Unpaid)';
|
||||
case 'MIN_45':
|
||||
return '45 min (Unpaid)';
|
||||
case 'MIN_60':
|
||||
return '60 min (Unpaid)';
|
||||
default:
|
||||
return 'No Break';
|
||||
}
|
||||
|
||||
@@ -1053,10 +1053,16 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
||||
final dc.BreakDuration? value =
|
||||
breakType is dc.Known<dc.BreakDuration> ? breakType.value : null;
|
||||
switch (value) {
|
||||
case dc.BreakDuration.MIN_10:
|
||||
return 'MIN_10';
|
||||
case dc.BreakDuration.MIN_15:
|
||||
return 'MIN_15';
|
||||
case dc.BreakDuration.MIN_30:
|
||||
return 'MIN_30';
|
||||
case dc.BreakDuration.MIN_45:
|
||||
return 'MIN_45';
|
||||
case dc.BreakDuration.MIN_60:
|
||||
return 'MIN_60';
|
||||
case dc.BreakDuration.NO_BREAK:
|
||||
case null:
|
||||
return 'NO_BREAK';
|
||||
@@ -1065,15 +1071,25 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
_RoleOption? _roleById(String roleId) {
|
||||
for (final _RoleOption role in _roles) {
|
||||
if (role.id == roleId) {
|
||||
@@ -1209,6 +1225,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
||||
.endTime(_toTimestamp(normalizedEnd))
|
||||
.hours(hours)
|
||||
.breakType(_breakDurationFromValue(lunchBreak))
|
||||
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||
.totalValue(totalValue)
|
||||
.execute();
|
||||
} else {
|
||||
@@ -1219,6 +1236,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
||||
.endTime(_toTimestamp(normalizedEnd))
|
||||
.hours(hours)
|
||||
.breakType(_breakDurationFromValue(lunchBreak))
|
||||
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||
.totalValue(totalValue)
|
||||
.execute();
|
||||
}
|
||||
@@ -1233,6 +1251,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
||||
.endTime(_toTimestamp(normalizedEnd))
|
||||
.hours(hours)
|
||||
.breakType(_breakDurationFromValue(lunchBreak))
|
||||
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||
.totalValue(totalValue)
|
||||
.execute();
|
||||
}
|
||||
@@ -1747,17 +1766,30 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
||||
|
||||
_buildSectionHeader('LUNCH BREAK'),
|
||||
_buildDropdownField(
|
||||
hint: 'No break',
|
||||
hint: 'No Break',
|
||||
value: pos['lunch_break'],
|
||||
items: <String>['NO_BREAK', 'MIN_15', 'MIN_30'],
|
||||
items: <String>[
|
||||
'NO_BREAK',
|
||||
'MIN_10',
|
||||
'MIN_15',
|
||||
'MIN_30',
|
||||
'MIN_45',
|
||||
'MIN_60',
|
||||
],
|
||||
itemBuilder: (dynamic val) {
|
||||
switch (val.toString()) {
|
||||
case 'MIN_10':
|
||||
return '10 min (Paid)';
|
||||
case 'MIN_15':
|
||||
return '15 min';
|
||||
return '15 min (Paid)';
|
||||
case 'MIN_30':
|
||||
return '30 min';
|
||||
return '30 min (Unpaid)';
|
||||
case 'MIN_45':
|
||||
return '45 min (Unpaid)';
|
||||
case 'MIN_60':
|
||||
return '60 min (Unpaid)';
|
||||
default:
|
||||
return 'No break';
|
||||
return 'No Break';
|
||||
}
|
||||
},
|
||||
onChanged: (dynamic val) =>
|
||||
|
||||
Reference in New Issue
Block a user