Tạo trang Test report
This commit is contained in:
parent
fb32244185
commit
17a273ac61
|
|
@ -1,7 +1,3 @@
|
|||
import { createOrUpdateUser } from '@/api/Admin'
|
||||
import { post } from '@/rtk/helpers/apiService'
|
||||
import { update } from '@/rtk/helpers/CRUD'
|
||||
import { TUser } from '@/variables/types'
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
|
|
@ -10,18 +6,14 @@ import {
|
|||
Text,
|
||||
Title
|
||||
} from '@mantine/core'
|
||||
import { useForm } from '@mantine/form'
|
||||
import { notifications } from '@mantine/notifications'
|
||||
import { useEffect, useState } from 'react'
|
||||
import classes from './SprintReview.module.css'
|
||||
|
||||
const SprintReview = () => {
|
||||
// const [users, setUsers] = useState<TUser[]>([])
|
||||
const [action, setAction] = useState('')
|
||||
const [activeBtn, setActiveBtn] = useState(false)
|
||||
// const [item, setItem] = useState({ id: 0 })
|
||||
const [disableBtn, setDisableBtn] = useState(false)
|
||||
const [info, setInfo] = useState('')
|
||||
// const [action, setAction] = useState('')
|
||||
// const [info, setInfo] = useState('')
|
||||
const [filter, setFilter] = useState({
|
||||
typeReason: '',
|
||||
statusFilter: '',
|
||||
|
|
@ -62,14 +54,14 @@ const SprintReview = () => {
|
|||
// fetchData()
|
||||
// }, [])
|
||||
|
||||
const form = useForm({
|
||||
initialValues: {
|
||||
id: 0,
|
||||
name: '',
|
||||
email: '',
|
||||
permission: '',
|
||||
},
|
||||
})
|
||||
// const form = useForm({
|
||||
// initialValues: {
|
||||
// id: 0,
|
||||
// name: '',
|
||||
// email: '',
|
||||
// permission: '',
|
||||
// },
|
||||
// })
|
||||
|
||||
// const getAll = async () => {
|
||||
// try {
|
||||
|
|
@ -82,36 +74,36 @@ const SprintReview = () => {
|
|||
// }
|
||||
// }
|
||||
|
||||
const handleCreate = async (values: TUser) => {
|
||||
try {
|
||||
const { id, ...data } = values
|
||||
const res = await post(createOrUpdateUser, data)
|
||||
if (res.status === true) {
|
||||
setAction('review')
|
||||
form.reset()
|
||||
// getAll()
|
||||
setInfo(JSON.stringify(res.data, null, 2))
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
// const handleCreate = async (values: TUser) => {
|
||||
// try {
|
||||
// const { id, ...data } = values
|
||||
// const res = await post(createOrUpdateUser, data)
|
||||
// if (res.status === true) {
|
||||
// // setAction('review')
|
||||
// form.reset()
|
||||
// // getAll()
|
||||
// // setInfo(JSON.stringify(res.data, null, 2))
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.log(error)
|
||||
// }
|
||||
// }
|
||||
|
||||
const handleUpdate = async (values: TUser) => {
|
||||
try {
|
||||
const res = await update(
|
||||
createOrUpdateUser,
|
||||
values,
|
||||
// , getAll
|
||||
)
|
||||
if (res === true) {
|
||||
setAction('')
|
||||
form.reset()
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
// const handleUpdate = async (values: TUser) => {
|
||||
// try {
|
||||
// const res = await update(
|
||||
// createOrUpdateUser,
|
||||
// values,
|
||||
// // , getAll
|
||||
// )
|
||||
// if (res === true) {
|
||||
// // setAction('')
|
||||
// form.reset()
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.log(error)
|
||||
// }
|
||||
// }
|
||||
|
||||
// const handleDelete = async (id: number) => {
|
||||
// try {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,10 @@
|
|||
import { createOrUpdateUser, deleteUser } from '@/api/Admin'
|
||||
import { ButtonCopy } from '@/components/CopyClipboard/CopyClipboard'
|
||||
import { post } from '@/rtk/helpers/apiService'
|
||||
import { update, Xdelete } from '@/rtk/helpers/CRUD'
|
||||
import { TUser } from '@/variables/types'
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Code,
|
||||
Dialog,
|
||||
Group,
|
||||
Modal,
|
||||
MultiSelect,
|
||||
Select,
|
||||
Table,
|
||||
Text,
|
||||
|
|
@ -19,10 +13,9 @@ import {
|
|||
Title,
|
||||
} from '@mantine/core'
|
||||
import { useForm } from '@mantine/form'
|
||||
import { IconInfoSquare, IconSquareXFilled } from '@tabler/icons-react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import classes from './TestReport.module.css'
|
||||
import { IconCheckbox, IconInfoSquare } from '@tabler/icons-react'
|
||||
import { IconSquareXFilled } from '@tabler/icons-react'
|
||||
|
||||
const TestReport = () => {
|
||||
// const [users, setUsers] = useState<TUser[]>([])
|
||||
|
|
@ -30,7 +23,7 @@ const TestReport = () => {
|
|||
const [activeBtn, setActiveBtn] = useState(false)
|
||||
// const [item, setItem] = useState({ id: 0 })
|
||||
const [disableBtn, setDisableBtn] = useState(false)
|
||||
const [info, setInfo] = useState('')
|
||||
// const [info, setInfo] = useState('')
|
||||
const [filter, setFilter] = useState({
|
||||
typeReason: '',
|
||||
statusFilter: '',
|
||||
|
|
@ -110,6 +103,11 @@ const TestReport = () => {
|
|||
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
const data = {
|
||||
id: id,
|
||||
}
|
||||
console.log(data, 'data')
|
||||
|
||||
// await Xdelete(
|
||||
// deleteUser,
|
||||
// { id: id },
|
||||
|
|
@ -124,14 +122,6 @@ const TestReport = () => {
|
|||
// getAll()
|
||||
}, [])
|
||||
|
||||
const pointsOptions = [
|
||||
{ value: '1', label: '1' },
|
||||
{ value: '2', label: '2' },
|
||||
{ value: '3', label: '3' },
|
||||
{ value: '4', label: '4' },
|
||||
{ value: '5', label: '5' },
|
||||
]
|
||||
|
||||
const rowStyle = {
|
||||
height: '30px', // Điều chỉnh chiều cao hàng
|
||||
}
|
||||
|
|
@ -533,7 +523,7 @@ const TestReport = () => {
|
|||
variant="light"
|
||||
onClick={async () => {
|
||||
setActiveBtn(true)
|
||||
await handleDelete(0)
|
||||
await handleDelete(2)
|
||||
setActiveBtn(false)
|
||||
setAction('')
|
||||
}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue