email editable only for admins
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
// import axios from "axios";
|
// import axios from "axios";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { use, useEffect, useState } from "react";
|
||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
@ -15,6 +15,7 @@ import AvailabilityList from "../availability/AvailabilityList";
|
|||||||
import ShiftsList from "../publisher/ShiftsList.tsx";
|
import ShiftsList from "../publisher/ShiftsList.tsx";
|
||||||
import ConfirmationModal from "../ConfirmationModal";
|
import ConfirmationModal from "../ConfirmationModal";
|
||||||
import { UserRole } from "@prisma/client";
|
import { UserRole } from "@prisma/client";
|
||||||
|
import { getSession } from "next-auth/react";
|
||||||
|
|
||||||
// import { Tabs, List } from 'tw-elements'
|
// import { Tabs, List } from 'tw-elements'
|
||||||
|
|
||||||
@ -56,15 +57,11 @@ Array.prototype.groupBy = function (prop) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function PublisherForm({ item, me }) {
|
export default function PublisherForm({ item, me }) {
|
||||||
|
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
console.log("init PublisherForm: ");
|
|
||||||
const urls = {
|
const urls = {
|
||||||
apiUrl: "/api/data/publishers/",
|
apiUrl: "/api/data/publishers/",
|
||||||
indexUrl: "/cart/publishers"
|
indexUrl: "/dash"
|
||||||
}
|
}
|
||||||
|
|
||||||
const [helpers, setHelper] = useState(null);
|
const [helpers, setHelper] = useState(null);
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
|
|
||||||
@ -202,10 +199,13 @@ export default function PublisherForm({ item, me }) {
|
|||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<label className="label" htmlFor="desiredShiftsPerMonth">Желани смeни на месец</label>
|
<label className="label" htmlFor="desiredShiftsPerMonth">Желани смeни на месец</label>
|
||||||
<input type="number" id="desiredShiftsPerMonth" name="desiredShiftsPerMonth" value={publisher.desiredShiftsPerMonth} onChange={handleChange} className="textbox" placeholder="desiredShiftsPerMonth" autoFocus />
|
<input type="number" id="desiredShiftsPerMonth" name="desiredShiftsPerMonth" value={publisher.desiredShiftsPerMonth} onChange={handleChange} className="textbox" placeholder="desiredShiftsPerMonth" autoFocus />
|
||||||
</div>
|
</div> <div className="mb-4">
|
||||||
<div className="mb-4">
|
|
||||||
<label className="label" htmlFor="email">Имейл</label>
|
<label className="label" htmlFor="email">Имейл</label>
|
||||||
<input type="text" id="email" name="email" value={publisher.email} onChange={handleChange} className="textbox" placeholder="Email" autoFocus />
|
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage={publisher.email} className="">
|
||||||
|
<div className="border border-blue-500 border-solid p-2">
|
||||||
|
<input type="text" id="email" name="email" value={publisher.email} onChange={handleChange} className="textbox" placeholder="Email" autoFocus />
|
||||||
|
</div>
|
||||||
|
</ProtectedRoute>
|
||||||
</div>
|
</div>
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<label className="label" htmlFor="phone">Телефон</label>
|
<label className="label" htmlFor="phone">Телефон</label>
|
||||||
@ -263,10 +263,8 @@ export default function PublisherForm({ item, me }) {
|
|||||||
|
|
||||||
{/* ADMINISTRATORS ONLY */}
|
{/* ADMINISTRATORS ONLY */}
|
||||||
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage=" " className="">
|
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage=" " className="">
|
||||||
|
|
||||||
<PwaManager />
|
|
||||||
|
|
||||||
<div className="border border-blue-500 border-solid p-2">
|
<div className="border border-blue-500 border-solid p-2">
|
||||||
|
<PwaManager />
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<label className="label" htmlFor="type">Тип</label>
|
<label className="label" htmlFor="type">Тип</label>
|
||||||
<select id="type" name="type" value={publisher.type} onChange={handleChange} className="textbox" placeholder="Type" autoFocus >
|
<select id="type" name="type" value={publisher.type} onChange={handleChange} className="textbox" placeholder="Type" autoFocus >
|
||||||
@ -307,7 +305,6 @@ export default function PublisherForm({ item, me }) {
|
|||||||
{/* Add other roles as needed */}
|
{/* Add other roles as needed */}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
{/* ---------------------------- Actions --------------------------------- */}
|
{/* ---------------------------- Actions --------------------------------- */}
|
||||||
|
Reference in New Issue
Block a user