fix_translate
This commit is contained in:
parent
d3f689bd3c
commit
ece9e9d9ed
|
|
@ -30,13 +30,27 @@ i18n.use(initReactI18next).init({
|
||||||
|
|
||||||
export function useLanguage() {
|
export function useLanguage() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
changeLanguage(language);
|
// Define a function to handle language change events
|
||||||
|
const handleLanguageChange = () => {
|
||||||
|
const newLanguage = localStorage.getItem('language') ?? 'en';
|
||||||
|
changeLanguage(newLanguage);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Add an event listener to detect changes in localStorage
|
||||||
|
window.addEventListener('storage', handleLanguageChange);
|
||||||
|
|
||||||
|
// Clean up by removing the event listener when the component unmounts
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('storage', handleLanguageChange);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const changeLanguage = (newLanguage:any) => {
|
const changeLanguage = (newLanguage:any) => {
|
||||||
i18n.changeLanguage(newLanguage);
|
i18n.changeLanguage(newLanguage);
|
||||||
localStorage.setItem('language', newLanguage);
|
localStorage.setItem('language', newLanguage);
|
||||||
applyLanguageStyles(newLanguage);
|
applyLanguageStyles(newLanguage);
|
||||||
|
// Refresh the page to apply the language changes
|
||||||
|
window.location.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
return { changeLanguage };
|
return { changeLanguage };
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ export default function HomePage() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const {data,isLoading} = useGetHome()
|
const {data,isLoading} = useGetHome()
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
|
|
||||||
const cardsData = [
|
const cardsData = [
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ const ObjectField = ({ tabKey }: any) => {
|
||||||
</Space>
|
</Space>
|
||||||
))}
|
))}
|
||||||
<Button type="dashed" onClick={() => setFieldItems([...FieldItems, { Description: '', key: '' }])} block>
|
<Button type="dashed" onClick={() => setFieldItems([...FieldItems, { Description: '', key: '' }])} block>
|
||||||
{t("+ Add Another Item")}
|
{t("Add Another Item")}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ const OrderPage = () => {
|
||||||
|
|
||||||
const { data, status } = useGetOrder();
|
const { data, status } = useGetOrder();
|
||||||
|
|
||||||
const totalRows = data?.pagination?.total || 0;
|
const totalRows = data?.meta?.total;
|
||||||
|
|
||||||
const columns = useTableColumns();
|
const columns = useTableColumns();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ import React from 'react'
|
||||||
import { DatePicker } from 'antd'
|
import { DatePicker } from 'antd'
|
||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import { useOrderFillterState } from '../../../zustand/OrderFillter';
|
import { useOrderFillterState } from '../../../zustand/OrderFillter';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
|
|
||||||
const CustomDateRange = () => {
|
const CustomDateRange = () => {
|
||||||
const dateFormat = 'YYYY-MM-DD';
|
const dateFormat = 'YYYY-MM-DD';
|
||||||
const { toDate,fromDate,setFromDate,setToDate } = useOrderFillterState(); // Moved hook call inside the functional component
|
const { toDate,fromDate,setFromDate,setToDate } = useOrderFillterState(); // Moved hook call inside the functional component
|
||||||
|
const [t] = useTranslation();
|
||||||
|
|
||||||
const onCalendarChange = (value: any) => {
|
const onCalendarChange = (value: any) => {
|
||||||
const FromData = value[0]?.format(dateFormat)
|
const FromData = value[0]?.format(dateFormat)
|
||||||
|
|
@ -23,6 +25,7 @@ const CustomDateRange = () => {
|
||||||
format={dateFormat}
|
format={dateFormat}
|
||||||
onChange={onCalendarChange}
|
onChange={onCalendarChange}
|
||||||
className="CustomDateRange"
|
className="CustomDateRange"
|
||||||
|
placeholder={[t(`PriceFrom`),t(`PriceTo`)]}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import { InputNumber } from 'antd';
|
import { InputNumber } from 'antd';
|
||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useOrderFillterState } from '../../../zustand/OrderFillter';
|
import { useOrderFillterState } from '../../../zustand/OrderFillter';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const CustomNumber = () => {
|
const CustomNumber = () => {
|
||||||
const [valueFrom, setValueFrom] = useState<number | null>(null);
|
const [valueFrom, setValueFrom] = useState<number | null>(null);
|
||||||
|
|
@ -18,11 +19,16 @@ const CustomNumber = () => {
|
||||||
setValueTo(value);
|
setValueTo(value);
|
||||||
setTotalTo(value);
|
setTotalTo(value);
|
||||||
};
|
};
|
||||||
|
const [t] = useTranslation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='CustomNumber'>
|
<div className='CustomNumber'>
|
||||||
<InputNumber placeholder='PriceFrom' value={valueFrom} onChange={onChangeFrom} />
|
<InputNumber
|
||||||
<InputNumber placeholder='PriceTo' value={valueTo} onChange={onChangeTo} />
|
placeholder={t(`PriceFrom`)}
|
||||||
|
value={valueFrom} onChange={onChangeFrom} />
|
||||||
|
<InputNumber
|
||||||
|
placeholder={t(`PriceTo`)}
|
||||||
|
value={valueTo} onChange={onChangeTo} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,6 @@ const useTableColumns = () => {
|
||||||
{
|
{
|
||||||
name: t("status"),
|
name: t("status"),
|
||||||
center: true,
|
center: true,
|
||||||
width:"300",
|
|
||||||
cell: (row: any) => {
|
cell: (row: any) => {
|
||||||
let status = row?.state;
|
let status = row?.state;
|
||||||
let icon;
|
let icon;
|
||||||
|
|
@ -85,10 +84,10 @@ const useTableColumns = () => {
|
||||||
showDelete={false}
|
showDelete={false}
|
||||||
objectToEdit={row}
|
objectToEdit={row}
|
||||||
onDelete={() => deleteMutation.mutate({order_id:row.id })}
|
onDelete={() => deleteMutation.mutate({order_id:row.id })}
|
||||||
showEdit={true}
|
showEdit={false}
|
||||||
showView={false}
|
showView={true}
|
||||||
onView={()=>navigate(`/order/view/${row?.id}` )}
|
// onView={()=>navigate(`/order/view/${row?.id}` )}
|
||||||
onEdit={()=>navigate(`/order/${row?.id}` )}
|
onView={()=>navigate(`/order/${row?.id}` )}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -597,6 +597,7 @@ padding: 10px 40px;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
padding-inline: 10px;
|
padding-inline: 10px;
|
||||||
text-wrap: nowrap;
|
text-wrap: nowrap;
|
||||||
|
white-space: nowrap;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ export default function useGetQueryPagination(KEY: string | string[], Api: strin
|
||||||
const axios = useAxios();
|
const axios = useAxios();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
let pagination = location?.search || '';
|
let pagination = location?.search || '';
|
||||||
|
const language = localStorage.getItem("language") ?? "en"
|
||||||
|
|
||||||
const { logout } = useAuthState();
|
const { logout } = useAuthState();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
@ -25,7 +26,7 @@ export default function useGetQueryPagination(KEY: string | string[], Api: strin
|
||||||
const apiUrl = Api + paginationParams;
|
const apiUrl = Api + paginationParams;
|
||||||
|
|
||||||
return useQuery(
|
return useQuery(
|
||||||
[Array.isArray(KEY) ? KEY.join(',') : KEY, pagination], async () => {
|
[Array.isArray(KEY) ? KEY.join(',') : KEY, pagination,language], async () => {
|
||||||
const response = await axios.get(apiUrl, { params });
|
const response = await axios.get(apiUrl, { params });
|
||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ function useGetOneQuery(key: string, url: string , params:any={},options:any={})
|
||||||
const {id} = useParams()
|
const {id} = useParams()
|
||||||
|
|
||||||
return useQuery(
|
return useQuery(
|
||||||
[id, key],
|
[id, key,language],
|
||||||
async () => {
|
async () => {
|
||||||
const response = await axios.get(url+"/"+ id+`?lang=${language}`);
|
const response = await axios.get(url+"/"+ id+`?lang=${language}`);
|
||||||
return response.data;
|
return response.data;
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,14 @@ import useAxios from './useAxios';
|
||||||
import useAuthState from '../../lib/state mangment/AuthState';
|
import useAuthState from '../../lib/state mangment/AuthState';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
function useGetQuery(key: string, url: string , params:any={},options:any={}) {
|
function useGetQuery(KEY: string | string[], url: string , params:any={},options:any={}) {
|
||||||
const axios = useAxios();
|
const axios = useAxios();
|
||||||
const {logout} = useAuthState()
|
const {logout} = useAuthState()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
|
const language = localStorage.getItem("language") ?? "en"
|
||||||
|
|
||||||
return useQuery(
|
return useQuery(
|
||||||
params ? [key, params] : key,
|
params ? [Array.isArray(KEY) ? KEY.join(',') : KEY, params,language] : [Array.isArray(KEY) ? KEY.join(',') : KEY,language],
|
||||||
async () => {
|
async () => {
|
||||||
const response = await axios.get(url , {params});
|
const response = await axios.get(url , {params});
|
||||||
return response.data;
|
return response.data;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ const API = {
|
||||||
UPDATE: `home/overview`,
|
UPDATE: `home/overview`,
|
||||||
|
|
||||||
};
|
};
|
||||||
const KEY = "home"
|
const KEY = ["home","order","users","categories"]
|
||||||
|
|
||||||
|
|
||||||
export const useGetHome = (params?:any) => useGetQuery(KEY, API.GET_ALL,params);
|
export const useGetHome = (params?:any) => useGetQuery(KEY, API.GET_ALL,params);
|
||||||
|
|
@ -166,7 +166,15 @@
|
||||||
"checkAndModify": "يرجى التحقق من الشبكة الخاصة بك وإعادة تحميل الصفحة.",
|
"checkAndModify": "يرجى التحقق من الشبكة الخاصة بك وإعادة تحميل الصفحة.",
|
||||||
"refetch": "إعادة تحميل الصفحة",
|
"refetch": "إعادة تحميل الصفحة",
|
||||||
"goToHome": "الانتقال إلى الصفحة الرئيسية"
|
"goToHome": "الانتقال إلى الصفحة الرئيسية"
|
||||||
}
|
},
|
||||||
|
"value_en": "القيمة (الإنجليزية)",
|
||||||
|
"value_ar": "القيمة (العربية)",
|
||||||
|
"value_de": "القيمة (الألمانية)",
|
||||||
|
"type": "النوع",
|
||||||
|
"id": "المعرف",
|
||||||
|
"submite": "تقديم",
|
||||||
|
"PriceFrom": "السعر من",
|
||||||
|
"PriceTo": "السعر إلى"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,15 @@
|
||||||
"refetch": "Seite neu laden",
|
"refetch": "Seite neu laden",
|
||||||
"goToHome": "Zum Startseite"
|
"goToHome": "Zum Startseite"
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
"value_en": "Wert (Englisch)",
|
||||||
|
"value_ar": "Wert (Arabisch)",
|
||||||
|
"value_de": "Wert (Deutsch)",
|
||||||
|
"type": "Typ",
|
||||||
|
"id": "ID",
|
||||||
|
"submite": "Einreichen",
|
||||||
|
"PriceFrom": "Preis ab",
|
||||||
|
"PriceTo": "Preis bis"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,14 @@
|
||||||
"refetch": "Refetch Page",
|
"refetch": "Refetch Page",
|
||||||
"goToHome": "Go to Home"
|
"goToHome": "Go to Home"
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
"value_en": "Value (English)",
|
||||||
|
"value_ar": "Value (Arabic)",
|
||||||
|
"value_de": "Value (German)",
|
||||||
|
"type": "Type",
|
||||||
|
"id": "ID",
|
||||||
|
"submite": "Submit",
|
||||||
|
"PriceFrom": "Price From",
|
||||||
|
"PriceTo": "Price To"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
sorry_only_user_can_change_his_status
|
value_en
|
||||||
create_notification
|
value_ar
|
||||||
SupportMessages
|
value_de
|
||||||
email
|
type
|
||||||
whatsApp
|
id
|
||||||
subject
|
|
||||||
message
|
|
||||||
SupportMessages
|
|
||||||
EditDetails
|
|
||||||
OrderItems
|
|
||||||
reset
|
|
||||||
submite
|
submite
|
||||||
|
PriceFrom
|
||||||
|
PriceTo
|
||||||
|
PriceFrom
|
||||||
|
PriceTo
|
||||||
Loading…
Reference in New Issue
Block a user