This commit is contained in:
liamzi
2024-12-27 18:34:17 +08:00
parent c3c8966cce
commit bfa895fa16
2 changed files with 21 additions and 17 deletions

View File

@@ -3,7 +3,7 @@ import { Form, Card, Input, Select, message,Button } from 'antd';
import { supabaseService } from '@/hooks/supabaseService';
import {ArrowLeftOutlined}from '@ant-design/icons'
import SectionList from '@/components/SectionList';
const TYPE = 'quotation'
const QuotationTemplate = ({ id, isView, onCancel,isEdit }) => {
const [form] = Form.useForm();
const [loading, setLoading] = useState(false);
@@ -28,7 +28,7 @@ const QuotationTemplate = ({ id, isView, onCancel,isEdit }) => {
filter: {
id: { eq: id },
type: { eq: 'serviceTemplate' },
'attributes->>template_type': { eq: 'quotation' }
'attributes->>template_type': { eq: TYPE }
}
});
console.log(data,'data');
@@ -57,7 +57,7 @@ const QuotationTemplate = ({ id, isView, onCancel,isEdit }) => {
const { data } = await supabaseService.select('resources', {
filter: {
type: { eq: 'categories' },
'attributes->>template_type': { in: `(quotation,common)` }
'attributes->>template_type': { in: `(${TYPE},common)` }
},
order: {
column: 'created_at',
@@ -95,7 +95,7 @@ const QuotationTemplate = ({ id, isView, onCancel,isEdit }) => {
const serviceData = {
type: "serviceTemplate",
attributes: {
template_type: "quotation",
template_type: TYPE,
templateName: values.templateName,
description: values.description,
sections: values.sections,
@@ -189,13 +189,16 @@ const QuotationTemplate = ({ id, isView, onCancel,isEdit }) => {
bordered={false}
>
<SectionList
type="quotation"
form={form}
isView={isView}
formValues={formValues}
onValuesChange={handleValuesChange}
/>
</Card>
<div className="flex justify-end space-x-4">
</Form>
<div className="flex justify-end pt-4 space-x-4">
<Button
icon={<ArrowLeftOutlined />}
onClick={onCancel}
@@ -212,8 +215,6 @@ const QuotationTemplate = ({ id, isView, onCancel,isEdit }) => {
</Button>
)}
</div>
</Form>
</>
);
};