Skip to content

Commit b6da9d3

Browse files
committed
change: borrando fragmento de codigo comentado
1 parent fb45e83 commit b6da9d3

File tree

7 files changed

+4
-275
lines changed

7 files changed

+4
-275
lines changed

frontend/src/components/DataPensum/index.tsx

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,13 @@ import iconAdd from "../../assets/plus-circle-solid-24.png";
1515
import { fetchClasses } from "../../store/module/classesStore";
1616

1717

18-
// type classe = {id:number,names:string}
19-
2018
function DataPensum(){
2119
const dispatch = useDispatch();
2220
const profession = useSelector((state:store) => state.profession);
2321
const pensum = useSelector((state:store) => state.pensum);
2422
const semesters = useSelector((state:store) => state.semesters);
2523
const classes = useSelector((state:store) => state.classes);
2624

27-
// const [acordionActive,setAcordionActive] = useState<Boolean[]>([]);
28-
// const [acordionActive,setAcordionActive] = useState<Boolean[]>([]);
29-
3025
const [modal,setModal] = useState({type:"", IdSemesters:0, value:false, data:{id:0,names:""}, id:0, semesterName:"", ClasseName:""});
3126
const [activeInsertSemester, setActiveInsertSemester] = useState(true);
3227

@@ -40,7 +35,6 @@ function DataPensum(){
4035
}, []);
4136

4237
useEffect(() => {
43-
// console.log(pensum.selectPensum > 0);
4438
pensum.selectPensum > 0 ? setActiveInsertSemester(false) : setActiveInsertSemester(true);
4539

4640
return () => {}
@@ -50,56 +44,14 @@ function DataPensum(){
5044
let promiseClasses:any;
5145
if(modal.value){
5246
promiseClasses = dispatch(fetchClasses());
53-
// console.log(modal);
54-
// setModal({...modal,data:classes.data})
5547
}
5648

5749
return () => {
58-
// promiseClasses.abort();
5950
}
60-
}, [modal.value])
61-
62-
// useEffect(() => {
63-
// console.log(modal)
64-
65-
// return () => {}
66-
// }, [modal.type])
67-
68-
69-
70-
71-
// useEffect(() => {
72-
// setAcordionActive(pensum.data.map(()=>true));
73-
// return () => {}
74-
// }, [pensum]);
75-
76-
// useEffect(() => {
77-
// // console.log(semesters);
78-
79-
// return () => {}
80-
// }, [semesters])
51+
}, [modal.value]);
8152

8253

83-
84-
// const addClasses = async (name:string) => {
85-
// return await dispatch(fetchPostProfession(name));
86-
// }
87-
88-
// const edit = (data:profession) => {
89-
// setModal({type:"edit",value:true, data});
90-
// }
91-
9254
const removeClasse = (id:number,semesterName:string,ClasseName:string) => {
93-
// console.log(modal);
94-
// setModal({
95-
// type:"removeClasse",
96-
// value:true,
97-
// IdSemesters,
98-
// data: {
99-
// id: data.IdClasses,
100-
// names:data.Name_Classes
101-
// }
102-
// });
10355
setModal({
10456
...modal,
10557
type:"removeClasse",
@@ -121,19 +73,9 @@ function DataPensum(){
12173
}]));
12274
case "removeClasse":
12375
return dispatch(fetchDeleteClassePensum({id:modal.id}));
124-
// break;
125-
// case "delete":
126-
// return dispatch(fetchDeleteProfession({id:modal.data.id}));
12776
}
128-
// dispatch(insertClasse(modal));
12977
}
13078

131-
// const changeInputEdit = (e:any)=>{
132-
// setModal({...modal,data:{...modal.data,names:e.target.value}})
133-
// }
134-
135-
136-
13779
const changeSelectProfession = (e:any) => {
13880
const ID = e.target.value;
13981
ID > 0 && dispatch(fetchGetPensum(ID));
@@ -189,18 +131,7 @@ function DataPensum(){
189131
"removeClasse": <p>¿Desea eliminar la Clases/Materia <strong>"{modal.ClasseName}"</strong> del <strong>"{modal.semesterName}</strong>?</p>
190132
};
191133

192-
return(
193-
// <div>
194-
// <InputForm addCallBack={addClasses} title={"Profesiones"} />
195-
// <Div>
196-
// <TableComponent edit={edit} remove={remove} data={profession.data} />
197-
// </Div>
198-
// <Alert />
199-
// {
200-
// modal.value && <Popup setModal={setModal} aceptCallback={aceptCallback} > {cuerpoPopup[modal.type]} </Popup>
201-
// }
202-
// </div>
203-
134+
return(
204135
<ContentDataPensum>
205136
<SelectPensum>
206137
<h2>Profesiones</h2>
@@ -235,7 +166,6 @@ function DataPensum(){
235166
</SelectSemester>
236167
{
237168
modal.value && <Popup setModal={setModal} aceptCallback={aceptCallback} >
238-
{/* <Select identify="classes" changeSelect={changeSelectClasses} value={modal.data.id} data={classes.data} /> */}
239169
{cuerpoPopup[modal.type]}
240170
</Popup>
241171
}

frontend/src/components/DataStudents/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ function DataStudents(){
195195
const changeSelect = (e:any) => {
196196
const element = e.target.id;
197197
const value = e.target.value;
198-
// setStudent({...student,[element]:Number(value)});
199198
setStudent((e:students)=>{
200199
return {...e,[element]:Number(value)};
201200
});

frontend/src/components/PersonsForms/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { SelectStyle } from "../../styled/style";
22
import Select from "../Select";
33

44
function PersonsForms({children, person, changeRole, changeDataPerson, roles, wait, persons, cancelEdit, save, type}:any){
5-
// console.log("PersonsForms");
65
return(
76
<form className="newPerson" onSubmit={(e)=>e.preventDefault()} >
87
<div className="dataUser">

frontend/src/components/Sidebar/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ function Sidebar(){
2121
<Side id="sidebar" visibleSide={visibleSide.status} >
2222
<div id="title">
2323
<h1>{visibleSide.status ? "Universidad" : "U"}</h1>
24-
{/* <button onClick={()=>dispatch(change())}>{visibleSide.status ? <img src={arrow} /> : "+"}</button> */}
2524
<button onClick={()=>dispatch(change())}><img src={arrow} /> </button>
2625
</div>
2726
<div id="admin">

frontend/src/store/module/pensumStore.tsx

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -40,42 +40,6 @@ export const fetchDeleteClassePensum = createAsyncThunk('pensum/fetchDeleteClass
4040
return deleteData;
4141
});
4242

43-
// export const fetchPostProfession = createAsyncThunk('/profession/fetchPostProfession',async (name:any)=> {
44-
// const newData = await fetch('/api/v1/profession',{
45-
// method:'POST',
46-
// headers:{'Content-Type': 'application/json'},
47-
// body: JSON.stringify(name)
48-
// }).then(async (r)=>{
49-
// const res = await r.json();
50-
// return res.error ? res : {id:res.insertId, names:name.names}
51-
// });
52-
// return newData;
53-
// });
54-
55-
// export const fetchDeleteProfession = createAsyncThunk('/profession/fetchDeleteProfession', async (id:any)=>{
56-
// const deleteData = await fetch('/api/v1/profession',{
57-
// method:'DELETE',
58-
// headers:{'Content-Type': 'application/json'},
59-
// body: JSON.stringify(id)
60-
// }).then(async (r)=>{
61-
// const res = await r.json();
62-
// return res;
63-
// });
64-
// return deleteData;
65-
// });
66-
67-
// export const fetchUpdateProfession = createAsyncThunk('/profession/fetchUpdateProfession', async (data:any)=>{
68-
// const updateData = await fetch('/api/v1/profession',{
69-
// method:'PUT',
70-
// headers:{'Content-Type': 'application/json'},
71-
// body: JSON.stringify(data)
72-
// }).then(async (r)=>{
73-
// const res = await r.json();
74-
// return res;
75-
// });
76-
// return updateData;
77-
// });
78-
7943
export const pensumStore = createSlice({
8044
name: 'pensum',
8145
initialState,
@@ -89,20 +53,7 @@ export const pensumStore = createSlice({
8953
insertSemester:(state,action)=>{
9054
state.data.push(action.payload);
9155
state.data.sort((a,b)=>a.IdSemesters-b.IdSemesters);
92-
// console.log(action.payload);
9356
},
94-
// insertClasse:(state,action) => {
95-
// const data = action.payload;
96-
// // console.log(data);
97-
// state.data.forEach(semestre=>{
98-
// if(semestre.IdSemesters === data.IdSemesters){
99-
// semestre.Classes.push({
100-
// IdClasses:data.data.id,
101-
// Name_Classes:data.data.names
102-
// });
103-
// }
104-
// })
105-
// }
10657
},
10758
extraReducers(builder) {
10859
builder
@@ -160,36 +111,15 @@ export const pensumStore = createSlice({
160111
}else{
161112
state.status = "removed"
162113
const {deleteId} = action.payload;
163-
// state.data = state.data.filter(item=>item.id !== deleteId);
114+
164115
state.data.forEach(semestre=>{
165-
semestre.Classes = semestre.Classes.filter(classe=>classe.id !== deleteId)
166-
// semestre.Classes.forEach(classe=>{
167-
// console.log(classe.id, deleteId);
168-
// })
116+
semestre.Classes = semestre.Classes.filter(classe=>classe.id !== deleteId);
169117
})
170118
}
171119
})
172120
.addCase(fetchDeleteClassePensum.rejected,(state,action)=>{
173121
state.status = 'errorRemove'
174122
})
175-
176-
// // Actualiza clases o materias
177-
// .addCase(fetchUpdateProfession.pending,(state,action)=>{
178-
// state.status = 'updating'
179-
// })
180-
// .addCase(fetchUpdateProfession.fulfilled,(state,action)=>{
181-
// if(action.payload.error){
182-
// console.log(action.payload.error);
183-
// state.status = action.payload.error
184-
// }else{
185-
// state.status = "updated"
186-
// const newData = action.meta.arg;
187-
// state.data = state.data.map((oldData:profession) => oldData.id === newData.id ? newData : oldData )
188-
// }
189-
// })
190-
// .addCase(fetchUpdateProfession.rejected,(state,action)=>{
191-
// state.status = 'errorUpdate'
192-
// })
193123
}
194124
})
195125

frontend/src/store/module/semestersStore.tsx

Lines changed: 0 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,6 @@ export const fetchGetSemesters = createAsyncThunk('semesters/fetchGetSemesters',
1515
return response
1616
});
1717

18-
// export const fetchPostProfession = createAsyncThunk('/profession/fetchPostProfession',async (name:any)=> {
19-
// const newData = await fetch('/api/v1/profession',{
20-
// method:'POST',
21-
// headers:{'Content-Type': 'application/json'},
22-
// body: JSON.stringify(name)
23-
// }).then(async (r)=>{
24-
// const res = await r.json();
25-
// return res.error ? res : {id:res.insertId, names:name.names}
26-
// });
27-
// return newData;
28-
// });
29-
30-
// export const fetchDeleteProfession = createAsyncThunk('/profession/fetchDeleteProfession', async (id:any)=>{
31-
// const deleteData = await fetch('/api/v1/profession',{
32-
// method:'DELETE',
33-
// headers:{'Content-Type': 'application/json'},
34-
// body: JSON.stringify(id)
35-
// }).then(async (r)=>{
36-
// const res = await r.json();
37-
// return res;
38-
// });
39-
// return deleteData;
40-
// });
41-
42-
// export const fetchUpdateProfession = createAsyncThunk('/profession/fetchUpdateProfession', async (data:any)=>{
43-
// const updateData = await fetch('/api/v1/profession',{
44-
// method:'PUT',
45-
// headers:{'Content-Type': 'application/json'},
46-
// body: JSON.stringify(data)
47-
// }).then(async (r)=>{
48-
// const res = await r.json();
49-
// return res;
50-
// });
51-
// return updateData;
52-
// });
53-
5418
export const semestersStore = createSlice({
5519
name: 'semesters',
5620
initialState,
@@ -70,70 +34,15 @@ export const semestersStore = createSlice({
7034
})
7135
.addCase(fetchGetSemesters.fulfilled, (state, action) => {
7236
if(action.payload.error){
73-
// console.log(action.payload.error);
7437
state.status = action.payload.error
7538
}else{
7639
state.status = "succeeded"
7740
state.data = action.payload;
78-
// console.log(action.payload)
7941
}
8042
})
8143
.addCase(fetchGetSemesters.rejected, (state, action) => {
8244
state.status = action.meta.aborted ? '' : 'failed';
8345
})
84-
85-
// // Agrega clases o materias
86-
// .addCase(fetchPostProfession.pending,(state,action)=>{
87-
// state.status = 'adding'
88-
// })
89-
// .addCase(fetchPostProfession.fulfilled,(state,action)=>{
90-
// if(action.payload.error){
91-
// console.log(action.payload.error);
92-
// state.status = action.payload.error
93-
// }else{
94-
// state.status = "added"
95-
// state.data.unshift(action.payload);
96-
// }
97-
// })
98-
// .addCase(fetchPostProfession.rejected,(state,action)=>{
99-
// state.status = 'errorAdd'
100-
// })
101-
102-
// // Elimina clases o materias
103-
// .addCase(fetchDeleteProfession.pending,(state,action)=>{
104-
// state.status = 'deleting'
105-
// })
106-
// .addCase(fetchDeleteProfession.fulfilled,(state,action)=>{
107-
// if(action.payload.error){
108-
// console.log(action.payload.error);
109-
// state.status = action.payload.error
110-
// }else{
111-
// state.status = "removed"
112-
// const {deleteId} = action.payload;
113-
// state.data = state.data.filter(item=>item.id !== deleteId);
114-
// }
115-
// })
116-
// .addCase(fetchDeleteProfession.rejected,(state,action)=>{
117-
// state.status = 'errorRemove'
118-
// })
119-
120-
// // Actualiza clases o materias
121-
// .addCase(fetchUpdateProfession.pending,(state,action)=>{
122-
// state.status = 'updating'
123-
// })
124-
// .addCase(fetchUpdateProfession.fulfilled,(state,action)=>{
125-
// if(action.payload.error){
126-
// console.log(action.payload.error);
127-
// state.status = action.payload.error
128-
// }else{
129-
// state.status = "updated"
130-
// const newData = action.meta.arg;
131-
// state.data = state.data.map((oldData:profession) => oldData.id === newData.id ? newData : oldData )
132-
// }
133-
// })
134-
// .addCase(fetchUpdateProfession.rejected,(state,action)=>{
135-
// state.status = 'errorUpdate'
136-
// })
13746
}
13847
})
13948

0 commit comments

Comments
 (0)