feat: add sight short_name and sight features

This commit is contained in:
2026-04-19 22:36:14 +03:00
parent beb9e932ef
commit 938a7e6d1e
7 changed files with 84 additions and 9 deletions

View File

@@ -51,7 +51,23 @@ export const SightListPage = observer(() => {
const columns: GridColDef[] = [
{
field: "name",
headerName: "Имя",
headerName: "Название",
flex: 1,
renderCell: (params: GridRenderCellParams) => {
return (
<div className="w-full h-full flex items-center">
{params.value ? (
params.value
) : (
<Minus size={20} className="text-red-500" />
)}
</div>
);
},
},
{
field: "short_name",
headerName: "Сокращенное название",
flex: 1,
renderCell: (params: GridRenderCellParams) => {
return (
@@ -124,10 +140,11 @@ export const SightListPage = observer(() => {
const query = searchQuery.trim().toLowerCase();
const rows = filteredSights
.filter((sight: any) => !query || (sight.name ?? "").toLowerCase().includes(query))
.map((sight) => ({
.filter((sight: any) => !query || (sight.name ?? "").toLowerCase().includes(query) || (sight.short_name ?? "").toLowerCase().includes(query))
.map((sight: any) => ({
id: sight.id,
name: sight.name,
short_name: sight.short_name,
city_id: sight.city_id,
}));
@@ -165,6 +182,7 @@ export const SightListPage = observer(() => {
<DataGrid
rows={rows}
columns={columns}
onRowDoubleClick={(params) => canWriteSights && navigate(`/sight/${params.row.id}/edit`)}
checkboxSelection={canWriteSights}
disableRowSelectionExcludeModel
loading={isLoading}