Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
6ee0d94
added width and height properties in tailwind config
onkar-saeloun Jun 28, 2022
257b12e
added reports routes
onkar-saeloun Jun 28, 2022
47ca435
added route conf
onkar-saeloun Jun 28, 2022
8852195
added reports header
onkar-saeloun Jun 28, 2022
8ea07b8
added outstanding amt page
onkar-saeloun Jun 28, 2022
8baba00
added report card component
onkar-saeloun Jun 28, 2022
acfc59f
added report card
onkar-saeloun Jun 28, 2022
0799ffe
added revenue by client page
onkar-saeloun Jun 28, 2022
138c340
added time entry page
onkar-saeloun Jun 28, 2022
720b20e
added total hours logged page
onkar-saeloun Jun 28, 2022
2a1cec0
added routes path for reports
onkar-saeloun Jun 28, 2022
8b780a0
added svgs for report list page
onkar-saeloun Jun 28, 2022
e0ab0aa
added route in navbar
onkar-saeloun Jun 28, 2022
7be19b1
resolved conflicts
onkar-saeloun Jun 28, 2022
70d9c51
Merge branch 'develop' of github.com:saeloun/miru-web into feature/re…
onkar-saeloun Jun 28, 2022
e5589b8
added flag to show the report in list
onkar-saeloun Jun 28, 2022
d093c3a
resolved comment
onkar-saeloun Jun 28, 2022
955d79c
resolved conflict
onkar-saeloun Jun 28, 2022
19013f7
Merge branch 'develop' of github.com:saeloun/miru-web into feature/re…
onkar-saeloun Jun 29, 2022
522e22d
added total header page
onkar-saeloun Jul 1, 2022
3892dde
changed time enty import
onkar-saeloun Jul 1, 2022
cda097f
changed entry context
onkar-saeloun Jul 1, 2022
3f5eeda
added z index
onkar-saeloun Jul 1, 2022
1fbb9b2
added revenue by client context
onkar-saeloun Jul 1, 2022
5de5d14
added time entry context
onkar-saeloun Jul 1, 2022
c909122
added time entry context import
onkar-saeloun Jul 1, 2022
9b1b357
added time entry context
onkar-saeloun Jul 1, 2022
9d286ce
added navigation changes
onkar-saeloun Jul 1, 2022
d93b647
added revenue by client page
onkar-saeloun Jul 1, 2022
1a4d2fa
added header
onkar-saeloun Jul 1, 2022
3407d15
added table
onkar-saeloun Jul 1, 2022
4ee7829
added filter
onkar-saeloun Jul 1, 2022
b98a3ad
added styles
onkar-saeloun Jul 1, 2022
7200e61
added time entry context
onkar-saeloun Jul 1, 2022
5f942e1
added changes in date util
onkar-saeloun Jul 1, 2022
ff52f85
added css
onkar-saeloun Jul 1, 2022
b4d8893
added filter
onkar-saeloun Jul 1, 2022
a3bb8c6
added custom date rage
onkar-saeloun Jul 1, 2022
4d15cd4
Merge branch 'develop' of github.com:saeloun/miru-web into feature/re…
onkar-saeloun Jul 1, 2022
4ebefec
added filter counter
onkar-saeloun Jul 1, 2022
18acb0a
added filte rrelated changes
onkar-saeloun Jul 1, 2022
f0776c8
added interface
onkar-saeloun Jul 1, 2022
7cd0431
added css changes
onkar-saeloun Jul 1, 2022
46fcb40
added css changes
onkar-saeloun Jul 1, 2022
2f0bff8
added API for client revenue report
onkar-saeloun Jul 5, 2022
1ecc95e
added API for fetching result
onkar-saeloun Jul 5, 2022
87351b3
added filter
onkar-saeloun Jul 5, 2022
4f27d2d
added common function
onkar-saeloun Jul 5, 2022
aae7950
imported common function
onkar-saeloun Jul 5, 2022
42e9e30
added common function
onkar-saeloun Jul 5, 2022
7f63edb
enabled revenue report
onkar-saeloun Jul 5, 2022
001bdf0
added defaul filters
onkar-saeloun Jul 5, 2022
63925f3
renamed interface
onkar-saeloun Jul 5, 2022
2436726
added dynamic values
onkar-saeloun Jul 5, 2022
6569a16
added table row
onkar-saeloun Jul 5, 2022
ac26d96
resolved conflict
onkar-saeloun Jul 5, 2022
f5c1a87
Merge branch 'develop' of github.com:saeloun/miru-web into feature/ap…
onkar-saeloun Jul 6, 2022
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
9 changes: 9 additions & 0 deletions app/javascript/src/apis/reports/clientRevenue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import axios from "axios";

const path = "/reports/client_revenues/";

const get = () => axios.get(`${path}`);

const reports = { get };

export default reports;
13 changes: 2 additions & 11 deletions app/javascript/src/components/Reports/Header/NavigationFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import React, { Fragment } from "react";
import { X } from "phosphor-react";
import { getReports } from "./fetchReport";
import { useEntry } from "../context/EntryContext";

const NavigationFilter = () => {
const { revenueByClientReport, currentReport, timeEntryReport } = useEntry();
const getReport = (currentReport) => {
switch (currentReport) {
case "RevenueByClientReport":
return revenueByClientReport;
case "TimeEntryReport":
return timeEntryReport;
default:
break;
}
};

const selectedReport = getReport(currentReport);
const selectedReport = getReports({ currentReport, timeEntryReport, revenueByClientReport });

const filterHtml = (value, key, filterKey) => (
<li key={key} className="flex px-2 mr-4 py-1 rounded-xl tracking-widest font-semibold px-1 text-xs tracking-widest bg-miru-gray-400 text-miru-dark-purple-1000">
Expand Down
10 changes: 10 additions & 0 deletions app/javascript/src/components/Reports/Header/fetchReport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export const getReports = ({ currentReport, timeEntryReport, revenueByClientReport }) => {
switch (currentReport) {
case "RevenueByClientReport":
return revenueByClientReport;
case "TimeEntryReport":
return timeEntryReport;
default:
break;
}
};
13 changes: 2 additions & 11 deletions app/javascript/src/components/Reports/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Share,
X
} from "phosphor-react";
import { getReports } from "./fetchReport";
import NavigationFilter from "./NavigationFilter";
import { useEntry } from "../context/EntryContext";

Expand All @@ -25,18 +26,8 @@ const Header = ({
type
}) => {
const { timeEntryReport, revenueByClientReport, currentReport } = useEntry();
const getReport = (currentReport) => {
switch (currentReport) {
case "RevenueByClientReport":
return revenueByClientReport;
case "TimeEntryReport":
return timeEntryReport;
default:
break;
}
};

const selectedReport = getReport(currentReport);
const selectedReport = getReports({ currentReport, timeEntryReport, revenueByClientReport });

const [showExportOptions, setShowExportOptions] = useState<boolean>(false);

Expand Down
14 changes: 14 additions & 0 deletions app/javascript/src/components/Reports/api/revenueByClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import reports from "apis/reports/clientRevenue";

const getReportData = async ({ selectedFilter, setClientList, setNavFilters, setFilterVisibilty, setSummary, setCurrency }) => {

const res = await reports.get();
setClientList(res.data.clients);
setCurrency(res.data.currency);
setSummary(res.data.summary);
setNavFilters(true);
setFilterVisibilty(false);
};

export default getReportData;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ const RevenueByClientReportContext = {
to: ""
},
filterCounter: 0,
handleRemoveSingleFilter: (key, value) => { }, //eslint-disable-line
clientList: [],
currency: "",
summary: {
totalPaidAmount: 0,
totalUnpaidAmount: 0,
totalRevenue: 0
},
handleRemoveSingleFilter: (key, value) => { }, //eslint-disable-line
};

export default RevenueByClientReportContext;
2 changes: 1 addition & 1 deletion app/javascript/src/components/Reports/reportList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const listDetails = [{
title: "Revenue by client",
description: "A detailed report of revenue from each client.",
url: "revenue-by-client",
show: false
show: true
}];

const ReportsList = () => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { RevenueByClients } from "../interface";
const TableRow = ({
id,
name,
unpaidAmt,
paidAmt,
total
unpaidAmount,
paidAmount,
totalAmount
}: RevenueByClients) => (

<tr key={id} className="flex flex-row items-center">
Expand All @@ -17,15 +17,15 @@ const TableRow = ({
</p>
</td>
<td className="w-2/5 px-6 py-4 text-left text-base font-normal text-miru-dark-purple-1000 whitespace-pre-wrap">
{unpaidAmt}
{unpaidAmount}
</td>
<td className="w-1/5 px-6 py-4 text-left whitespace-nowrap">
<p className="font-normal text-base text-miru-dark-purple-1000">
{paidAmt}
{paidAmount}
</p>
</td>
<td className="w-1/5 pl-6 py-4 text-xl text-right whitespace-nowrap font-bold text-miru-dark-purple-1000">
{total}
{totalAmount}
</td>
</tr>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, { Fragment } from "react";
import TotalHeader from "common/TotalHeader";
import { useEntry } from "components/Reports/context/EntryContext";
import { cashFormatter } from "helpers/cashFormater";
import { currencySymbol } from "helpers/currencySymbol";
import TableRow from "./TableRow";

const TableHeader = () => (
Expand Down Expand Up @@ -34,42 +37,34 @@ const TableHeader = () => (
);

const Container = () => {
const dumRep = [{
"name": "Neflix",
"unpaidAmt": "$446.41",
"paidAmt": "$60113",
"total": "$655.29"
}];
const { revenueByClientReport } = useEntry();

const getEntryList = (entries) =>
entries.map((timeEntry, index) => (
<TableRow key={`${timeEntry.client}-${index}`} {...timeEntry} />
));
const currencySymb = currencySymbol(revenueByClientReport.currency);

return (
<Fragment>
<TotalHeader
firstTitle={"TOTAL UNPAID AMOUNT"}
firstAmount={"$35.5K"}
firstAmount={`${currencySymb}${cashFormatter(revenueByClientReport.summary.totalUnpaidAmount)}`}
secondTitle={"TOTAL PAID AMOUNT"}
secondAmount={"$35.5K"}
secondAmount={`${currencySymb}${cashFormatter(revenueByClientReport.summary.totalPaidAmount)}`}
thirdTitle={"TOTAL REVENUE"}
thirdAmount={"$71.0K"}
thirdAmount={`${currencySymb}${cashFormatter(revenueByClientReport.summary.totalRevenue)}`}
/>
<div>
</div>
{
dumRep.map((report, index) => (
<Fragment key={index}>
<table className="min-w-full divide-y divide-gray-200 mt-4">
<TableHeader />
<tbody className="bg-white divide-y divide-gray-200">
{dumRep.length > 0 && getEntryList(dumRep)}
</tbody>
</table>
</Fragment>
))
}
<table className="min-w-full divide-y divide-gray-200 mt-4">
<TableHeader />
<tbody className="bg-white divide-y divide-gray-200">
{
revenueByClientReport.clientList.map((report, index) => (
<Fragment key={index}>
<TableRow key={"index"} {...report} />
</Fragment>
))
}
</tbody>
</table>
</Fragment>
);
};
Expand Down
25 changes: 17 additions & 8 deletions app/javascript/src/components/Reports/revenueByClient/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { sendGAPageView } from "utils/googleAnalytics";
import Container from "./Container";

import Filters from "./Filters";
import { getQuarter } from "./Filters/filterOptions";
import { RevenueByClients } from "./interface";
import getReportData from "../api/revenueByClient";
import EntryContext from "../context/EntryContext";

import TimeEntryReportContext from "../context/TimeEntryReportContext";
import Header from "../Header";

const RevenueByClientReport = () => {

const filterIntialValues = {
dateRange: { label: getQuarter(true), value: "this_quarter" },
clients: []
dateRange: { label: "All", value: "" },
clients: [{ label: "All Clients", value: "" }]
};

const [filterOptions, getFilterOptions] = useState({ clients: [] }); //eslint-disable-line
Expand All @@ -25,6 +25,13 @@ const RevenueByClientReport = () => {
const [filterCounter, setFilterCounter] = useState(0);
const [dateRange, setDateRange] = useState({ from: "", to: "" });
const [selectedInput, setSelectedInput] = useState("from-input");
const [clientList, setClientList] = useState<Array<RevenueByClients>>([]);
const [currency, setCurrency] = useState("");
const [summary, setSummary] = useState({
totalPaidAmount: 0,
totalUnpaidAmount: 0,
totalRevenue: 0
});

useEffect(() => {
sendGAPageView();
Expand Down Expand Up @@ -62,28 +69,30 @@ const RevenueByClientReport = () => {

useEffect(() => {
updateFilterCounter();
setNavFilters(true);
setFilterVisibilty(false);
getReportData({ selectedFilter, setClientList, setNavFilters, setFilterVisibilty, setSummary, setCurrency });
}, [selectedFilter]);

const contextValues = {
timeEntryReport: TimeEntryReportContext,
revenueByClientReport: {
filterOptions: {
clients: [{ label: "Microsoft", value: 1 }, { label: "Flipkart", value: 2 }]
clients: [{ label: "All Clients", value: "" }]
},
selectedFilter: selectedFilter,
customDateFilter: {
from: dateRange.from,
to: dateRange.to
},
filterCounter: filterCounter,
clientList: clientList,
handleRemoveSingleFilter: handleRemoveSingleFilter, //eslint-disable-line
currency: currency,
summary: summary
},
currentReport: "RevenueByClientReport"
};

const handleApplyFilter = async (filters) => {
const handleApplyFilter = (filters) => {
setSelectedFilter(filters);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export interface RevenueByClients {
id: number;
name: string,
unpaidAmt: string,
paidAmt: string,
total: string,
unpaidAmount: string,
paidAmount: string,
totalAmount: string,
}