@daeryun/dr_components 0.6.26 → 0.6.28

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.
@@ -0,0 +1,8 @@
1
+ import VisitReservationLawyer from './VisitReservationLawyer';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import '../../styles/globals.css';
4
+ import '../../styles/font_style.css';
5
+ declare const meta: Meta<typeof VisitReservationLawyer>;
6
+ export default meta;
7
+ type Story = StoryObj<typeof meta>;
8
+ export declare const Default: Story;
@@ -0,0 +1,15 @@
1
+ import VisitReservationLawyer from './VisitReservationLawyer';
2
+ import '../../styles/globals.css';
3
+ import '../../styles/font_style.css';
4
+ const meta = {
5
+ component: VisitReservationLawyer,
6
+ title: 'VisitReservationLawyer'
7
+ };
8
+ export default meta;
9
+ export const Default = {
10
+ render: args => {
11
+ return (<div className={'font-[SUIT]'}>
12
+ <VisitReservationLawyer lawyer_code_name={'대표변호사'} lawyer_name={'홍길동'}/>
13
+ </div>);
14
+ }
15
+ };
@@ -0,0 +1,23 @@
1
+ import VisitReservationLawyer from './VisitReservationLawyer';
2
+ import type { Meta, StoryObj } from '@storybook/react';
3
+ import '../../styles/globals.css';
4
+ import '../../styles/font_style.css';
5
+
6
+ const meta: Meta<typeof VisitReservationLawyer> = {
7
+ component: VisitReservationLawyer,
8
+ title: 'VisitReservationLawyer'
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof meta>;
14
+
15
+ export const Default: Story = {
16
+ render: args => {
17
+ return (
18
+ <div className={'font-[SUIT]'}>
19
+ <VisitReservationLawyer lawyer_code_name={'대표변호사'} lawyer_name={'홍길동'} />
20
+ </div>
21
+ );
22
+ }
23
+ };
@@ -0,0 +1,469 @@
1
+ 'use client';
2
+
3
+ import React, { useEffect, useState } from 'react';
4
+ import { SelectBox } from '../SelectBox/SelectBox';
5
+ import Image from 'next/image';
6
+ import axios from 'axios';
7
+ import mobile from 'is-mobile';
8
+ import { formatPhoneNumber, insert } from '../../lib';
9
+ import { savePowerLinkConversion } from '../../lib';
10
+ import { useRouter } from 'next/navigation';
11
+ import Loader from '../Loader/Loader';
12
+
13
+ interface consultPostType {
14
+ cc_name: string;
15
+ cc_tel: string;
16
+ office_code: string;
17
+ law_type_code: string;
18
+ consult_type: string;
19
+ contents: string;
20
+ isCheck: boolean;
21
+ lawyerName?: string;
22
+ lawyerCodeName?: string;
23
+ }
24
+
25
+ interface IField {
26
+ code: string;
27
+ codename: string;
28
+ }
29
+ interface IOffice {
30
+ code: string;
31
+ codename: string;
32
+ }
33
+
34
+ const VisitReservationFooter = ({
35
+ lawyer_name,
36
+ lawyer_code_name,
37
+ aceUrl
38
+ }: {
39
+ lawyer_name: string;
40
+ aceUrl?: string;
41
+ lawyer_code_name: string;
42
+ }) => {
43
+ const router = useRouter();
44
+ const isMobileDevice = mobile();
45
+
46
+ const [name, setName] = useState<string>('');
47
+ const [tel, setTel] = useState<string>('');
48
+ const [lawTypeCode, setLawTypeCode] = useState<string>('');
49
+ const [officeCode, setOfficeCode] = useState<string>('');
50
+ const [contents, setContents] = useState<string>('');
51
+ const [isCheck, setIsCheck] = useState<boolean>(false);
52
+ const [isOver14, setIsOver14] = useState<boolean>(false);
53
+
54
+ const [offices, setOffices] = useState<IOffice[]>([]);
55
+ const [fields, setFields] = useState<IField[]>([]);
56
+
57
+ const [isMobile, setIsMobile] = useState<boolean>(false);
58
+ const [isLoading, setIsLoading] = useState<boolean>(false);
59
+
60
+ const ace_Click = () => {
61
+ // @ts-ignore
62
+ if (window._AM_CK) {
63
+ try {
64
+ // @ts-ignore
65
+ AM_PL('/complete');
66
+ } catch (e) {}
67
+ } else {
68
+ try {
69
+ // @ts-ignore
70
+ _PL(aceUrl ? aceUrl : '');
71
+ } catch (e) {}
72
+ }
73
+ };
74
+
75
+ const consultPost = async () => {
76
+ setIsLoading(true);
77
+ if (!isCheck) {
78
+ alert('개인정보 제공에 동의해주세요');
79
+ document.getElementById('consultCk')?.focus();
80
+ setIsLoading(false);
81
+ return false;
82
+ }
83
+ if (!isOver14) {
84
+ alert('만 14세 이상 여부를 체크해주세요');
85
+ document.getElementById('isOver14Check')?.focus();
86
+ setIsLoading(false);
87
+ return false;
88
+ }
89
+ if (name === '') {
90
+ alert('이름을 입력해주세요.');
91
+ document.getElementById('nameInput')?.focus();
92
+ setIsLoading(false);
93
+ return false;
94
+ }
95
+ if (tel === '') {
96
+ alert('연락처를 입력해주세요.');
97
+ document.getElementById('telInput')?.focus();
98
+ setIsLoading(false);
99
+ return false;
100
+ }
101
+ if (officeCode === '' || officeCode === '사무소 선택') {
102
+ alert('사무소를 선택해주세요');
103
+ document.getElementById('사무소선택')?.focus();
104
+ setIsLoading(false);
105
+ return false;
106
+ }
107
+ if (lawTypeCode === '' || lawTypeCode === '사건분야 선택') {
108
+ alert('사건분야를 선택해주세요');
109
+ document.getElementById('사건분야선택')?.focus();
110
+ setIsLoading(false);
111
+ return false;
112
+ }
113
+ if (contents === '') {
114
+ alert('문의내용을 입력해주세요.');
115
+ document.getElementById('contentsInput')?.focus();
116
+ setIsLoading(false);
117
+ return false;
118
+ }
119
+
120
+ const data: consultPostType = {
121
+ cc_name: name,
122
+ cc_tel: tel,
123
+ office_code: officeCode,
124
+ law_type_code: lawTypeCode,
125
+ consult_type: 'consult',
126
+ contents: contents,
127
+ isCheck: isCheck,
128
+ lawyerName: lawyer_name,
129
+ lawyerCodeName: lawyer_code_name
130
+ };
131
+
132
+ insert('consult', isMobile);
133
+
134
+ if (aceUrl) {
135
+ ace_Click();
136
+ }
137
+
138
+ try {
139
+ const response = await axios.post('/api/consult', data);
140
+ const obj = response.data;
141
+ if (obj.result) {
142
+ if (obj.msg) {
143
+ alert(obj.msg);
144
+ setIsLoading(false);
145
+ }
146
+ if (!obj.isNotComplete) {
147
+ savePowerLinkConversion('online', isMobile);
148
+ router.push('/complete?isConsult=true');
149
+ }
150
+ } else {
151
+ alert('상담 신청에 실패했습니다. 잠시후 다시 시도해주세요.');
152
+ setIsLoading(false);
153
+ }
154
+ } catch (error) {
155
+ console.error('상담 신청 오류:', error);
156
+ alert('상담 신청에 오류가 발생했습니다. 잠시후 다시 시도해주세요.');
157
+ setIsLoading(false);
158
+ }
159
+ };
160
+
161
+ useEffect(() => {
162
+ Promise.all([axios.get('/api/field/list'), axios.get('/api/office/list')]).then(
163
+ ([fieldResponse, officeResponse]) => {
164
+ setFields([{ code: '사건분야 선택', codename: '사건분야 선택' }, ...fieldResponse.data.list]);
165
+ setOffices([{ code: '사무소 선택', codename: '사무소 선택' }, ...officeResponse.data.list]);
166
+ }
167
+ );
168
+ setIsMobile(isMobileDevice);
169
+ }, []);
170
+
171
+ return (
172
+ <div
173
+ className={
174
+ 'h-[750px] w-full bg-[#F8F8F8] pb-[100px] pt-[125px] ' +
175
+ 'max-xl:h-auto max-sm:py-[100px] max-xs:py-[30px]'
176
+ }
177
+ >
178
+ {isLoading ? <Loader fullScreen /> : <></>}
179
+ <span
180
+ className={
181
+ 'mx-auto flex max-w-[1420px] justify-between px-[20px] ' +
182
+ 'max-xl:w-[90%] ' +
183
+ 'max-lg:max-w-[830px] max-lg:flex-col max-lg:gap-[80px] ' +
184
+ 'max-sm:w-full max-xs:gap-[30px] '
185
+ }
186
+ >
187
+ <div>
188
+ <p className={'mb-[10px] text-lg text-[#285FA7] ' + 'max-xs:text-sm'}>방문상담예약접수</p>
189
+ <p
190
+ className={
191
+ 'max-y-[500px] break-keep text-[34px] font-[800] leading-[50px] ' +
192
+ 'max-lg:text-3xl max-lg:leading-[40px] ' +
193
+ 'max-xs:text-[20px] max-xs:leading-[24px] ' +
194
+ 'sm:w-[100%]'
195
+ }
196
+ >
197
+ 방문상담예약접수
198
+ <br />
199
+ {lawyer_name} {lawyer_code_name}와 상담해보세요
200
+ </p>
201
+ </div>
202
+ <form>
203
+ <div
204
+ className={
205
+ 'flex w-[50vw] max-w-[715px] flex-col gap-[40px] ' +
206
+ 'max-lg:w-full max-lg:max-w-[unset] ' +
207
+ 'max-xs:gap-[20px]'
208
+ }
209
+ >
210
+ {/*-- 이름 --*/}
211
+ <span
212
+ className={
213
+ 'flex h-[60px] items-center justify-between ' +
214
+ 'max-sm:h-auto max-sm:w-full max-sm:flex-col max-sm:items-start max-sm:gap-[10px]'
215
+ }
216
+ >
217
+ <label htmlFor="nameInput">
218
+ <p className={'w-[84px] text-[18px] font-[600] max-xs:text-[16px]'}>이름</p>
219
+ </label>
220
+ <input
221
+ name="name"
222
+ id="nameInput"
223
+ placeholder={'입력해주세요'}
224
+ spellCheck={false}
225
+ className={
226
+ 'h-[60px] flex-1 border-[1px] border-solid border-[#D0D0D0] px-[20px] py-[18px] text-[18px] leading-[18px] transition-[border] placeholder:text-[#555555] ' +
227
+ 'focus-visible:border-[#285FA7] focus-visible:outline-none ' +
228
+ 'max-sm:w-full max-xs:h-[50px] max-xs:flex-none max-xs:px-[15px] max-xs:py-0 max-xs:text-[14px]'
229
+ }
230
+ style={{ WebkitAppearance: 'none', WebkitBorderRadius: 0 }}
231
+ onChange={e => {
232
+ setName(e.target.value);
233
+ }}
234
+ />
235
+ </span>
236
+ {/*-- 연락처 --*/}
237
+ <span
238
+ className={
239
+ 'flex h-[60px] items-center justify-between ' +
240
+ 'max-sm:h-auto max-sm:w-full max-sm:flex-col max-sm:items-start max-sm:gap-[10px]'
241
+ }
242
+ >
243
+ <label htmlFor="telInput">
244
+ <p className={'w-[84px] text-[18px] font-[600] max-sm:w-[200px] max-xs:text-[16px]'}>
245
+ 연락처
246
+ </p>
247
+ </label>
248
+ <input
249
+ name="tel"
250
+ id="telInput"
251
+ placeholder={'- 없이 입력해주세요'}
252
+ spellCheck={false}
253
+ value={tel}
254
+ className={
255
+ 'h-[60px] flex-1 border-[1px] border-solid border-[#D0D0D0] px-[20px] py-[18px] text-[18px] leading-[18px] transition-[border] placeholder:text-[#555555] ' +
256
+ 'focus-visible:border-[#285FA7] focus-visible:outline-none ' +
257
+ 'max-sm:w-full max-xs:h-[50px] max-xs:flex-none max-xs:px-[15px] max-xs:py-0 max-xs:text-[14px]'
258
+ }
259
+ style={{ WebkitAppearance: 'none', WebkitBorderRadius: 0 }}
260
+ onChange={e => {
261
+ setTel(formatPhoneNumber(e.target.value));
262
+ }}
263
+ />
264
+ </span>
265
+ <span
266
+ className={
267
+ 'flex h-[60px] items-center justify-between gap-[25px] ' +
268
+ 'max-sm:h-auto max-sm:flex-col max-sm:gap-[40px] ' +
269
+ 'max-xs:gap-[20px]'
270
+ }
271
+ >
272
+ {/* 사무소 */}
273
+ <ConsultSelectBox
274
+ label={'사무소'}
275
+ id={'사무소선택'}
276
+ value={officeCode}
277
+ onSelect={(codename, code) => {
278
+ setOfficeCode(code);
279
+ }}
280
+ items={offices}
281
+ />
282
+
283
+ {/* 사건분야 */}
284
+ <ConsultSelectBox
285
+ label={'사건분야'}
286
+ id={'사건분야선택'}
287
+ value={lawTypeCode}
288
+ onSelect={(codename, code) => {
289
+ setLawTypeCode(code);
290
+ }}
291
+ items={fields}
292
+ />
293
+ </span>
294
+ {/* 문의내용 */}
295
+ <span
296
+ className={
297
+ 'flex h-[60px] items-center justify-between ' +
298
+ 'max-sm:h-auto max-sm:w-full max-sm:flex-col max-sm:items-start max-sm:gap-[10px]'
299
+ }
300
+ >
301
+ <label htmlFor="contentsInput">
302
+ <p className={'w-[84px] text-[18px] font-[600] max-xs:text-[16px]'}>문의내용</p>
303
+ </label>
304
+ <textarea
305
+ name="contents"
306
+ id="contentsInput"
307
+ placeholder={'입력해주세요(50자 이내)'}
308
+ spellCheck={false}
309
+ maxLength={50}
310
+ style={{ WebkitAppearance: 'none', WebkitBorderRadius: 0 }}
311
+ className={
312
+ 'h-[60px] flex-1 resize-none border-[1px] border-solid border-[#D0D0D0] px-[20px] py-[20px] text-[18px] leading-[18px] transition-[border] placeholder:text-[#555555] ' +
313
+ 'focus-visible:border-[#285FA7] focus-visible:outline-none ' +
314
+ 'max-sm:h-[200px] max-sm:w-full max-sm:flex-none ' +
315
+ 'max-xs:h-[150px] max-xs:p-[15px] max-xs:text-[14px]'
316
+ }
317
+ onChange={e => {
318
+ setContents(e.target.value);
319
+ }}
320
+ />
321
+ </span>
322
+ <span className={'block pl-[84px] max-sm:pl-0 max-xs:mt-[10px]'}>
323
+ {/* 동의 체크박스 */}{' '}
324
+ <span className={'mb-[30px] flex w-fit flex-col gap-2 max-sm:mx-auto'}>
325
+ <CheckBox
326
+ labelText={'개인정보수집에 동의합니다.'}
327
+ type="checkbox"
328
+ name="consultCheck"
329
+ id="consultCk"
330
+ onChange={e => {
331
+ setIsCheck(!isCheck);
332
+ }}
333
+ checked={isCheck}
334
+ onKeyDown={e => {
335
+ if (e.key === 'Enter') {
336
+ setIsCheck(!isCheck);
337
+ }
338
+ }}
339
+ />
340
+ <CheckBox
341
+ labelText={'만 14세 이상입니다.'}
342
+ type="checkbox"
343
+ name="isOver14Check"
344
+ id="isOver14Check"
345
+ onChange={e => {
346
+ setIsOver14(!isOver14);
347
+ }}
348
+ checked={isOver14}
349
+ onKeyDown={e => {
350
+ if (e.key === 'Enter') {
351
+ setIsOver14(!isOver14);
352
+ }
353
+ }}
354
+ />
355
+ </span>
356
+ {/* 제출 submit 버튼 */}
357
+ <button
358
+ type="button"
359
+ id={'submitBtn'}
360
+ className={
361
+ 'h-[60px] w-full cursor-pointer bg-[#285FA7] text-white ' +
362
+ 'max-xs:h-[50px] max-xs:text-sm'
363
+ }
364
+ onClick={async () => {
365
+ await consultPost();
366
+ }}
367
+ disabled={isLoading}
368
+ >
369
+ 상담신청서 제출
370
+ </button>
371
+ </span>
372
+ </div>
373
+ </form>
374
+ </span>
375
+ </div>
376
+ );
377
+ };
378
+
379
+ export default VisitReservationFooter;
380
+
381
+ const ConsultSelectBox = ({
382
+ id,
383
+ value,
384
+ onSelect,
385
+ label,
386
+ items
387
+ }: {
388
+ id: string;
389
+ value: string;
390
+ label: string;
391
+ onSelect: (codename: string, code: string) => void;
392
+ items: { code: string; codename: string }[];
393
+ }) => {
394
+ return (
395
+ <span
396
+ className={
397
+ 'relative flex w-[50%] items-center justify-between ' +
398
+ 'max-sm:w-full max-sm:flex-col max-sm:items-start max-sm:gap-[10px]'
399
+ }
400
+ >
401
+ <label htmlFor={id}>
402
+ <p className={'w-[84px] text-[18px] font-[600] max-xs:text-[16px]'}>{label}</p>
403
+ </label>
404
+ <SelectBox
405
+ id={id}
406
+ value={value}
407
+ onSelect={onSelect}
408
+ items={items}
409
+ icon={
410
+ <Image
411
+ src={'https://d1tgonli21s4df.cloudfront.net/divorce/main_new/icon_arrow_gray.webp'}
412
+ alt={''}
413
+ width={28}
414
+ height={15}
415
+ className={'absolute right-[24px] top-[50%] w-[15px] translate-y-[-50%] max-xs:w-[11px]'}
416
+ />
417
+ }
418
+ style={
419
+ 'h-[60px] w-full px-[20px] py-[17px] bg-white border-solid border-[1px] border-[#D0D0D0] cursor-pointer transition-[border] ' +
420
+ 'focus-visible:outline-none focus-visible:border-[#285FA7] ' +
421
+ 'max-sm:w-full max-xs:h-[50px] max-xs:flex-none max-xs:text-[14px] max-xs:px-[15px] max-xs:py-0'
422
+ }
423
+ parentStyle={'flex-1 ' + 'max-sm:w-full'}
424
+ />
425
+ </span>
426
+ );
427
+ };
428
+ const CheckBox = ({
429
+ type,
430
+ name,
431
+ id,
432
+ onChange,
433
+ checked,
434
+ onKeyDown,
435
+ labelText
436
+ }: {
437
+ type: string;
438
+ name: string;
439
+ id: string;
440
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
441
+ checked: boolean;
442
+ onKeyDown: (e: React.KeyboardEvent<HTMLInputElement>) => void;
443
+ labelText: string;
444
+ }) => {
445
+ return (
446
+ <label
447
+ className={
448
+ 'block w-full cursor-pointer text-[16px] leading-[16px] text-[#5F5F5F] ' +
449
+ 'flex items-center gap-[10px] ' +
450
+ 'max-xs:text-[12px]'
451
+ }
452
+ >
453
+ <input
454
+ type={type}
455
+ name={name}
456
+ id={id}
457
+ className={
458
+ 'h-[17px] w-[17px] cursor-pointer ' +
459
+ 'after:pointer-events-none after:block after:h-full after:w-full after:border-[1px] after:border-solid after:border-[#B4B4B4] after:bg-white after:font-[SUIT] after:font-[800] after:content-[""] ' +
460
+ 'checked:after:border-[#285FA7] checked:after:bg-[#285FA7] checked:after:text-center checked:after:text-[17px] checked:after:leading-[15px] checked:after:text-white checked:after:content-["✓"] '
461
+ }
462
+ onChange={onChange}
463
+ checked={checked}
464
+ onKeyDown={onKeyDown}
465
+ />
466
+ {labelText}
467
+ </label>
468
+ );
469
+ };
@@ -2,7 +2,7 @@ export declare const getSearchKeywordJson: (searchKeywords: {
2
2
  code_name: string;
3
3
  survey_title: string;
4
4
  }[]) => {
5
- [key: string]: string[];
5
+ [x: string]: string[];
6
6
  };
7
7
  export declare const tabTypes: {
8
8
  tab: string;
@@ -31,4 +31,5 @@ export { default as PageTitleBox } from './PageTitleBox/PageTitleBox';
31
31
  export { ImgTypes } from './PageTitleBox/ImgTypes';
32
32
  export { default as PageWrapper } from './Layout/PageWrapper';
33
33
  export { default as SearchBar } from './SearchBar/SearchBar';
34
+ export { default as VisitReservationLawyer } from './VisitReservationLawyer/VisitReservationLawyer';
34
35
  export { default as RelatedGroup } from './FieldNew/RelatedGroup';
@@ -31,4 +31,5 @@ export { default as PageTitleBox } from './PageTitleBox/PageTitleBox';
31
31
  export { ImgTypes } from './PageTitleBox/ImgTypes';
32
32
  export { default as PageWrapper } from './Layout/PageWrapper';
33
33
  export { default as SearchBar } from './SearchBar/SearchBar';
34
+ export { default as VisitReservationLawyer } from './VisitReservationLawyer/VisitReservationLawyer';
34
35
  export { default as RelatedGroup } from './FieldNew/RelatedGroup';