правка верстки тарифов, порядок тарифов
This commit is contained in:
parent
a331d14445
commit
dc102ea323
@ -58,7 +58,7 @@ export default function Analytics() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (quizes.length > 0) {
|
if (quizes.length > 0) {
|
||||||
const quiz = quizes.find((q) => q.backendId === editQuizId);
|
const quiz = quizes.find((q) => q.backendId === editQuizId);
|
||||||
if (quiz === undefined) throw new Error("Не удалось получить квиз")
|
if (quiz === undefined) throw new Error("Не удалось получить квиз");
|
||||||
setQuiz(quiz);
|
setQuiz(quiz);
|
||||||
setFrom(moment(new Date(quiz.created_at)));
|
setFrom(moment(new Date(quiz.created_at)));
|
||||||
}
|
}
|
||||||
@ -68,10 +68,8 @@ export default function Analytics() {
|
|||||||
const getData = async (): Promise<void> => {
|
const getData = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
if (editQuizId !== null) {
|
if (editQuizId !== null) {
|
||||||
|
|
||||||
const gottenQuizes = await quizApi.getList();
|
const gottenQuizes = await quizApi.getList();
|
||||||
setQuizes(gottenQuizes)
|
setQuizes(gottenQuizes);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Не удалось получить квизы", error);
|
console.error("Не удалось получить квизы", error);
|
||||||
|
@ -24,13 +24,13 @@ const COLORS: Record<number, string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const dateParser = (object: Record<string, number>): Record<string, number> => {
|
const dateParser = (object: Record<string, number>): Record<string, number> => {
|
||||||
const result = {} as Record<string, number>
|
const result = {} as Record<string, number>;
|
||||||
for (var key in object) {
|
for (var key in object) {
|
||||||
result[moment.utc(Number(key)*1000).format('DD/MM/YYYY')] = object[key]
|
result[moment.utc(Number(key) * 1000).format("DD/MM/YYYY")] = object[key];
|
||||||
console.log(result)
|
console.log(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
};
|
||||||
|
|
||||||
const GeneralItem = ({
|
const GeneralItem = ({
|
||||||
title,
|
title,
|
||||||
@ -45,9 +45,9 @@ const GeneralItem = ({
|
|||||||
numberType === "sum"
|
numberType === "sum"
|
||||||
? Object.values(general).reduce((total, item) => total + item, 0)
|
? Object.values(general).reduce((total, item) => total + item, 0)
|
||||||
: Object.entries(general).reduce(
|
: Object.entries(general).reduce(
|
||||||
(total, [key, value]) => total + (value / Number(key)) * 100,
|
(total, [key, value]) => total + (value / Number(key)) * 100,
|
||||||
0,
|
0,
|
||||||
) / Object.keys(general).length || Number(0);
|
) / Object.keys(general).length || Number(0);
|
||||||
return (
|
return (
|
||||||
<Paper
|
<Paper
|
||||||
sx={{
|
sx={{
|
||||||
@ -61,7 +61,13 @@ const GeneralItem = ({
|
|||||||
{numberType === "sum" ? numberValue : `${numberValue.toFixed()}%`}
|
{numberType === "sum" ? numberValue : `${numberValue.toFixed()}%`}
|
||||||
</Typography>
|
</Typography>
|
||||||
<LineChart
|
<LineChart
|
||||||
xAxis={[{ data: Object.keys(general), valueFormatter: (value) => moment.utc(Number(value)*1000).format('DD/MM/YYYY') }]}
|
xAxis={[
|
||||||
|
{
|
||||||
|
data: Object.keys(general),
|
||||||
|
valueFormatter: (value) =>
|
||||||
|
moment.utc(Number(value) * 1000).format("DD/MM/YYYY"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
series={[{ data: Object.values(general) }]}
|
series={[{ data: Object.values(general) }]}
|
||||||
height={220}
|
height={220}
|
||||||
colors={[color]}
|
colors={[color]}
|
||||||
|
@ -4,8 +4,8 @@ import { CustomTab } from "./CustomTab";
|
|||||||
type TabsProps = {
|
type TabsProps = {
|
||||||
names: string[];
|
names: string[];
|
||||||
items: string[];
|
items: string[];
|
||||||
selectedItem: "count" | "day" | "dop";
|
selectedItem: "day" | "count" | "dop";
|
||||||
setSelectedItem: (num: "count" | "day" | "dop") => void;
|
setSelectedItem: (num: "day" | "count" | "dop") => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Tabs = ({
|
export const Tabs = ({
|
||||||
@ -18,7 +18,7 @@ export const Tabs = ({
|
|||||||
sx={{ m: "25px" }}
|
sx={{ m: "25px" }}
|
||||||
TabIndicatorProps={{ sx: { display: "none" } }}
|
TabIndicatorProps={{ sx: { display: "none" } }}
|
||||||
value={selectedItem}
|
value={selectedItem}
|
||||||
onChange={(event, newValue: "count" | "day" | "dop") => {
|
onChange={(event, newValue: "day" | "count" | "dop") => {
|
||||||
setSelectedItem(newValue);
|
setSelectedItem(newValue);
|
||||||
}}
|
}}
|
||||||
variant="scrollable"
|
variant="scrollable"
|
||||||
|
@ -32,8 +32,8 @@ import { createTariffElements } from "./tariffsUtils/createTariffElements";
|
|||||||
import { currencyFormatter } from "./tariffsUtils/currencyFormatter";
|
import { currencyFormatter } from "./tariffsUtils/currencyFormatter";
|
||||||
|
|
||||||
const StepperText: Record<string, string> = {
|
const StepperText: Record<string, string> = {
|
||||||
count: "Тарифы на объём",
|
|
||||||
day: "Тарифы на время",
|
day: "Тарифы на время",
|
||||||
|
count: "Тарифы на объём",
|
||||||
dop: "Доп. услуги",
|
dop: "Доп. услуги",
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,7 +50,9 @@ function TariffPage() {
|
|||||||
const [discounts, setDiscounts] = useState();
|
const [discounts, setDiscounts] = useState();
|
||||||
const [openModal, setOpenModal] = useState({});
|
const [openModal, setOpenModal] = useState({});
|
||||||
const [cash, setCash] = useState("0");
|
const [cash, setCash] = useState("0");
|
||||||
const [selectedItem, setSelectedItem] = useState<"count" | "day">("count");
|
const [selectedItem, setSelectedItem] = useState<"count" | "day" | "dop">(
|
||||||
|
"day",
|
||||||
|
);
|
||||||
const { isTestServer } = useDomainDefine();
|
const { isTestServer } = useDomainDefine();
|
||||||
const [promocodeField, setPromocodeField] = useState<string>("");
|
const [promocodeField, setPromocodeField] = useState<string>("");
|
||||||
|
|
||||||
@ -297,7 +299,6 @@ function TariffPage() {
|
|||||||
justifyContent: "left",
|
justifyContent: "left",
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gap: "40px",
|
gap: "40px",
|
||||||
p: "20px",
|
|
||||||
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${
|
gridTemplateColumns: `repeat(auto-fit, minmax(300px, ${
|
||||||
isTablet ? "436px" : "360px"
|
isTablet ? "436px" : "360px"
|
||||||
}))`,
|
}))`,
|
||||||
|
Loading…
Reference in New Issue
Block a user