fix showing unpublished and old assignments to publishers
This commit is contained in:
@ -9,6 +9,7 @@ const common = require('src/helpers/common');
|
||||
import AvailabilityForm from "../availability/AvailabilityForm";
|
||||
|
||||
import { TrashIcon, PencilSquareIcon } from "@heroicons/react/24/outline";
|
||||
import { Availability, AvailabilityType } from "@prisma/client";
|
||||
|
||||
|
||||
|
||||
@ -58,7 +59,10 @@ export default function AvailabilityList({ publisher, showNew }) {
|
||||
{items?.sort((a, b) => new Date(a.startTime) - new Date(b.startTime)).map(item => (
|
||||
<tr key={item.id} availability={item} disabled={!item.isActive} className={`${item.isFromPreviousMonth ? 'bg-yellow-200' : ''} ${!item.isActive ? 'opacity-50' : ''}`}>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
{item.dayOfMonth ? `${common.getDateFormated(new Date(item.startTime))}` : `Всеки(Всяка) ${common.getDayOfWeekName(new Date(item.startTime))}`}
|
||||
{item.type == AvailabilityType.OneTime ? `${common.getDateFormated(new Date(item.startTime))}` :
|
||||
item.type == AvailabilityType.Weekly ? `Всеки(Всяка) ${common.getDayOfWeekName(new Date(item.startTime))}` : "месечно"
|
||||
|
||||
}
|
||||
{/* {common.getDateFormated(new Date(item.startTime))} */}
|
||||
</td>
|
||||
<td className="px-6 py-4 whitespace-nowrap">
|
||||
@ -118,14 +122,14 @@ export default function AvailabilityList({ publisher, showNew }) {
|
||||
|
||||
}
|
||||
|
||||
export const getServerSideProps = async () => {
|
||||
const { data: items } = await axiosInstance.get(
|
||||
common.getBaseUrl("/api/data/availabilities")
|
||||
);
|
||||
// export const getServerSideProps = async () => {
|
||||
// const { data: items } = await axiosInstance.get(
|
||||
// common.getBaseUrl("/api/data/availabilities")
|
||||
// );
|
||||
|
||||
return {
|
||||
props: {
|
||||
items,
|
||||
},
|
||||
};
|
||||
};
|
||||
// return {
|
||||
// props: {
|
||||
// items,
|
||||
// },
|
||||
// };
|
||||
// };
|
Reference in New Issue
Block a user