Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ const ContractEditModal = ({
.filter((uid: number | null): uid is number => uid !== null)
);

const normalize = (str?: string) => str?.trim().replace(/\s+/g, "") ?? "";

const matchedProperty = allProperties.find(
(p) => p.address === data.propertyAddress
(p) => normalize(p.address) === normalize(data.propertyAddress)
);

setPropertyUid(matchedProperty ? matchedProperty.uid : null);

setCategory(
Expand Down
6 changes: 3 additions & 3 deletions src/pages/CustomerDetailPage/CustomerInfo/CustomerInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,19 @@ function CustomerInfo({ customerId }: { customerId: string }) {
const [loading, setLoading] = useState(false);

// Consultation 관련 상태
const [counselPage, setCounselPage] = useState(1);
const [counselPage, setCounselPage] = useState(0);
const [counselRowsPerPage, setCounselRowsPerPage] = useState(10);
const [counselTotalCount, setCounselTotalCount] = useState(0);
const [counselLoading, setCounselLoading] = useState(false);

// Property 관련 상태
const [propertyPage, setPropertyPage] = useState(1);
const [propertyPage, setPropertyPage] = useState(0);
const [propertyRowsPerPage, setPropertyRowsPerPage] = useState(10);
const [propertyTotalCount, setPropertyTotalCount] = useState(0);
const [propertyLoading, setPropertyLoading] = useState(false);

// Contract 관련 상태
const [contractPage, setContractPage] = useState(1);
const [contractPage, setContractPage] = useState(0);
const [contractRowsPerPage, setContractRowsPerPage] = useState(10);
const [contractTotalCount, setContractTotalCount] = useState(0);
const [contractLoading, setContractLoading] = useState(false);
Expand Down
41 changes: 16 additions & 25 deletions src/pages/CustomerDetailPage/Tables/ContractTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TableRow,
Chip,
CircularProgress,
TablePagination,
} from "@mui/material";

interface ContractTableProps {
Expand Down Expand Up @@ -194,31 +195,21 @@ function ContractTable({
<Typography variant="body2" color="text.secondary">
총 {totalCount}건
</Typography>
<Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
<FormControl size="small" sx={{ minWidth: 120 }}>
<InputLabel>페이지당 행</InputLabel>
<Select
value={rowsPerPage}
label="페이지당 행"
onChange={(e) => {
onRowsPerPageChange(Number(e.target.value));
}}
>
<MenuItem value={10}>10</MenuItem>
<MenuItem value={25}>25</MenuItem>
<MenuItem value={50}>50</MenuItem>
<MenuItem value={100}>100</MenuItem>
</Select>
</FormControl>
<Pagination
count={Math.ceil(totalCount / rowsPerPage)}
page={page}
onChange={(_, newPage) => onPageChange(newPage)}
color="primary"
showFirstButton
showLastButton
/>
</Box>
<TablePagination
component="div"
count={totalCount}
page={page}
rowsPerPage={rowsPerPage}
onPageChange={(_, newPage) => onPageChange(newPage)}
onRowsPerPageChange={(e) => {
onRowsPerPageChange(Number(e.target.value));
}}
rowsPerPageOptions={[10, 25, 50, 100]}
labelRowsPerPage="페이지당 행 수"
labelDisplayedRows={({ from, to, count }) =>
`${count}건 중 ${from}-${to}건`
}
/>
</Box>
</Paper>
);
Expand Down
41 changes: 16 additions & 25 deletions src/pages/CustomerDetailPage/Tables/PropertyTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Paper,
Chip,
CircularProgress,
TablePagination,
} from "@mui/material";
import { useNavigate } from "react-router-dom";
import { formatPriceWithKorean } from "@utils/numberUtil";
Expand Down Expand Up @@ -192,31 +193,21 @@ function PropertyTable({
<Typography variant="body2" color="text.secondary">
총 {totalCount}건
</Typography>
<Box sx={{ display: "flex", alignItems: "center", gap: 2 }}>
<FormControl size="small" sx={{ minWidth: 120 }}>
<InputLabel>페이지당 행</InputLabel>
<Select
value={rowsPerPage}
label="페이지당 행"
onChange={(e) => {
onRowsPerPageChange(Number(e.target.value));
}}
>
<MenuItem value={10}>10</MenuItem>
<MenuItem value={25}>25</MenuItem>
<MenuItem value={50}>50</MenuItem>
<MenuItem value={100}>100</MenuItem>
</Select>
</FormControl>
<Pagination
count={Math.ceil(totalCount / rowsPerPage)}
page={page}
onChange={(_, newPage) => onPageChange(newPage)}
color="primary"
showFirstButton
showLastButton
/>
</Box>
<TablePagination
component="div"
count={totalCount}
page={page}
rowsPerPage={rowsPerPage}
onPageChange={(_, newPage) => onPageChange(newPage)}
onRowsPerPageChange={(e) => {
onRowsPerPageChange(Number(e.target.value));
}}
rowsPerPageOptions={[10, 25, 50, 100]}
labelRowsPerPage="페이지당 행 수"
labelDisplayedRows={({ from, to, count }) =>
`${count}건 중 ${from}-${to}건`
}
/>
</Box>
</Paper>
);
Expand Down