Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventtype #338

Open
wants to merge 39 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c2e44c7
[Added new page for eventtype]
etolopez Jan 17, 2023
2b49c66
[Added two new views for EventTypes]
etolopez Feb 7, 2023
708ec90
[Made all changes, still working on it]
etolopez Feb 14, 2023
0f9430d
[Added the Modal inside EventypeDetails]
etolopez Feb 15, 2023
d1f04c6
[Simplified the JoinEvents file]
etolopez Feb 16, 2023
e7bb8eb
[Updates to eventtypes]
etolopez Feb 17, 2023
aec587a
[Finished Eventype pages]
etolopez Feb 21, 2023
fba1a99
[commented out the trash and the + for eventypes]
etolopez Feb 21, 2023
e078932
[Made changes to names]
etolopez Feb 27, 2023
9ca1155
[Changed flag position & add an Avatar image]
etolopez Feb 27, 2023
e3a0aae
[Made final changes]
etolopez Feb 28, 2023
23de318
[Added US flags]
etolopez Mar 9, 2023
6b10d58
[Changed flags to work]
etolopez Mar 9, 2023
e9038b9
[Added DE to languages]
etolopez Mar 14, 2023
fc4a561
[Added languages]
etolopez Mar 14, 2023
cab8647
[Added filter and language]
etolopez Mar 15, 2023
5762aaf
Merge pull request #349 from breatheco-de/development
alesanchezr Mar 21, 2023
5777a14
Merge pull request #350 from breatheco-de/development
alesanchezr Mar 21, 2023
0217dfa
Update ComposeAsset.js
tommygonzaleza Mar 27, 2023
585520f
Update ComposeAsset.js
tommygonzaleza Mar 27, 2023
38b6224
Merge branch 'development' of https://github.com/etolopez/admin into …
etolopez Mar 29, 2023
43166cf
Merge branch 'breatheco-de:master' into master
etolopez Mar 29, 2023
b54f10c
[Made Allowed_shared Creation]
etolopez Apr 5, 2023
caf7aa9
Merge branch 'development' of https://github.com/etolopez/admin into …
etolopez Apr 5, 2023
793fed5
Merge branch 'eventtype' of https://github.com/etolopez/admin into ev…
etolopez Apr 5, 2023
38dc73b
trying to create UI to add github org users directly
alesanchezr Apr 10, 2023
5f568f4
added devcontainers
alesanchezr Apr 10, 2023
6a67828
you can now add users to the github organization from your admin
alesanchezr Apr 11, 2023
34442b4
warning for invites
alesanchezr Apr 11, 2023
dceedb2
fixed github connection display error and now you can click on assets…
alesanchezr Apr 12, 2023
28b6e51
better github connection recomendation
alesanchezr Apr 12, 2023
4aa6c91
better explanation to github organization users
alesanchezr Apr 12, 2023
7f5cc13
Merge pull request #351 from breatheco-de/tommygonzaleza-patch-2
alesanchezr Apr 17, 2023
692f573
[Changing to Codespace]
etolopez Apr 18, 2023
356fffe
Merge branch 'breatheco-de:master' into eventtype
etolopez Apr 18, 2023
204ed6c
[Finished Event Types]
etolopez Apr 27, 2023
0e7f76c
Merge branch 'eventtype' of https://github.com/etolopez/admin into ev…
etolopez Apr 27, 2023
51ceba3
Merge branch 'master' of https://github.com/etolopez/admin into event…
etolopez Jun 23, 2023
cc86d9e
[Updated EvenType]
etolopez Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions src/app/services/breathecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,28 @@ class BreatheCodeClient {
"Academy event",
`${this.host}/events/academy/organizer`
),
addAcademyEventType: (payload) =>
axios.bcPost(
"Academy event type",
`${this.host}/events/academy/eventype`,
payload
),
getAcademyEventType: () =>
axios.bcGet(
"Event Type",
`${this.host}/events/academy/eventype`
),
getAcademyEventTypeSlug: (slug) =>
axios.bcGet(
"Event Type Slug",
`${this.host}/events/academy/eventype/${slug}`
),
updateAcademyEventTypeSlug: (slug, payload) =>
axios.bcPut(
"Event Type Slug",
`${this.host}/events/academy/eventype/${slug}`,
payload
),
postAcademyEventOrganization: (payload) =>
axios.bcPost(
"Academy event",
Expand All @@ -802,6 +824,11 @@ class BreatheCodeClient {
"Delete organizer",
`${this.host}/events/academy/organization/organizer/${org}`
),
deleteAcademyEventTypes: (org) =>
axios.bcDelete(
"Delete Eventtype",
`${this.host}/events/academy/eventype`
),
getEventbriteWebhook: (query) => {
const qs = serializeQuerystring(query);
return axios.bcGet(
Expand All @@ -815,11 +842,6 @@ class BreatheCodeClient {
},
getAcademyVenues: () =>
axios.bcGet("Venues", `${this.host}/events/academy/venues`),
getAcademyEventType: () =>
axios.bcGet(
"Event Type",
`${this.host}/events/academy/eventype`
),
downloadCSV: (query) => {
const qs = Object.keys(query)
.map((key) => `${key}=${query[key]}`)
Expand Down
1 change: 0 additions & 1 deletion src/app/views/admin/syllabus-form/SyllabusDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const schema = Yup.object().shape({

const StudentDetails = ({ syllabus, onSubmit }) => {
const [status, setStatus] = useState({ color: "", message: "" });

const session = getSession();
const academyOwner = session.academy.id
const syllabusId = syllabus.academy_owner.id
Expand Down
1 change: 0 additions & 1 deletion src/app/views/admin/syllabus-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ dayjs.extend(LocalizedFormat);
const Student = () => {
const { syllabusSlug } = useParams();
const session = getSession();
console.log("session", session)
const [syllabus, setSyllabus] = useState(null);
const [schedules, setSchedules] = useState([]);
const [openDialog, setOpenDialog] = useState(false);
Expand Down
187 changes: 187 additions & 0 deletions src/app/views/events/EditAddEventTypes/EventTypeDetails.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import React, { useState, useEffect } from 'react';
import { Button, Card, Grid, TextField, MenuItem, Checkbox, FormControlLabel } from '@material-ui/core';
import { Formik, Form } from 'formik';
import { Alert, AlertTitle } from '@material-ui/lab';
import * as Yup from 'yup';
// import axios from 'axios';
// import * as yup from 'yup';
import PropTypes from 'prop-types';
import Field from '../../../components/Field';
import { schemas } from '../../../utils';
import { getSession } from '../../../redux/actions/SessionActions';


const eventypePropTypes = {
id: PropTypes.number,
slug: PropTypes.string,
name: PropTypes.string,
language: PropTypes.string,
onSubmit: PropTypes.func,
academy_owner: PropTypes.number,
};

const propTypes = {
onSubmit: PropTypes.func.isRequired,
eventype: PropTypes.shape(eventypePropTypes).isRequired,
};

const schema = Yup.object().shape({
// academy: yup.number().required().positive().integer(),
// schedule: yup.number().required().positive().integer(),
slug: schemas.slug(),
name: schemas.name(),
});



const EventTypeDetails = ({ eventype, onSubmit }) => {
const [status, setStatus] = useState({ color: "", message: "" });
const session = getSession();
const academyOwner = session.academy.id;
const eventypeAcademyId = eventype.academy.id;

useEffect(() => {
if (eventypeAcademyId !== academyOwner) {
setStatus({ color: "warning", message: `This Event Type is owned by another academy, you can not make changes to its basic information.` });
} else {
"";
}
}, [academyOwner]);

return (

<Card elevation={3}>
{eventypeAcademyId !== academyOwner && (<Alert severity={status.color}>

<AlertTitle>{eventypePropTypes.id !== academyOwner
? (<>{status.message}</>)
: ""}
</AlertTitle>
</Alert>)}

{eventype.private && (
<Grid item md={12} sm={12} xs={12}>
<Alert severity="warning">
<AlertTitle className="m-auto" cy-data="eventype-private-alert">
This event type is private
</AlertTitle>
</Alert>
</Grid>
)}


<Formik
initialValues={eventype}
validationSchema={schema}
onSubmit={(values, { setSubmitting }) => {
onSubmit(values);
setSubmitting(false);
}}
>

{eventypeAcademyId !== academyOwner ? (
<Grid className="p-4" container spacing={1} alignItems="center">
<Field
type="text"
name="Name"
placeholder="Full Stack PT"
disabled
/>
<Field
type="text"
name="Slug"
placeholder="full-stack-pt"
disabled
/>
<Field
type="text"
name="Description"
placeholder="Description"
disabled
/>
</Grid>
) : (
({ values, isSubmitting, setFieldValue, handleChange }) => (
<Form className="p-4">
<Grid container spacing={3} alignItems="center">
<Field
type="text"
name="Name"
placeholder="Full Stack PT"
required
/>
<Field
type="text"
name="Slug"
placeholder="full-stack-pt"
disabled
required
/>
<Field
type="text"
label="Description"
name="description"
placeholder="This is a description"
required
/>
<Grid item md={5} sm={4} xs={12}>
Language
</Grid>
<Grid item md={7} sm={8} xs={12}>
<TextField
label="Language"
type="text"
data-cy="language"
size="small"
fullWidth
variant="outlined"
value={values.lang}
onChange={(e) => {
setFieldValue('lang', e.target.value);
}}
select
>
{['es', 'en'].map((item) => (
<MenuItem value={item} key={item}>
{item?.toUpperCase()}
</MenuItem>
))}
</TextField>
</Grid>
<Grid item md={12} sm={12} xs={12}>
<FormControlLabel
control={
<Checkbox
className="text-right"
checked={values.shared}
onChange={handleChange}
name="shared_creation"
data-cy="shared_creation"
color="primary"
/>
}
label="Allow Shared Creation"
/>
</Grid>
<div className="flex-column items-start px-4 mb-4">
<Button
color="primary"
variant="contained"
type="submit"
data-cy="submit"
disabled={isSubmitting}
>
Save Event type Details
</Button>
</div>
</Grid>
</Form>
))}
</Formik>
</Card>
)
};

EventTypeDetails.propTypes = propTypes;

export default EventTypeDetails;
Loading