Revize ebfe6347
Přidáno uživatelem plundrichov před více než 4 roky(ů)
client/src/Calendar.js | ||
---|---|---|
54 | 54 |
const addEvent = async (e) => { |
55 | 55 |
e.preventDefault(); |
56 | 56 |
|
57 |
try { |
|
57 | 58 |
// setting an object |
58 | 59 |
const newDate = whatDate.split("-").join("/"); |
59 | 60 |
|
... | ... | |
64 | 65 |
to: typeRadio === 'sickday' ? null : moment().startOf('day').add(whatTime, "hours").format("hh:mm"), |
65 | 66 |
} |
66 | 67 |
|
67 |
api_fetch.addEventApi(dataAddEventEmployee).catch(reason => { |
|
68 |
alert(reason) |
|
69 |
}); |
|
68 |
await api_fetch.addEventApi(dataAddEventEmployee); |
|
69 |
if (typeRadio === 'holiday') { |
|
70 |
props.setUserName({ |
|
71 |
...props.userName, |
|
72 |
holiday: props.userName.holiday - whatTime |
|
73 |
}) |
|
74 |
} else if (typeRadio === 'sickday') { |
|
75 |
props.setUserName({ |
|
76 |
...props.userName, |
|
77 |
takenSickday: props.userName.takenSickday + 1 |
|
78 |
}) |
|
79 |
} |
|
70 | 80 |
|
71 | 81 |
setOpen(false) |
82 |
} catch (e) { |
|
83 |
alert(e) |
|
72 | 84 |
} |
73 |
|
|
85 |
} |
|
74 | 86 |
// ********************* ADD EVENT ADMIN - EMPLOYER ************************** |
75 | 87 |
|
76 | 88 |
const addEventAdmin = async (e) => { |
... | ... | |
94 | 106 |
//concat new request to current ones |
95 | 107 |
props.setRequest((acceptedRequest) => acceptedRequest.concat(userProps)) |
96 | 108 |
}).catch(reason => { |
97 |
alert(reason) |
|
109 |
alert(reason)
|
|
98 | 110 |
}); |
99 | 111 |
|
100 | 112 |
setOpen(false) |
113 |
|
|
114 |
api_fetch.getUsersOverview().then(usersOverview => { |
|
115 |
props.setEmployees(usersOverview); |
|
116 |
}).catch(reason => { |
|
117 |
alert(reason) |
|
118 |
}); |
|
101 | 119 |
} |
102 | 120 |
|
103 |
|
|
104 | 121 |
return ( |
105 | 122 |
<div className="calendar"> |
106 | 123 |
|
Také k dispozici: Unified diff
re #58 client part(especially rebuilt api.js, all fetches, little edits in YourRequests/UpcomingRequests and fixed bugs in calendar and overview (add event, save, post, numbers)