Skip to content

Commit

Permalink
fix: hide delete button when TimesheetLine is linked to TSTimer (#395)
Browse files Browse the repository at this point in the history
* RM#75119
  • Loading branch information
gca-axelor authored and lme-axelor committed Feb 14, 2024
1 parent 75daf0b commit 4c76d86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface TimeDetailCardProps {
durationUnit: string;
isSmallCard?: boolean;
isActions?: boolean;
showTrash?: boolean;
style?: any;
onEdit?: () => void;
onDelete?: () => void;
Expand All @@ -49,6 +50,7 @@ const TimeDetailCard = ({
duration,
durationUnit,
isSmallCard,
showTrash = true,
isActions = true,
style,
onEdit = () => {},
Expand Down Expand Up @@ -79,12 +81,14 @@ const TimeDetailCard = ({
onPress={onEdit}
style={styles.cardIconButton}
/>
<CardIconButton
iconName={'trash3-fill'}
iconColor={Colors.errorColor.background}
onPress={onDelete}
style={styles.cardIconButton}
/>
{showTrash && (
<CardIconButton
iconName={'trash3-fill'}
iconColor={Colors.errorColor.background}
onPress={onDelete}
style={styles.cardIconButton}
/>
)}
</View>
)}
</View>
Expand Down
1 change: 1 addition & 0 deletions packages/apps/hr/src/models/objectFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export const hr_modelAPI: ObjectFields = {
date: schemaContructor.string(),
duration: schemaContructor.number(),
hoursDuration: schemaContructor.number(),
timer: schemaContructor.subObject(),
}),
auth_user: schemaContructor.object({
employee: schemaContructor.subObject().concat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const TimesheetDetailsScreen = ({navigation, route}) => {
comments={item.comments}
date={item.date}
duration={item.duration}
showTrash={item.timer == null}
durationUnit={timesheet.timeLoggingPreferenceSelect}
isActions={_statusSelect === Timesheet.statusSelect.Draft}
onEdit={() =>
Expand Down

0 comments on commit 4c76d86

Please sign in to comment.