feat: purchase form
This commit is contained in:
parent
4c4579f009
commit
49ed3386be
@ -1,7 +1,7 @@
|
||||
import Grid from '@mui/material/Grid2'
|
||||
|
||||
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 = () => {
|
||||
return (
|
||||
@ -10,7 +10,7 @@ const PurchaseOrderAddPage = () => {
|
||||
<PurchaseOrderAddHeader />
|
||||
</Grid>
|
||||
<Grid size={{ xs: 12 }}>
|
||||
<PurchaseOrderAddForm />
|
||||
<PurchaseAddForm />
|
||||
</Grid>
|
||||
</Grid>
|
||||
)
|
||||
|
||||
@ -4,11 +4,11 @@ import React, { useState } from 'react'
|
||||
import { Card, CardContent } from '@mui/material'
|
||||
import Grid from '@mui/material/Grid2'
|
||||
import { IngredientItem, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
||||
import PurchaseOrderBasicInfo from './PurchaseOrderBasicInfo'
|
||||
import PurchaseOrderIngredientsTable from './PurchaseOrderIngredientsTable'
|
||||
import PurchaseOrderSummary from './PurchaseOrderSummary'
|
||||
import PurchaseBasicInfo from './PurchaseBasicInfo'
|
||||
import PurchaseIngredientsTable from './PurchaseIngredientsTable'
|
||||
import PurchaseSummary from './PurchaseSummary'
|
||||
|
||||
const PurchaseOrderAddForm: React.FC = () => {
|
||||
const PurchaseAddForm: React.FC = () => {
|
||||
const [formData, setFormData] = useState<PurchaseOrderFormData>({
|
||||
vendor: null,
|
||||
nomor: 'PO/00043',
|
||||
@ -100,10 +100,10 @@ const PurchaseOrderAddForm: React.FC = () => {
|
||||
<CardContent>
|
||||
<Grid container spacing={3}>
|
||||
{/* Basic Info Section */}
|
||||
<PurchaseOrderBasicInfo formData={formData} handleInputChange={handleInputChange} />
|
||||
<PurchaseBasicInfo formData={formData} handleInputChange={handleInputChange} />
|
||||
|
||||
{/* Ingredients Table Section */}
|
||||
<PurchaseOrderIngredientsTable
|
||||
<PurchaseIngredientsTable
|
||||
formData={formData}
|
||||
handleIngredientChange={handleIngredientChange}
|
||||
addIngredientItem={addIngredientItem}
|
||||
@ -111,11 +111,11 @@ const PurchaseOrderAddForm: React.FC = () => {
|
||||
/>
|
||||
|
||||
{/* Summary Section */}
|
||||
<PurchaseOrderSummary formData={formData} handleInputChange={handleInputChange} />
|
||||
<PurchaseSummary formData={formData} handleInputChange={handleInputChange} />
|
||||
</Grid>
|
||||
</CardContent>
|
||||
</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 { DropdownOption, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
||||
|
||||
interface PurchaseOrderBasicInfoProps {
|
||||
interface PurchaseBasicInfoProps {
|
||||
formData: PurchaseOrderFormData
|
||||
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
|
||||
const vendorOptions: DropdownOption[] = [
|
||||
{ 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 { IngredientItem, PurchaseOrderFormData } from '@/types/apps/purchaseOrderTypes'
|
||||
|
||||
interface PurchaseOrderIngredientsTableProps {
|
||||
interface PurchaseIngredientsTableProps {
|
||||
formData: PurchaseOrderFormData
|
||||
handleIngredientChange: (index: number, field: keyof IngredientItem, value: any) => void
|
||||
addIngredientItem: () => void
|
||||
removeIngredientItem: (index: number) => void
|
||||
}
|
||||
|
||||
const PurchaseOrderIngredientsTable: React.FC<PurchaseOrderIngredientsTableProps> = ({
|
||||
const PurchaseIngredientsTable: React.FC<PurchaseIngredientsTableProps> = ({
|
||||
formData,
|
||||
handleIngredientChange,
|
||||
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 ImageUpload from '@/components/ImageUpload'
|
||||
|
||||
interface PurchaseOrderSummaryProps {
|
||||
interface PurchaseSummaryProps {
|
||||
formData: PurchaseOrderFormData
|
||||
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
|
||||
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