Commit 1f6e62c9 by tdgiang

updtae code

parent d7db34b4
......@@ -346,10 +346,11 @@
"ERROR_UPDATE_FAIL_ERROR_PHONE_EXIST" :"Số điện thoại đã tồn tại",
"ERROR_UPDATE_FAIL_ERROR_EMAIL_EXIST" :"Email đã tồn tại",
"ERROR_UPDATE_FAIL_ERROR_USERNAME_EXIST" :"Tài khoản đã tồn tại.",
"ERROR_USERNAME_MISSING" :"Thiếu tài khoản"
"ERROR_USERNAME_MISSING" :"Thiếu tài khoản",
"ERROR_PERMISSION_IS_EXIST":"Nhóm quyền đã tồn tại",
"ERROR_CODE_IS_EXISTS":"Mã code đã tồn tại",
"ERROR_NAME_IS_EXISTS":"Tên sản phẩm đã tồn tại"
}
......@@ -128,7 +128,7 @@ export default function FormDialog({ onCreate }) {
return (
<>
<Tooltip title="Chuyển tiền đáo hạn">
<Tooltip title="Thêm mới vòi xăng">
<IconButton onClick={handleClickOpen}>
<Icon style={{ color: '#4caf50' }}>add_circle</Icon>
</IconButton>
......
......@@ -53,16 +53,29 @@ const ToolNotificate = (props) => {
}
}
const getData = async () => {
const getData = async (isInit) => {
try {
props.showLoading()
const res = await getListEmployees({
let res
if (isInit) {
setPageIndex(0)
res = await getListEmployees({
full_name: searchDebount,
page_no: 0,
page_size: pageSize,
status,
user_group_id: role,
})
} else {
res = await getListEmployees({
full_name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
status,
user_group_id: role,
})
}
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
const newList = res.data.data.data.map((e, i) => {
......@@ -84,15 +97,18 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [searchDebount, pageIndex, status, role])
getData(true)
}, [searchDebount, status, role])
useEffect(() => {
getData(false)
}, [pageIndex])
const removeItem = async (id) => {
props.showLoading()
const res = await deleteEmployee({ id })
props.hideLoading()
if (res.data.code == 200) {
getData()
getData(true)
toast.success('Xoá bản ghi thành công!', {
theme: 'colored',
})
......
......@@ -58,13 +58,25 @@ const ToolNotificate = (props) => {
}
}
const getData = async () => {
const getData = async (isInit) => {
props.showLoading()
const res = await getListFunction({
let res
if (isInit) {
setPageIndex(0)
res = await getListFunction({
name: searchDebount,
page_no: 0,
page_size: pageSize,
})
} else {
res = await getListFunction({
name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
})
}
props.hideLoading()
......@@ -89,8 +101,12 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [searchDebount, pageIndex])
getData(true)
}, [searchDebount])
useEffect(() => {
getData(false)
}, [pageIndex])
const removeItem = async (id) => {
props.showLoading()
......
......@@ -42,13 +42,23 @@ const ToolNotificate = (props) => {
}
}
const getData = async () => {
const getData = async (isInit) => {
props.showLoading()
const res = await getListGroups({
let res
if (isInit) {
setPageIndex(0)
res = await getListGroups({
name: searchDebount,
page_no: 0,
page_size: pageSize,
})
} else {
res = await getListGroups({
name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
})
}
props.hideLoading()
......@@ -73,15 +83,19 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [searchDebount, pageIndex])
getData(false)
}, [pageIndex])
useEffect(() => {
getData(true)
}, [searchDebount])
const removeItem = async (id) => {
props.showLoading()
const res = await deleteGroup({ id })
props.hideLoading()
if (res.data.code == 200) {
getData()
getData(true)
toast.success('Xoá bản ghi thành công!', {
theme: 'colored',
})
......
......@@ -51,14 +51,26 @@ const ToolNotificate = (props) => {
}
}
const getData = async () => {
const getData = async (isInit) => {
props.showLoading()
const res = await getListActions({
let res
if (isInit) {
setPageIndex(0)
res = await getListActions({
name: searchDebount,
page_no: 0,
page_size: pageSize,
function_id,
})
} else {
res = await getListActions({
name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
function_id,
})
}
props.hideLoading()
......@@ -83,8 +95,12 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [searchDebount, pageIndex, function_id])
getData(false)
}, [pageIndex])
useEffect(() => {
getData(true)
}, [searchDebount, function_id])
const removeItem = async (id) => {
props.showLoading()
......@@ -101,7 +117,7 @@ const ToolNotificate = (props) => {
history.push('/')
}, 100)
} else {
toast.error(t(res.data.error), {
toast.error('Bản ghi đã sử dụng, xoá hành động thất bại', {
theme: 'colored',
})
}
......
......@@ -20,7 +20,7 @@ const ToolNotificate = (props) => {
const { t } = useTranslation()
const [activeSelected, setActiveSeleted] = useState(null)
const [changeActive, setChangeActive] = useState(1)
const [status, setStatus] = useState()
const [pageIndex, setPageIndex] = useState(0)
const [pageSize] = useState(10)
const [totalRecords, setTotalRecord] = useState(0)
......@@ -61,6 +61,7 @@ const ToolNotificate = (props) => {
page_no: 0,
page_size: pageSize,
merchant_id: merchant,
status,
})
} else {
res = await getListGasStation({
......@@ -68,6 +69,7 @@ const ToolNotificate = (props) => {
page_no: pageIndex + 1,
page_size: pageSize,
merchant_id: merchant,
status,
})
}
......@@ -112,7 +114,7 @@ const ToolNotificate = (props) => {
useEffect(() => {
getData(true)
}, [searchDebount, merchant])
}, [searchDebount, merchant, status])
const removeItem = async (id) => {
props.showLoading()
......@@ -152,6 +154,8 @@ const ToolNotificate = (props) => {
listMerchant={listMerchant}
merchant={merchant}
setMerchant={setMerchant}
status={status}
setStatus={setStatus}
/>
)
}
......
......@@ -37,6 +37,12 @@ const columns = [
align: 'center',
minWidth: 50,
},
// {
// id: 'id',
// label: 'id',
// align: 'center',
// minWidth: 50,
// },
{
id: 'store_name',
......
......@@ -34,6 +34,8 @@ function CustomerView(props) {
merchant,
setMerchant,
listMerchant,
status,
setStatus,
} = props
const [age, setAge] = React.useState('')
const { user } = useAuth()
......@@ -87,6 +89,7 @@ function CustomerView(props) {
}}
/>
</Grid>
<Grid item lg={4} md={4} sm={6} xs={6}>
<FormControl variant="outlined" fullWidth>
<InputLabel htmlFor="outlined-age-native-simple">
......@@ -114,6 +117,41 @@ function CustomerView(props) {
</Select>
</FormControl>
</Grid>
<Grid item lg={4} md={4} sm={6} xs={6}>
<FormControl variant="outlined" fullWidth>
<InputLabel htmlFor="outlined-age-native-simple">
Trng thái
</InputLabel>
<Select
label="Trạng thái"
value={status}
onChange={(e) => setStatus(e.target.value)}
inputProps={{
name: 'age',
id: 'outlined-age-native-simple',
}}
>
<MenuItem value="">
<em>Tt c</em>
</MenuItem>
{[
{
id: 1,
name: 'Hoạt động',
},
{
id: 2,
name: 'Khoá',
},
].map((e) => (
<MenuItem value={e.id}>
{e.name}
</MenuItem>
))}
</Select>
</FormControl>
</Grid>
</Grid>
{checkRole(user, '/gas-station/create') ? (
<Link to="/gas-station/create">
......
......@@ -18,15 +18,28 @@ const ToolNotificate = (props) => {
const history = useHistory()
const [data, setData] = useState([])
const getData = async () => {
const getData = async (isInit) => {
props.showLoading()
const res = await getLogAction({
let res
if (isInit) {
setPageIndex(0)
res = await getLogAction({
search: txtSearch,
results,
functions,
page_no: 0,
page_size: pageSize,
})
} else {
res = await getLogAction({
search: txtSearch,
results,
functions,
page_no: pageIndex + 1,
page_size: pageSize,
})
}
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
......@@ -47,8 +60,11 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [txtSearch, pageIndex, functions, results])
getData(true)
}, [txtSearch, functions, results])
useEffect(() => {
getData(false)
}, [pageIndex])
return (
<LogAuth
......
......@@ -17,14 +17,27 @@ const ToolNotificate = (props) => {
const [data, setData] = useState([])
const getData = async () => {
const getData = async (isInit) => {
props.showLoading()
const res = await getLogApi({
let res
if (isInit) {
setPageIndex(0)
res = await getLogApi({
search: txtSearch,
applications,
page_no: 0,
page_size: pageSize,
})
} else {
res = await getLogApi({
search: txtSearch,
applications,
page_no: pageIndex + 1,
page_size: pageSize,
})
}
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
const newList = res.data.data.data.map((e, i) => {
......@@ -44,8 +57,12 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [txtSearch, pageIndex, applications])
getData(true)
}, [txtSearch, applications])
useEffect(() => {
getData(false)
}, [pageIndex])
return (
<LogAuth
......
......@@ -17,14 +17,27 @@ const ToolNotificate = (props) => {
const [data, setData] = useState([])
const getData = async () => {
const getData = async (isInit) => {
props.showLoading()
const res = await getLogAuth({
let res
if (isInit) {
setPageIndex(0)
res = await getLogAuth({
search: txtSearch,
applications,
page_no: 0,
page_size: pageSize,
})
} else {
res = await getLogAuth({
search: txtSearch,
applications,
page_no: pageIndex + 1,
page_size: pageSize,
})
}
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
......@@ -45,8 +58,12 @@ const ToolNotificate = (props) => {
}
useEffect(() => {
getData()
}, [txtSearch, pageIndex, applications])
getData(true)
}, [txtSearch, applications])
useEffect(() => {
getData(false)
}, [pageIndex])
return (
<LogAuth
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment