статистика промокода(без кодвордов, почищено)
This commit is contained in:
parent
56f1a2f7ab
commit
eb6cd2face
@ -2,10 +2,9 @@ import {Button, Table, TableBody, TableCell, TableHead, TableRow, Typography, us
|
||||
import {AdapterMoment} from "@mui/x-date-pickers/AdapterMoment";
|
||||
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
|
||||
import DateFilter from "@pages/dashboard/Content/QuizStatistic/dateFilter";
|
||||
import {useEffect, useState} from "react";
|
||||
import {useState} from "react";
|
||||
import moment, {Moment} from "moment";
|
||||
import {usePromocodeStatistic} from "@root/utils/hooks/usePromocodeStatistic";
|
||||
import {promocodeApi} from "@root/api/promocode/requests";
|
||||
import {useAllPromocodes} from "@root/api/promocode/swr";
|
||||
|
||||
export default function StstisticPromocode() {
|
||||
@ -16,19 +15,9 @@ export default function StstisticPromocode() {
|
||||
|
||||
const statisticPromo = usePromocodeStatistic({to, from})
|
||||
|
||||
for (statisticPromo.key in statisticPromo) {
|
||||
const codewordSearch = promocodes.find(obj => obj.id === statisticPromo.key)
|
||||
let codeword = codewordSearch?.codeword
|
||||
console.log( "xnj 'nj", codeword)
|
||||
}
|
||||
|
||||
|
||||
return(
|
||||
<LocalizationProvider dateAdapter={AdapterMoment}>
|
||||
<Typography>Статистика промокодов</Typography>
|
||||
<Button
|
||||
onClick={async()=> promocodeApi.getAllPromocodes()}
|
||||
>promocodeList</Button>
|
||||
<DateFilter from={from} to={to} setFrom={setFrom} setTo={setTo}/>
|
||||
<Table
|
||||
sx={{
|
||||
@ -53,16 +42,15 @@ export default function StstisticPromocode() {
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
|
||||
{Object.values(statisticPromo).map((sPromo:any)=> {
|
||||
{Object.values(statisticPromo || {}).map((sPromo:any)=> {
|
||||
let codeword
|
||||
let listPromo = promocodes
|
||||
let statisticP = statisticPromo
|
||||
console.log("in map", sPromo.key)
|
||||
|
||||
for (statisticP.key in statisticP) {
|
||||
const codewordSearch = listPromo.find(obj => obj.id === statisticP.key)
|
||||
for (let key in statisticP) {
|
||||
const codewordSearch = listPromo.find(obj => obj.id === key)
|
||||
codeword = codewordSearch?.codeword
|
||||
console.log(codeword)
|
||||
// console.log(codeword)
|
||||
}
|
||||
|
||||
return(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user