Skip to content

Commit 0bffc53

Browse files
author
ninjadev999
committed
Merge pull request #119 from goldenstar999/backend
added talent metric on admin page
2 parents 5413759 + c759fb8 commit 0bffc53

25 files changed

+633
-410
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.tabSize": 2
3+
}

frontend/src/actions/videoActions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { RSAA } from 'redux-api-middleware';
22
import apiConfig from '../constants/api';
3-
import defaultValues from 'constants/defaultValues'
4-
import * as types from './actionTypes'
3+
import defaultValues from 'constants/defaultValues';
4+
import * as types from './actionTypes';
55

66
export const getVideoQuestionsActions = (positionName, mode) => ({
77
[RSAA]: {

frontend/src/components/admin/Table/Table.jsx

+26-16
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import React from "react";
22
import PropTypes from "prop-types";
3-
// @material-ui/core components
43
import withStyles from "@material-ui/core/styles/withStyles";
54
import Table from "@material-ui/core/Table";
65
import TableHead from "@material-ui/core/TableHead";
76
import TableRow from "@material-ui/core/TableRow";
87
import TableBody from "@material-ui/core/TableBody";
98
import TableCell from "@material-ui/core/TableCell";
10-
// core components
9+
import CircularProgress from '@material-ui/core/CircularProgress';
1110
import tableStyle from "assets/jss/material-dashboard-react/components/tableStyle.jsx";
1211

1312
function CustomTable({ ...props }) {
14-
const { classes, tableHead, tableData, tableHeaderColor } = props;
13+
const { classes, tableHead, tableData, tableHeaderColor, isLoading } = props;
14+
console.log('==== tableData: ', tableData, tableData && tableData.length);
15+
1516
return (
1617
<div className={classes.tableResponsive}>
1718
<Table className={classes.table}>
@@ -32,19 +33,28 @@ function CustomTable({ ...props }) {
3233
</TableHead>
3334
) : null}
3435
<TableBody>
35-
{tableData.map((prop, key) => {
36-
return (
37-
<TableRow key={key}>
38-
{prop.map((prop, key) => {
39-
return (
40-
<TableCell className={classes.tableCell} key={key}>
41-
{prop}
42-
</TableCell>
43-
);
44-
})}
45-
</TableRow>
46-
);
47-
})}
36+
{(tableData && (tableData.length > 0))
37+
? tableData.map((prop, key) => {
38+
console.log('==== prop: ', prop)
39+
return (
40+
<TableRow key={key}>
41+
{prop.map((prop, key) => {
42+
return (
43+
<TableCell className={classes.tableCell} key={key}>
44+
{prop}
45+
</TableCell>
46+
);
47+
})}
48+
</TableRow>
49+
);
50+
})
51+
: <div style={{paddingTop: 20, textAlign: 'center', color: 'grey', fontStyle: 'italic'}}>
52+
{isLoading
53+
? <CircularProgress className={classes.progress} />
54+
: 'No items'
55+
}
56+
</div>
57+
}
4858
</TableBody>
4959
</Table>
5060
</div>

frontend/src/components/shiptalent/headers/adminHeader.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ class AdminHeader extends Component {
9898
};
9999

100100
getUserAvatarFromProps() {
101-
const { adminInfo } = this.props
102-
103101
return null
104102
}
105103

@@ -176,7 +174,7 @@ class AdminHeader extends Component {
176174
}
177175

178176
const isMenuOpen = Boolean(anchorEl);
179-
const isMobileMenuOpen = Boolean(mobileMoreAnchorEl);
177+
// const isMobileMenuOpen = Boolean(mobileMoreAnchorEl);
180178

181179
const renderMenu = loggedIn ? (
182180
<Menu

frontend/src/constants/defaultValues.js

+17
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,26 @@ export default {
202202
PERSONAL_INFO: 'PersonalInfo',
203203
IMMIGRATION: 'Immigration',
204204
LANGUAGE: 'Language'
205+
},
206+
ADMIN_TALENT_SORT_CONDITION: {
207+
ALPHA: {name: 'alpha', title: 'LIST ALL TALENT (ALPHA)'},
208+
POSITION: {name: 'position', title: 'LIST ALL TALENT (POSITION)'},
209+
LOGIN_DATE: {name: 'login_date', title: 'SORT TALENT BY LOGIN DATE'},
210+
TIME_ONLINE: {name: 'time_online', title: 'SORT TALENT BY TIME ONLINE'},
211+
SEARCH_RETURNS: {name: 'search_returns', title: 'SORT TALENT BY SEARCH RETURNS'},
212+
VIEWD_TIME_BY_CLIENT: {name: 'viewed_time_by_client', title: 'SORT TALENT BY VIEWS'},
213+
SHARES: {name: 'shares', title: 'SORT TALENT BY SHARES'},
214+
BLOCKS: {name: 'blocks', title: 'SORT TALENT BY BLOCKS'},
215+
RATING: {name: 'rating', title: 'SORT TALENT BY RATING'},
216+
NATIONALITY: {name: 'nationality', title: 'SORT TALENT BY NATIONALITY'},
217+
CASTING_REQUEST: {name: 'casting_request', title: 'SORT TALENT BY CASTING REQUESTS'},
218+
CONTRACT_COMPLETED: {name: 'contract_completed', title: 'SORT TALENT BY CONTRACTS COMPLETED'},
219+
MEDICAL: {name: 'medical', title: 'SHOW TALENT WITH MEDICAL'},
220+
LOCKOUTS: {name: 'lockouts', title: 'SORT TALENT BY COMBO LOCKOUTS'}
205221
}
206222
};
207223

224+
208225
function generateWeightConst() {
209226
let weights = []
210227
for (let i = 99; i <= 251; i ++) {

frontend/src/containers/admin/Dashboard/Dashboard.jsx

+9-74
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Link } from 'react-router-dom';
1111
import Typography from '@material-ui/core/Typography';
1212
import AdminForm from 'components/shiptalent/forms/adminForm';
1313
import Spacer from 'components/general/spacer';
14+
import DashboardItem from './DashboardItem';
1415
import AdminAPI from 'apis/adminAPIs';
1516
import { adminStyles } from 'styles';
1617

@@ -48,100 +49,34 @@ class Dashboard extends React.Component {
4849

4950
return(
5051
<div>
51-
<Grid container spacing={16}>
52+
<Grid container spacing={8}>
5253
<Grid item xs={12}><Spacer size={10} /></Grid>
5354
<Grid xs={1}/>
5455
<Grid item xs={10}>
5556
<Grid container spacing={32} direction="row" justify="column" alignItems="center">
5657
<Grid item xs={12}>
57-
<Link to='/admin/profile-search'>
58-
<Panel>
59-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
60-
PROFILE SEARCH
61-
</Typography>
62-
</Panel>
63-
</Link>
58+
<DashboardItem path='/admin/profile-search' title='PROFILE SEARCH'/>
6459
</Grid>
6560

6661
<Grid item xs={6}>
67-
<Link to={'/admin/new-profiles'}>
68-
<Panel>
69-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
70-
NEW PROFILE
71-
</Typography>
72-
<Spacer size={10} />
73-
<Typography className={classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red)}>
74-
{newProfiles}
75-
</Typography>
76-
</Panel>
77-
</Link>
62+
<DashboardItem path='/admin/new-profiles' title='NEW PROFILE' subTitle={newProfiles} />
7863
</Grid>
7964
<Grid item xs={6}>
80-
<Link to='/admin/edit-profiles'>
81-
<Panel>
82-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
83-
EDIT PROFILE
84-
</Typography>
85-
<Spacer size={10} />
86-
<Typography className={classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red)}>
87-
{editProfiles}
88-
</Typography>
89-
</Panel>
90-
</Link>
65+
<DashboardItem path='/admin/edit-profiles' title='EDIT PROFILE' subTitle={editProfiles} />
9166
</Grid>
9267

9368
<Grid item xs={6}>
94-
<Link to={'/admin/casting-requests'}>
95-
<Panel>
96-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
97-
CASTING REQUESTS
98-
</Typography>
99-
<Spacer size={10} />
100-
<Typography className={classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red)}>
101-
{castingRequests}
102-
</Typography>
103-
</Panel>
104-
</Link>
69+
<DashboardItem path='/admin/casting-requests' title='CASTING REQUESTS' subTitle={castingRequests} />
10570
</Grid>
10671
<Grid item xs={6}>
107-
<Link to='/admin/metrics-tools'>
108-
<Panel>
109-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
110-
METRICS TOOLS
111-
</Typography>
112-
<Spacer size={10} />
113-
<Typography className={classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red)}>
114-
<Spacer size={24} />
115-
</Typography>
116-
</Panel>
117-
</Link>
72+
<DashboardItem path='/admin/metrics-tools' title='METRICS TOOLS' />
11873
</Grid>
11974

12075
<Grid item xs={6}>
121-
<Link to={'/admin/dance-combo-lockouts'}>
122-
<Panel>
123-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
124-
DANCE COMBO LOCKOUTS
125-
</Typography>
126-
<Spacer size={10} />
127-
<Typography className={classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red)}>
128-
{danceComboLockouts}
129-
</Typography>
130-
</Panel>
131-
</Link>
76+
<DashboardItem path='/admin/dance-combo-lockouts' title='DANCE COMBO LOCKOUTS' subTitle={danceComboLockouts} />
13277
</Grid>
13378
<Grid item xs={6}>
134-
<Link to='/admin/medicial-disclosure'>
135-
<Panel>
136-
<Typography className={classes.adminCastingRequestGroupButtonTitle}>
137-
MEDICIAL DISCLOSURE
138-
</Typography>
139-
<Spacer size={10} />
140-
<Typography className={classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red)}>
141-
{medicalDisclosures}
142-
</Typography>
143-
</Panel>
144-
</Link>
79+
<DashboardItem path='/admin/medicial-disclosure' title='MEDICIAL DISCLOSURE' subTitle={medicalDisclosures} />
14580
</Grid>
14681

14782
</Grid>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
import React from "react";
3+
import PropTypes from "prop-types";
4+
import classNames from 'classnames';
5+
import withStyles from "@material-ui/core/styles/withStyles";
6+
import { Link } from "react-router-dom";
7+
import Typography from '@material-ui/core/Typography';
8+
import Panel from "components/general/panel";
9+
import Card from "components/admin/Card/Card";
10+
import Spacer from "components/general/spacer";
11+
import { adminStyles } from 'styles';
12+
13+
14+
function DashboardItem(props) {
15+
const { path, title, subTitle, titleClass, subTitleClass, classes } = props;
16+
return (
17+
<Link to={path}>
18+
<Card className={classes.dashboardItemPanel}>
19+
<Typography className={titleClass ? titleClass : classNames(classes.adminCastingRequestGroupButtonTitle, classes.centerText)}>
20+
{title}
21+
</Typography>
22+
<Spacer size={10} />
23+
<Typography className={subTitleClass ? subTitleClass : classNames(classes.adminCastingRequestGroupButtonSubTitle, classes.red, classes.bold, classes.centerText)}>
24+
{subTitle ? subTitle : <Spacer size={24} />}
25+
</Typography>
26+
</Card>
27+
</Link>
28+
);
29+
}
30+
31+
DashboardItem.propTypes = {
32+
classes: PropTypes.object.isRequired
33+
};
34+
35+
export default withStyles(adminStyles)(DashboardItem);

0 commit comments

Comments
 (0)