upd
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
VITE_API_URL=http://localhost:3001
|
||||
# VITE_API_URL=https://crm.stream.graff.tech/api
|
||||
VITE_STREAM_URL=https://stream.graff.tech
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -43,7 +43,7 @@ function Card({
|
||||
async function getAvailableManagers() {
|
||||
const result: any[] = await api
|
||||
.get(
|
||||
`companies/${companyId}/builds/${buildId}/scheduled_sessions/${scheduledSessionId}/availableManagers?startAt=${scheduleSessionStartAt}`
|
||||
`companies/${companyId}/builds/${buildId}/scheduledSessions/${scheduledSessionId}/availableManagers?startAt=${scheduleSessionStartAt}`
|
||||
)
|
||||
.json();
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ interface InputProps {
|
||||
required?: boolean;
|
||||
readOnly?: boolean;
|
||||
className?: string;
|
||||
autoComplete?: string;
|
||||
handleChange?: (value: string) => void;
|
||||
handleFocus?: () => void;
|
||||
}
|
||||
@@ -21,6 +22,7 @@ function Input({
|
||||
required,
|
||||
readOnly,
|
||||
className,
|
||||
autoComplete,
|
||||
handleChange,
|
||||
handleFocus,
|
||||
}: InputProps) {
|
||||
@@ -31,6 +33,7 @@ function Input({
|
||||
|
||||
return (
|
||||
<input
|
||||
autoComplete={autoComplete}
|
||||
ref={type === "tel" ? inputRef : undefined}
|
||||
type={type}
|
||||
placeholder={placeholder}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import useAuthStore from "../stores/useAuthStore";
|
||||
import useModalStore from "../stores/useModalStore";
|
||||
import useSettingsStore from "../stores/useSettingsStore";
|
||||
import useStore from "../stores/useStore";
|
||||
import Button from "./Button";
|
||||
import ChevronDownIcon from "./icons/ChevronDownIcon";
|
||||
import ChevronUpIcon from "./icons/ChevronUpIcon";
|
||||
import MoreIcon from "./icons/MoreIcon";
|
||||
// import MoreIcon from "./icons/MoreIcon";
|
||||
import AddManagerModal from "./modals/AddManagerModal";
|
||||
|
||||
function Managers() {
|
||||
const { user } = useAuthStore();
|
||||
const { managers } = useStore();
|
||||
const { isShowManagers, setIsShowManagers } = useSettingsStore();
|
||||
const { setModal } = useModalStore();
|
||||
|
||||
return (
|
||||
<div className="p-4 flex flex-col gap-4 border-b border-[#DAE0E5]">
|
||||
@@ -34,19 +37,23 @@ function Managers() {
|
||||
</div>
|
||||
<p className="text-sm">{manager.name}</p>
|
||||
</div>
|
||||
{user?.role === "admin" && (
|
||||
{/* {user?.role === "admin" && (
|
||||
<Button
|
||||
disabled
|
||||
variant="tertiary"
|
||||
onlyIcon
|
||||
icon={<MoreIcon />}
|
||||
/>
|
||||
)}
|
||||
)} */}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{user?.role === "admin" && (
|
||||
<Button disabled variant="secondary" widthFull>
|
||||
<Button
|
||||
variant="secondary"
|
||||
widthFull
|
||||
onClick={() => setModal(<AddManagerModal />)}
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { Transition } from "react-transition-group";
|
||||
import useModalStore from "../stores/useModalStore";
|
||||
import { useEffect } from "react";
|
||||
|
||||
function ModalContainer() {
|
||||
const [modal, setModal] = useModalStore((state) => [
|
||||
@@ -7,6 +9,20 @@ function ModalContainer() {
|
||||
state.setModal,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
function handleKeyUp(e: KeyboardEvent) {
|
||||
if (e.key === "Escape") {
|
||||
setModal(null);
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("keyup", handleKeyUp);
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("keyup", handleKeyUp);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Transition
|
||||
in={modal ? true : false}
|
||||
@@ -16,12 +32,9 @@ function ModalContainer() {
|
||||
>
|
||||
{(state) => (
|
||||
<div
|
||||
onClick={() => setModal(null)}
|
||||
className={`min-h-screen p-8 absolute z-20 top-0 left-0 w-full flex justify-center items-center bg-black bg-opacity-30 overflow-auto cursor-pointer transition-opacity ${state}`}
|
||||
className={`min-h-screen p-8 absolute z-20 top-0 left-0 w-full flex justify-center items-center bg-black bg-opacity-30 overflow-auto transition-opacity ${state}`}
|
||||
>
|
||||
<div onClick={(e) => e.stopPropagation()} className="cursor-default">
|
||||
{modal}
|
||||
</div>
|
||||
{modal}
|
||||
</div>
|
||||
)}
|
||||
</Transition>
|
||||
|
||||
@@ -91,7 +91,7 @@ function Schedule({ selectedDay, slots, events }: Props) {
|
||||
|
||||
try {
|
||||
const result: any = await api
|
||||
.post(`scheduled_sessions`, {
|
||||
.post(`scheduledSessions`, {
|
||||
json: {
|
||||
companyId: company!.id,
|
||||
buildId: selectedBuild?.id,
|
||||
|
||||
@@ -62,7 +62,7 @@ function AddManagerModal() {
|
||||
return (
|
||||
<div className="bg-white rounded-lg w-[400px]">
|
||||
<div className="border-b border-[#DAE0E5] flex items-center justify-between pl-6 pr-2">
|
||||
<ModalTabButton active>Добавить сотрудника</ModalTabButton>
|
||||
<ModalTabButton active>Новый сотрудник</ModalTabButton>
|
||||
<Button
|
||||
variant="tertiary"
|
||||
icon={<CloseIcon />}
|
||||
@@ -73,7 +73,7 @@ function AddManagerModal() {
|
||||
<form onSubmit={handleSubmitAddManager}>
|
||||
<div className="border-b border-[#DAE0E5] p-6 space-y-4">
|
||||
<p className="text-sm text-[#77828C]">
|
||||
Информация для входа будет отправлена на почтовый адрес
|
||||
Информация для входа будет отправлена на указанный почтовый адрес
|
||||
</p>
|
||||
<div className="space-y-1">
|
||||
<Label value="Email*" />
|
||||
|
||||
@@ -46,7 +46,15 @@ function CompanyModal() {
|
||||
{selectedTab === "company" && (
|
||||
<div>
|
||||
<div className="flex gap-6 p-6 border-b border-[#DAE0E5]">
|
||||
<div className="min-w-[88px] min-h-[88px] w-[88px] h-[88px] bg-[#E6ECF2] rounded-full"></div>
|
||||
<div className="min-w-[88px] min-h-[88px] w-[88px] h-[88px] bg-[#E6ECF2] rounded-full">
|
||||
{company?.avatar && (
|
||||
<img
|
||||
src={`/images/companies/${company.avatar}`}
|
||||
alt=""
|
||||
className="pointer-events-none"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="w-full space-y-6">
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div className="space-y-4">
|
||||
@@ -58,11 +66,11 @@ function CompanyModal() {
|
||||
<DataField label="Адрес" value={company?.address} copyIcon />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{/* <div>
|
||||
<a href="#" className="text-[#49A1F5] text-xs">
|
||||
Сообщить о проблеме
|
||||
</a>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="p-6 space-y-4">
|
||||
@@ -131,7 +139,10 @@ function CompanyModal() {
|
||||
</div>
|
||||
{user?.role === "admin" && (
|
||||
<div className="px-6 py-4">
|
||||
<Button onClick={() => setModal(<AddManagerModal />)}>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => setModal(<AddManagerModal />)}
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,7 @@ function CreateScheduledSessionModal({ buildId, startAt, duration }: Props) {
|
||||
|
||||
try {
|
||||
await api
|
||||
.post(`scheduled_sessions`, {
|
||||
.post(`scheduledSessions`, {
|
||||
json: {
|
||||
buildId,
|
||||
startAt,
|
||||
|
||||
@@ -94,7 +94,7 @@ function CreateUserModal({ companyId }: Props) {
|
||||
|
||||
return (
|
||||
<div className="p-8 space-y-4 bg-white rounded-xl">
|
||||
<p className="text-xl font-semibold">Создание пользователя</p>
|
||||
<p className="text-xl font-semibold">Новый пользователь</p>
|
||||
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
|
||||
<Input
|
||||
placeholder="Имя Фамилия"
|
||||
@@ -110,6 +110,7 @@ function CreateUserModal({ companyId }: Props) {
|
||||
required
|
||||
/>
|
||||
<Input
|
||||
autoComplete="new-password"
|
||||
type="password"
|
||||
placeholder="Пароль"
|
||||
className="w-64"
|
||||
|
||||
@@ -137,7 +137,7 @@ function AdminCompanyPage() {
|
||||
users.map((user) => (
|
||||
<div
|
||||
key={user.id}
|
||||
className="flex justify-between gap-4 p-4 rounded-lg shadow"
|
||||
className="flex items-start justify-between gap-4 p-4 rounded-lg shadow"
|
||||
>
|
||||
<div className="flex gap-4">
|
||||
<img
|
||||
@@ -162,7 +162,7 @@ function AdminCompanyPage() {
|
||||
|
||||
<Button
|
||||
variant="secondary"
|
||||
icon={<MoreIcon />}
|
||||
icon={<MoreIcon className="w-5 h-5" />}
|
||||
onlyIcon
|
||||
onClick={() =>
|
||||
companyId &&
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { format, addDays, subDays } from "date-fns";
|
||||
import { format, addDays, subDays, startOfDay, endOfDay } from "date-fns";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import api from "../utils/api";
|
||||
import { ru } from "date-fns/locale";
|
||||
@@ -109,7 +109,6 @@ function DashboardPage() {
|
||||
|
||||
async function getScheduledSessions(useLoader?: boolean) {
|
||||
if (!company) {
|
||||
// console.log("No ScheduledSessions");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,9 +117,9 @@ function DashboardPage() {
|
||||
try {
|
||||
const result: any = await api
|
||||
.get(
|
||||
`companies/${
|
||||
company.id
|
||||
}/scheduled_sessions?date=${selectedDay.toISOString()}`
|
||||
`companies/${company.id}/scheduledSessions?startDate=${startOfDay(
|
||||
selectedDay
|
||||
).toISOString()}&endDate=${endOfDay(selectedDay).toISOString()}`
|
||||
)
|
||||
.json();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user