Done
This commit is contained in:
parent
e6f7a2a4a8
commit
ae45d6f186
|
|
@ -1,23 +1,29 @@
|
|||
|
||||
import React from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
import DashBody from '../../Layout/Dashboard/DashBody'
|
||||
import DashHeader from '../../Layout/Dashboard/DashHeader'
|
||||
import LyTable from '../../Layout/Dashboard/LyTable'
|
||||
import useTableColumns from './useTableColumns'
|
||||
import { QueryStatusEnum } from '../../config/QueryStatus'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import AddButton from '../../Layout/Dashboard/AddButton/AddButton'
|
||||
import { useGetCategories } from '../../api/Categories'
|
||||
import SearchField from '../../Layout/Dashboard/SearchField'
|
||||
import { usePageState } from '../../lib/state mangment/LayoutPagestate'
|
||||
|
||||
function Page() {
|
||||
|
||||
const column =useTableColumns()
|
||||
const {data ,status } = useGetCategories()
|
||||
const [t] = useTranslation()
|
||||
const navigate = useNavigate()
|
||||
const totalRows = data?.meta?.total;
|
||||
const { setObjectToEdit, objectToEdit } = usePageState()
|
||||
|
||||
useEffect(() => {
|
||||
if(objectToEdit && objectToEdit.length > 0)
|
||||
setObjectToEdit([])
|
||||
|
||||
}, [setObjectToEdit,objectToEdit ])
|
||||
|
||||
return (
|
||||
// Pass Status to Layout
|
||||
|
|
|
|||
|
|
@ -453,6 +453,7 @@ const EditPage = () => {
|
|||
|
||||
}
|
||||
|
||||
|
||||
}, [isSuccess])
|
||||
|
||||
|
||||
|
|
@ -483,7 +484,7 @@ const EditPage = () => {
|
|||
return item?.attribute_value
|
||||
}))
|
||||
|
||||
}, [data?.category, Atrribute?.data, isRefetching, AttributeisRefetching, setObjectToEdit]);
|
||||
}, [data?.category, Atrribute?.data, isRefetching, AttributeisRefetching, setObjectToEdit,isLoadingAtrribute]);
|
||||
|
||||
|
||||
const getValidationSchema = () => {
|
||||
|
|
@ -498,9 +499,10 @@ const EditPage = () => {
|
|||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className='ViewPage'>
|
||||
{objectToEdit && data ?
|
||||
{objectToEdit && !AttributeisRefetching && data ?
|
||||
<ViewPage {...ViewProps}>
|
||||
<Tabs>
|
||||
<TabList>
|
||||
|
|
@ -514,7 +516,10 @@ const EditPage = () => {
|
|||
</TabBody>
|
||||
|
||||
<TabBody >
|
||||
{Atrribute?.data &&
|
||||
<div className=" mt-4"><TabsContainer /></div>
|
||||
|
||||
}
|
||||
</TabBody>
|
||||
|
||||
</Tabs>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,14 @@
|
|||
import React, { useEffect, useState } from 'react'
|
||||
import React, { useEffect } from 'react'
|
||||
import { getInitialValues, getDataToSend } from './formUtil'
|
||||
import { Tab, TabList, TabPanel as TabBody, Tabs } from 'react-tabs'
|
||||
import 'react-tabs/style/react-tabs.css';
|
||||
import { MdLanguage } from 'react-icons/md'
|
||||
import { FaSadCry } from 'react-icons/fa'
|
||||
import ViewPage from '../../../Layout/Dashboard/ViewPage';
|
||||
import { Rate, Spin } from 'antd';
|
||||
import { Spin } from 'antd';
|
||||
import { usePageState } from '../../../lib/state mangment/LayoutPagestate';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import LoadingPage from '../../../Layout/app/LoadingPage';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BsInfoCircle } from 'react-icons/bs';
|
||||
import { useGetOneSlider, useUpdateSlider } from '../../../api/Slider';
|
||||
import useNavigateOnSuccess from '../../../Hooks/useNavigateOnSuccess';
|
||||
import Form from './EditForm';
|
||||
import { useGetOneOrder, useUpdateOrder } from '../../../api/order';
|
||||
|
|
@ -24,14 +21,27 @@ const EditPage = () => {
|
|||
const {mutate ,isSuccess,isLoading:IsloadingButton} = useUpdateOrder("put")
|
||||
const { id } = useParams();
|
||||
const { data, isLoading } = useGetOneOrder({id: id })
|
||||
const handleSubmit = (values:any)=>{
|
||||
|
||||
console.log(values?.deliviration_estimated_time?.format('YYYY-MM-DD HH:mm:ss'));
|
||||
return mutate({
|
||||
...values,
|
||||
deliviration_estimated_time:values?.deliviration_estimated_time?.format('YYYY-MM-DD HH:mm:ss')
|
||||
});
|
||||
const handleSubmit = (values:any) => {
|
||||
// Create a new object without empty string values
|
||||
const cleanedValues = {} as any;
|
||||
for (let key in values) {
|
||||
if (values[key] !== "") {
|
||||
cleanedValues[key] = values[key];
|
||||
}
|
||||
}
|
||||
|
||||
// Optionally format the deliviration_estimated_time if it exists
|
||||
if (cleanedValues.deliviration_estimated_time) {
|
||||
cleanedValues.deliviration_estimated_time = cleanedValues.deliviration_estimated_time.format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
|
||||
// Log the formatted deliviration_estimated_time
|
||||
console.log(cleanedValues.deliviration_estimated_time);
|
||||
|
||||
// Mutate with the cleaned values
|
||||
return mutate(cleanedValues);
|
||||
}
|
||||
|
||||
|
||||
useNavigateOnSuccess(isSuccess , '/order')
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user