-
Notifications
You must be signed in to change notification settings - Fork 88
Revenue by clients report page UI and common context for all reports. #537
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
Merged
Merged
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
6ee0d94
added width and height properties in tailwind config
onkar-saeloun 257b12e
added reports routes
onkar-saeloun 47ca435
added route conf
onkar-saeloun 8852195
added reports header
onkar-saeloun 8ea07b8
added outstanding amt page
onkar-saeloun 8baba00
added report card component
onkar-saeloun acfc59f
added report card
onkar-saeloun 0799ffe
added revenue by client page
onkar-saeloun 138c340
added time entry page
onkar-saeloun 720b20e
added total hours logged page
onkar-saeloun 2a1cec0
added routes path for reports
onkar-saeloun 8b780a0
added svgs for report list page
onkar-saeloun e0ab0aa
added route in navbar
onkar-saeloun 7be19b1
resolved conflicts
onkar-saeloun 70d9c51
Merge branch 'develop' of github.com:saeloun/miru-web into feature/re…
onkar-saeloun e5589b8
added flag to show the report in list
onkar-saeloun d093c3a
resolved comment
onkar-saeloun 955d79c
resolved conflict
onkar-saeloun 19013f7
Merge branch 'develop' of github.com:saeloun/miru-web into feature/re…
onkar-saeloun 522e22d
added total header page
onkar-saeloun 3892dde
changed time enty import
onkar-saeloun cda097f
changed entry context
onkar-saeloun 3f5eeda
added z index
onkar-saeloun 1fbb9b2
added revenue by client context
onkar-saeloun 5de5d14
added time entry context
onkar-saeloun c909122
added time entry context import
onkar-saeloun 9b1b357
added time entry context
onkar-saeloun 9d286ce
added navigation changes
onkar-saeloun d93b647
added revenue by client page
onkar-saeloun 1a4d2fa
added header
onkar-saeloun 3407d15
added table
onkar-saeloun 4ee7829
added filter
onkar-saeloun b98a3ad
added styles
onkar-saeloun 7200e61
added time entry context
onkar-saeloun 5f942e1
added changes in date util
onkar-saeloun ff52f85
added css
onkar-saeloun b4d8893
added filter
onkar-saeloun a3bb8c6
added custom date rage
onkar-saeloun 4d15cd4
Merge branch 'develop' of github.com:saeloun/miru-web into feature/re…
onkar-saeloun 4ebefec
added filter counter
onkar-saeloun 18acb0a
added filte rrelated changes
onkar-saeloun f0776c8
added interface
onkar-saeloun 7cd0431
added css changes
onkar-saeloun 46fcb40
added css changes
onkar-saeloun b8d9970
resolved comments
onkar-saeloun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
127 changes: 127 additions & 0 deletions
127
app/javascript/src/common/CustomDateRangePicker/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /* eslint-disable import/order */ | ||
| import React, { useEffect, useRef } from "react"; | ||
| import DatePicker from "react-datepicker"; | ||
| import { getMonth, getYear } from "date-fns"; | ||
| import dayjs from "dayjs"; | ||
| import "react-datepicker/dist/react-datepicker.css"; | ||
| import { CaretCircleLeft, CaretCircleRight, CaretLeft } from "phosphor-react"; //eslint-disable-line | ||
|
|
||
| const CustomDateRangePicker = ({ | ||
| hideCustomFilter, | ||
| handleSelectDate, | ||
| onClickInput, | ||
| selectedInput, | ||
| dateRange | ||
| }) => { | ||
| const fromInput = "from-input"; | ||
| const toInput = "to-input"; | ||
|
|
||
| const range = (start, end) => Array.from({ length: (end - start) }, (v, k) => k + start); | ||
|
|
||
| const years = range(1990, getYear(new Date()) + 1); | ||
| const months = [ | ||
| "Jan", | ||
| "Feb", | ||
| "Mar", | ||
| "Apr", | ||
| "May", | ||
| "Jun", | ||
| "Jul", | ||
| "Aug", | ||
| "Sep", | ||
| "Oct", | ||
| "Nov", | ||
| "Dec" | ||
| ]; | ||
|
|
||
| const textInput = useRef(null); | ||
| useEffect(() => { | ||
| textInput.current.focus(); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <DatePicker | ||
| wrapperClassName="datePicker absolute" | ||
| inline | ||
| calendarClassName="miru-calendar-date-range" | ||
| minDate={(selectedInput === toInput && dateRange.from) ? new Date(dateRange.from) : null} | ||
| maxDate={(selectedInput === fromInput && dateRange.to) ? new Date(dateRange.to) : null} | ||
| renderCustomHeader={({ | ||
| date, | ||
| changeYear, | ||
| changeMonth, | ||
| decreaseMonth, | ||
| increaseMonth, | ||
| prevMonthButtonDisabled, | ||
| nextMonthButtonDisabled | ||
| }) => ( | ||
| <div className="bg-miru-white-1000 "> | ||
| <div className="flex justify-start mt-2"> | ||
| <button onClick={hideCustomFilter}> | ||
| <CaretLeft color="#5b34ea" size={10} /> | ||
| </button> | ||
| <p className="text-sm font-medium ml-2"> Custom Date Range </p> | ||
| </div> | ||
| <div className="flex flex-row mt-4"> | ||
| <input | ||
| type={"text"} | ||
| placeholder={" From "} | ||
| value={dateRange.from ? dayjs(dateRange.from).format("DD MMM YYYY") : null} | ||
| ref={textInput} | ||
| className={`bg-miru-gray-100 h-8 w-32 mr-1 rounded p-1 ${selectedInput === fromInput && "border-2 border-miru-han-purple-1000"}`} | ||
| onClick={onClickInput} | ||
| id={fromInput} | ||
| name={fromInput} | ||
| /> | ||
| <input | ||
| type={"text"} | ||
| placeholder={" To "} | ||
| value={dateRange.to ? dayjs(dateRange.to).format("DD MMM YYYY") : null} | ||
| className={`bg-miru-gray-100 h-8 w-32 ml-1 rounded p-1 ${selectedInput === toInput && "border-2 border-miru-han-purple-1000"}`} | ||
| onClick={onClickInput} | ||
| id={toInput} | ||
| name={toInput} | ||
| /> | ||
| </div> | ||
| <div | ||
| className="headerWrapper mt-4" | ||
| > | ||
| <button onClick={decreaseMonth} disabled={prevMonthButtonDisabled}> | ||
| <CaretCircleLeft color="#5b34ea" size={16} /> | ||
| </button> | ||
| <div> | ||
| <select | ||
| value={months[getMonth(date)]} | ||
| onChange={({ target: { value } }) => | ||
| changeMonth(months.indexOf(value)) | ||
| } | ||
| > | ||
| {months.map((option) => ( | ||
| <option key={option} value={option}> | ||
| {option} | ||
| </option> | ||
| ))} | ||
| </select> | ||
| <select | ||
| value={getYear(date)} | ||
| onChange={({ target: { value } }) => changeYear(value)} | ||
| > | ||
| {years.map((option) => ( | ||
| <option key={option} value={option}> | ||
| {option} | ||
| </option> | ||
| ))} | ||
| </select> | ||
| </div> | ||
| <button onClick={increaseMonth} disabled={nextMonthButtonDisabled}> | ||
| <CaretCircleRight color="#5b34ea" size={16} /> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| )} | ||
| onChange={handleSelectDate} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| export default CustomDateRangePicker; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import React from "react"; | ||
|
|
||
| const TotalHeader = ({ | ||
| firstTitle, | ||
| firstAmount, | ||
| secondTitle, | ||
| secondAmount, | ||
| thirdTitle, | ||
| thirdAmount | ||
|
|
||
| }) => ( | ||
| <div className="px-10 py-10 mt-6 bg-miru-gray-100"> | ||
| <ul className="mt-0 border-t-0 page-display__wrap"> | ||
| <li className="page-display__box"> | ||
| <p className="text-sm font-normal tracking-widest uppercase"> | ||
| {firstTitle} | ||
| </p> | ||
| <p className="mt-3 text-5xl font-normal tracking-widest"> | ||
| {firstAmount} | ||
| </p> | ||
| </li> | ||
| <li className="page-display__box"> | ||
| <p className="text-sm font-normal tracking-widest uppercase"> | ||
| {secondTitle} | ||
| </p> | ||
| <p className="mt-3 text-5xl font-normal tracking-widest"> | ||
| {secondAmount} | ||
| </p> | ||
| </li> | ||
| <li className="page-display__box"> | ||
| <p className="text-sm font-normal tracking-widest uppercase"> | ||
| {thirdTitle} | ||
| </p> | ||
| <p className="mt-3 text-5xl font-normal tracking-widest"> | ||
| {thirdAmount} | ||
| </p> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| ); | ||
|
|
||
| export default TotalHeader; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 5 additions & 14 deletions
19
app/javascript/src/components/Reports/context/EntryContext.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
app/javascript/src/components/Reports/context/RevenueByClientContext.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| const RevenueByClientReportContext = { | ||
| filterOptions: { | ||
| clients: [] | ||
| }, | ||
| selectedFilter: { | ||
| dateRange: { label: "All", value: "" }, | ||
| clients: [] | ||
| }, | ||
| customDateFilter: { | ||
| from: "", | ||
| to: "" | ||
| }, | ||
| filterCounter: 0, | ||
| handleRemoveSingleFilter: (key, value) => { }, //eslint-disable-line | ||
| }; | ||
|
|
||
| export default RevenueByClientReportContext; |
18 changes: 18 additions & 0 deletions
18
app/javascript/src/components/Reports/context/TimeEntryReportContext.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| const TimeEntryReportContext = { | ||
| reports: [], | ||
| selectedFilter: { | ||
| dateRange: { label: "All", value: "" }, | ||
| clients: [], | ||
| teamMember: [], | ||
| status: [], | ||
| groupBy: { label: "None", value: "" } | ||
| }, | ||
| filterOptions: { | ||
| clients: [], | ||
| teamMembers: [] | ||
| }, | ||
| filterCounter: 0, | ||
| handleRemoveSingleFilter: (key, value) => { }, //eslint-disable-line | ||
| }; | ||
|
|
||
| export default TimeEntryReportContext; |
33 changes: 33 additions & 0 deletions
33
app/javascript/src/components/Reports/revenueByClient/Container/TableRow.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import React from "react"; | ||
|
|
||
| import { RevenueByClients } from "../interface"; | ||
|
|
||
| const TableRow = ({ | ||
| id, | ||
| name, | ||
| unpaidAmt, | ||
| paidAmt, | ||
| total | ||
| }: RevenueByClients) => ( | ||
|
|
||
| <tr key={id} className="flex flex-row items-center"> | ||
| <td className="w-3/5 pr-6 py-4 text-left whitespace-nowrap"> | ||
| <p className="font-normal whitespace-normal text-base text-miru-dark-purple-1000"> | ||
| {name} | ||
| </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} | ||
| </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} | ||
| </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} | ||
| </td> | ||
| </tr> | ||
| ); | ||
|
|
||
| export default TableRow; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRYthe function. we are defining the same function inapp/javascript/src/components/Reports/Header/NavigationFilter.tsx:7 aswell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harshaanNihal This refactoring is already done in API integration branch will raise separate PR for this.