From 4c76d8601e292f3928ea38f54988bac21eda254c Mon Sep 17 00:00:00 2001
From: gca-axelor <117281520+gca-axelor@users.noreply.github.com>
Date: Fri, 9 Feb 2024 11:16:02 +0100
Subject: [PATCH] fix: hide delete button when TimesheetLine is linked to
TSTimer (#395)
* RM#75119
---
.../molecules/TimeDetailCard/TimeDetailCard.tsx | 16 ++++++++++------
packages/apps/hr/src/models/objectFields.ts | 1 +
.../screens/timesheet/TimesheetDetailsScreen.js | 1 +
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/packages/apps/hr/src/components/molecules/TimeDetailCard/TimeDetailCard.tsx b/packages/apps/hr/src/components/molecules/TimeDetailCard/TimeDetailCard.tsx
index 7e54607131..402b99b15a 100644
--- a/packages/apps/hr/src/components/molecules/TimeDetailCard/TimeDetailCard.tsx
+++ b/packages/apps/hr/src/components/molecules/TimeDetailCard/TimeDetailCard.tsx
@@ -33,6 +33,7 @@ interface TimeDetailCardProps {
durationUnit: string;
isSmallCard?: boolean;
isActions?: boolean;
+ showTrash?: boolean;
style?: any;
onEdit?: () => void;
onDelete?: () => void;
@@ -49,6 +50,7 @@ const TimeDetailCard = ({
duration,
durationUnit,
isSmallCard,
+ showTrash = true,
isActions = true,
style,
onEdit = () => {},
@@ -79,12 +81,14 @@ const TimeDetailCard = ({
onPress={onEdit}
style={styles.cardIconButton}
/>
-
+ {showTrash && (
+
+ )}
)}
diff --git a/packages/apps/hr/src/models/objectFields.ts b/packages/apps/hr/src/models/objectFields.ts
index dd49f24d7d..9d98a542de 100644
--- a/packages/apps/hr/src/models/objectFields.ts
+++ b/packages/apps/hr/src/models/objectFields.ts
@@ -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(
diff --git a/packages/apps/hr/src/screens/timesheet/TimesheetDetailsScreen.js b/packages/apps/hr/src/screens/timesheet/TimesheetDetailsScreen.js
index 7eb8564b82..f61ca237f6 100644
--- a/packages/apps/hr/src/screens/timesheet/TimesheetDetailsScreen.js
+++ b/packages/apps/hr/src/screens/timesheet/TimesheetDetailsScreen.js
@@ -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={() =>