Commit bf4b5526 authored by Mai Thanh Cong's avatar Mai Thanh Cong

add stt in table

parent 4371fd59
...@@ -119,7 +119,7 @@ const AddProfile = () => { ...@@ -119,7 +119,7 @@ const AddProfile = () => {
type={phoneNumber ? "text" : "number"} type={phoneNumber ? "text" : "number"}
value={phoneNumber} value={phoneNumber}
onChange={(e) => setPhoneNumber(e.target.value)} onChange={(e) => setPhoneNumber(e.target.value)}
invalid={validPhoneNumber === true} invalid={validPhoneNumber}
/> />
<FormFeedback invalid>{validPhoneNumber ? "Phải có 10 chữ số bắt đầu bằng chữ số 0" : false}</FormFeedback> <FormFeedback invalid>{validPhoneNumber ? "Phải có 10 chữ số bắt đầu bằng chữ số 0" : false}</FormFeedback>
</InputGroup> </InputGroup>
......
...@@ -69,8 +69,11 @@ export const ProfileTable = (props) => { ...@@ -69,8 +69,11 @@ export const ProfileTable = (props) => {
dispatch(props.onLoadNextPage(nextActiveItem)); dispatch(props.onLoadNextPage(nextActiveItem));
}; };
let count = 0;
const TableRow = (props) => { const TableRow = (props) => {
const { id, address, logo, name, phone_number, profile_product, created_at, qr_code } = props; const { id, address, logo, name, phone_number, profile_product, created_at, qr_code } = props;
count++;
const productName = profile_product ? profile_product.map(item => item.name) : []; const productName = profile_product ? profile_product.map(item => item.name) : [];
let listProductName = []; let listProductName = [];
for(let i=0; i<productName.length; i++){ for(let i=0; i<productName.length; i++){
...@@ -79,7 +82,7 @@ export const ProfileTable = (props) => { ...@@ -79,7 +82,7 @@ export const ProfileTable = (props) => {
return ( return (
<tr> <tr>
<th scope="row">{""}</th> <th scope="row">{count}</th>
<td>{name}</td> <td>{name}</td>
<td><img src={window.location.origin + logo} alt="logo" width={100} height={50} /></td> <td><img src={window.location.origin + logo} alt="logo" width={100} height={50} /></td>
<td>{phone_number}</td> <td>{phone_number}</td>
...@@ -220,12 +223,14 @@ export const ProductTable = (props) => { ...@@ -220,12 +223,14 @@ export const ProductTable = (props) => {
); );
} }
let count = 0;
const TableRow = (props) => { const TableRow = (props) => {
const { product_id, name, trace_code, cost, origin, image, growing_conditions, description, created_at, qr_code } = props; const { product_id, name, trace_code, cost, origin, image, growing_conditions, description, created_at, qr_code } = props;
count++;
return ( return (
<tr> <tr>
<th scope="row">{""}</th> <th scope="row">{count}</th>
<td>{name}</td> <td>{name}</td>
<td>{trace_code}</td> <td>{trace_code}</td>
<td>{cost}</td> <td>{cost}</td>
...@@ -375,12 +380,14 @@ export const ProductDiaryTable = (props) => { ...@@ -375,12 +380,14 @@ export const ProductDiaryTable = (props) => {
); );
} }
let count = 0;
const TableRow = (props) => { const TableRow = (props) => {
const { id, company, description, date } = props; const { id, company, description, date } = props;
count++;
return ( return (
<tr> <tr>
<th scope="row">{""}</th> <th scope="row">{count}</th>
<td>{company}</td> <td>{company}</td>
<td>{description}</td> <td>{description}</td>
<td>{date ? profileFormatDateTime(date) : ""}</td> <td>{date ? profileFormatDateTime(date) : ""}</td>
......
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