summaryrefslogtreecommitdiff
path: root/components/signup
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-12-08 19:48:13 +0900
committerjoonhoekim <26rote@gmail.com>2025-12-08 19:48:13 +0900
commitaa89ba2ab47e3ad1ce3277fd11bc61546d20bbac (patch)
tree2f72e6e8efcdc8b79aa730c64a41d0c40fa3700a /components/signup
parent3ef36fc20e10391619be0a57de1b2184dece606a (diff)
parentb5ef49dce92c8994530f6ff670c81693c8716daf (diff)
Merge branch 'dujinkim' of https://github.com/DTS-Development/SHI_EVCP into dujinkim
Diffstat (limited to 'components/signup')
-rw-r--r--components/signup/join-form.tsx49
1 files changed, 46 insertions, 3 deletions
diff --git a/components/signup/join-form.tsx b/components/signup/join-form.tsx
index 6885279a..c6281b24 100644
--- a/components/signup/join-form.tsx
+++ b/components/signup/join-form.tsx
@@ -910,6 +910,32 @@ function CompleteVendorForm({
}: VendorStepProps) {
const [isSubmitting, setIsSubmitting] = useState(false);
const { toast } = useToast();
+ const effectiveCountry = data.country || accountData.country || "";
+ const isKR = effectiveCountry === "KR";
+
+ useEffect(() => {
+ const handleMessage = (event: MessageEvent) => {
+ if (!event.data || event.data.type !== "JUSO_SELECTED") return;
+ const { zipNo, roadAddrPart1, roadAddrPart2, addrDetail } = event.data.payload || {};
+ const combinedAddress = [roadAddrPart1, roadAddrPart2].filter(Boolean).join(" ").trim();
+ onChange(prev => ({
+ ...prev,
+ postalCode: zipNo || prev.postalCode,
+ address: combinedAddress || prev.address,
+ addressDetail: addrDetail || prev.addressDetail,
+ }));
+ };
+ window.addEventListener("message", handleMessage);
+ return () => window.removeEventListener("message", handleMessage);
+ }, [onChange]);
+
+ const handleJusoSearch = () => {
+ window.open(
+ "/api/juso",
+ "jusoSearch",
+ "width=570,height=420,scrollbars=yes,resizable=yes"
+ );
+ };
// 담당자 관리 함수들
const addContact = () => {
@@ -1259,13 +1285,28 @@ function CompleteVendorForm({
{/* 주소 */}
<div>
- <label className="block text-sm font-medium mb-1">
- {t('address')} <span className="text-red-500">*</span>
- </label>
+ <div className="flex items-center justify-between gap-2 mb-1">
+ <label className="block text-sm font-medium">
+ {t('address')} <span className="text-red-500">*</span>
+ </label>
+ {isKR && (
+ <Button
+ type="button"
+ variant="secondary"
+ size="sm"
+ onClick={handleJusoSearch}
+ disabled={isSubmitting}
+ >
+ 주소 검색
+ </Button>
+ )}
+ </div>
<Input
value={data.address}
onChange={(e) => handleInputChange('address', e.target.value)}
disabled={isSubmitting}
+ readOnly={isKR}
+ className={cn(isKR && "bg-muted text-muted-foreground")}
/>
</div>
@@ -1291,6 +1332,8 @@ function CompleteVendorForm({
value={data.postalCode}
onChange={(e) => handleInputChange('postalCode', e.target.value)}
disabled={isSubmitting}
+ readOnly={isKR}
+ className={cn(isKR && "bg-muted text-muted-foreground")}
placeholder="우편번호를 입력해주세요"
/>
</div>