Commit 1ca9425a by tdgiang

update code

parent 352ae214
......@@ -22,3 +22,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yarn
......@@ -43,12 +43,12 @@
"node-sass": "^7.0.1",
"notistack": "^0.8.8",
"prop-types": "^15.7.2",
"react-date-range": "^1.4.0",
"qwest": "^4.5.0",
"react": "^16.8.6",
"react-apexcharts": "^1.3.7",
"react-awesome-selector": "^2.0.0",
"react-beautiful-dnd": "^11.0.4",
"react-date-range": "^1.4.0",
"react-dom": "^16.8.6",
"react-dropzone": "^11.2.0",
"react-google-maps": "^9.4.5",
......
<!DOCTYPE html>
<html lang="en">
<html lang="no">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/logo.png" />
......@@ -10,6 +10,7 @@
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<meta name="google" content="notranslate">
<link
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900"
rel="stylesheet"
......
......@@ -10,7 +10,7 @@ import ManageJobRoutes from './views/Company/ManageJob/ManageJobRoutes'
import MyAccountRouters from './views/MyAccount/MyAccountRoute'
import FuntionRouters from './views/Company/Function/FuntionRoutes'
import SystemRouters from './views/System/SystemRouters'
import ProductRoutes from './views/product/ProductRouters'
import ProductRoutes from './views/product/ProductRouters'
import TransactionRouters from './views/Transaction/TransactionRouters'
import FeeRouters from './views/Fee/FeeRouters'
import MerchantRoutes from './views/Merchant/MerchantRoutes'
......@@ -18,6 +18,7 @@ import GasStationRoutes from './views/GasStation/GasStationRoutes'
import ListRequestRoutes from './views/ListRequest/routes'
import SignUp from './views/SignUp/routes'
import InvoiceSupplier from './views/InvoiceSupplier/routes'
import Package from './views/package/routers'
const redirectRoute = [
{
......@@ -34,6 +35,7 @@ const errorRoute = [
]
const routes = [
...Package,
...InvoiceSupplier,
...SignUp,
...ListRequestRoutes,
......@@ -53,7 +55,6 @@ const routes = [
...ManageJobRoutes,
...redirectRoute,
...errorRoute,
]
export default routes
......@@ -206,6 +206,43 @@ export const navigationsAdmin = [
},
{
name: 'Quản lý gói',
icon: 'widgets',
hide: false,
children: [
{
name: 'Danh sách gói',
path: '/package',
iconText: 'EM',
//icon: 'group',
hide: false,
id: 'EMPLOYEE',
},
{
name: 'Danh sách chức năng',
iconText: 'FN',
path: '/package-function',
hide: false,
id: 'FUNCTION',
},
{
name: 'Cấu hình báo giá',
iconText: 'FN',
path: '/package-setting',
hide: false,
id: 'FUNCTION',
},
],
},
{
name: 'Danh sách đăng ký',
path: '/package-register',
icon: 'how_to_reg',
id: 'SIGN-UP',
hide: false,
},
{
name: 'Quản lý hệ thống',
icon: 'wb_iridescent',
hide: false,
......
......@@ -304,7 +304,16 @@ const SimpleForm = (props) => {
return temp
}
const { store_name, address, merchant_id, store_code, queue_name } = state
const {
store_name,
address,
merchant_id,
store_code,
queue_name,
account,
user_name,
password,
} = state
return (
<div className="m-sm-30">
......@@ -394,6 +403,7 @@ const SimpleForm = (props) => {
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......@@ -409,6 +419,41 @@ const SimpleForm = (props) => {
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Tài khoản ATC "
onChange={handleChange}
type="text"
name="account"
value={account || ''}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Tên đăng nhập ATC "
onChange={handleChange}
type="text"
name="user_name"
value={user_name || ''}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Mật khẩu ATC"
onChange={handleChange}
type="text"
name="password"
value={password || ''}
/>
</Grid>
{/* <Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......
......@@ -372,7 +372,16 @@ const SimpleForm = (props) => {
}
}
const { store_name, address, merchant_id, store_code, queue_name } = state
const {
store_name,
address,
merchant_id,
store_code,
queue_name,
account,
user_name,
password,
} = state
return (
<div className="m-sm-30">
......@@ -481,6 +490,41 @@ const SimpleForm = (props) => {
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Tài khoản ATC "
onChange={handleChange}
type="text"
name="account"
value={account || ''}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Tên đăng nhập ATC "
onChange={handleChange}
type="text"
name="user_name"
value={user_name || ''}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Mật khẩu ATC"
onChange={handleChange}
type="text"
name="password"
value={password || ''}
/>
</Grid>
{/* <Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......
......@@ -62,7 +62,7 @@ const columns = [
minWidth: 'auto',
},
{
id: 'phone',
id: 'representative',
label: 'Người đại diện',
align: 'left',
minWidth: 'auto',
......
......@@ -11,6 +11,7 @@ import {
Checkbox,
Typography,
MenuItem,
Tooltip,
} from '@material-ui/core'
import { dropdownListSupplier } from 'app/apis/Functions/dropdown'
import { createMerchant } from 'app/apis/Functions/merchant'
......@@ -61,7 +62,11 @@ const SimpleForm = (props) => {
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
const newList = res.data.data.map((e) => {
return { ...e, name: e.supplier_name, id: e.supplier_code }
return {
...e,
name: e.supplier_name,
id: e.supplier_code,
}
})
setListDrop(newList)
......@@ -126,7 +131,6 @@ const SimpleForm = (props) => {
qr_merchant_code,
qr_api_key,
qr_secret_key,
hddt_sign_code,
hddt_account,
hddt_acpass,
......@@ -134,7 +138,6 @@ const SimpleForm = (props) => {
inv_pattern,
inv_serial,
publish_invoce_time,
supplier_code,
} = state
......@@ -538,26 +541,28 @@ const SimpleForm = (props) => {
{invoice ? (
<Grid lg={6} md={6} sm={12} xs={12} item>
<FormControlLabel
className="min-w-288"
control={
<Checkbox
size="small"
color="primary"
onChange={(event) => {
setAuto(
event.target.checked
)
}}
value={isAuto}
/>
}
label="Tự động phát hoá đơn"
/>
<Tooltip title="Cho phép chỉnh sửa thông tin giao dịch trước khi phát hành">
<FormControlLabel
className="min-w-288"
control={
<Checkbox
size="small"
color="primary"
onChange={(event) => {
setAuto(
event.target.checked
)
}}
value={isAuto}
/>
}
label="Cho phép chỉnh sửa thông tin giao dịch trước khi phát hành"
/>
</Tooltip>
</Grid>
) : null}
{invoice && isAuto ? (
{invoice ? (
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......
......@@ -11,6 +11,7 @@ import {
Checkbox,
Typography,
MenuItem,
Tooltip,
} from '@material-ui/core'
import { updateMerchant, detailMerchant } from 'app/apis/Functions/merchant'
......@@ -90,10 +91,14 @@ const SimpleForm = (props) => {
if (res.data.code == 200 && res.data.data) {
console.log(res.data.data)
setState(res.data.data)
setState({
...res.data.data,
publish_invoce_time: `${res.data.data?.publish_invoce_time}`,
})
setInvoice(res.data.data?.is_connect_hddt)
setPayment(res.data.data?.is_connect_qr)
setIsStore(res.data.data?.is_admin_store)
setAuto(res.data.data?.is_hddt_nomal)
} else if (res.data.code == 401) {
setTimeout(() => {
history.push('/')
......@@ -550,26 +555,29 @@ const SimpleForm = (props) => {
{invoice ? (
<Grid lg={6} md={6} sm={12} xs={12} item>
<FormControlLabel
className="min-w-288"
control={
<Checkbox
size="small"
color="primary"
onChange={(event) => {
setAuto(
event.target.checked
)
}}
value={isAuto}
/>
}
label="Tự động phát hoá đơn"
/>
<Tooltip title="Cho phép chỉnh sửa thông tin giao dịch trước khi phát hành">
<FormControlLabel
className="min-w-288"
control={
<Checkbox
size="small"
color="primary"
onChange={(event) => {
setAuto(
event.target.checked
)
}}
checked={isAuto}
value={isAuto}
/>
}
label="Cho phép chỉnh sửa thông tin giao dịch trước khi phát hành"
/>
</Tooltip>
</Grid>
) : null}
{invoice && isAuto ? (
{invoice ? (
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......
......@@ -70,12 +70,12 @@ const columns = [
align: 'left',
minWidth: 'auto',
},
// {
// id: 'city',
// label: 'Tỉnh/ Thành phố',
// align: 'left',
// minWidth: 'auto',
// },
{
id: 'date_created',
label: 'Ngày tạo yêu cầu',
align: 'left',
minWidth: 120,
},
]
function TableList(props) {
......
import React, { useState, useEffect } from 'react'
import { ValidatorForm, TextValidator } from 'react-material-ui-form-validator'
import { Button, Grid } from '@material-ui/core'
import { createFunction } from 'app/apis/Functions/function'
import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
import { toast } from 'react-toastify'
import { Breadcrumb, SimpleCard } from 'app/components'
import { Link, useHistory, useLocation } from 'react-router-dom'
import { trimObject } from 'app/config/Function'
import { connect } from 'react-redux'
import { useTranslation } from 'react-i18next'
const SimpleForm = (props) => {
const [state, setState] = useState({})
const { t } = useTranslation()
const history = useHistory()
const handleSubmit = async (event) => {
const newValue = trimObject(state)
props.showLoading()
const res = await createFunction({
...newValue,
status: 1,
is_default: true,
})
props.hideLoading()
if (res.data.code == 200) {
history.push('/function')
if (res.data.code == 200) {
toast.success('Tạo chức năng thành công!', {
theme: 'colored',
})
}
} else {
toast.error(t(res.data.error), {
theme: 'colored',
})
}
}
const handleChange = (event) => {
event.persist()
setState({
...state,
[event.target.name]: event.target.value,
})
}
const handleDateChange = (date) => {
setState({ ...state, date })
}
const { description, name, code, url } = state
return (
<div className="m-sm-30">
<div className="mb-sm-30">
<div className="mb-sm-30">
<Breadcrumb
routeSegments={[
{
name: 'Danh sách chức năng',
path: '/function',
},
{ name: 'Thêm mới chức năng' },
]}
/>
</div>
<SimpleCard>
<ValidatorForm onSubmit={handleSubmit} onError={() => null}>
<Grid container spacing={3}>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Tên chức năng *"
onChange={handleChange}
type="text"
name="name"
value={name || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Mã code *"
onChange={handleChange}
type="text"
name="code"
value={code || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Đường dẫn *"
onChange={handleChange}
type="text"
name="url"
value={url || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Mô tả"
onChange={handleChange}
type="text"
name="description"
value={description || ''}
// validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
</Grid>
<Grid container justify={'flex-end'}>
<Button
style={{
marginRight: 20,
}}
color="inherit"
variant="contained"
onClick={() => {
history.goBack()
}}
>
<span className="capitalize">Quay li</span>
</Button>
<Button
color="primary"
variant="contained"
type="submit"
>
<span className="capitalize">Thêm mi</span>
</Button>
</Grid>
</ValidatorForm>
</SimpleCard>
</div>
</div>
)
}
const mapStateToProps = (state) => {
return {}
}
export default connect(mapStateToProps, { showLoading, hideLoading })(
SimpleForm
)
import React, { useState, useEffect } from 'react'
import ToolUserView from './View'
import {
getListFunction,
deleteFunction,
changeStatusFunction,
} from 'app/apis/Functions/function'
import { useHistory } from 'react-router-dom'
import KEY from '../../../assets/Key'
import { connect } from 'react-redux'
import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
import { toast } from 'react-toastify'
import useDebounce from 'app/hooks/useDebounce'
import { useTranslation } from 'react-i18next'
const ToolNotificate = (props) => {
const [txtSearch, setTxtSearch] = useState('')
const searchDebount = useDebounce(txtSearch, 1000)
const { t } = useTranslation()
const [activeSelected, setActiveSeleted] = useState(null)
const [changeActive, setChangeActive] = useState(1)
const [pageIndex, setPageIndex] = useState(0)
const [pageSize] = useState(10)
const [totalRecords, setTotalRecord] = useState(0)
const history = useHistory()
const [data, setData] = useState([])
const [permissions, setPermissions] = useState([])
// useEffect(() => {
// getListPermission();
// }, []);
// const getListPermission = () => {
// let temp = localStorage.getItem(KEY.LISTPATH);
// let listPath = JSON.parse(temp);
// if (listPath) {
// const newlist = listPath.map((e) => {
// if (e.function_code) return e.function_code;
// return e.action_code;
// });
// setPermissions(newlist);
// }
// };
const handeChangeActive = async (id, status_id) => {
props.showLoading()
const res = await changeStatusFunction({ id, status_id })
props.hideLoading()
if (res.data.code == 200) {
getData()
toast.success('Thay đổi trạng thái thành công!', {
theme: 'colored',
})
} else {
toast.error(t(res.data.error), {
theme: 'colored',
})
}
}
const getData = async (isInit) => {
props.showLoading()
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()
if (res.data.code == 200 && res.data.data) {
console.log(res.data)
const newList = res.data.data.data.map((e, i) => {
return { ...e, index: i + 1 + pageIndex * pageSize }
})
setData(newList)
setTotalRecord(res.data.data.total_elements)
} else if (res.data.code == 401) {
localStorage.removeItem(KEY.API_TOKEN)
setTimeout(() => {
history.push('/')
}, 100)
} else {
toast.error(t(res.data.error), {
theme: 'colored',
})
}
}
useEffect(() => {
getData(true)
}, [searchDebount])
useEffect(() => {
getData(false)
}, [pageIndex])
const removeItem = async (id) => {
props.showLoading()
const res = await deleteFunction({ id })
props.hideLoading()
if (res.data.code == 200) {
getData()
toast.success('Xoá bản ghi thành công!', {
theme: 'colored',
})
} else if (res.data.code == 401) {
localStorage.removeItem(KEY.API_TOKEN)
setTimeout(() => {
history.push('/')
}, 100)
} else {
toast.error(t(res.data.error), {
theme: 'colored',
})
}
}
return (
<ToolUserView
data={data}
removeItem={removeItem}
setTxtSearch={setTxtSearch}
setActiveSeleted={setActiveSeleted}
pageIndex={pageIndex}
changeActive={changeActive}
setChangeActive={setChangeActive}
setPageIndex={setPageIndex}
activeSelected={activeSelected}
handeChangeActive={handeChangeActive}
totalRecords={totalRecords}
permissions={permissions}
/>
)
}
const mapStateToProps = (state) => {
return {}
}
export default connect(mapStateToProps, { showLoading, hideLoading })(
ToolNotificate
)
import React, { useState, useEffect } from 'react'
import { ValidatorForm, TextValidator } from 'react-material-ui-form-validator'
import { Button, Grid } from '@material-ui/core'
import { detailFunction, updateFunction } from 'app/apis/Functions/function'
import { showLoading, hideLoading } from 'app/redux/actions/loadingAction'
import { toast } from 'react-toastify'
import { Breadcrumb, SimpleCard } from 'app/components'
import { Link, useHistory, useLocation } from 'react-router-dom'
import { trimObject } from 'app/config/Function'
import { connect } from 'react-redux'
import localStorageService from 'app/services/localStorageService'
import { useTranslation } from 'react-i18next'
const SimpleForm = (props) => {
const [state, setState] = useState({})
const history = useHistory()
const location = useLocation()
const { t } = useTranslation()
useEffect(() => {
getData()
}, [])
const getData = async () => {
props.showLoading()
const res = await detailFunction(location.state, {})
props.hideLoading()
if (res.data.code == 200 && res.data.data) {
setState(res.data.data)
} else if (res.data.code == 401) {
localStorageService.removeToken()
setTimeout(() => {
history.push('/')
}, 100)
} else {
toast.error(t(res.data.error), {
theme: 'colored',
})
}
}
const handleSubmit = async (event) => {
const newValue = trimObject(state)
props.showLoading()
const res = await updateFunction({
...newValue,
status: 1,
is_default: true,
})
props.hideLoading()
if (res.data.code == 200) {
history.push('/function')
if (res.data.code == 200) {
toast.success('Cập nhật chức năng thành công!', {
theme: 'colored',
})
}
} else {
toast.error(t(res.data.error), {
theme: 'colored',
})
}
}
const handleChange = (event) => {
event.persist()
setState({
...state,
[event.target.name]: event.target.value,
})
}
const handleDateChange = (date) => {
setState({ ...state, date })
}
const { description, name, code, url } = state
return (
<div className="m-sm-30">
<div className="mb-sm-30">
<div className="mb-sm-30">
<Breadcrumb
routeSegments={[
{
name: 'Danh sách chức năng',
path: '/function',
},
{ name: 'Cập nhật chức năng' },
]}
/>
</div>
<SimpleCard>
<ValidatorForm onSubmit={handleSubmit} onError={() => null}>
<Grid container spacing={3}>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Tên chức năng *"
onChange={handleChange}
type="text"
name="name"
value={name || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Mã code *"
onChange={handleChange}
type="text"
name="code"
value={code || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Đường dẫn *"
onChange={handleChange}
type="text"
name="url"
value={url || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Mô tả "
onChange={handleChange}
type="text"
name="description"
value={description || ''}
//validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
</Grid>
<Grid container justify={'flex-end'}>
<Button
style={{
marginRight: 20,
}}
color="inherit"
variant="contained"
onClick={() => {
history.goBack()
}}
>
<span className="capitalize">Quay li</span>
</Button>
<Button
color="primary"
variant="contained"
type="submit"
>
<span className="capitalize">Cp nht</span>
</Button>
</Grid>
</ValidatorForm>
</SimpleCard>
</div>
</div>
)
}
const mapStateToProps = (state) => {
return {}
}
export default connect(mapStateToProps, { showLoading, hideLoading })(
SimpleForm
)
import React, { Fragment, useState, useEffect } from 'react'
import {
TextField,
Icon,
Button,
StepLabel,
Step,
Stepper,
Grid,
FormControl,
InputLabel,
Select,
MenuItem,
} from '@material-ui/core'
import Table from './Table'
import { Breadcrumb } from 'app/components'
import { Link } from 'react-router-dom'
import { Autocomplete, createFilterOptions } from '@material-ui/lab'
import useAuth from 'app/hooks/useAuth'
import { checkRole } from 'app/config/Function'
function CustomerView(props) {
const {
data,
updateItem,
removeItem,
setTxtSearch,
changeActive,
setChangeActive,
handeChangeActive,
setPageIndex,
pageIndex,
totalRecords,
permissions,
} = props
const [age, setAge] = React.useState('')
const { user } = useAuth()
const handleChange = (event) => {
setAge(event.target.value)
}
return (
<Fragment>
<div className="m-sm-30">
<div className="mb-sm-30">
<Breadcrumb
routeSegments={[
{
name: 'Danh sách chức năng',
path: '/function',
},
]}
/>
</div>
<Grid
style={{
padding: 10,
marginBottom: 20,
}}
justify={'space-between'}
alignItems={'center'}
container
spacing={3}
>
<Grid item lg={3} md={3} sm={6} xs={6}>
<TextField
variant="outlined"
className="w-full"
label="Nhập từ khoá"
onChange={(e) => {
const text = e.target.value
setTimeout(() => {
setTxtSearch(text)
}, 1000)
}}
/>
</Grid>
{checkRole(user, '/function/create') ? (
<Link to="/function/create">
<Button
variant="contained"
className={'bg-light-primary'}
>
<span className={'text-primary'}>Thêm mi</span>
</Button>
</Link>
) : null}
</Grid>
<Table
data={data}
changeActive={changeActive}
setChangeActive={setChangeActive}
handeChangeActive={handeChangeActive}
updateItem={updateItem}
removeItem={removeItem}
pageIndex={pageIndex}
setPageIndex={setPageIndex}
totalRecords={totalRecords}
permissions={permissions}
/>
</div>
</Fragment>
)
}
export default CustomerView
import React from 'react'
const ProductRoutes = [
{
path: '/package-function/create',
component: React.lazy(() => import('./function/Create')),
},
{
path: '/package-function/update',
component: React.lazy(() => import('./function/Update')),
},
{
path: '/package-function',
component: React.lazy(() => import('./function/Index')),
},
]
export default ProductRoutes
This source diff could not be displayed because it is too large. You can view the blob instead.
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