renames
This commit is contained in:
@ -40,7 +40,7 @@ class ExampleForm extends React.Component {
|
||||
}
|
||||
|
||||
const [item, set] = useState({
|
||||
isactive: true,
|
||||
isActive: true,
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
@ -63,7 +63,7 @@ class ExampleForm extends React.Component {
|
||||
|
||||
|
||||
handleChange = ({ target }) => {
|
||||
if (target.name === "isactive") {
|
||||
if (target.name === "isActive") {
|
||||
set({ ...item, [target.name]: target.checked });
|
||||
} else if (target.name === "age") {
|
||||
set({ ...item, [target.name]: parseInt(target.value) });
|
||||
@ -100,8 +100,8 @@ class ExampleForm extends React.Component {
|
||||
<h3>{router.query?.id ? "Редактирай" : "Създай"} Item </h3>
|
||||
<div className="mb-4">
|
||||
<div className="form-check">
|
||||
<input className="checkbox" type="checkbox" id="isactive" name="isactive" onChange={handleChange} checked={item.isactive} autoComplete="off" />
|
||||
<label className="label" htmlFor="isactive">
|
||||
<input className="checkbox" type="checkbox" id="isActive" name="isActive" onChange={handleChange} checked={item.isActive} autoComplete="off" />
|
||||
<label className="label" htmlFor="isActive">
|
||||
Is Active</label>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,7 +39,7 @@ export default function AvailabilityForm({ publisherId, existingItems, inline, o
|
||||
dayOfMonth: null,
|
||||
// startTime: "08:00",
|
||||
// endTime: "20:00",
|
||||
isactive: true,
|
||||
isActive: true,
|
||||
repeatWeekly: false,
|
||||
endDate: null,
|
||||
isFirst: false,
|
||||
|
@ -36,7 +36,7 @@ model Availability {
|
||||
weekOfMonth Int?
|
||||
startTime DateTime
|
||||
endTime DateTime
|
||||
isactive Boolean @default(true)
|
||||
isActive Boolean @default(true)
|
||||
type AvailabilityType @default(Weekly)
|
||||
isWithTransport Boolean @default(false)
|
||||
isFromPreviousAssignment Boolean @default(false)
|
||||
@ -69,7 +69,7 @@ export default function AvailabilityForm({ publisherId, existingItem, inline, on
|
||||
dayOfMonth: null,
|
||||
startTime: "08:00",
|
||||
endTime: "20:00",
|
||||
isactive: true,
|
||||
isActive: true,
|
||||
repeatWeekly: false,
|
||||
endDate: null,
|
||||
});
|
||||
@ -554,11 +554,11 @@ export default function AvailabilityForm({ publisherId, existingItem, inline, on
|
||||
|
||||
<div className="mb-2 hidden">
|
||||
<div className="form-check">
|
||||
<input className="checkbox form-input" type="checkbox" id="isactive" name="isactive" onChange={handleChange} checked={availability.isactive} autoComplete="off" />
|
||||
<label className="label" htmlFor="isactive">активно</label>
|
||||
<input className="checkbox form-input" type="checkbox" id="isActive" name="isActive" onChange={handleChange} checked={availability.isActive} autoComplete="off" />
|
||||
<label className="label" htmlFor="isActive">активно</label>
|
||||
</div>
|
||||
</div>
|
||||
{/* <input type="hidden" name="isactive" value={availability.isactive} /> */}
|
||||
{/* <input type="hidden" name="isActive" value={availability.isActive} /> */}
|
||||
|
||||
<div className="panel-actions">
|
||||
<button className="action-button" onClick={() => handleCompletion()}> Отмени </button>
|
||||
|
@ -56,7 +56,7 @@ export default function AvailabilityList({ publisher, showNew }) {
|
||||
</thead>
|
||||
<tbody>
|
||||
{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' : ''}`}>
|
||||
<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))}`}
|
||||
{/* {common.getDateFormated(new Date(item.startTime))} */}
|
||||
|
@ -70,7 +70,7 @@ function ShiftComponent({ shift, onShiftSelect, isSelected, onPublisherSelect, a
|
||||
const newAssignment = {
|
||||
publisher: { connect: { id: publisher.id } },
|
||||
shift: { connect: { id: shiftId } },
|
||||
//isactive: true,
|
||||
//isActive: true,
|
||||
isConfirmed: true,
|
||||
};
|
||||
const { data } = await axiosInstance.post("/api/data/assignments", newAssignment);
|
||||
|
@ -206,7 +206,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
|
||||
// startTime: start,
|
||||
// endTime: end,
|
||||
// dayOfMonth: start.getDate(),
|
||||
// isactive: true,
|
||||
// isActive: true,
|
||||
// publisherId: publisherId,
|
||||
// // Add any other initial values needed
|
||||
// //set dayOfMonth to null, so that we repeat the availability every week
|
||||
@ -273,9 +273,9 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
|
||||
//if event.type is availability show in blue. if it is schedule - green if confirmed, yellow if not confirmed
|
||||
//if event is not active - show in gray
|
||||
let bgColorClass = 'bg-gray-500'; // Default color for inactive events
|
||||
var bgColor = event.isactive ? "" : "bg-gray-500";
|
||||
var bgColor = event.isActive ? "" : "bg-gray-500";
|
||||
if (event.type === "assignment") {
|
||||
bgColor = event.isTentative ? "bg-red-500" : (event.isConfirmed ? "bg-green-500" : "bg-yellow-500");
|
||||
bgColor = event.isBySystem ? "bg-red-500" : (event.isConfirmed ? "bg-green-500" : "bg-yellow-500");
|
||||
|
||||
//event.title = event.publisher.name; //ToDo: add other publishers names
|
||||
//event.title = common.getTimeFomatted(event.startTime) + " - " + common.getTimeFomatted(event.endTime);
|
||||
@ -319,7 +319,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
|
||||
toast.info("Потвърдено!", { autoClose: 2000 });
|
||||
// Update the event data
|
||||
event.isConfirmed = true;
|
||||
event.isTentative = false;
|
||||
event.isBySystem = false;
|
||||
// Update the events array by first removing the old event and then adding the updated one
|
||||
setEvents(currentEvents => {
|
||||
const filteredEvents = currentEvents.filter(e => e.id !== event.id);
|
||||
@ -328,7 +328,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
|
||||
//store the updated event in the database
|
||||
var assignment = {
|
||||
isConfirmed: true,
|
||||
isTentative: false
|
||||
isBySystem: false
|
||||
};
|
||||
axiosInstance.put('/api/data/assignments/' + event.id, assignment)
|
||||
.then((response) => {
|
||||
@ -388,7 +388,7 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
|
||||
// orange-500 from Tailwind CSS
|
||||
backgroundColor = '#f56565';
|
||||
}
|
||||
if (event.isactive) {
|
||||
if (event.isActive) {
|
||||
switch (event.type) {
|
||||
case 'assignment':
|
||||
backgroundColor = event.isConfirmed ? '#48bb78' : '#f6e05e'; // green-500 and yellow-300 from Tailwind CSS
|
||||
|
@ -15,7 +15,7 @@ model CartEvent {
|
||||
shiftDuration Int
|
||||
shifts Shift[]
|
||||
dayofweek DayOfWeek
|
||||
isactive Boolean @default(true)
|
||||
isActive Boolean @default(true)
|
||||
}*/
|
||||
interface Location {
|
||||
id: number;
|
||||
@ -174,8 +174,8 @@ export default function CartEventForm(props: IProps) {
|
||||
|
||||
<div className="mb-4">
|
||||
<div className="form-check">
|
||||
<input className="checkbox" type="checkbox" name="isactive" id="isactive" checked={evt.isactive} onChange={handleChange} />
|
||||
<label className='label align-text-bottom' htmlFor="isactive">Active</label>
|
||||
<input className="checkbox" type="checkbox" name="isActive" id="isActive" checked={evt.isActive} onChange={handleChange} />
|
||||
<label className='label align-text-bottom' htmlFor="isActive">Active</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="panel-actions">
|
||||
|
@ -28,11 +28,11 @@ export default function LocationCard({ location }) {
|
||||
<>
|
||||
<div
|
||||
id={`location-card-${location.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 cursor-pointer ${location.isactive ? 'text-gray-900 dark:text-white font-bold' : 'text-gray-400 dark:text-gray-600'}`}
|
||||
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 cursor-pointer ${location.isActive ? 'text-gray-900 dark:text-white font-bold' : 'text-gray-400 dark:text-gray-600'}`}
|
||||
onClick={() => router.push(`/cart/locations/edit/${location.id}`)}
|
||||
>
|
||||
<h5 className={`mb-2 text-2xl tracking-tight`}>
|
||||
{location.name} ({location.isactive ? "active" : "inactive"})
|
||||
{location.name} ({location.isActive ? "active" : "inactive"})
|
||||
</h5>
|
||||
<p className="font-normal text-gray-700 dark:text-gray-200">
|
||||
{location.address}
|
||||
|
@ -19,7 +19,7 @@ const common = require('src/helpers/common');
|
||||
// id Int @id @default(autoincrement())
|
||||
// name String
|
||||
// address String
|
||||
// isactive Boolean @default(true)
|
||||
// isActive Boolean @default(true)
|
||||
// content String? @db.Text
|
||||
// cartEvents CartEvent[]
|
||||
// reports Report[]
|
||||
@ -65,7 +65,7 @@ export default function LocationForm() {
|
||||
const [location, set] = useState({
|
||||
name: "",
|
||||
address: "",
|
||||
isactive: true,
|
||||
isActive: true,
|
||||
});
|
||||
|
||||
// const [isEdit, setIsEdit] = useState(false);
|
||||
@ -171,11 +171,11 @@ export default function LocationForm() {
|
||||
<input className="textbox"
|
||||
placeholder="address" id="address" name="address" onChange={handleChange} value={location.address} autoComplete="off" />
|
||||
</div>
|
||||
{/* UI for Location.isactive */}
|
||||
{/* UI for Location.isActive */}
|
||||
<div className="mb-4">
|
||||
<div className="form-check">
|
||||
<input className="checkbox form-input" type="checkbox" id="isactive" name="isactive" onChange={handleChange} checked={location.isactive} autoComplete="off" />
|
||||
<label className="label" htmlFor="isactive">Активна</label>
|
||||
<input className="checkbox form-input" type="checkbox" id="isActive" name="isActive" onChange={handleChange} checked={location.isActive} autoComplete="off" />
|
||||
<label className="label" htmlFor="isActive">Активна</label>
|
||||
</div>
|
||||
</div>
|
||||
{/* backupLocation */}
|
||||
|
@ -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>
|
||||
|
@ -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" />
|
||||
|
@ -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) {
|
||||
|
@ -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", {
|
||||
|
@ -99,7 +99,7 @@ export default function Sidebar({ isSidebarOpen, toggleSidebar }) {
|
||||
try {
|
||||
const response = await axiosInstance.get('/api/data/locations'); // Adjust the API endpoint as needed
|
||||
const locationsData = response.data
|
||||
.filter(location => location.isactive === true)
|
||||
.filter(location => location.isActive === true)
|
||||
.map(location => ({
|
||||
text: location.name,
|
||||
url: `/cart/locations/${location.id}`,
|
||||
|
Reference in New Issue
Block a user