This commit is contained in:
Dobromir Popov
2024-03-26 01:08:57 +02:00
parent 3fcdfc1347
commit acd776e988
37 changed files with 143 additions and 107 deletions

View File

@ -57,7 +57,7 @@ export default function PublisherCard({ publisher }) {
return isCardVisible ? (
// className="block p-6 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 mb-3"
<div id={`publisher-card-${publisher.id}`} className={`relative block p-6 max-w-sm rounded-lg border border-gray-200 shadow-md hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 mb-3
${!publisher.isactive ? "opacity-50 bg-gray-200 border-gray-300 text-gray-400" : (publisher.isImported ? "bg-orange-50" : (publisher.isTrained ? "bg-white" : "bg-red-50"))}`}
${!publisher.isActive ? "opacity-50 bg-gray-200 border-gray-300 text-gray-400" : (publisher.isImported ? "bg-orange-50" : (publisher.isTrained ? "bg-white" : "bg-red-50"))}`}
>
<a
href={`/cart/publishers/edit/${publisher.id}`}
@ -66,7 +66,7 @@ export default function PublisherCard({ publisher }) {
>
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
{publisher.firstName} {publisher.lastName} ({publisher.isactive ? "active" : "inactive"})
{publisher.firstName} {publisher.lastName} ({publisher.isActive ? "active" : "inactive"})
</h5>
<div className="font-normal text-gray-700 dark:text-gray-200">
<p> {publisher.assignments.length} смени общо</p>

View File

@ -23,7 +23,7 @@ import { UserRole } from "@prisma/client";
// lastName String
// email String @unique
// phone String?
// isactive Boolean @default(true)
// isActive Boolean @default(true)
// isImported Boolean @default(false)
// age Int?
// availabilities Availability[]
@ -75,7 +75,7 @@ export default function PublisherForm({ item, me }) {
}, []);
const [publisher, set] = useState(item || {
isactive: true,
isActive: true,
});
const handleChange = ({ target }) => {
@ -259,8 +259,8 @@ export default function PublisherForm({ item, me }) {
</div>
<div className="mb-4">
<div className="form-check">
<input className="checkbox" type="checkbox" id="isactive" name="isactive" onChange={handleChange} checked={publisher.isactive} autoComplete="off" />
<label className="label" htmlFor="isactive">Активен</label>
<input className="checkbox" type="checkbox" id="isActive" name="isActive" onChange={handleChange} checked={publisher.isActive} autoComplete="off" />
<label className="label" htmlFor="isActive">Активен</label>
<input className="checkbox" type="checkbox" id="isTrained" name="isTrained" onChange={handleChange} checked={publisher.isTrained} autoComplete="off" />
<label className="label" htmlFor="isTrained">Получил обучение</label>
<input className="checkbox disabled" type="checkbox" id="isImported" name="isImported" onChange={handleChange} checked={publisher.isImported} autoComplete="off" />

View File

@ -18,7 +18,7 @@ function PublisherSearchBox({ selectedId, onChange, isFocused, filterDate, showS
const fetchPublishers = async () => {
console.log("fetchPublishers called");
try {
let url = `/api/?action=filterPublishers&select=id,firstName,lastName,email,isactive&searchText=${searchText}&availabilities=false`;
let url = `/api/?action=filterPublishers&select=id,firstName,lastName,email,isActive&searchText=${searchText}&availabilities=false`;
if (filterDate) {
url += `&filterDate=${common.getISODateOnly(filterDate)}`;
@ -29,7 +29,7 @@ function PublisherSearchBox({ selectedId, onChange, isFocused, filterDate, showS
const { data: publishersData } = await axiosInstance.get(url);
//setPublishers(publishersData);
const activePublishers = publishersData.filter(publisher => publisher.isactive === true);
const activePublishers = publishersData.filter(publisher => publisher.isActive === true);
setPublishers(activePublishers);
} catch (error) {

View File

@ -35,7 +35,7 @@ const ShiftsList = ({ assignments, selectedtab }: ShiftsListProps) => {
try {
var assignment = (await axiosInstance.get("/api/data/assignments/" + id)).data;
assignment.isConfirmed = false;
assignment.isTentative = true;
// ! assignment.isTentative = true;
// assignment.isDeleted = true;
await axiosInstance.put("/api/data/assignments/" + id, assignment);
toast.success("Shift Tentative", {