diff --git a/src/components/Administrator.tsx b/src/components/Administrator.tsx
index 342abfb..5404707 100644
--- a/src/components/Administrator.tsx
+++ b/src/components/Administrator.tsx
@@ -38,6 +38,7 @@ const SaveButton = styled.button`
font-weight: bold;
cursor: pointer;
height: 40px;
+ margin:10px;
&:hover {
color: #ffffff;
box-shadow: 0px 5px 4px 0px rgba(0, 0, 0, 0.24);
@@ -66,6 +67,7 @@ const LogoWrapper = styled.div`
flex-direction: column;
justify-content: center;
align-items: center;
+ margin-top:-50px;
`;
const Text = styled.div`
@@ -212,7 +214,8 @@ export const Administrator = () => {
plan na plan
- {xd !== true ? (
+ {xd === true ? (
+
- ) : (
-
- Pobierz dane.csv
-
+
+ Pobierz dane.csv
+
+
+ ) : (
)}
diff --git a/src/components/SelectMenu.tsx b/src/components/SelectMenu.tsx
index f8a18fa..547f070 100644
--- a/src/components/SelectMenu.tsx
+++ b/src/components/SelectMenu.tsx
@@ -84,7 +84,6 @@ export const SelectMenu = ({changeSelectedOption,changeDropdownOpen, selectedOpt
{changeDropdownOpen(false)}}>
{
- console.log('clicked');
setIsOpen(!isOpen);
}}
>
diff --git a/src/components/Transfer.tsx b/src/components/Transfer.tsx
index 4c93676..7b8da55 100644
--- a/src/components/Transfer.tsx
+++ b/src/components/Transfer.tsx
@@ -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 Fade from '@material-ui/core/Fade';
import { makeStyles } from '@material-ui/core/styles';
@@ -11,6 +11,7 @@ import { Dropdown } from './Dropdown';
import { DropdownModal } from './DropdownModal';
import { dayMapping } from '../constants';
import TransferIcon from '../assets/switch.svg';
+import DeleteIcon from '@material-ui/icons/Delete';
interface TransferProps {
handleClose: (e: React.MouseEvent) => void;
@@ -42,6 +43,15 @@ const TransferStyled = styled.div`
letter-spacing: 0.2ch;
`;
+const BinIcon = styled(DeleteIcon)`
+ max-width: 30px;
+ min-width: 30px;
+ cursor: pointer;
+ &:hover {
+ fill: white;
+ }
+`;
+
const InputWrapper = styled.div`
display: flex;
flex-direction: row;
@@ -153,14 +163,7 @@ const Exchange = styled.div`
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) => {
const { basket, selectBasketCourses } = useContext(coursesContext)!;
@@ -174,33 +177,24 @@ export const Transfer = ({ handleClose, isTransferOpen }: TransferProps) => {
const [assignmentsClasses, setAssignmentsClasses] = useState>([]);
const [selectedAssignmentsClasses, setSelectedAssignmentsClasses] = useState('');
- const [groups, setGroups] = useState([]);
const [selectedGroup, setSelectedGroup] = useState('');
+ const [groups, setGroups] = useState([]);
const [exchanges, setExchanges] = useState(null);
const [save, setSave] = useState(false);
// const allGroups
const handleSelectedAssignmentsGroupChange = (event: React.ChangeEvent<{ value: unknown }>) => {
- setSelectedAssignmentsClasses(event.target.value);
+ setSelectedAssignmentsClasses(event.target.value as any);
};
const handleGroupsChange = (event: React.ChangeEvent<{ value: unknown }>) => {
setSelectedGroup(event.target.value as any);
};
+
const handleChange = (event: ChangeEvent) => setInput(event.target.value);
const handleShowDropdown = () => setOpen(true);
const handleCloseDropdown = () => setOpen(false);
-useEffect(()=>{
- console.log("ASAJNMENTS",selectedAssignmentsClasses)
-},[selectedAssignmentsClasses])
-
-
-useEffect(()=>{
- console.log("SELEKTET GTUP",selectedGroup)
-},[selectedGroup])
-
-
useEffect(() => {
if (selectedAssignmentsClasses) {
const allGroups = basketCourses.filter((el) => el.name === selectedAssignmentsClasses.name);
@@ -214,16 +208,16 @@ useEffect(()=>{
}
}, [selectedAssignmentsClasses]);
- useEffect(() => {
- const getExchanges = async () => {
- try {
- const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/all`);
- setExchanges(data);
- } catch (e) {
- console.log(e);
- }
- };
+ const getExchanges = async () => {
+ try {
+ const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/exchanges/exchange/all`);
+ setExchanges(data);
+ } catch (e) {
+ console.log(e);
+ }
+ };
+ useEffect(() => {
const getAssignmentsGroups = async () => {
try {
const { data } = await axiosInstance.get(`${process.env.REACT_APP_API_URL}/api/v1/commisions/user/assignments`);
@@ -246,9 +240,32 @@ useEffect(()=>{
} catch (e) {
console.log(e);
}
+ setSelectedGroup('');
+ setSelectedAssignmentsClasses('');
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 (
{
placeholder="Wyszukaj..."
style={{ width: '200px' }}
>
- {assignmentsClasses.map((el) => {
+ {assignmentsClasses.map((el: any, index: number) => {
return (