feat: add description to tariff
This commit is contained in:
parent
c7d1c90ab8
commit
05e7d399f3
@ -8,6 +8,7 @@ import type { EditTariffRequestBody } from "@root/model/tariff";
|
|||||||
|
|
||||||
type CreateTariffBackendRequest = {
|
type CreateTariffBackendRequest = {
|
||||||
name: string;
|
name: string;
|
||||||
|
description: string;
|
||||||
price: number;
|
price: number;
|
||||||
isCustom: boolean;
|
isCustom: boolean;
|
||||||
privileges: Omit<PrivilegeWithAmount, "_id" | "updatedAt">[];
|
privileges: Omit<PrivilegeWithAmount, "_id" | "updatedAt">[];
|
||||||
|
@ -23,6 +23,7 @@ import { Formik, Field, Form, FormikHelpers } from "formik";
|
|||||||
|
|
||||||
interface Values {
|
interface Values {
|
||||||
nameField: string,
|
nameField: string,
|
||||||
|
descriptionField: string,
|
||||||
amountField: string,
|
amountField: string,
|
||||||
customPriceField: string,
|
customPriceField: string,
|
||||||
privilegeIdField: string,
|
privilegeIdField: string,
|
||||||
@ -53,6 +54,7 @@ export default function CreateTariff() {
|
|||||||
|
|
||||||
const initialValues: Values = {
|
const initialValues: Values = {
|
||||||
nameField: "",
|
nameField: "",
|
||||||
|
descriptionField: "",
|
||||||
amountField: "",
|
amountField: "",
|
||||||
customPriceField: "",
|
customPriceField: "",
|
||||||
privilegeIdField: "",
|
privilegeIdField: "",
|
||||||
@ -68,6 +70,7 @@ export default function CreateTariff() {
|
|||||||
name: values.nameField,
|
name: values.nameField,
|
||||||
price: Number(values.customPriceField) * 100,
|
price: Number(values.customPriceField) * 100,
|
||||||
isCustom: false,
|
isCustom: false,
|
||||||
|
description: values.descriptionField,
|
||||||
privileges: [
|
privileges: [
|
||||||
{
|
{
|
||||||
name: values.privilege.name,
|
name: values.privilege.name,
|
||||||
@ -283,6 +286,29 @@ export default function CreateTariff() {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
<TextField
|
||||||
|
id="tariff-dezcription"
|
||||||
|
name="descriptionField"
|
||||||
|
variant="filled"
|
||||||
|
onChange={(e) => {
|
||||||
|
props.setFieldValue("descriptionField", e.target.value)
|
||||||
|
}}
|
||||||
|
value={props.values.descriptionField}
|
||||||
|
onBlur={props.handleBlur}
|
||||||
|
label="Описание"
|
||||||
|
multiline={true}
|
||||||
|
InputProps={{
|
||||||
|
style: {
|
||||||
|
backgroundColor: theme.palette.content.main,
|
||||||
|
color: theme.palette.secondary.main,
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
InputLabelProps={{
|
||||||
|
style: {
|
||||||
|
color: theme.palette.secondary.main
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
className="btn_createTariffBackend"
|
className="btn_createTariffBackend"
|
||||||
type="submit"
|
type="submit"
|
||||||
|
Loading…
Reference in New Issue
Block a user