sms count

This commit is contained in:
hamid zarghami
2025-12-29 16:21:00 +03:30
parent 8bdd838ddc
commit deda1f1603
10 changed files with 229 additions and 10 deletions
+31 -8
View File
@@ -1,4 +1,4 @@
import { FC } from 'react'
import { FC, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { useGetRestaurants } from '../hooks/useIconData'
import PageLoading from '../../../components/PageLoading'
@@ -7,14 +7,28 @@ import { RestaurantType } from '../types/Types'
import moment from 'moment-jalaali'
import { Copy } from 'iconsax-react'
import { toast } from 'react-toastify'
import Button from '../../../components/Button'
import RestaurantAdminsModal from './components/RestaurantAdminsModal'
const RestaurantsList: FC = () => {
const { t } = useTranslation('global')
const { data: restaurants, isLoading } = useGetRestaurants()
const [selectedRestaurantId, setSelectedRestaurantId] = useState<string>('')
const [isAdminsModalOpen, setIsAdminsModalOpen] = useState<boolean>(false)
const restaurantsList = (restaurants as { data?: RestaurantType[] })?.data || []
const handleOpenAdminsModal = (restaurantId: string) => {
setSelectedRestaurantId(restaurantId)
setIsAdminsModalOpen(true)
}
const handleCloseAdminsModal = () => {
setIsAdminsModalOpen(false)
setSelectedRestaurantId('')
}
const handleCopyAddress = async (address: string | null) => {
if (!address) return
@@ -87,21 +101,30 @@ const RestaurantsList: FC = () => {
{moment(item.createdAt).format('jYYYY-jMM-jDD HH:mm')}
</div>
</Td>
<Td text={''} />
<Td text={''}>
<div className='flex items-center gap-2'>
<Button
className='w-fit px-4'
onClick={() => handleOpenAdminsModal(item.id)}
>
{t('restaurant.admins')}
</Button>
</div>
</Td>
</tr>
)
})
}
</tbody>
</table>
{restaurantsList.length === 0 && (
<div className="text-center py-12">
<div className="text-gray-500 text-lg">هیچ رستورانی یافت نشد</div>
</div>
)}
</div>
}
<RestaurantAdminsModal
open={isAdminsModalOpen}
close={handleCloseAdminsModal}
restaurantId={selectedRestaurantId}
/>
</div>
)
}