Commit 691ab984 by tdgiang

update code

parent 1fd34b93
......@@ -105,12 +105,18 @@ export default {
changeStatusInvoiceSupp: `${root}/supplierInvoice/changeStatus`,
//supplier
urlGetListSupplier: `${root}/supplierconstruction/paging`,
urlCreateSupplier: `${root}/supplierconstruction/create`,
urlUpdateSupplier: `${root}/supplierconstruction/update`,
urlDeleteSupplier: `${root}/supplierconstruction/delete`,
urlDetailSupplier: `${root}/supplierconstruction`,
changeStatusSupplier: `${root}/supplierconstruction/changeStatus`,
// urlGetListSupplier: `${root}/supplierconstruction/paging`,
// urlCreateSupplier: `${root}/supplierconstruction/create`,
// urlUpdateSupplier: `${root}/supplierconstruction/update`,
// urlDeleteSupplier: `${root}/supplierconstruction/delete`,
// urlDetailSupplier: `${root}/supplierconstruction`,
// changeStatusSupplier: `${root}/supplierconstruction/changeStatus`,
urlGetListSupplier: `${root}/provider/paging`,
urlCreateSupplier: `${root}/provider/create`,
urlUpdateSupplier: `${root}/provider/update`,
urlDeleteSupplier: `${root}/provider/delete`,
urlDetailSupplier: `${root}/provider`,
changeStatusSupplier: `${root}/provider/changeStatus`,
//Log
logAuth: `${root}/logging/listLogin`,
......
......@@ -99,6 +99,7 @@ const SimpleForm = (props) => {
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('/')
......
......@@ -39,8 +39,6 @@ const SimpleForm = (props) => {
const { t } = useTranslation()
console.log('user', user)
const history = useHistory()
const handleSubmit = async (event) => {
......@@ -48,6 +46,7 @@ const SimpleForm = (props) => {
props.showLoading()
const res = await createSupplier({
...newValue,
type: parseInt(newValue?.type),
status: 1,
})
console.log(res)
......@@ -74,7 +73,7 @@ const SimpleForm = (props) => {
})
}
const { supp_code, supp_name, phone, email, address } = state
const { provider_code, provider_name, phone, email, address, type } = state
return (
<div className="m-sm-30">
<div className="mb-sm-30">
......@@ -92,6 +91,45 @@ const SimpleForm = (props) => {
<SimpleCard>
<ValidatorForm onSubmit={handleSubmit} onError={() => null}>
<Grid container spacing={3}>
<Grid xs={6} sm={6} item>
<SelectValidator
variant={'outlined'}
label={'Loại nhà cung cấp *'}
className="mb-4 w-full"
value={type || ''}
displayEmpty
name="type"
onChange={handleChange}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
>
{[
{
id: '0',
name: 'Cổng thanh toán',
},
{
id: '1',
name: 'Hoá đơn',
},
{
id: '2',
name: 'Nhiên liệu',
},
{
id: '3',
name: 'Thiết bị',
},
].map((e) => (
<MenuItem value={e.id}>
{e.name}
</MenuItem>
))}
</SelectValidator>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......@@ -99,8 +137,8 @@ const SimpleForm = (props) => {
label="Mã nhà cung cấp *"
onChange={handleChange}
type="text"
name="supp_code"
value={supp_code || ''}
name="provider_code"
value={provider_code || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
......@@ -114,8 +152,8 @@ const SimpleForm = (props) => {
label="Tên nhà cung cấp *"
onChange={handleChange}
type="text"
name="supp_name"
value={supp_name || ''}
name="provider_name"
value={provider_name || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
......
......@@ -31,9 +31,9 @@ const ToolNotificate = (props) => {
const [data, setData] = useState([])
const handeChangeActive = async (idGuid, status_id) => {
const handeChangeActive = async (id, status_id) => {
props.showLoading()
const res = await changeStatusSupplier({ idGuid, status_id })
const res = await changeStatusSupplier({ id, status_id })
props.hideLoading()
if (res.data.code == 200) {
getData()
......@@ -92,9 +92,9 @@ const ToolNotificate = (props) => {
getData(true)
}, [searchDebount, status, store, group])
const removeItem = async (idGuid) => {
const removeItem = async (id) => {
props.showLoading()
const res = await deleteSupplier({ idGuid })
const res = await deleteSupplier({ id })
props.hideLoading()
if (res.data.code == 200) {
getData(true)
......
......@@ -38,14 +38,14 @@ const columns = [
minWidth: 50,
},
{
id: 'supp_code',
id: 'provider_code',
label: 'Mã nhà cung cấp',
align: 'center',
minWidth: 150,
},
{
id: 'supp_name',
id: 'provider_name',
label: 'Tên nhà cung cấp',
align: 'left',
minWidth: 200,
......@@ -208,7 +208,7 @@ function TableList(props) {
setSelected({
...row,
title: 'Xóa NCC',
content: `Bạn có muốn xóa NCC thiết bị ${row.supp_name} hay không?`,
content: `Bạn có muốn xóa NCC thiết bị ${row.provider_name} hay không?`,
})
setOpen(true)
}}
......
......@@ -45,7 +45,7 @@ const SimpleForm = (props) => {
props.showLoading()
try {
const res = await detailSupplier(location.state, {})
setState(res.data.data)
setState({ ...res.data.data, type: `${res.data.data.type}` })
} catch (err) {
toast.error(t(err), {
theme: 'colored',
......@@ -60,6 +60,7 @@ const SimpleForm = (props) => {
props.showLoading()
const res = await updateSupplier({
...newValue,
type: parseInt(newValue?.type),
})
console.log(res)
props.hideLoading()
......@@ -85,7 +86,7 @@ const SimpleForm = (props) => {
})
}
const { supp_code, supp_name, phone, email, address } = state
const { provider_code, provider_name, phone, email, address, type } = state
return (
<div className="m-sm-30">
<div className="mb-sm-30">
......@@ -103,6 +104,45 @@ const SimpleForm = (props) => {
<SimpleCard>
<ValidatorForm onSubmit={handleSubmit} onError={() => null}>
<Grid container spacing={3}>
<Grid xs={6} sm={6} item>
<SelectValidator
variant={'outlined'}
label={'Loại nhà cung cấp *'}
className="mb-4 w-full"
value={type || ''}
displayEmpty
name="type"
onChange={handleChange}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
>
{[
{
id: '0',
name: 'Cổng thanh toán',
},
{
id: '1',
name: 'Hoá đơn',
},
{
id: '2',
name: 'Nhiên liệu',
},
{
id: '3',
name: 'Thiết bị',
},
].map((e) => (
<MenuItem value={e.id}>
{e.name}
</MenuItem>
))}
</SelectValidator>
</Grid>
<Grid item lg={6} md={6} sm={12} xs={12}>
<TextValidator
variant="outlined"
......@@ -110,9 +150,9 @@ const SimpleForm = (props) => {
label="Mã nhà cung cấp *"
onChange={handleChange}
type="text"
name="supp_code"
name="provider_code"
disabled={true}
value={supp_code || ''}
value={provider_code || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
......@@ -126,8 +166,8 @@ const SimpleForm = (props) => {
label="Tên nhà cung cấp *"
onChange={handleChange}
type="text"
name="supp_name"
value={supp_name || ''}
name="provider_name"
value={provider_name || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
......
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