Merge pull request #9 from lora322/ai-dev

Ai dev
This commit is contained in:
lora322 2025-09-11 12:35:32 -04:00 committed by GitHub
commit a5d34b970e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,6 +50,22 @@ const OrdersNew = () => {
const router = useRouter();
const dispatch = useAppDispatch();
// State for property options
const [propertyOptions, setPropertyOptions] = useState([]);
// Fetch property options from your backend API
useEffect(() => {
fetch('https://vres.flatlogic.app/api/properties') // <-- uses deployed api
.then(res => res.json())
.then(data => {
const options = data.map(property => ({
value: property.id,
label: property.name,
}));
setPropertyOptions(options);
});
}, []);
const handleSubmit = async (data) => {
await dispatch(create(data));
await router.push('/orders/orders-list');
@ -88,9 +104,9 @@ const OrdersNew = () => {
name='property'
id='property'
component={SelectField}
options={[]}
options={propertyOptions}
itemRef={'properties'}
></Field>
/>
</FormField>
<FormField label='RequestedDate'>