- Implemented TemplateCheckpointEditDialog for creating and editing inspection checkpoints. - Added VendorActions component for managing vendor actions including edit, activate/deactivate, and delete. - Created VendorContext for managing vendor state across components. - Developed VendorGeneralInfo component to display detailed vendor information. - Introduced AedSymbol and Money components for consistent currency representation. - Added PromptDialog for user input prompts throughout the application. - Implemented RelationLink component for unified related-data display in CRUD tables. - Created InspectionTemplatesClient for API interactions related to inspection templates.
29 lines
525 B
TypeScript
29 lines
525 B
TypeScript
"use client"
|
|
|
|
import { createContext, useContext } from "react"
|
|
|
|
type VendorContextValue = {
|
|
id: string
|
|
label: string
|
|
}
|
|
|
|
const VendorContext = createContext<VendorContextValue | null>(null)
|
|
|
|
export function VendorProvider({
|
|
vendor,
|
|
children,
|
|
}: {
|
|
vendor: VendorContextValue
|
|
children: React.ReactNode
|
|
}) {
|
|
return (
|
|
<VendorContext.Provider value={vendor}>
|
|
{children}
|
|
</VendorContext.Provider>
|
|
)
|
|
}
|
|
|
|
export function useVendor() {
|
|
return useContext(VendorContext)
|
|
}
|