go to master
This commit is contained in:
parent
aedc0ea708
commit
edda909c66
@ -38,6 +38,7 @@ const SaveButton = styled.button`
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
margin:10px;
|
||||||
&:hover {
|
&:hover {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
box-shadow: 0px 5px 4px 0px rgba(0, 0, 0, 0.24);
|
box-shadow: 0px 5px 4px 0px rgba(0, 0, 0, 0.24);
|
||||||
@ -66,6 +67,7 @@ const LogoWrapper = styled.div`
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-top:-50px;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Text = styled.div`
|
const Text = styled.div`
|
||||||
@ -212,7 +214,8 @@ export const Administrator = () => {
|
|||||||
<Logo alt="logo" src="https://plannaplan.pl/img/logo.svg" />
|
<Logo alt="logo" src="https://plannaplan.pl/img/logo.svg" />
|
||||||
<Text> plan na plan </Text>
|
<Text> plan na plan </Text>
|
||||||
</LogoWrapper>
|
</LogoWrapper>
|
||||||
{xd !== true ? (
|
{xd === true ? (
|
||||||
|
<div>
|
||||||
<Form onSubmit={uploadFile}>
|
<Form onSubmit={uploadFile}>
|
||||||
<div>
|
<div>
|
||||||
<div>Start pierwszej tury:</div>{' '}
|
<div>Start pierwszej tury:</div>{' '}
|
||||||
@ -251,10 +254,11 @@ export const Administrator = () => {
|
|||||||
<SaveButton type="submit">{loading === false ? 'Zapisz' : <SyncLoader />} </SaveButton>
|
<SaveButton type="submit">{loading === false ? 'Zapisz' : <SyncLoader />} </SaveButton>
|
||||||
</div>
|
</div>
|
||||||
</Form>
|
</Form>
|
||||||
) : (
|
<DownloadSection>
|
||||||
<DownloadSection>
|
<SaveButton onClick={downloadFile}>Pobierz dane.csv</SaveButton>
|
||||||
<SaveButton onClick={downloadFile}>Pobierz dane.csv</SaveButton>
|
</DownloadSection>
|
||||||
</DownloadSection>
|
</div>
|
||||||
|
) : (<div></div>
|
||||||
)}
|
)}
|
||||||
</Wrap>
|
</Wrap>
|
||||||
</AdministratorWrapper>
|
</AdministratorWrapper>
|
||||||
|
@ -84,7 +84,6 @@ export const SelectMenu = ({changeSelectedOption,changeDropdownOpen, selectedOpt
|
|||||||
<Wrapper onClick={() => {changeDropdownOpen(false)}}>
|
<Wrapper onClick={() => {changeDropdownOpen(false)}}>
|
||||||
<Header
|
<Header
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
console.log('clicked');
|
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { ChangeEvent, useContext, useEffect, useMemo, useState } from 'react';
|
import React, { ChangeEvent, useContext, useEffect, MouseEvent, useState } from 'react';
|
||||||
import Modal from '@material-ui/core/Modal';
|
import Modal from '@material-ui/core/Modal';
|
||||||
import Fade from '@material-ui/core/Fade';
|
import Fade from '@material-ui/core/Fade';
|
||||||
import { makeStyles } from '@material-ui/core/styles';
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
@ -11,6 +11,7 @@ import { Dropdown } from './Dropdown';
|
|||||||
import { DropdownModal } from './DropdownModal';
|
import { DropdownModal } from './DropdownModal';
|
||||||
import { dayMapping } from '../constants';
|
import { dayMapping } from '../constants';
|
||||||
import TransferIcon from '../assets/switch.svg';
|
import TransferIcon from '../assets/switch.svg';
|
||||||
|
import DeleteIcon from '@material-ui/icons/Delete';
|
||||||
|
|
||||||
interface TransferProps {
|
interface TransferProps {
|
||||||
handleClose: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
handleClose: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
||||||
@ -42,6 +43,15 @@ const TransferStyled = styled.div`
|
|||||||
letter-spacing: 0.2ch;
|
letter-spacing: 0.2ch;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const BinIcon = styled(DeleteIcon)`
|
||||||
|
max-width: 30px;
|
||||||
|
min-width: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
fill: white;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
const InputWrapper = styled.div`
|
const InputWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -153,14 +163,7 @@ const Exchange = styled.div`
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const deleteExchange = async (id: number) => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance.delete(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/${id}`);
|
|
||||||
console.log('delete exchange response: ', response);
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Transfer = ({ handleClose, isTransferOpen }: TransferProps) => {
|
export const Transfer = ({ handleClose, isTransferOpen }: TransferProps) => {
|
||||||
const { basket, selectBasketCourses } = useContext(coursesContext)!;
|
const { basket, selectBasketCourses } = useContext(coursesContext)!;
|
||||||
@ -174,33 +177,24 @@ export const Transfer = ({ handleClose, isTransferOpen }: TransferProps) => {
|
|||||||
|
|
||||||
const [assignmentsClasses, setAssignmentsClasses] = useState<Array<any>>([]);
|
const [assignmentsClasses, setAssignmentsClasses] = useState<Array<any>>([]);
|
||||||
const [selectedAssignmentsClasses, setSelectedAssignmentsClasses] = useState<any>('');
|
const [selectedAssignmentsClasses, setSelectedAssignmentsClasses] = useState<any>('');
|
||||||
const [groups, setGroups] = useState<any>([]);
|
|
||||||
const [selectedGroup, setSelectedGroup] = useState<any>('');
|
const [selectedGroup, setSelectedGroup] = useState<any>('');
|
||||||
|
const [groups, setGroups] = useState<any>([]);
|
||||||
const [exchanges, setExchanges] = useState<any>(null);
|
const [exchanges, setExchanges] = useState<any>(null);
|
||||||
const [save, setSave] = useState(false);
|
const [save, setSave] = useState(false);
|
||||||
// const allGroups
|
// const allGroups
|
||||||
const handleSelectedAssignmentsGroupChange = (event: React.ChangeEvent<{ value: unknown }>) => {
|
const handleSelectedAssignmentsGroupChange = (event: React.ChangeEvent<{ value: unknown }>) => {
|
||||||
setSelectedAssignmentsClasses(event.target.value);
|
setSelectedAssignmentsClasses(event.target.value as any);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGroupsChange = (event: React.ChangeEvent<{ value: unknown }>) => {
|
const handleGroupsChange = (event: React.ChangeEvent<{ value: unknown }>) => {
|
||||||
setSelectedGroup(event.target.value as any);
|
setSelectedGroup(event.target.value as any);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChange = (event: ChangeEvent<HTMLInputElement>) => setInput(event.target.value);
|
const handleChange = (event: ChangeEvent<HTMLInputElement>) => setInput(event.target.value);
|
||||||
const handleShowDropdown = () => setOpen(true);
|
const handleShowDropdown = () => setOpen(true);
|
||||||
|
|
||||||
const handleCloseDropdown = () => setOpen(false);
|
const handleCloseDropdown = () => setOpen(false);
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
console.log("ASAJNMENTS",selectedAssignmentsClasses)
|
|
||||||
},[selectedAssignmentsClasses])
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(()=>{
|
|
||||||
console.log("SELEKTET GTUP",selectedGroup)
|
|
||||||
},[selectedGroup])
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedAssignmentsClasses) {
|
if (selectedAssignmentsClasses) {
|
||||||
const allGroups = basketCourses.filter((el) => el.name === selectedAssignmentsClasses.name);
|
const allGroups = basketCourses.filter((el) => el.name === selectedAssignmentsClasses.name);
|
||||||
@ -214,16 +208,16 @@ useEffect(()=>{
|
|||||||
}
|
}
|
||||||
}, [selectedAssignmentsClasses]);
|
}, [selectedAssignmentsClasses]);
|
||||||
|
|
||||||
useEffect(() => {
|
const getExchanges = async () => {
|
||||||
const getExchanges = async () => {
|
try {
|
||||||
try {
|
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/all`);
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/all`);
|
setExchanges(data);
|
||||||
setExchanges(data);
|
} catch (e) {
|
||||||
} catch (e) {
|
console.log(e);
|
||||||
console.log(e);
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
const getAssignmentsGroups = async () => {
|
const getAssignmentsGroups = async () => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/assignments`);
|
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/assignments`);
|
||||||
@ -246,9 +240,32 @@ useEffect(()=>{
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
setSelectedGroup('');
|
||||||
|
setSelectedAssignmentsClasses('');
|
||||||
setSave(!save);
|
setSave(!save);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getExchange = async (event: MouseEvent) => {
|
||||||
|
const target = event.currentTarget;
|
||||||
|
try {
|
||||||
|
const response = await axiosInstance.post(
|
||||||
|
`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/${target.id}`,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteExchange = async (id: number) => {
|
||||||
|
try {
|
||||||
|
const response = await axiosInstance.delete(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/${id}`);
|
||||||
|
getExchanges();
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Modal
|
<Modal
|
||||||
@ -273,10 +290,10 @@ useEffect(()=>{
|
|||||||
placeholder="Wyszukaj..."
|
placeholder="Wyszukaj..."
|
||||||
style={{ width: '200px' }}
|
style={{ width: '200px' }}
|
||||||
>
|
>
|
||||||
{assignmentsClasses.map((el) => {
|
{assignmentsClasses.map((el: any, index: number) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={el.id}
|
key={index}
|
||||||
value={el}
|
value={el}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -343,18 +360,26 @@ useEffect(()=>{
|
|||||||
|
|
||||||
<ExchangesWrapper>
|
<ExchangesWrapper>
|
||||||
{exchanges ? (
|
{exchanges ? (
|
||||||
exchanges.map((name: any) => (
|
exchanges.map((name: any, index: number) => (
|
||||||
<ExchangesRow>
|
<ExchangesRow key={index}>
|
||||||
{' '}
|
{' '}
|
||||||
<Exchange>
|
<Exchange>
|
||||||
{name.ownedAssignment.lecturer} <br></br> {dayMapping[name.ownedAssignment.day]} <br></br>{' '}
|
{name.ownedAssignment.lecturer} <br></br> {dayMapping[name.ownedAssignment.day]} <br></br>{' '}
|
||||||
{name.ownedAssignment.time} - {name.ownedAssignment.endTime}
|
{name.ownedAssignment.time} - {name.ownedAssignment.endTime}
|
||||||
</Exchange>
|
</Exchange>
|
||||||
<Icon alt="transfer" src={TransferIcon} />
|
<Icon alt="transfer" src={TransferIcon} onClick={getExchange} />
|
||||||
<Exchange>
|
<Exchange>
|
||||||
{name.desiredGroup.lecturer} <br></br> {dayMapping[name.desiredGroup.day]} <br></br>{' '}
|
{name.desiredGroup.lecturer} <br></br> {dayMapping[name.desiredGroup.day]} <br></br>{' '}
|
||||||
{name.desiredGroup.time} - {name.desiredGroup.endTime}
|
{name.desiredGroup.time} - {name.desiredGroup.endTime}
|
||||||
</Exchange>{' '}
|
</Exchange>{' '}
|
||||||
|
<BinIcon
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
const id = Number(e.currentTarget.id);
|
||||||
|
deleteExchange(id);
|
||||||
|
}}
|
||||||
|
id={name.id}
|
||||||
|
></BinIcon>
|
||||||
</ExchangesRow>
|
</ExchangesRow>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
|
@ -111,7 +111,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
|||||||
|
|
||||||
const selectGroups = () => {
|
const selectGroups = () => {
|
||||||
const groups = [];
|
const groups = [];
|
||||||
console.log('courses are: ', courses);
|
|
||||||
return (courses as unknown) as Array<Group>;
|
return (courses as unknown) as Array<Group>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user