'How to select holidays by date list?
So I currently have my own made dashboard (CRUD). I work in React.js and Node.js (SQL).
export default function CreateDeveloper() {
const url = "http://localhost:8080";
const [name, setName] = useState("");
const [slack_id, setSlackID] = useState(0);
const [selected, setSelected] = useState("");
const [absent, setAbsent] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
addDeveloper();
}
const addDeveloper = () => {
Axios.post(`${url}/create`, {
name: name,
slack_id: slack_id,
absent: absent,
selected: selected
}).then(() => {
})
}
return (
<form className='forms' onSubmit={handleSubmit}>
<label>Slack ID:</label>
<input type="text" onChange={(event) => { setSlackID(event.target.value) }} />
<label>Absent:</label>
<input type="number" min="0" max="1" onChange={(event) => { setAbsent(event.target.value) }} />
<label>Name:</label>
<input type="text" onChange={(event) => { setName(event.target.value) }} />
<label>Selected:</label>
<input type="number" min="0" max="0" onChange={(event) => { setSelected(event.target.value) }} />
{/* Button Add Developer */}
<button type="submit">add developer</button>
</form>
)
}
This is a segment of the code I have, its to create a new row. As you can see there is Absent. This is a boolean which is either 0 or 1. I'm trying to convert this into something different.
The question: Basically, Developers have free days and holidays, with this create method I want the Admin to be able to select multiple dates of whenever a developer is not around and store them into the database. However, I also need these dates to be linked with the Absent. So If a developer has an off day, The Date is linked with Absent, and Absent returns that he is absent.
Down the line there is more code which outputs a call to a slack bot and selects a certain developer, obviously people who are on holidays cannot be selected, I already have this created, but now I have to link the absent with certain dates of individual developer holidays.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
