Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code revereted for invoice and time tracking #310

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export const DropdownHeader = () => (
/>
</button>
</div>
<div>
{/* <div>
<button className=" mx-3 font-bold text-xs tracking-widest text-miru-han-purple-1000">
CLICK TO ADD MULTIPLE ENTRIES
</button>
</div>
</div> */}
</div>
);
34 changes: 17 additions & 17 deletions app/javascript/src/components/time-tracking/WeeklyEntries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ const WeeklyEntries: React.FC<Props> = ({
}
};

const handleDeleteEntries = async () => {
try {
if (!currentEntries.length) return;
const ids = getIds();
const delRes = await timesheetEntryApi.destroyBulk({ ids: ids });
if (delRes.status === 200) {
const getRes = await timesheetEntryApi.list(dayInfo[0]["fullDate"], dayInfo[6]["fullDate"]);
if (getRes.status === 200) {
const newState = { ...entryList, ...getRes.data.entries };
setEntryList(newState);
}
}
} catch (error) {
Logger.error(error.message);
}
};
// const handleDeleteEntries = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete code, we avoid commenting

// try {
// if (!currentEntries.length) return;
// const ids = getIds();
// const delRes = await timesheetEntryApi.destroyBulk({ ids: ids });
// if (delRes.status === 200) {
// const getRes = await timesheetEntryApi.list(dayInfo[0]["fullDate"], dayInfo[6]["fullDate"]);
// if (getRes.status === 200) {
// const newState = { ...entryList, ...getRes.data.entries };
// setEntryList(newState);
// }
// }
// } catch (error) {
// Logger.error(error.message);
// }
// };

const handleSetData = () => {
if (projectId) {
Expand Down Expand Up @@ -105,7 +105,7 @@ const WeeklyEntries: React.FC<Props> = ({
newRowView={newRowView}
setNewRowView={setNewRowView}
setEntryList={setEntryList}
handleDeleteEntries={handleDeleteEntries}
// handleDeleteEntries={handleDeleteEntries}
handleEditEntries={handleEditEntries}
dayInfo={dayInfo}
isWeeklyEditing={isWeeklyEditing}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const WeeklyEntriesCard = ({
project,
currentEntries,
setProjectSelected,
handleDeleteEntries,
// handleDeleteEntries,
currentProjectId,
setEntryList,
setCurrentEntries,
Expand Down Expand Up @@ -205,12 +205,12 @@ const WeeklyEntriesCard = ({
alt="edit"
className="icon-hover ml-8 cursor-pointer"
/>
<img
{/* <img
onClick={handleDeleteEntries}
src="/delete.svg"
alt="delete"
className="icon-hover ml-8 cursor-pointer"
/>
/> */}
</div>
</div>
{showNote && (
Expand Down Expand Up @@ -307,7 +307,7 @@ interface Iprops {
newRowView: boolean;
setNewRowView: React.Dispatch<React.SetStateAction<boolean>>;
setEntryList: React.Dispatch<React.SetStateAction<[]>>;
handleDeleteEntries: () => any;
// handleDeleteEntries: () => any;
handleEditEntries: () => any;
dayInfo: Array<any>;
isWeeklyEditing: boolean;
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/src/helpers/validateTimesheetEntry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { minutesFromHHMM } from "./hhmm-parser";
// import { minutesFromHHMM } from "./hhmm-parser";

const validateTimesheetEntry = (tse: object) => {
if (tse["duration"] <= 0 || tse["duration"] >= (3600 * 24)) {
Expand Down