new field and enums values for break in shiftrole
This commit is contained in:
@@ -140,6 +140,7 @@ class ClientCreateOrderRepositoryImpl
|
|||||||
.endTime(_toTimestamp(normalizedEnd))
|
.endTime(_toTimestamp(normalizedEnd))
|
||||||
.hours(hours)
|
.hours(hours)
|
||||||
.breakType(_breakDurationFromValue(position.lunchBreak))
|
.breakType(_breakDurationFromValue(position.lunchBreak))
|
||||||
|
.isBreakPaid(_isBreakPaid(position.lunchBreak))
|
||||||
.totalValue(totalValue)
|
.totalValue(totalValue)
|
||||||
.execute());
|
.execute());
|
||||||
}
|
}
|
||||||
@@ -172,15 +173,25 @@ class ClientCreateOrderRepositoryImpl
|
|||||||
|
|
||||||
dc.BreakDuration _breakDurationFromValue(String value) {
|
dc.BreakDuration _breakDurationFromValue(String value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case 'MIN_10':
|
||||||
|
return dc.BreakDuration.MIN_10;
|
||||||
case 'MIN_15':
|
case 'MIN_15':
|
||||||
return dc.BreakDuration.MIN_15;
|
return dc.BreakDuration.MIN_15;
|
||||||
case 'MIN_30':
|
case 'MIN_30':
|
||||||
return dc.BreakDuration.MIN_30;
|
return dc.BreakDuration.MIN_30;
|
||||||
|
case 'MIN_45':
|
||||||
|
return dc.BreakDuration.MIN_45;
|
||||||
|
case 'MIN_60':
|
||||||
|
return dc.BreakDuration.MIN_60;
|
||||||
default:
|
default:
|
||||||
return dc.BreakDuration.NO_BREAK;
|
return dc.BreakDuration.NO_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isBreakPaid(String value) {
|
||||||
|
return value == 'MIN_10' || value == 'MIN_15';
|
||||||
|
}
|
||||||
|
|
||||||
DateTime _parseTime(DateTime date, String time) {
|
DateTime _parseTime(DateTime date, String time) {
|
||||||
if (time.trim().isEmpty) {
|
if (time.trim().isEmpty) {
|
||||||
throw Exception('Shift time is missing.');
|
throw Exception('Shift time is missing.');
|
||||||
|
|||||||
@@ -243,13 +243,24 @@ class OneTimeOrderPositionCard extends StatelessWidget {
|
|||||||
onUpdated(position.copyWith(lunchBreak: val));
|
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,
|
String value,
|
||||||
) {
|
) {
|
||||||
final String label = switch (value) {
|
final String label = switch (value) {
|
||||||
'NO_BREAK' => 'No Break',
|
'NO_BREAK' => 'No Break',
|
||||||
'MIN_15' => '15 min',
|
'MIN_10' => '10 min (Paid)',
|
||||||
_ => '30 min',
|
'MIN_15' => '15 min (Paid)',
|
||||||
|
'MIN_30' => '30 min (Unpaid)',
|
||||||
|
'MIN_45' => '45 min (Unpaid)',
|
||||||
|
'MIN_60' => '60 min (Unpaid)',
|
||||||
|
_ => value,
|
||||||
};
|
};
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
value: value,
|
value: value,
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
|||||||
.endTime(_toTimestamp(normalizedEnd))
|
.endTime(_toTimestamp(normalizedEnd))
|
||||||
.hours(hours)
|
.hours(hours)
|
||||||
.breakType(_breakDurationFromValue(lunchBreak))
|
.breakType(_breakDurationFromValue(lunchBreak))
|
||||||
|
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||||
.totalValue(totalValue)
|
.totalValue(totalValue)
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -527,10 +528,16 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
|||||||
final dc.BreakDuration? value =
|
final dc.BreakDuration? value =
|
||||||
breakType is dc.Known<dc.BreakDuration> ? breakType.value : null;
|
breakType is dc.Known<dc.BreakDuration> ? breakType.value : null;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case dc.BreakDuration.MIN_10:
|
||||||
|
return 'MIN_10';
|
||||||
case dc.BreakDuration.MIN_15:
|
case dc.BreakDuration.MIN_15:
|
||||||
return 'MIN_15';
|
return 'MIN_15';
|
||||||
case dc.BreakDuration.MIN_30:
|
case dc.BreakDuration.MIN_30:
|
||||||
return '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 dc.BreakDuration.NO_BREAK:
|
||||||
case null:
|
case null:
|
||||||
return 'NO_BREAK';
|
return 'NO_BREAK';
|
||||||
@@ -539,15 +546,25 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
|||||||
|
|
||||||
dc.BreakDuration _breakDurationFromValue(String value) {
|
dc.BreakDuration _breakDurationFromValue(String value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case 'MIN_10':
|
||||||
|
return dc.BreakDuration.MIN_10;
|
||||||
case 'MIN_15':
|
case 'MIN_15':
|
||||||
return dc.BreakDuration.MIN_15;
|
return dc.BreakDuration.MIN_15;
|
||||||
case 'MIN_30':
|
case 'MIN_30':
|
||||||
return dc.BreakDuration.MIN_30;
|
return dc.BreakDuration.MIN_30;
|
||||||
|
case 'MIN_45':
|
||||||
|
return dc.BreakDuration.MIN_45;
|
||||||
|
case 'MIN_60':
|
||||||
|
return dc.BreakDuration.MIN_60;
|
||||||
default:
|
default:
|
||||||
return dc.BreakDuration.NO_BREAK;
|
return dc.BreakDuration.NO_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isBreakPaid(String value) {
|
||||||
|
return value == 'MIN_10' || value == 'MIN_15';
|
||||||
|
}
|
||||||
|
|
||||||
dc.OrderType _orderTypeFromValue(String? value) {
|
dc.OrderType _orderTypeFromValue(String? value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 'PERMANENT':
|
case 'PERMANENT':
|
||||||
@@ -1053,15 +1070,28 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: UiConstants.space1),
|
const SizedBox(height: UiConstants.space1),
|
||||||
_buildDropdownField(
|
_buildDropdownField(
|
||||||
hint: 'None',
|
hint: 'No Break',
|
||||||
value: pos['lunch_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) {
|
itemBuilder: (dynamic value) {
|
||||||
switch (value.toString()) {
|
switch (value.toString()) {
|
||||||
|
case 'MIN_10':
|
||||||
|
return '10 min (Paid)';
|
||||||
case 'MIN_15':
|
case 'MIN_15':
|
||||||
return '15 min';
|
return '15 min (Paid)';
|
||||||
case 'MIN_30':
|
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:
|
default:
|
||||||
return 'No Break';
|
return 'No Break';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1053,10 +1053,16 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
|||||||
final dc.BreakDuration? value =
|
final dc.BreakDuration? value =
|
||||||
breakType is dc.Known<dc.BreakDuration> ? breakType.value : null;
|
breakType is dc.Known<dc.BreakDuration> ? breakType.value : null;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case dc.BreakDuration.MIN_10:
|
||||||
|
return 'MIN_10';
|
||||||
case dc.BreakDuration.MIN_15:
|
case dc.BreakDuration.MIN_15:
|
||||||
return 'MIN_15';
|
return 'MIN_15';
|
||||||
case dc.BreakDuration.MIN_30:
|
case dc.BreakDuration.MIN_30:
|
||||||
return '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 dc.BreakDuration.NO_BREAK:
|
||||||
case null:
|
case null:
|
||||||
return 'NO_BREAK';
|
return 'NO_BREAK';
|
||||||
@@ -1065,15 +1071,25 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
|||||||
|
|
||||||
dc.BreakDuration _breakDurationFromValue(String value) {
|
dc.BreakDuration _breakDurationFromValue(String value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
case 'MIN_10':
|
||||||
|
return dc.BreakDuration.MIN_10;
|
||||||
case 'MIN_15':
|
case 'MIN_15':
|
||||||
return dc.BreakDuration.MIN_15;
|
return dc.BreakDuration.MIN_15;
|
||||||
case 'MIN_30':
|
case 'MIN_30':
|
||||||
return dc.BreakDuration.MIN_30;
|
return dc.BreakDuration.MIN_30;
|
||||||
|
case 'MIN_45':
|
||||||
|
return dc.BreakDuration.MIN_45;
|
||||||
|
case 'MIN_60':
|
||||||
|
return dc.BreakDuration.MIN_60;
|
||||||
default:
|
default:
|
||||||
return dc.BreakDuration.NO_BREAK;
|
return dc.BreakDuration.NO_BREAK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _isBreakPaid(String value) {
|
||||||
|
return value == 'MIN_10' || value == 'MIN_15';
|
||||||
|
}
|
||||||
|
|
||||||
_RoleOption? _roleById(String roleId) {
|
_RoleOption? _roleById(String roleId) {
|
||||||
for (final _RoleOption role in _roles) {
|
for (final _RoleOption role in _roles) {
|
||||||
if (role.id == roleId) {
|
if (role.id == roleId) {
|
||||||
@@ -1209,6 +1225,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
|||||||
.endTime(_toTimestamp(normalizedEnd))
|
.endTime(_toTimestamp(normalizedEnd))
|
||||||
.hours(hours)
|
.hours(hours)
|
||||||
.breakType(_breakDurationFromValue(lunchBreak))
|
.breakType(_breakDurationFromValue(lunchBreak))
|
||||||
|
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||||
.totalValue(totalValue)
|
.totalValue(totalValue)
|
||||||
.execute();
|
.execute();
|
||||||
} else {
|
} else {
|
||||||
@@ -1219,6 +1236,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
|||||||
.endTime(_toTimestamp(normalizedEnd))
|
.endTime(_toTimestamp(normalizedEnd))
|
||||||
.hours(hours)
|
.hours(hours)
|
||||||
.breakType(_breakDurationFromValue(lunchBreak))
|
.breakType(_breakDurationFromValue(lunchBreak))
|
||||||
|
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||||
.totalValue(totalValue)
|
.totalValue(totalValue)
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -1233,6 +1251,7 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
|||||||
.endTime(_toTimestamp(normalizedEnd))
|
.endTime(_toTimestamp(normalizedEnd))
|
||||||
.hours(hours)
|
.hours(hours)
|
||||||
.breakType(_breakDurationFromValue(lunchBreak))
|
.breakType(_breakDurationFromValue(lunchBreak))
|
||||||
|
.isBreakPaid(_isBreakPaid(lunchBreak))
|
||||||
.totalValue(totalValue)
|
.totalValue(totalValue)
|
||||||
.execute();
|
.execute();
|
||||||
}
|
}
|
||||||
@@ -1747,17 +1766,30 @@ class _OrderEditSheetState extends State<_OrderEditSheet> {
|
|||||||
|
|
||||||
_buildSectionHeader('LUNCH BREAK'),
|
_buildSectionHeader('LUNCH BREAK'),
|
||||||
_buildDropdownField(
|
_buildDropdownField(
|
||||||
hint: 'No break',
|
hint: 'No Break',
|
||||||
value: pos['lunch_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) {
|
itemBuilder: (dynamic val) {
|
||||||
switch (val.toString()) {
|
switch (val.toString()) {
|
||||||
|
case 'MIN_10':
|
||||||
|
return '10 min (Paid)';
|
||||||
case 'MIN_15':
|
case 'MIN_15':
|
||||||
return '15 min';
|
return '15 min (Paid)';
|
||||||
case 'MIN_30':
|
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:
|
default:
|
||||||
return 'No break';
|
return 'No Break';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChanged: (dynamic val) =>
|
onChanged: (dynamic val) =>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ mutation createShiftRole(
|
|||||||
$department: String
|
$department: String
|
||||||
$uniform: String
|
$uniform: String
|
||||||
$breakType: BreakDuration
|
$breakType: BreakDuration
|
||||||
|
$isBreakPaid: Boolean
|
||||||
$totalValue: Float
|
$totalValue: Float
|
||||||
) @auth(level: USER) {
|
) @auth(level: USER) {
|
||||||
shiftRole_insert(
|
shiftRole_insert(
|
||||||
@@ -23,6 +24,7 @@ mutation createShiftRole(
|
|||||||
department: $department
|
department: $department
|
||||||
uniform: $uniform
|
uniform: $uniform
|
||||||
breakType: $breakType
|
breakType: $breakType
|
||||||
|
isBreakPaid: $isBreakPaid
|
||||||
totalValue: $totalValue
|
totalValue: $totalValue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -39,6 +41,7 @@ mutation updateShiftRole(
|
|||||||
$department: String
|
$department: String
|
||||||
$uniform: String
|
$uniform: String
|
||||||
$breakType: BreakDuration
|
$breakType: BreakDuration
|
||||||
|
$isBreakPaid: Boolean
|
||||||
$totalValue: Float
|
$totalValue: Float
|
||||||
) @auth(level: USER) {
|
) @auth(level: USER) {
|
||||||
shiftRole_update(
|
shiftRole_update(
|
||||||
@@ -52,6 +55,7 @@ mutation updateShiftRole(
|
|||||||
department: $department
|
department: $department
|
||||||
uniform: $uniform
|
uniform: $uniform
|
||||||
breakType: $breakType
|
breakType: $breakType
|
||||||
|
isBreakPaid: $isBreakPaid
|
||||||
totalValue: $totalValue
|
totalValue: $totalValue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ query getShiftRoleById(
|
|||||||
department
|
department
|
||||||
uniform
|
uniform
|
||||||
breakType
|
breakType
|
||||||
|
isBreakPaid
|
||||||
totalValue
|
totalValue
|
||||||
createdAt
|
createdAt
|
||||||
|
|
||||||
@@ -76,6 +77,7 @@ query listShiftRolesByShiftId(
|
|||||||
department
|
department
|
||||||
uniform
|
uniform
|
||||||
breakType
|
breakType
|
||||||
|
isBreakPaid
|
||||||
totalValue
|
totalValue
|
||||||
createdAt
|
createdAt
|
||||||
|
|
||||||
@@ -132,6 +134,7 @@ query listShiftRolesByRoleId(
|
|||||||
department
|
department
|
||||||
uniform
|
uniform
|
||||||
breakType
|
breakType
|
||||||
|
isBreakPaid
|
||||||
totalValue
|
totalValue
|
||||||
createdAt
|
createdAt
|
||||||
|
|
||||||
@@ -195,6 +198,7 @@ query listShiftRolesByShiftIdAndTimeRange(
|
|||||||
department
|
department
|
||||||
uniform
|
uniform
|
||||||
breakType
|
breakType
|
||||||
|
isBreakPaid
|
||||||
totalValue
|
totalValue
|
||||||
createdAt
|
createdAt
|
||||||
|
|
||||||
@@ -263,6 +267,7 @@ query listShiftRolesByVendorId(
|
|||||||
department
|
department
|
||||||
uniform
|
uniform
|
||||||
breakType
|
breakType
|
||||||
|
isBreakPaid
|
||||||
totalValue
|
totalValue
|
||||||
createdAt
|
createdAt
|
||||||
|
|
||||||
@@ -371,6 +376,7 @@ query listShiftRolesByBusinessAndOrder(
|
|||||||
endTime
|
endTime
|
||||||
hours
|
hours
|
||||||
breakType
|
breakType
|
||||||
|
isBreakPaid
|
||||||
totalValue
|
totalValue
|
||||||
createdAt
|
createdAt
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
enum BreakDuration {
|
enum BreakDuration {
|
||||||
|
MIN_10
|
||||||
MIN_15
|
MIN_15
|
||||||
MIN_30
|
MIN_30
|
||||||
|
MIN_45
|
||||||
|
MIN_60
|
||||||
NO_BREAK
|
NO_BREAK
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +28,7 @@ type ShiftRole @table(name: "shift_roles", key: ["shiftId", "roleId"]) {
|
|||||||
department: String
|
department: String
|
||||||
uniform: String
|
uniform: String
|
||||||
breakType: BreakDuration
|
breakType: BreakDuration
|
||||||
|
isBreakPaid: Boolean @default(expr: "false")
|
||||||
totalValue: Float
|
totalValue: Float
|
||||||
|
|
||||||
createdAt: Timestamp @default(expr: "request.time")
|
createdAt: Timestamp @default(expr: "request.time")
|
||||||
|
|||||||
Reference in New Issue
Block a user