diff --git a/src/components/CardAttributeFields/components/CardAttributeField.tsx b/src/components/CardAttributeFields/components/CardAttributeField.tsx
index 1bde2ad..a77ce1b 100644
--- a/src/components/CardAttributeFields/components/CardAttributeField.tsx
+++ b/src/components/CardAttributeFields/components/CardAttributeField.tsx
@@ -1,8 +1,9 @@
import { AttributeSchema } from "../../../client";
-import { Checkbox, NumberInput, TextInput } from "@mantine/core";
+import { Checkbox, Group, NumberInput, TextInput, Tooltip } from "@mantine/core";
import { UseFormReturnType } from "@mantine/form";
import { DatePickerInput, DateTimePicker } from "@mantine/dates";
import { CardGeneralFormType } from "../../../pages/CardsPage/tabs/GeneralTab/GeneralTab.tsx";
+import { IconInfoCircle } from "@tabler/icons-react";
type Props = {
attribute: AttributeSchema;
@@ -18,22 +19,29 @@ const CardAttributeField = ({ attribute, form }: Props) => {
return new Date(value);
};
- const labelData = {
- label: attribute.label,
- description: attribute.description,
- };
+ const label = (
+
+ {attribute.label}
+ {attribute.description && (
+
+
+
+ )}
+
+ );
if (type === "bool") {
return (
);
- } else if (type === "date") {
+ }
+ if (type === "date") {
return (
{
valueFormat="DD.MM.YYYY"
/>
);
- } else if (type === "datetime") {
+ }
+ if (type === "datetime") {
return (
{
valueFormat="DD.MM.YYYY HH:mm"
/>
);
- } else if (type === "str") {
+ }
+ if (type === "str") {
return (
);
- } else if (type === "int" || type === "float") {
+ }
+ if (type === "int" || type === "float") {
return (
);
diff --git a/src/pages/AdminPage/tabs/Attributes/components/DefaultAttributeValueInput.tsx b/src/pages/AdminPage/tabs/Attributes/components/DefaultAttributeValueInput.tsx
index cd5c37c..665ce8c 100644
--- a/src/pages/AdminPage/tabs/Attributes/components/DefaultAttributeValueInput.tsx
+++ b/src/pages/AdminPage/tabs/Attributes/components/DefaultAttributeValueInput.tsx
@@ -55,7 +55,7 @@ const DefaultAttributeValueInput = ({ form }: Props) => {
allowDecimal={type === "float"}
label={label}
{...form.getInputProps(inputName)}
- value={Number(form.values.defaultValue)}
+ value={form.values.defaultValue ? Number(form.values.defaultValue) : undefined}
/>
)
}
diff --git a/src/pages/AdminPage/tabs/Attributes/hooks/attributesTableColumns.tsx b/src/pages/AdminPage/tabs/Attributes/hooks/attributesTableColumns.tsx
index 1dfea1e..33ed194 100644
--- a/src/pages/AdminPage/tabs/Attributes/hooks/attributesTableColumns.tsx
+++ b/src/pages/AdminPage/tabs/Attributes/hooks/attributesTableColumns.tsx
@@ -3,6 +3,7 @@ import { MRT_ColumnDef } from "mantine-react-table";
import { AttributeSchema } from "../../../../../client";
import { IconCheck, IconX } from "@tabler/icons-react";
import { formatDate, formatDateTime } from "../../../../../types/utils.ts";
+import { Box } from "@mantine/core";
const useAttributesTableColumns = () => {
@@ -58,7 +59,8 @@ const useAttributesTableColumns = () => {
{
header: "Описаниие",
accessorKey: "description",
- }
+ Cell: ({ row }) => {row.original.description},
+ },
],
[],
);
diff --git a/src/pages/AdminPage/tabs/Attributes/modals/AttributeModal.tsx b/src/pages/AdminPage/tabs/Attributes/modals/AttributeModal.tsx
index 9dd5533..515cefe 100644
--- a/src/pages/AdminPage/tabs/Attributes/modals/AttributeModal.tsx
+++ b/src/pages/AdminPage/tabs/Attributes/modals/AttributeModal.tsx
@@ -22,7 +22,7 @@ const AttributeModal = ({
const isEditing = "attribute" in innerProps;
const [isInitial, setIsInitial] = useState(true);
const [isNullableInputShown, setIsNullableInputShown] = useState(true);
- const [isDefaultValueInputShown, setIsDefaultValueInputShown] = useState(true);
+ const [copyTypeId, setCopyTypeId] = useState();
const closeModal = () => context.closeContextModal(id);
const form = useForm>({
@@ -49,7 +49,6 @@ const AttributeModal = ({
}, [form.values.label]);
useEffect(() => {
- setIsDefaultValueInputShown(false);
const type = form.values.type?.type;
setIsNullableInputShown(type !== "bool");
@@ -62,7 +61,7 @@ const AttributeModal = ({
}
}
setIsInitial(false);
- setIsDefaultValueInputShown(true);
+ setCopyTypeId(form.values.type?.id);
}, [form.values.type?.id]);
const validate = (): boolean => {
@@ -150,7 +149,7 @@ const AttributeModal = ({
{...form.getInputProps("isNullable", { type: "checkbox" })}
/>
)}
- {form.values.type && isDefaultValueInputShown && (
+ {form.values.type && copyTypeId === form.values.type.id && (
)}