repeat last month option added in tue UI
This commit is contained in:
@ -86,6 +86,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
const handleCheckboxChange = (event) => {
|
||||
setFilterShowWithoutAssignments(!filterShowWithoutAssignments); // Toggle the checkbox state
|
||||
};
|
||||
const [repeatEnabled, setRepeatEnabled] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("checkbox checked: " + filterShowWithoutAssignments);
|
||||
@ -445,7 +446,7 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
const generateShifts = async (buttonId, copyFromPrevious = false, autoFill = false, forDay?: Boolean | null, type = 0) => {
|
||||
try {
|
||||
setActiveButton(buttonId);
|
||||
const endpoint = `/api/shiftgenerate?action=generate&date=${common.getISODateOnly(value)}©FromPreviousMonth=${copyFromPrevious}&autoFill=${autoFill}&forDay=${forDay}&type=${type}`;
|
||||
const endpoint = `/api/shiftgenerate?action=generate&date=${common.getISODateOnly(value)}©FromPreviousMonth=${copyFromPrevious}&autoFill=${autoFill}&forDay=${forDay}&type=${type}&repeat=${repeatEnabled}`;
|
||||
const { shifts } = await axiosInstance.get(endpoint);
|
||||
toast.success('Готово!', { autoClose: 1000 });
|
||||
setIsMenuOpen(false);
|
||||
@ -728,9 +729,22 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
|
||||
<button className="block w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 flex items-center" onClick={() => generateShifts("genDay", true, true, null, 0)}>
|
||||
{isLoading('genDay') ? (<i className="fas fa-sync-alt fa-spin mr-2"></i>) : (<i className="fas fa-cogs mr-2"></i>)}
|
||||
Генерирай смени </button>
|
||||
<button className="block w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 flex items-center" onClick={() => generateShifts("genDay", true, true, null, 1)}>
|
||||
{isLoading('genDay') ? (<i className="fas fa-sync-alt fa-spin mr-2"></i>) : (<i className="fas fa-cogs mr-2"></i>)}
|
||||
Генерирай смени 2 <span className="text-yellow-500 ml-1 text-xs">✨</span></button>
|
||||
<button className="block w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 flex items-center justify-between"
|
||||
onClick={() => generateShifts("genDay", true, true, null, 1)}>
|
||||
<div className="flex items-center">
|
||||
{isLoading('genDay') ? (<i className="fas fa-sync-alt fa-spin mr-2"></i>) : (<i className="fas fa-cogs mr-2"></i>)}
|
||||
Генерирай<span className="text-yellow-500 ml-1 text-xs">✨</span>
|
||||
</div>
|
||||
<div className="flex items-center" onClick={(e) => e.stopPropagation()}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={repeatEnabled}
|
||||
onChange={(e) => setRepeatEnabled(e.target.checked)}
|
||||
className="mr-2 form-checkbox h-4 w-4 text-blue-600 transition duration-150 ease-in-out"
|
||||
/>
|
||||
<span className="text-sm text-gray-600">повт.</span>
|
||||
</div>
|
||||
</button>
|
||||
{/* ✧✨ */}
|
||||
{/* <button className="block w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 flex items-center" onClick={() => generateShifts("genDay", true, true, null, 2)}>
|
||||
{isLoading('genDay') ? (<i className="fas fa-sync-alt fa-spin mr-2"></i>) : (<i className="fas fa-cogs mr-2"></i>)}
|
||||
|
Reference in New Issue
Block a user