import React from "react"; import Card from "@/components/ui/card/card"; import { Skeleton } from "@/components/ui/skeleton/skeleton"; import { useLocale } from "@/hooks/useLocale"; import type { Result } from "@/services/eva-panel/get-user-settings/get-user-settings"; import { useGetUsetSettingsQuery } from "@/services/eva-panel/get-user-settings/get-user-settings"; export default function Communation() { const getUserSettings = useGetUsetSettingsQuery(); const getUserSettingsData = getUserSettings.data?.Result; const { t } = useLocale(); const getDataByPropertyId = (data: Result[], name: string) => { return data?.find((item) => item?.PropertyName === name); }; const adressData = getDataByPropertyId(getUserSettingsData ?? [], "Adres"); const adressProvinceData = getDataByPropertyId( getUserSettingsData ?? [], "İlçe", ); const adressCityData = getDataByPropertyId( getUserSettingsData ?? [], "Şehir", ); const adressCountryData = getDataByPropertyId( getUserSettingsData ?? [], "Ülke", ); const callCenterData = getDataByPropertyId( getUserSettingsData ?? [], "Çağrı Merkezi", ); const callCenterInfoData = getDataByPropertyId( getUserSettingsData ?? [], "Çağrı Merkezi Bilgilendirme", ); const phoneData = getDataByPropertyId(getUserSettingsData ?? [], "Telefon"); const faxData = getDataByPropertyId(getUserSettingsData ?? [], "Fax"); const emailData = getDataByPropertyId(getUserSettingsData ?? [], "Email"); if (!getUserSettings.isSuccess) { return (
{adressData?.CulturedPropertyName && ( {`${adressData?.CulturedPropertyName} : `} )} {(adressData?.PropertyName && adressData?.PropertyValue) || (adressData?.PropertyValue !== null && `${adressData?.PropertyValue}`)} {adressProvinceData?.PropertyValue !== null && adressProvinceData?.PropertyValue && `, ${adressProvinceData?.PropertyValue}`} {adressCityData?.PropertyValue !== null && adressCityData?.PropertyValue && ` / ${adressCityData?.PropertyValue}`} {adressCountryData?.PropertyValue !== null && adressCountryData?.PropertyValue && ` / ${adressCountryData?.PropertyValue}`}
)} {phoneData?.PropertyValue !== null && phoneData?.PropertyValue && ({phoneData?.CulturedPropertyName && `${phoneData?.CulturedPropertyName} : `} {phoneData?.PropertyValue}
)} {faxData?.PropertyValue !== null && faxData?.PropertyValue && ({faxData?.CulturedPropertyName && `${faxData?.CulturedPropertyName} : `} {faxData?.PropertyValue}
)} {(callCenterData?.PropertyValue || callCenterInfoData?.PropertyValue) && ({callCenterData?.CulturedPropertyName && ( {`${callCenterData?.CulturedPropertyName} : `} )} {(callCenterData?.PropertyValue !== null && callCenterData?.PropertyName && callCenterData?.PropertyValue) || (callCenterData?.PropertyValue !== null && `${callCenterData?.PropertyValue} `)} {callCenterInfoData?.PropertyValue !== null && callCenterInfoData?.PropertyValue && ` (${callCenterInfoData?.PropertyValue})`}
)} {emailData?.PropertyValue !== null && emailData?.PropertyValue && ({emailData?.CulturedPropertyName && `${emailData?.CulturedPropertyName} : `} {emailData?.PropertyValue}
)}