feat: purchase form
This commit is contained in:
parent
4c4579f009
commit
49ed3386be
@ -1,7 +1,7 @@
|
|||||||
import Grid from '@mui/material/Grid2'
|
import Grid from '@mui/material/Grid2'
|
||||||
|
|
||||||
import PurchaseOrderAddHeader from '@/views/apps/purchase/purchase-orders/add/PurchaseOrderAddHeader'
|
import PurchaseOrderAddHeader from '@/views/apps/purchase/purchase-orders/add/PurchaseOrderAddHeader'
|
||||||
import PurchaseOrderAddForm from '@/views/apps/purchase/purchase-orders/add/PurchaseOrderAddForm'
|
import PurchaseAddForm from '@/views/apps/purchase/purchase-form/PurchaseAddForm'
|
||||||
|
|
||||||
const PurchaseOrderAddPage = () => {
|
const PurchaseOrderAddPage = () => {
|
||||||
return (
|
return (
|
||||||
@ -10,7 +10,7 @@ const PurchaseOrderAddPage = () => {
|
|||||||
<PurchaseOrderAddHeader />
|
<PurchaseOrderAddHeader />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid size={{ xs: 12 }}>
|
<Grid size={{ xs: 12 }}>
|
||||||
<PurchaseOrderAddForm />
|
<PurchaseAddForm />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import React, { useState } from 'react'
|
|||||||
import { Card, CardContent } from '@mui/material'
|
import { Card, CardContent } from '@mui/material'
|
||||||
import Grid from '@mui/material/Grid2'
|
import Grid from '@mui/material/Grid2'
|
||||||
import { IngredientItem, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
import { IngredientItem, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
||||||
import PurchaseOrderBasicInfo from './PurchaseOrderBasicInfo'
|
import PurchaseBasicInfo from './PurchaseBasicInfo'
|
||||||
import PurchaseOrderIngredientsTable from './PurchaseOrderIngredientsTable'
|
import PurchaseIngredientsTable from './PurchaseIngredientsTable'
|
||||||
import PurchaseOrderSummary from './PurchaseOrderSummary'
|
import PurchaseSummary from './PurchaseSummary'
|
||||||
|
|
||||||
const PurchaseOrderAddForm: React.FC = () => {
|
const PurchaseAddForm: React.FC = () => {
|
||||||
const [formData, setFormData] = useState<PurchaseOrderFormData>({
|
const [formData, setFormData] = useState<PurchaseOrderFormData>({
|
||||||
vendor: null,
|
vendor: null,
|
||||||
nomor: 'PO/00043',
|
nomor: 'PO/00043',
|
||||||
@ -100,10 +100,10 @@ const PurchaseOrderAddForm: React.FC = () => {
|
|||||||
<CardContent>
|
<CardContent>
|
||||||
<Grid container spacing={3}>
|
<Grid container spacing={3}>
|
||||||
{/* Basic Info Section */}
|
{/* Basic Info Section */}
|
||||||
<PurchaseOrderBasicInfo formData={formData} handleInputChange={handleInputChange} />
|
<PurchaseBasicInfo formData={formData} handleInputChange={handleInputChange} />
|
||||||
|
|
||||||
{/* Ingredients Table Section */}
|
{/* Ingredients Table Section */}
|
||||||
<PurchaseOrderIngredientsTable
|
<PurchaseIngredientsTable
|
||||||
formData={formData}
|
formData={formData}
|
||||||
handleIngredientChange={handleIngredientChange}
|
handleIngredientChange={handleIngredientChange}
|
||||||
addIngredientItem={addIngredientItem}
|
addIngredientItem={addIngredientItem}
|
||||||
@ -111,11 +111,11 @@ const PurchaseOrderAddForm: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Summary Section */}
|
{/* Summary Section */}
|
||||||
<PurchaseOrderSummary formData={formData} handleInputChange={handleInputChange} />
|
<PurchaseSummary formData={formData} handleInputChange={handleInputChange} />
|
||||||
</Grid>
|
</Grid>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PurchaseOrderAddForm
|
export default PurchaseAddForm
|
||||||
@ -7,12 +7,12 @@ import CustomAutocomplete from '@/@core/components/mui/Autocomplete'
|
|||||||
import CustomTextField from '@/@core/components/mui/TextField'
|
import CustomTextField from '@/@core/components/mui/TextField'
|
||||||
import { DropdownOption, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
import { DropdownOption, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
||||||
|
|
||||||
interface PurchaseOrderBasicInfoProps {
|
interface PurchaseBasicInfoProps {
|
||||||
formData: PurchaseOrderFormData
|
formData: PurchaseOrderFormData
|
||||||
handleInputChange: (field: keyof PurchaseOrderFormData, value: any) => void
|
handleInputChange: (field: keyof PurchaseOrderFormData, value: any) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const PurchaseOrderBasicInfo: React.FC<PurchaseOrderBasicInfoProps> = ({ formData, handleInputChange }) => {
|
const PurchaseBasicInfo: React.FC<PurchaseBasicInfoProps> = ({ formData, handleInputChange }) => {
|
||||||
// Sample data for dropdowns
|
// Sample data for dropdowns
|
||||||
const vendorOptions: DropdownOption[] = [
|
const vendorOptions: DropdownOption[] = [
|
||||||
{ label: 'Vendor A', value: 'vendor_a' },
|
{ label: 'Vendor A', value: 'vendor_a' },
|
||||||
@ -194,4 +194,4 @@ const PurchaseOrderBasicInfo: React.FC<PurchaseOrderBasicInfoProps> = ({ formDat
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PurchaseOrderBasicInfo
|
export default PurchaseBasicInfo
|
||||||
@ -7,14 +7,14 @@ import CustomAutocomplete from '@/@core/components/mui/Autocomplete'
|
|||||||
import CustomTextField from '@/@core/components/mui/TextField'
|
import CustomTextField from '@/@core/components/mui/TextField'
|
||||||
import { IngredientItem, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
import { IngredientItem, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
||||||
|
|
||||||
interface PurchaseOrderIngredientsTableProps {
|
interface PurchaseIngredientsTableProps {
|
||||||
formData: PurchaseOrderFormData
|
formData: PurchaseOrderFormData
|
||||||
handleIngredientChange: (index: number, field: keyof IngredientItem, value: any) => void
|
handleIngredientChange: (index: number, field: keyof IngredientItem, value: any) => void
|
||||||
addIngredientItem: () => void
|
addIngredientItem: () => void
|
||||||
removeIngredientItem: (index: number) => void
|
removeIngredientItem: (index: number) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const PurchaseOrderIngredientsTable: React.FC<PurchaseOrderIngredientsTableProps> = ({
|
const PurchaseIngredientsTable: React.FC<PurchaseIngredientsTableProps> = ({
|
||||||
formData,
|
formData,
|
||||||
handleIngredientChange,
|
handleIngredientChange,
|
||||||
addIngredientItem,
|
addIngredientItem,
|
||||||
@ -246,4 +246,4 @@ const PurchaseOrderIngredientsTable: React.FC<PurchaseOrderIngredientsTableProps
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PurchaseOrderIngredientsTable
|
export default PurchaseIngredientsTable
|
||||||
@ -8,12 +8,12 @@ import { PurchaseOrderFormData, TransactionCost } from '@/types/apps/purchaseOrd
|
|||||||
import CustomAutocomplete from '@/@core/components/mui/Autocomplete'
|
import CustomAutocomplete from '@/@core/components/mui/Autocomplete'
|
||||||
import ImageUpload from '@/components/ImageUpload'
|
import ImageUpload from '@/components/ImageUpload'
|
||||||
|
|
||||||
interface PurchaseOrderSummaryProps {
|
interface PurchaseSummaryProps {
|
||||||
formData: PurchaseOrderFormData
|
formData: PurchaseOrderFormData
|
||||||
handleInputChange: (field: keyof PurchaseOrderFormData, value: any) => void
|
handleInputChange: (field: keyof PurchaseOrderFormData, value: any) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const PurchaseOrderSummary: React.FC<PurchaseOrderSummaryProps> = ({ formData, handleInputChange }) => {
|
const PurchaseSummary: React.FC<PurchaseSummaryProps> = ({ formData, handleInputChange }) => {
|
||||||
// Initialize transaction costs if not exist
|
// Initialize transaction costs if not exist
|
||||||
const transactionCosts = formData.transactionCosts || []
|
const transactionCosts = formData.transactionCosts || []
|
||||||
|
|
||||||
@ -575,4 +575,4 @@ const PurchaseOrderSummary: React.FC<PurchaseOrderSummaryProps> = ({ formData, h
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PurchaseOrderSummary
|
export default PurchaseSummary
|
||||||
Loading…
x
Reference in New Issue
Block a user