contact information + ...
This commit is contained in:
@@ -1,15 +1,18 @@
|
|||||||
import { ArrowRight } from 'iconsax-react'
|
import { ArrowRight } from 'iconsax-react'
|
||||||
import { FC } from 'react'
|
import { FC } from 'react'
|
||||||
|
import { useRouter } from 'next/navigation'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
title: string
|
title: string
|
||||||
|
href?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const TitleBack: FC<Props> = (props) => {
|
const TitleBack: FC<Props> = (props) => {
|
||||||
const { title } = props
|
const router = useRouter()
|
||||||
|
const { title, href } = props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='h-16 border border-border rounded-2xl flex gap-1.5 items-center px-6'>
|
<div onClick={() => href ? router.push(href) : router.back()} className='h-16 border border-border rounded-2xl flex gap-1.5 items-center px-6'>
|
||||||
<ArrowRight size={20} color='#333333' />
|
<ArrowRight size={20} color='#333333' />
|
||||||
<div className='font-light '>{title}</div>
|
<div className='font-light '>{title}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import { useGetCart, useSaveShipmentCart, useShippingCost } from '../hooks/useCa
|
|||||||
import { useGetProfile } from '@/app/profile/hooks/useProfileData'
|
import { useGetProfile } from '@/app/profile/hooks/useProfileData'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
|
import { toast } from '@/components/Toast'
|
||||||
|
import { extractErrorMessage } from '@/helpers/errorUtils'
|
||||||
|
|
||||||
const CartShipping: NextPage = () => {
|
const CartShipping: NextPage = () => {
|
||||||
|
|
||||||
@@ -67,7 +69,6 @@ const CartShipping: NextPage = () => {
|
|||||||
|
|
||||||
setIsSavingShipment(true)
|
setIsSavingShipment(true)
|
||||||
|
|
||||||
try {
|
|
||||||
// تبدیل selectedShipments به فرمت مورد نیاز API
|
// تبدیل selectedShipments به فرمت مورد نیاز API
|
||||||
const shipmentsInfo = Object.entries(selectedShipments).map(([shopId, shipperId]) => ({
|
const shipmentsInfo = Object.entries(selectedShipments).map(([shopId, shipperId]) => ({
|
||||||
shopId,
|
shopId,
|
||||||
@@ -77,20 +78,18 @@ const CartShipping: NextPage = () => {
|
|||||||
// ذخیره انتخابها در API
|
// ذخیره انتخابها در API
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
saveShipmentCart({ shipmentsInfo }, {
|
saveShipmentCart({ shipmentsInfo }, {
|
||||||
onSuccess: () => resolve(),
|
onSuccess: () => {
|
||||||
onError: (error) => reject(error)
|
resolve()
|
||||||
|
window.location.href = '/cart/payment'
|
||||||
|
},
|
||||||
|
onError: (error) => {
|
||||||
|
setIsSavingShipment(false)
|
||||||
|
toast(extractErrorMessage(error))
|
||||||
|
reject(error)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// انتقال به صفحه پرداخت
|
|
||||||
window.location.href = '/cart/payment'
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error saving shipment cart:', error)
|
|
||||||
// در صورت خطا همچنان به صفحه پرداخت برویم
|
|
||||||
window.location.href = '/cart/payment'
|
|
||||||
} finally {
|
|
||||||
setIsSavingShipment(false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cartLoading || shippingLoading || profileLoading) {
|
if (cartLoading || shippingLoading || profileLoading) {
|
||||||
|
|||||||
@@ -5,19 +5,21 @@ import { Button } from '@/components/ui/button'
|
|||||||
import Layout from '@/hoc/Layout'
|
import Layout from '@/hoc/Layout'
|
||||||
import { NextPage } from 'next'
|
import { NextPage } from 'next'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { Call, Location, Sms } from 'iconsax-react'
|
import { Call, Location } from 'iconsax-react'
|
||||||
import { useForm } from 'react-hook-form'
|
import { useForm } from 'react-hook-form'
|
||||||
import { ContactUsType } from './types/Types'
|
import { ContactUsType } from './types/Types'
|
||||||
import { useContactUs } from './hooks/useContactData'
|
import { useContactUs } from './hooks/useContactData'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { toast } from '@/components/Toast'
|
import { toast } from '@/components/Toast'
|
||||||
import { extractErrorMessage } from '@/helpers/errorUtils'
|
import { extractErrorMessage } from '@/helpers/errorUtils'
|
||||||
|
import { useGetSiteSetting } from '../privacy/hooks/usePrivacyData'
|
||||||
|
|
||||||
const ContactPage: NextPage = () => {
|
const ContactPage: NextPage = () => {
|
||||||
|
|
||||||
const { mutate: contactUs, isPending } = useContactUs()
|
const { mutate: contactUs, isPending } = useContactUs()
|
||||||
const { register, handleSubmit, reset, formState: { errors } } = useForm<ContactUsType>()
|
const { register, handleSubmit, reset, formState: { errors } } = useForm<ContactUsType>()
|
||||||
const [successMessage, setSuccessMessage] = useState<string>('')
|
const [successMessage, setSuccessMessage] = useState<string>('')
|
||||||
|
const { data: siteSetting } = useGetSiteSetting('all')
|
||||||
|
|
||||||
const onSubmit = (data: ContactUsType) => {
|
const onSubmit = (data: ContactUsType) => {
|
||||||
contactUs(data, {
|
contactUs(data, {
|
||||||
@@ -103,19 +105,21 @@ const ContactPage: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className='font-medium text-sm sm:text-base'>تلفن:</div>
|
<div className='font-medium text-sm sm:text-base'>تلفن:</div>
|
||||||
<span className='text-black font-semibold text-base sm:text-lg'>67341</span>
|
<span className='text-black font-semibold text-base sm:text-lg'>{siteSetting?.results.siteSetting.footerPhone}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='flex items-center gap-3 text-[#7F7F7F]'>
|
{/* <div className='flex items-center gap-3 text-[#7F7F7F]'>
|
||||||
<div className='bg-green-500 w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center flex-shrink-0'>
|
<div className='bg-green-500 w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center flex-shrink-0'>
|
||||||
<Sms size={16} className='sm:w-5 sm:h-5' color='white' />
|
<Sms size={16} className='sm:w-5 sm:h-5' color='white' />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className='font-medium text-sm sm:text-base'>کدپستی:</div>
|
<div className='font-medium text-sm sm:text-base'>کدپستی:</div>
|
||||||
<span className='text-black font-semibold text-base sm:text-lg'>1136834843</span>
|
<span className='text-black font-semibold text-base sm:text-lg'>
|
||||||
</div>
|
{siteSetting?.results.siteSetting.}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
<div className='flex items-start gap-3 text-[#7F7F7F]'>
|
<div className='flex items-start gap-3 text-[#7F7F7F]'>
|
||||||
<div className='bg-red-500 w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center mt-1 flex-shrink-0'>
|
<div className='bg-red-500 w-8 h-8 sm:w-10 sm:h-10 rounded-full flex items-center justify-center mt-1 flex-shrink-0'>
|
||||||
@@ -123,7 +127,7 @@ const ContactPage: NextPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div className='font-medium text-sm sm:text-base'>دفتر مرکزی:</div>
|
<div className='font-medium text-sm sm:text-base'>دفتر مرکزی:</div>
|
||||||
<span className='text-black font-semibold text-xs sm:text-sm leading-relaxed'>تهران، میدان امام خمینی، خیابان فردوسی، خیابان سرهنگ سخائی نبش کوچه بهنیا، پلاک 40، طبقه چهارم، واحد 12</span>
|
<span className='text-black font-semibold text-xs sm:text-sm leading-relaxed'>{siteSetting?.results.siteSetting.footerAddress}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { SHOP_CONFIG } from '@/config/const'
|
||||||
import Layout from '@/hoc/Layout'
|
import Layout from '@/hoc/Layout'
|
||||||
import { type FC } from 'react'
|
import { type FC } from 'react'
|
||||||
|
|
||||||
@@ -9,7 +10,7 @@ const GuideOrder: FC = () => {
|
|||||||
<h1 className='text-2xl leading-10'>
|
<h1 className='text-2xl leading-10'>
|
||||||
نحوه ثبت سفارش در
|
نحوه ثبت سفارش در
|
||||||
<br />
|
<br />
|
||||||
فروشگاه اینترنتی سندس کالا
|
{SHOP_CONFIG.fullName}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<p className='mt-5 text-[#7F7F7F]'>
|
<p className='mt-5 text-[#7F7F7F]'>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const useGetPriceHistory = (productId: string) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useGetProductQuestion = (productId: string) => {
|
export const useGetProductQuestion = (productId: number) => {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ["product-question", productId],
|
queryKey: ["product-question", productId],
|
||||||
queryFn: () => api.getProductQuestion(productId),
|
queryFn: () => api.getProductQuestion(productId),
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const getPriceHistory = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getProductQuestion = async (
|
export const getProductQuestion = async (
|
||||||
productId: string
|
productId: number
|
||||||
): Promise<ProductQuestionsResponse> => {
|
): Promise<ProductQuestionsResponse> => {
|
||||||
const { data } = await axios.get(`/product/${productId}/report/questions`);
|
const { data } = await axios.get(`/product/${productId}/report/questions`);
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import React from 'react'
|
|||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { Checkbox } from '@/components/ui/checkbox'
|
import { Checkbox } from '@/components/ui/checkbox'
|
||||||
import { ShipmentItemDetail } from '../../../types/Types'
|
import { ShipmentItemDetail } from '../../../types/Types'
|
||||||
|
import { SHOP_CONFIG } from '@/config/const'
|
||||||
|
|
||||||
interface ProductSelectionProps {
|
interface ProductSelectionProps {
|
||||||
items: ShipmentItemDetail[]
|
items: ShipmentItemDetail[]
|
||||||
@@ -63,7 +64,7 @@ const ProductSelection: React.FC<ProductSelectionProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='text-xs text-gray-500 mb-1'>
|
<div className='text-xs text-gray-500 mb-1'>
|
||||||
فروشنده: سندس کالا
|
فروشنده: {SHOP_CONFIG.fullName}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='text-xs text-gray-500 mb-2'>
|
<div className='text-xs text-gray-500 mb-2'>
|
||||||
|
|||||||
Reference in New Issue
Block a user