Commit a18e4537 by tdgiang

update build

parent 03e4f965
......@@ -37,13 +37,19 @@ const SimpleForm = (props) => {
const handleSubmit = async (event) => {
const newValue = trimObject(state)
if (
isNumeric(newValue.price) ||
newValue.price == '' ||
!newValue.price
) {
props.showLoading()
const res = await createPackage({
...newValue,
status: 1,
outstand: 1,
func_id_add: listChecked,
price: newValue.price != '' ? null : newValue.price,
price: newValue.price != '' ? newValue.price : null,
})
props.hideLoading()
if (res.data.code == 200) {
......@@ -58,6 +64,11 @@ const SimpleForm = (props) => {
theme: 'colored',
})
}
} else {
toast.warn('Đơn giá không đúng định dạng', {
theme: 'colored',
})
}
}
const handleChange = (event) => {
......@@ -136,8 +147,6 @@ const SimpleForm = (props) => {
type="text"
name="price"
value={toPriceVndInput(price) || ''}
validators={['isNumber']}
errorMessages={['Trường này phải nhập số ']}
/>
</Grid>
<Grid row container item xs={12} sm={12}>
......
......@@ -61,11 +61,17 @@ const SimpleForm = (props) => {
const handleSubmit = async (event) => {
const newValue = trimObject(state)
if (
isNumeric(newValue.price) ||
newValue.price == '' ||
!newValue.price
) {
props.showLoading()
const res = await updatePackage({
...newValue,
func_id_add: listChecked,
price: newValue.price != '' ? null : newValue.price,
price: newValue.price != '' ? newValue.price : null,
})
props.hideLoading()
if (res.data.code == 200) {
......@@ -80,6 +86,11 @@ const SimpleForm = (props) => {
theme: 'colored',
})
}
} else {
toast.warn('Đơn giá không đúng định dạng', {
theme: 'colored',
})
}
}
const handleChange = (event) => {
......@@ -157,8 +168,6 @@ const SimpleForm = (props) => {
type="text"
name="price"
value={toPriceVndInput(price) || ''}
validators={['isNumber']}
errorMessages={['Trường này phải nhập số ']}
/>
</Grid>
<Grid row container item xs={12} sm={12}>
......
......@@ -57,10 +57,16 @@ const SimpleForm = (props) => {
const history = useHistory()
const handleSubmit = async (event) => {
const newValue = trimObject(state)
if (
isNumeric(newValue.price) ||
newValue.price == '' ||
!newValue.price
) {
props.showLoading()
const res = await createPriceProduct({
...newValue,
status: 1,
price: newValue.price != '' ? newValue.price : null,
})
props.hideLoading()
if (res.data.code == 200) {
......@@ -75,6 +81,11 @@ const SimpleForm = (props) => {
theme: 'colored',
})
}
} else {
toast.warn('Đơn giá không đúng định dạng', {
theme: 'colored',
})
}
}
const handleChange = (event) => {
......@@ -158,15 +169,11 @@ const SimpleForm = (props) => {
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Đơn giá *"
label="Đơn giá"
onChange={handleChange}
name="price"
type="text"
value={toPriceVndInput(price) || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
<Grid xs={6} sm={6} item>
......
......@@ -66,13 +66,13 @@ const ToolNotificate = (props) => {
if (isInit) {
setPageIndex(0)
res = await getListPriceProduct({
func_name: searchDebount,
cons_name: searchDebount,
page_no: 0,
page_size: pageSize,
})
} else {
res = await getListPriceProduct({
func_name: searchDebount,
cons_name: searchDebount,
page_no: pageIndex + 1,
page_size: pageSize,
})
......
......@@ -14,7 +14,7 @@ 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, toPriceVndInput } from 'app/config/Function'
import { trimObject, toPriceVndInput, isNumeric } from 'app/config/Function'
import { connect } from 'react-redux'
import localStorageService from 'app/services/localStorageService'
import { useTranslation } from 'react-i18next'
......@@ -77,8 +77,14 @@ const SimpleForm = (props) => {
const handleSubmit = async (event) => {
const newValue = trimObject(state)
props.showLoading()
if (
isNumeric(newValue.price) ||
newValue.price == '' ||
!newValue.price
) {
const res = await updatePriceProduct({
...newValue,
price: newValue.price != '' ? newValue.price : null,
})
props.hideLoading()
if (res.data.code == 200) {
......@@ -93,6 +99,11 @@ const SimpleForm = (props) => {
theme: 'colored',
})
}
} else {
toast.warn('Đơn giá không đúng định dạng', {
theme: 'colored',
})
}
}
const handleChange = (event) => {
event.persist()
......@@ -159,7 +170,7 @@ const SimpleForm = (props) => {
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Đơn vị tính *"
label="Đơn vị tính"
onChange={handleChange}
type="text"
name="unit"
......@@ -175,15 +186,11 @@ const SimpleForm = (props) => {
<TextValidator
variant="outlined"
className="mb-4 w-full"
label="Đơn giá *"
label="Đơn giá"
onChange={handleChange}
name="price"
type="text"
value={toPriceVndInput(price) || ''}
validators={['required']}
errorMessages={[
'Không được để trống trường này',
]}
/>
</Grid>
{type_caculator && (
......
......@@ -75,16 +75,6 @@ function CustomerView(props) {
}}
/>
</Grid>
{checkRole(user, '/package-function/create') ? (
<Link to="/package-function/create">
<Button
variant="contained"
className={'bg-light-primary'}
>
<span className={'text-primary'}>Thêm mi</span>
</Button>
</Link>
) : null}
</Grid>
<Table
......
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