only use blocked date and no published date for blocking;
allow any date to be selected as block date - not only the end of the month
This commit is contained in:
@ -625,7 +625,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
async function setAvailabilityBlockDate(AvailabilityBlockDate: Date): Promise<void> {
|
||||
// set AvailabilityBlockDate to the selected date
|
||||
let monthInfo = common.getMonthInfo(value);
|
||||
await axiosInstance.put(`/api/?action=settings&key=AvailabilityBlockDate&value=${common.getISODateOnly(monthInfo.lastSunday)}`)
|
||||
await axiosInstance.put(`/api/?action=settings&key=AvailabilityBlockDate&value=${common.getISODateOnly(value)}`)
|
||||
.then((response) => {
|
||||
console.log("AvailabilityBlockDate set to:", response.data);
|
||||
// setShifts([...shifts, response.data]);
|
||||
@ -749,7 +749,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
{isLoading('fetchShifts') ? (<i className="fas fa-sync-alt fa-spin mr-2"></i>) : (<i className="fas fa-sync-alt mr-2"></i>)} презареди</button>
|
||||
{/* <button className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onClick={generateMonthlyStatistics}><i className="fas fa-chart-bar mr-2"></i> Генерирай статистика</button>
|
||||
<button className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onClick={copyOldAvailabilities}><i className="fas fa-copy mr-2"></i> Прехвърли предпочитанията</button> */}
|
||||
<button className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onClick={setAvailabilityBlockDate}><i className="fas fa-copy mr-2"></i> Блокирай предпочитанията до края на {selectedMonth + 1} м.</button>
|
||||
<button className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100" onClick={setAvailabilityBlockDate}><i className="fas fa-copy mr-2"></i> Блокирай предпочитанията до {value.getDate()}-ти</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
@ -318,7 +318,7 @@ export const getServerSideProps = async (context) => {
|
||||
|
||||
if (blockedDate) {
|
||||
blockedDate.value = new Date(blockedDate.value);
|
||||
lastPublishedDate = lastPublishedDate > blockedDate.value ? lastPublishedDate : blockedDate.value;
|
||||
lastPublishedDate = blockedDate.value;
|
||||
}
|
||||
|
||||
let messages = await prisma.message.findMany({
|
||||
|
Reference in New Issue
Block a user