diff options
author | eug-vs <eug-vs@keemail.me> | 2021-03-14 12:08:32 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2021-03-14 12:08:32 +0300 |
commit | 8e011b65f346386abe26afcce737dd59c5865988 (patch) | |
tree | 68e1159eea6ec6ea65740bf61e5ee1182883dae4 /src/containers/Service | |
parent | dfe13c7c061b4b2fd6dfde8e1c3c284d574ad8f2 (diff) | |
download | commercel-ui-8e011b65f346386abe26afcce737dd59c5865988.tar.gz |
feat: add Waybills
Diffstat (limited to 'src/containers/Service')
-rw-r--r-- | src/containers/Service/ServiceContext.tsx | 1 | ||||
-rw-r--r-- | src/containers/Service/ServiceForm.tsx | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/containers/Service/ServiceContext.tsx b/src/containers/Service/ServiceContext.tsx index 2602936..8f23d9d 100644 --- a/src/containers/Service/ServiceContext.tsx +++ b/src/containers/Service/ServiceContext.tsx @@ -6,6 +6,7 @@ export interface ServiceParams { nameSingular: string; tableFields: any[]; Form: React.FC<any>; + default: Record<string, any>; } const ServiceContext = React.createContext<ServiceParams>({ diff --git a/src/containers/Service/ServiceForm.tsx b/src/containers/Service/ServiceForm.tsx index 273f5bd..62e4521 100644 --- a/src/containers/Service/ServiceForm.tsx +++ b/src/containers/Service/ServiceForm.tsx @@ -1,6 +1,7 @@ import React, { useContext } from 'react'; import { useParams, useHistory } from 'react-router-dom'; import { Formik } from 'formik'; +import _ from 'lodash'; import Page, { Action } from '../Page'; import hooks from '../../hooks/useAPIClient'; import { post, patch } from '../../requests'; @@ -32,7 +33,7 @@ const ServiceForm: React.FC = () => { <Page title={id ? item?.name : `Новый ${service.nameSingular}`} actions={actions}> {(!id || item) && ( <Formik - initialValues={item || { name: '', debt: '', vatId: '' }} + initialValues={_.defaults(item, service.default)} onSubmit={onSubmit} > <service.Form /> |