@daeryun/dr_components 0.6.20 → 0.6.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,9 @@ import { PaymentList, Payment } from '../../_type/type';
4
4
  import { useState } from 'react';
5
5
  import ContractModal from './_modal/ContractModal';
6
6
  import { useActionGetContact } from '../../_actions/action';
7
+ import Loading from '../../_component/_loading/Loading';
8
+ import Image from 'next/image';
9
+ import contractIcon from '../../../../../asset/images/mycase/icon/contract_icon.webp';
7
10
 
8
11
  const Label = ({ title, status }: { title: string; status: boolean }) => {
9
12
  return (
@@ -28,23 +31,8 @@ const LineBox = ({ children, title }: { children: React.ReactNode; title?: strin
28
31
  );
29
32
  };
30
33
  const ContactInfo = ({ id }: { id: string }) => {
31
- // const list: PaymentList = {
32
- // payment_status: '완납',
33
- // price: '11200000',
34
- // balance: '2000',
35
- // payments: [
36
- // {
37
- // pay_type: '수임료',
38
- // card_name: '롯데카드',
39
- // money: '11200000',
40
- // pay_date: '2025-03-10T00:00:00.000Z',
41
- // img_name: '25.03.10 천은유 영수증.pdf',
42
- // img_path: 'https://d6robzfync7d.cloudfront.net/consult/20250310105625220.pdf'
43
- // }
44
- // ]
45
- // };
46
34
  const [isOpen, setIsOpen] = useState(false);
47
- const { data: list, isLoading } = useActionGetContact(id);
35
+ const { data: list, isLoading, isFetched } = useActionGetContact(id);
48
36
 
49
37
  return (
50
38
  <CaseLayout
@@ -54,58 +42,100 @@ const ContactInfo = ({ id }: { id: string }) => {
54
42
  'pt-[32px] px-[20px] pb-[40px] 2sm:px-[40px] sm-top:mt-[24px] sm-top:px-[50px] sm-top:pb-[60px] sm-top:pt-[56px] lg:pt-[60px] lg:pb-[80px] lg:px-[60px]'
55
43
  }
56
44
  >
57
- <div className="flex flex-row items-center justify-between">
58
- <div className="flex flex-row gap-[12px] sm-top:gap-[28px] lg:gap-[32px]">
59
- <Label title="일부납" status={list?.data?.payment_status !== '완납'} />
60
- <Label title="완납" status={list?.data?.payment_status === '완납'} />
61
- </div>
62
- <button
63
- className={`flex h-[26px] w-[66px] items-center justify-center rounded-[13px] border border-solid border-black disabled:border-[#DBDBDB] disabled:text-[#DBDBDB] sm-top:h-[39px] sm-top:w-[96px] sm-top:rounded-[20px] lg:h-[41px] lg:w-[95px] lg:rounded-[21px]`}
64
- disabled={list?.data?.contractImages === null}
65
- onClick={() => setIsOpen(!isOpen)}
66
- >
67
- <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 !leading-none">내 약정서</p>
68
- </button>
69
- </div>
45
+ {isLoading ? (
46
+ <Loading />
47
+ ) : (
48
+ <>
49
+ {!list && isFetched ? (
50
+ <div className="mt-[40px] flex flex-col items-center justify-center sm-top:mt-[110px] lg:mt-[126px]">
51
+ <Image
52
+ src={contractIcon}
53
+ alt="contact_empty"
54
+ width={100}
55
+ height={100}
56
+ className="h-[43.63px] w-[36px] sm-top:h-[50.9px] sm-top:w-[42px] lg:h-[63.01px] lg:w-[52px]"
57
+ />
58
+ <div className="mt-[12.38px] sm-top:mt-[24.1px] lg:mt-[40px]">
59
+ <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-center">
60
+ 종결된 사건의 경우 <br className="sm-top:hidden" />
61
+ 계약정보 확인이 제한될 수 있습니다.
62
+ </p>
63
+ </div>
64
+ <div className="mt-[8px]">
65
+ <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-center">
66
+ 사건을 담당한 사무소로 문의해 주시면 <br className="sm-top:hidden" />
67
+ 친절히 안내해 드리겠습니다.
68
+ </p>
69
+ </div>
70
+ </div>
71
+ ) : (
72
+ <>
73
+ <div className="flex flex-row items-center justify-between">
74
+ <div className="flex flex-row gap-[12px] sm-top:gap-[28px] lg:gap-[32px]">
75
+ <Label title="일부납" status={list?.data?.payment_status !== '완납'} />
76
+ <Label title="완납" status={list?.data?.payment_status === '완납'} />
77
+ </div>
78
+ <button
79
+ className={`flex h-[26px] w-[66px] items-center justify-center rounded-[13px] border border-solid border-black disabled:border-[#DBDBDB] disabled:text-[#DBDBDB] sm-top:h-[39px] sm-top:w-[96px] sm-top:rounded-[20px] lg:h-[41px] lg:w-[95px] lg:rounded-[21px]`}
80
+ disabled={list?.data?.contractImages === null}
81
+ onClick={() => setIsOpen(!isOpen)}
82
+ >
83
+ <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 !leading-none">
84
+ 내 약정서
85
+ </p>
86
+ </button>
87
+ </div>
70
88
 
71
- <div className={'mt-[16px] sm-top:mt-[28px] lg:mt-[26px]'}>
72
- <LineBox>
73
- <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">착수금</p>
74
- <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
75
- {Number(list?.data?.price).toLocaleString()}원
76
- </p>
77
- </LineBox>
89
+ <div className="mt-[16px] sm-top:mt-[28px] lg:mt-[26px]">
90
+ <LineBox>
91
+ <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
92
+ 착수금
93
+ </p>
94
+ <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
95
+ {Number(list?.data?.price).toLocaleString()}원
96
+ </p>
97
+ </LineBox>
78
98
 
79
- {list?.data?.payments.map((item, index) => (
80
- <LineBox key={index} title={index === 0 ? '입금액' : ''}>
81
- <div
82
- className={`${index === 0 ? 'mt-[13px] sm-top:mt-[16px] lg:mt-[25px] ' : ''} flex flex-col gap-[8px] sm-top:gap-[12px] lg:gap-[8px]`}
83
- >
84
- <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-grayScale2">
85
- {item.pay_type}
86
- </p>
87
- <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-grayScale2">
88
- {dayjs(item.pay_date).format('YYYY.MM.DD HH:mm')}
89
- </p>
90
- </div>
91
- <div className="flex flex-col items-end gap-[8px] sm-top:gap-[12px] lg:gap-[8px]">
92
- <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
93
- {Number(item.money).toLocaleString()}원
94
- </p>
95
- <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-grayScale2">
96
- {item.card_name}
97
- </p>
98
- </div>
99
- </LineBox>
100
- ))}
101
- <LineBox>
102
- <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">잔여금액</p>
103
- <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
104
- {Number(list?.data?.balance).toLocaleString()}원
105
- </p>
106
- </LineBox>
107
- </div>
108
- <ContractModal data={list?.data?.contractImages || []} isOpen={isOpen} onClose={() => setIsOpen(false)} />
99
+ {list?.data?.payments.map((item, index) => (
100
+ <LineBox key={index} title={index === 0 ? '입금액' : ''}>
101
+ <div
102
+ className={`${index === 0 ? 'mt-[13px] sm-top:mt-[16px] lg:mt-[25px]' : ''} flex flex-col gap-[8px] sm-top:gap-[12px] lg:gap-[8px]`}
103
+ >
104
+ <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-grayScale2">
105
+ {item.pay_type}
106
+ </p>
107
+ <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-grayScale2">
108
+ {dayjs(item.pay_date).format('YYYY.MM.DD HH:mm')}
109
+ </p>
110
+ </div>
111
+ <div className="flex flex-col items-end gap-[8px] sm-top:gap-[12px] lg:gap-[8px]">
112
+ <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
113
+ {Number(item.money).toLocaleString()}원
114
+ </p>
115
+ <p className="body_small2_mo sm-top:body_small2_tb lg:body_small2 text-grayScale2">
116
+ {item.card_name}
117
+ </p>
118
+ </div>
119
+ </LineBox>
120
+ ))}
121
+ <LineBox>
122
+ <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
123
+ 잔여금액
124
+ </p>
125
+ <p className="body_medium1_mo sm-top:body_medium1_tb lg:body_medium1 text-black">
126
+ {Number(list?.data?.balance).toLocaleString()}원
127
+ </p>
128
+ </LineBox>
129
+ </div>
130
+ <ContractModal
131
+ data={list?.data?.contractImages || []}
132
+ isOpen={isOpen}
133
+ onClose={() => setIsOpen(false)}
134
+ />
135
+ </>
136
+ )}
137
+ </>
138
+ )}
109
139
  </CaseLayout>
110
140
  );
111
141
  };
@@ -37,6 +37,7 @@ export declare const useActionPostMyCaseQuestion: (id: string, content: string,
37
37
  export declare const useActionGetContact: (id: string) => {
38
38
  data: FetchType<PaymentList> | undefined;
39
39
  isLoading: boolean;
40
+ isFetched: boolean;
40
41
  };
41
42
  export declare const useActionPostMyFileUpload: (id: string) => {
42
43
  mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<FetchType<Question[]>, unknown, File, unknown>;
@@ -149,7 +149,7 @@ export const useActionPostMyCaseQuestion = (id, content, jwt) => {
149
149
  return { mutateAsync, isLoading };
150
150
  };
151
151
  export const useActionGetContact = (id) => {
152
- const { data, isLoading } = useQuery({
152
+ const { data, isLoading, isFetched } = useQuery({
153
153
  queryKey: ['case', 'contact', id],
154
154
  queryFn: () => getContact({
155
155
  id: id
@@ -162,7 +162,7 @@ export const useActionGetContact = (id) => {
162
162
  // console.log(error);
163
163
  // }
164
164
  });
165
- return { data, isLoading };
165
+ return { data, isLoading, isFetched };
166
166
  };
167
167
  export const useActionPostMyFileUpload = (id) => {
168
168
  const { mutateAsync, status } = useMutation({
@@ -168,7 +168,7 @@ export const useActionPostMyCaseQuestion = (id: string, content: string, jwt?: s
168
168
  };
169
169
 
170
170
  export const useActionGetContact = (id: string) => {
171
- const { data, isLoading } = useQuery<FetchType<PaymentList>>({
171
+ const { data, isLoading, isFetched } = useQuery<FetchType<PaymentList>>({
172
172
  queryKey: ['case', 'contact', id],
173
173
  queryFn: () =>
174
174
  getContact({
@@ -182,7 +182,7 @@ export const useActionGetContact = (id: string) => {
182
182
  // console.log(error);
183
183
  // }
184
184
  });
185
- return { data, isLoading };
185
+ return { data, isLoading, isFetched };
186
186
  };
187
187
 
188
188
  export const useActionPostMyFileUpload = (id: string) => {