#119 setup tbl while user have no tasks

parent 2d68f3fe
...@@ -28,7 +28,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => { ...@@ -28,7 +28,7 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority} = req.body; const {user,title,description,project,executor,dateTimeStart,dateTimeDue, dateTimeDeadLine,priority} = req.body;
//** if dateTimeDue is null , then dateTimeDeadLine copied to dateTimeDue and dateTimeStart = dateTimeDue - 1 hour*/ //** if dateTimeDue is null , then dateTimeDeadLine copied to dateTimeDue and dateTimeStart = dateTimeDue - 1 hour*/
let dateTimeDueFinal = dateTimeDue let dateTimeDueFinal = dateTimeDue
let dateTimeStartFinal = dateTimeStart let dateTimeStartFinal = dateTimeStart
let dateTimeDeadlineFinal= dateTimeDeadLine let dateTimeDeadlineFinal= dateTimeDeadLine
if (!dateTimeDue && dateTimeDeadLine) { if (!dateTimeDue && dateTimeDeadLine) {
......
...@@ -29,7 +29,7 @@ export default function EnhancedTable() { ...@@ -29,7 +29,7 @@ export default function EnhancedTable() {
const [order, setOrder] = useState("asc"); const [order, setOrder] = useState("asc");
const [orderBy, setOrderBy] = useState("id"); const [orderBy, setOrderBy] = useState("id");
const [page, setPage] = useState(0); const [page, setPage] = useState(0);
const [rowsPerPage, setRowsPerPage] = useState(5); const [rowsPerPage, setRowsPerPage] = useState(25);
const [modal, setModal] = useState({ const [modal, setModal] = useState({
open: false, open: false,
task: null, task: null,
...@@ -44,7 +44,7 @@ export default function EnhancedTable() { ...@@ -44,7 +44,7 @@ export default function EnhancedTable() {
}, [ }, [
tasks?.length, tasks?.length,
addTaskForm, setAddTaskForm, dispatch]); addTaskForm, setAddTaskForm, dispatch]);
console.log('tasks ', tasks, 'projects ', projects) console.log('tasks ', tasks, 'projects ', projects,"recievedTasks ", recievedTasks )
...@@ -184,12 +184,13 @@ export default function EnhancedTable() { ...@@ -184,12 +184,13 @@ export default function EnhancedTable() {
setFilterProjectTumbler(true) setFilterProjectTumbler(true)
} }
if ( // if (
tasks && // tasks &&
tasks?.length > 0 && // tasks?.length > 0
recievedTasks && // &&
recievedTasks?.length > 0 // recievedTasks &&
) { // recievedTasks?.length > 0
// ) {
return ( return (
<Box sx={{ width: "fullwidth" }}> <Box sx={{ width: "fullwidth" }}>
<Paper sx={{ width: "100%", mb: 2 }}> <Paper sx={{ width: "100%", mb: 2 }}>
...@@ -215,7 +216,7 @@ export default function EnhancedTable() { ...@@ -215,7 +216,7 @@ export default function EnhancedTable() {
order={order} order={order}
orderBy={orderBy} orderBy={orderBy}
onRequestSort={handleRequestSort} onRequestSort={handleRequestSort}
rowCount={tasks.length} rowCount={recievedTasks.length}
/> />
<TableBody> <TableBody>
{stableSort(recievedTasks, getComparator(order, orderBy)) {stableSort(recievedTasks, getComparator(order, orderBy))
...@@ -246,7 +247,7 @@ export default function EnhancedTable() { ...@@ -246,7 +247,7 @@ export default function EnhancedTable() {
<TablePagination <TablePagination
rowsPerPageOptions={[5, 10, 25]} rowsPerPageOptions={[5, 10, 25]}
component="div" component="div"
count={tasks.length} count={recievedTasks.length}
rowsPerPage={rowsPerPage} rowsPerPage={rowsPerPage}
page={page} page={page}
onPageChange={handleChangePage} onPageChange={handleChangePage}
...@@ -263,7 +264,7 @@ export default function EnhancedTable() { ...@@ -263,7 +264,7 @@ export default function EnhancedTable() {
</Box> </Box>
); );
} }
} // }
function descendingComparator(a, b, orderBy) { function descendingComparator(a, b, orderBy) {
if (b[orderBy] < a[orderBy]) { if (b[orderBy] < a[orderBy]) {
......
...@@ -199,12 +199,12 @@ export default function UsersTasks() { ...@@ -199,12 +199,12 @@ export default function UsersTasks() {
setFilterProjectTumbler(true) setFilterProjectTumbler(true)
} }
if ( // if (
tasks && // tasks &&
tasks?.length > 0 && // tasks?.length > 0 &&
recievedTasks && // recievedTasks &&
recievedTasks?.length > 0 // recievedTasks?.length > 0
) { // ) {
return ( return (
<Box sx={{ width: "fullwidth" }}> <Box sx={{ width: "fullwidth" }}>
<Paper sx={{ width: "100%", mb: 2 }}> <Paper sx={{ width: "100%", mb: 2 }}>
...@@ -233,7 +233,7 @@ export default function UsersTasks() { ...@@ -233,7 +233,7 @@ export default function UsersTasks() {
order={order} order={order}
orderBy={orderBy} orderBy={orderBy}
onRequestSort={handleRequestSort} onRequestSort={handleRequestSort}
rowCount={tasks.length} rowCount={recievedTasks.length}
/> />
<TableBody> <TableBody>
...@@ -267,7 +267,7 @@ export default function UsersTasks() { ...@@ -267,7 +267,7 @@ export default function UsersTasks() {
<TablePagination <TablePagination
rowsPerPageOptions={[5, 10, 25]} rowsPerPageOptions={[5, 10, 25]}
component="div" component="div"
count={tasks.length} count={recievedTasks.length}
rowsPerPage={rowsPerPage} rowsPerPage={rowsPerPage}
page={page} page={page}
onPageChange={handleChangePage} onPageChange={handleChangePage}
...@@ -284,7 +284,7 @@ export default function UsersTasks() { ...@@ -284,7 +284,7 @@ export default function UsersTasks() {
</Box> </Box>
); );
} }
} // }
function descendingComparator(a, b, orderBy) { function descendingComparator(a, b, orderBy) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment