Skip to content

Commit

Permalink
List with departments + color on plannings page
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaVR committed Feb 17, 2019
1 parent ca736a2 commit 2f73510
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/components/planning/PlanningsPage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@
.headerForUndefined {
font-style: italic;
}

.unplannedStudentsList {
margin-bottom: 8px !important;
}

.departmentNameColumn {
display: flex;
}
45 changes: 42 additions & 3 deletions src/components/planning/PlanningsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Calendar, Col, List, notification, Popover, Row, Spin, Tag, Tooltip } from "antd";
import { Button, Calendar, Card, Col, List, notification, Popover, Row, Spin, Tag, Tooltip } from "antd";
import classNames from "classnames";
import moment from "moment";
import React from "react";
Expand Down Expand Up @@ -66,10 +66,14 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
selectedDateForPlanningDetail: undefined,
};

this.unsubscribeFromPlannedStudents = () => { return; };
this.unsubscribeFromPlannedStudents = () => {
return;
};

this.renderStudentListHeader = this.renderStudentListHeader.bind(this);
this.renderStudentListItem = this.renderStudentListItem.bind(this);
this.renderDepartmentsHeader = this.renderDepartmentsHeader.bind(this);
this.renderDepartmentsListItem = this.renderDepartmentsListItem.bind(this);
this.renderDateCell = this.renderDateCell.bind(this);
this.renderDepartmentPopoverContent = this.renderDepartmentPopoverContent.bind(this);
this.handlePlanningsDetailClose = this.handlePlanningsDetailClose.bind(this);
Expand Down Expand Up @@ -119,13 +123,22 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
</Col>
<Col span={24} xl={8} xxl={6}>
<List
className={styles.unplannedStudentsList}
dataSource={this.state.unplannedStudents}
header={this.renderStudentListHeader()}
renderItem={this.renderStudentListItem}
loading={this.state.areStudentsLoading}
bordered={true}
pagination={{ position: "bottom" }}
/>
<List
dataSource={this.state.departments}
header={this.renderDepartmentsHeader()}
renderItem={this.renderDepartmentsListItem}
loading={this.state.areDepartmentsLoading}
bordered={true}
pagination={false}
/>
</Col>
</Row>
<PlanningsFormModal
Expand Down Expand Up @@ -184,6 +197,32 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
);
}

private renderDepartmentsHeader(): React.ReactNode {
return (
<Row type="flex" justify="space-between">
<Col>
<h2>Afdelingen</h2>
</Col>
</Row>
);
}

private renderDepartmentsListItem(department: Department): React.ReactNode {
return (
<Card bordered={false} bodyStyle={{ padding: "8px 16px" }}>
<Row type="flex" justify="space-between" align="middle">
<Col className={styles.departmentNameColumn}>
<Tag className={styles.notClickableTag} color={department.color} />
<span><b>{department.name}</b></span>
</Col>
<Col>
<span>(<b>{department.totalCapacity}</b> totale capaciteit)</span>
</Col>
</Row>
</Card>
);
}

private renderDateCell(date: moment.Moment): React.ReactNode {
const plannedStudentsToday = studentsPlannedInDay(this.state.plannedStudents, date);
const departmentsRows = this.state.departments.map((department) => {
Expand Down Expand Up @@ -212,7 +251,7 @@ class PlanningsPage extends React.Component<PlanningsPageProps, IPlanningsPageSt
<div className={styles.calendarCellContainer}>
{departmentsRows}
</div>
</Popover >
</Popover>
);
}

Expand Down

1 comment on commit 2f73510

@BenjaVR
Copy link
Owner

@BenjaVR BenjaVR commented on 2f73510 Feb 17, 2019

Choose a reason for hiding this comment

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

#52

Please sign in to comment.