Skip to content
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
72 changes: 39 additions & 33 deletions project/application/src/pages/ReportsPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ import { Loading } from '../../components/Loading';
import { UnitedReportsComponents } from './UnitedReportsComponents';
import { BlankListComponent } from '../../components/CommonComponents/BlankListcomponent/BlankListComponent';
import PageHeader from '../../components/PageHeader/index';
import Spinner from '../../components/Spinner';

// Actions
import reportsPageAction from '../../actions/ReportsPageAction';
import { getClientsAction } from '../../actions/ClientsActions';
Expand All @@ -62,6 +64,7 @@ const localeMap = {
class ReportsPage extends Component {
state = {
isInitialFetching: true,
isFetching: false,
toggleBar: false,
toggleChar: false,
projectsArr: [],
Expand Down Expand Up @@ -168,7 +171,7 @@ class ReportsPage extends Component {
lang,
} = vocabulary;

const { isInitialFetching } = this.state;
const { isInitialFetching, isFetching } = this.state;

const customLocale = localeMap[lang.short];
customLocale.options.weekStartsOn = firstDayOfWeek;
Expand Down Expand Up @@ -222,36 +225,39 @@ class ReportsPage extends Component {
)}
</div>
</PageHeader>
{checkIsAdminByRole(currentTeam.data.role) && (
<ReportsSearchBar
applySearch={e => this.applySearch()}
inputProjectData={this.props.inputProjectData}
inputUserData={this.props.inputUserData}
reportsPageAction={this.props.reportsPageAction}
inputClientData={this.props.clientsList}
/>
)}
{this.props.projectsArr.length > 0 ? (
<UnitedReportsComponents
toggleBar={this.state.toggleBar}
toggleChar={this.state.toggleChar}
v_total={v_total}
totalUpChartTime={this.state.totalUpChartTime}
getTimeDurationByGivenTimestamp={getTimeDurationByGivenTimestamp}
durationTimeFormat={durationTimeFormat}
export={this.export.bind(this)}
v_export={v_export}
data={this.props.dataBarChat}
height={isMobile ? 150 : 50}
lineChartOption={this.lineChartOption}
selectionRange={this.props.timeRange}
usersArr={this.props.inputUserData}
projectsArr={this.props.projectsArr}
dataDoughnutChat={this.props.dataDoughnutChat}
/>
) : (
BlankListComponent(this.props.vocabulary.v_no_report, null, { bottom: '-70px' })
)}
<div className={'content_wrapper'}>
{isFetching && <Spinner withLogo={false} mode={'overlay'} />}
{checkIsAdminByRole(currentTeam.data.role) && (
<ReportsSearchBar
applySearch={e => this.applySearch()}
inputProjectData={this.props.inputProjectData}
inputUserData={this.props.inputUserData}
reportsPageAction={this.props.reportsPageAction}
inputClientData={this.props.clientsList}
/>
)}
{this.props.projectsArr.length > 0 ? (
<UnitedReportsComponents
toggleBar={this.state.toggleBar}
toggleChar={this.state.toggleChar}
v_total={v_total}
totalUpChartTime={this.state.totalUpChartTime}
getTimeDurationByGivenTimestamp={getTimeDurationByGivenTimestamp}
durationTimeFormat={durationTimeFormat}
export={this.export.bind(this)}
v_export={v_export}
data={this.props.dataBarChat}
height={isMobile ? 150 : 50}
lineChartOption={this.lineChartOption}
selectionRange={this.props.timeRange}
usersArr={this.props.inputUserData}
projectsArr={this.props.projectsArr}
dataDoughnutChat={this.props.dataDoughnutChat}
/>
) : (
BlankListComponent(this.props.vocabulary.v_no_report, null, { bottom: '-70px' })
)}
</div>
</div>
</div>
</Loading>
Expand Down Expand Up @@ -515,7 +521,7 @@ class ReportsPage extends Component {
}
}
);
this.setState({ isInitialFetching: true });
this.setState({ isFetching: true });
apiCall(
AppConfig.apiURL +
`timer/reports-list?startDate=${convertDateToISOString(
Expand Down Expand Up @@ -546,7 +552,7 @@ class ReportsPage extends Component {
this.setDataToGraph(this.props.dataBarChat, this.getLablesAndTime(datePeriod, sumTimeEntriesByDay))
);
this.setState({ toggleBar: true });
this.setState({ isInitialFetching: false });
this.setState({ isFetching: false });
},
err => {
if (err instanceof Response) {
Expand Down
7 changes: 7 additions & 0 deletions project/application/src/pages/ReportsPage/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
overflow-y: auto;

.data_container_reports_page {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
background-color: #333333;
Expand All @@ -25,6 +27,11 @@
font-weight: bold;
}

.content_wrapper {
position: relative;
flex-grow: 1;
}

.line_chart_container {
position: relative;
top: 110px;
Expand Down