new coverMe routine; refactoring
This commit is contained in:
@ -7,6 +7,7 @@ import common from '../../../src/helpers/common';
|
||||
import Modal from 'components/Modal';
|
||||
import ConfirmationModal from 'components/ConfirmationModal';
|
||||
import PublisherSearchBox from '../../../components/publisher/PublisherSearchBox'; // Update the path
|
||||
import SearchReplacement from '../../../components/publisher/SearchReplacement'; // Update the path
|
||||
|
||||
import { monthNamesBG, GetTimeFormat, GetDateFormat } from "../../../src/helpers/const"
|
||||
import { useSession, getSession } from 'next-auth/react';
|
||||
@ -52,21 +53,6 @@ export default function MySchedulePage({ assignments }) {
|
||||
});
|
||||
};
|
||||
|
||||
const searchReplacement = (assignmentId) => {
|
||||
axiosInstance.post('/api/email?action=sendCoverMeRequestByEmail', {
|
||||
assignmentId: assignmentId,
|
||||
}).then(response => {
|
||||
console.log("response", response);
|
||||
//toast success and confirm the change
|
||||
toast.success("Заявката за заместник е изпратена!", {
|
||||
onClose: () => {
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
console.log("error", error);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
@ -121,12 +107,8 @@ export default function MySchedulePage({ assignments }) {
|
||||
>
|
||||
Избери Заместник
|
||||
</button>
|
||||
<button
|
||||
className="mr-2 mb-2 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
onClick={() => searchReplacement(assignment.id)}
|
||||
>
|
||||
Търси заместник
|
||||
</button>
|
||||
|
||||
<SearchReplacement shiftId={assignment.shift.id} assignmentId={assignment.id} />
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
Reference in New Issue
Block a user