contact information + ...

This commit is contained in:
hamid zarghami
2025-10-27 13:00:03 +03:30
parent 10b395577a
commit abc74eb970
7 changed files with 41 additions and 33 deletions
+5 -2
View File
@@ -1,15 +1,18 @@
import { ArrowRight } from 'iconsax-react'
import { FC } from 'react'
import { useRouter } from 'next/navigation'
type Props = {
title: string
href?: string
}
const TitleBack: FC<Props> = (props) => {
const { title } = props
const router = useRouter()
const { title, href } = props
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' />
<div className='font-light '>{title}</div>
</div>
+11 -12
View File
@@ -11,6 +11,8 @@ import { useGetCart, useSaveShipmentCart, useShippingCost } from '../hooks/useCa
import { useGetProfile } from '@/app/profile/hooks/useProfileData'
import Link from 'next/link'
import { useState, useEffect } from 'react'
import { toast } from '@/components/Toast'
import { extractErrorMessage } from '@/helpers/errorUtils'
const CartShipping: NextPage = () => {
@@ -67,7 +69,6 @@ const CartShipping: NextPage = () => {
setIsSavingShipment(true)
try {
// تبدیل selectedShipments به فرمت مورد نیاز API
const shipmentsInfo = Object.entries(selectedShipments).map(([shopId, shipperId]) => ({
shopId,
@@ -77,20 +78,18 @@ const CartShipping: NextPage = () => {
// ذخیره انتخاب‌ها در API
await new Promise<void>((resolve, reject) => {
saveShipmentCart({ shipmentsInfo }, {
onSuccess: () => resolve(),
onError: (error) => reject(error)
onSuccess: () => {
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) {
+10 -6
View File
@@ -5,19 +5,21 @@ import { Button } from '@/components/ui/button'
import Layout from '@/hoc/Layout'
import { NextPage } from 'next'
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 { ContactUsType } from './types/Types'
import { useContactUs } from './hooks/useContactData'
import { useState } from 'react'
import { toast } from '@/components/Toast'
import { extractErrorMessage } from '@/helpers/errorUtils'
import { useGetSiteSetting } from '../privacy/hooks/usePrivacyData'
const ContactPage: NextPage = () => {
const { mutate: contactUs, isPending } = useContactUs()
const { register, handleSubmit, reset, formState: { errors } } = useForm<ContactUsType>()
const [successMessage, setSuccessMessage] = useState<string>('')
const { data: siteSetting } = useGetSiteSetting('all')
const onSubmit = (data: ContactUsType) => {
contactUs(data, {
@@ -103,19 +105,21 @@ const ContactPage: NextPage = () => {
</div>
<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 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'>
<Sms size={16} className='sm:w-5 sm:h-5' color='white' />
</div>
<div>
<div className='font-medium text-sm sm:text-base'>کدپستی:</div>
<span className='text-black font-semibold text-base sm:text-lg'>1136834843</span>
</div>
<span className='text-black font-semibold text-base sm:text-lg'>
{siteSetting?.results.siteSetting.}
</span>
</div>
</div> */}
<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'>
@@ -123,7 +127,7 @@ const ContactPage: NextPage = () => {
</div>
<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>
+2 -1
View File
@@ -1,3 +1,4 @@
import { SHOP_CONFIG } from '@/config/const'
import Layout from '@/hoc/Layout'
import { type FC } from 'react'
@@ -9,7 +10,7 @@ const GuideOrder: FC = () => {
<h1 className='text-2xl leading-10'>
نحوه ثبت سفارش در
<br />
فروشگاه اینترنتی سندس کالا
{SHOP_CONFIG.fullName}
</h1>
<p className='mt-5 text-[#7F7F7F]'>
+1 -1
View File
@@ -43,7 +43,7 @@ export const useGetPriceHistory = (productId: string) => {
});
};
export const useGetProductQuestion = (productId: string) => {
export const useGetProductQuestion = (productId: number) => {
return useQuery({
queryKey: ["product-question", productId],
queryFn: () => api.getProductQuestion(productId),
+1 -1
View File
@@ -50,7 +50,7 @@ export const getPriceHistory = async (
};
export const getProductQuestion = async (
productId: string
productId: number
): Promise<ProductQuestionsResponse> => {
const { data } = await axios.get(`/product/${productId}/report/questions`);
return data;
@@ -3,6 +3,7 @@ import React from 'react'
import Image from 'next/image'
import { Checkbox } from '@/components/ui/checkbox'
import { ShipmentItemDetail } from '../../../types/Types'
import { SHOP_CONFIG } from '@/config/const'
interface ProductSelectionProps {
items: ShipmentItemDetail[]
@@ -63,7 +64,7 @@ const ProductSelection: React.FC<ProductSelectionProps> = ({
</div>
<div className='text-xs text-gray-500 mb-1'>
فروشنده: سندس کالا
فروشنده: {SHOP_CONFIG.fullName}
</div>
<div className='text-xs text-gray-500 mb-2'>