add repotys filter and store type properly

This commit is contained in:
Dobromir Popov
2024-04-17 13:44:34 +03:00
parent 7b8f14720a
commit 2c45064391
5 changed files with 40 additions and 22 deletions

View File

@ -4,7 +4,7 @@ import { toast } from 'react-toastify';
import { useRouter } from "next/router";
import Link from "next/link";
import DayOfWeek from "../DayOfWeek";
import { Location, UserRole } from "@prisma/client";
import { ReportType } from "@prisma/client";
const common = require('src/helpers/common');
import { useSession } from "next-auth/react"
@ -97,6 +97,7 @@ export default function ExperienceForm({ publisherId, assgnmentId, existingItem,
e.preventDefault();
item.publisher = { connect: { id: pubId } };
item.location = { connect: { id: parseInt(item.locationId) } };
item.type = ReportType.Experience;
delete item.locationId;
try {

View File

@ -4,7 +4,7 @@ import { toast } from 'react-toastify';
import { useRouter } from "next/router";
import Link from "next/link";
import DayOfWeek from "../DayOfWeek";
import { Location, UserRole } from "@prisma/client";
import { ReportType } from "@prisma/client";
const common = require('src/helpers/common');
import { useSession } from "next-auth/react"
@ -72,7 +72,9 @@ export default function FeedbackForm({ publisherId, onDone }) {
const handleSubmit = async (e) => {
e.preventDefault();
item.publisher = { connect: { id: pubId } };
item.
item.publisher = { connect: { id: pubId } };
item.type = ReportType.Feedback;
delete item.assignmentId;
try {

View File

@ -4,6 +4,7 @@ import { toast } from "react-hot-toast";
import { useRouter } from "next/router";
import Link from "next/link";
import { useSession } from "next-auth/react"
import { ReportType } from "@prisma/client";
const common = require('src/helpers/common');
@ -89,6 +90,7 @@ export default function ReportForm({ shiftId, existingItem, onDone }) {
item.publisher = { connect: { id: publisherId } };
item.shift = { connect: { id: parseInt(item.shiftId) } };
item.date = new Date(item.date);
item.type = ReportType.Report;
delete item.publisherId;
delete item.shiftId;
item.placementCount = parseInt(item.placementCount);