refactor(pop): extract company path via usePopCompanyPath hook
Replace hardcoded /COMPANY_7/ URL prefixes across POP pages and components with usePopCompanyPath() so navigation derives the company code from the authenticated user. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_change";
|
||||
|
||||
export function ChangeInbound({ cart, onCartClick, saving, inboundType, sourceTable }: ChangeInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function ChangeInbound({ cart, onCartClick, saving, inboundType, sourceTa
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_error";
|
||||
|
||||
export function ErrorInbound({ cart, onCartClick, saving, inboundType, sourceTable }: ErrorInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function ErrorInbound({ cart, onCartClick, saving, inboundType, sourceTab
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { apiClient } from "@/lib/api/client";
|
||||
import { InspectionModal, type InspectionResult } from "./InspectionModal";
|
||||
@@ -73,6 +74,7 @@ export function InboundCart({
|
||||
onUpdateItems,
|
||||
}: InboundCartProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const [resultMsg, setResultMsg] = useState<string | null>(null);
|
||||
const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());
|
||||
@@ -288,7 +290,7 @@ export function InboundCart({
|
||||
setTimeout(() => {
|
||||
onClear();
|
||||
onClose();
|
||||
router.push("/COMPANY_7/pop/inbound");
|
||||
router.push(companyPath("/pop/inbound"));
|
||||
}, 1500);
|
||||
} else {
|
||||
setResultMsg(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -106,6 +107,7 @@ interface InboundCartPageProps {
|
||||
|
||||
export function InboundCartPage({ backUrl }: InboundCartPageProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* Cart sync hook — 입고 카테고리 공통 */
|
||||
const cart = useCartSync("inbound");
|
||||
@@ -1458,7 +1460,7 @@ export function InboundCartPage({ backUrl }: InboundCartPageProps) {
|
||||
<button
|
||||
onClick={() => {
|
||||
setConfirmResult(null);
|
||||
router.push("/COMPANY_7/pop/inbound");
|
||||
router.push(companyPath("/pop/inbound"));
|
||||
}}
|
||||
className={`w-full h-12 rounded-xl text-white font-bold text-base active:scale-[0.98] transition-all ${COLOR_MAP.blue.buttonBg} ${COLOR_MAP.blue.buttonBgHover} shadow-[0_4px_12px_rgba(59,130,246,0.3)]`}
|
||||
>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useEffect, useCallback } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier } from "./SupplierModal";
|
||||
import {
|
||||
getReceivingList,
|
||||
@@ -45,6 +46,7 @@ const INBOUND_TYPE_OPTIONS = [
|
||||
|
||||
export function InboundManage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
/* ── Filters ── */
|
||||
@@ -241,7 +243,7 @@ export function InboundManage() {
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { apiClient } from "@/lib/api/client";
|
||||
import { SupplierModal, type Supplier, type PartnerSourceConfig, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
@@ -66,6 +67,7 @@ const PROCESS_SOURCE: PartnerSourceConfig = {
|
||||
|
||||
export function ProductionInbound({ cart, onCartClick, saving, inboundType, sourceTable }: ProductionInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -312,7 +314,7 @@ export function ProductionInbound({ cart, onCartClick, saving, inboundType, sour
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { apiClient } from "@/lib/api/client";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
@@ -62,6 +63,7 @@ const STORAGE_KEY = "pop_supplier_purchase";
|
||||
|
||||
export function PurchaseInbound({ cart, onCartClick, saving, inboundType, sourceTable }: PurchaseInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -316,7 +318,7 @@ export function PurchaseInbound({ cart, onCartClick, saving, inboundType, source
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_recovery";
|
||||
|
||||
export function RecoveryInbound({ cart, onCartClick, saving, inboundType, sourceTable }: RecoveryInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function RecoveryInbound({ cart, onCartClick, saving, inboundType, source
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_return-external";
|
||||
|
||||
export function ReturnExternalInbound({ cart, onCartClick, saving, inboundType, sourceTable }: ReturnExternalInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function ReturnExternalInbound({ cart, onCartClick, saving, inboundType,
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_return-internal";
|
||||
|
||||
export function ReturnInternalInbound({ cart, onCartClick, saving, inboundType, sourceTable }: ReturnInternalInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function ReturnInternalInbound({ cart, onCartClick, saving, inboundType,
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_subcontractor";
|
||||
|
||||
export function SubcontractorInbound({ cart, onCartClick, saving, inboundType, sourceTable }: SubcontractorInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function SubcontractorInbound({ cart, onCartClick, saving, inboundType, s
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "./SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_supplier_supplied";
|
||||
|
||||
export function SuppliedInbound({ cart, onCartClick, saving, inboundType, sourceTable }: SuppliedInboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedSupplier, setSelectedSupplier] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function SuppliedInbound({ cart, onCartClick, saving, inboundType, source
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/inbound")}
|
||||
onClick={() => router.push(companyPath("/pop/inbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "../inbound/SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -48,6 +49,7 @@ const STORAGE_KEY = "pop_customer_etc";
|
||||
|
||||
export function EtcOutbound({ cart, onCartClick, saving, outboundType, sourceTable }: EtcOutboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
const [selectedCustomer, setSelectedCustomer] = useState<Supplier | null>(null);
|
||||
const [customerModalOpen, setCustomerModalOpen] = useState(false);
|
||||
@@ -217,7 +219,7 @@ export function EtcOutbound({ cart, onCartClick, saving, outboundType, sourceTab
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
@@ -95,6 +96,7 @@ interface OutboundCartPageProps {
|
||||
|
||||
export function OutboundCartPage({ backUrl }: OutboundCartPageProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* Cart sync hook — 출고 카테고리 공통 */
|
||||
const cart = useCartSync("outbound");
|
||||
@@ -1227,7 +1229,7 @@ export function OutboundCartPage({ backUrl }: OutboundCartPageProps) {
|
||||
<button
|
||||
onClick={() => {
|
||||
setConfirmResult(null);
|
||||
router.push("/COMPANY_7/pop/outbound");
|
||||
router.push(companyPath("/pop/outbound"));
|
||||
}}
|
||||
className={`w-full h-12 rounded-xl text-white font-bold text-base active:scale-[0.98] transition-all ${COLOR_MAP.blue.buttonBg} ${COLOR_MAP.blue.buttonBgHover} shadow-[0_4px_12px_rgba(59,130,246,0.3)]`}
|
||||
>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useEffect, useCallback } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier } from "../inbound/SupplierModal";
|
||||
import {
|
||||
getOutboundList,
|
||||
@@ -42,6 +43,7 @@ const OUTBOUND_TYPE_OPTIONS = [
|
||||
|
||||
export function OutboundManage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
/* ── Filters ── */
|
||||
@@ -235,7 +237,7 @@ export function OutboundManage() {
|
||||
{/* ===== Header ===== */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "../inbound/SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -49,6 +50,7 @@ const STORAGE_KEY = "pop_customer_production";
|
||||
|
||||
export function ProductionOutbound({ cart, onCartClick, saving, outboundType, sourceTable }: ProductionOutboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
const [selectedCustomer, setSelectedCustomer] = useState<Supplier | null>(null);
|
||||
const [customerModalOpen, setCustomerModalOpen] = useState(false);
|
||||
@@ -218,7 +220,7 @@ export function ProductionOutbound({ cart, onCartClick, saving, outboundType, so
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "../inbound/SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -48,6 +49,7 @@ const STORAGE_KEY = "pop_customer_return";
|
||||
|
||||
export function ReturnOutbound({ cart, onCartClick, saving, outboundType, sourceTable }: ReturnOutboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
const [selectedCustomer, setSelectedCustomer] = useState<Supplier | null>(null);
|
||||
const [customerModalOpen, setCustomerModalOpen] = useState(false);
|
||||
@@ -217,7 +219,7 @@ export function ReturnOutbound({ cart, onCartClick, saving, outboundType, source
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "../inbound/SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -56,6 +57,7 @@ const STORAGE_KEY = "pop_customer_sales";
|
||||
|
||||
export function SalesOutbound({ cart, onCartClick, saving, outboundType, sourceTable }: SalesOutboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* State */
|
||||
const [selectedCustomer, setSelectedCustomer] = useState<Supplier | null>(null);
|
||||
@@ -240,7 +242,7 @@ export function SalesOutbound({ cart, onCartClick, saving, outboundType, sourceT
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "../inbound/SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -49,6 +50,7 @@ const STORAGE_KEY = "pop_customer_subcontractor";
|
||||
|
||||
export function SubcontractorOutbound({ cart, onCartClick, saving, outboundType, sourceTable }: SubcontractorOutboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
const [selectedCustomer, setSelectedCustomer] = useState<Supplier | null>(null);
|
||||
const [customerModalOpen, setCustomerModalOpen] = useState(false);
|
||||
@@ -218,7 +220,7 @@ export function SubcontractorOutbound({ cart, onCartClick, saving, outboundType,
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, matchChosung } from "../inbound/SupplierModal";
|
||||
import { SimpleKeypadModal } from "../common/SimpleKeypadModal";
|
||||
import { BarcodeScanModal } from "../common/BarcodeScanModal";
|
||||
@@ -49,6 +50,7 @@ const STORAGE_KEY = "pop_customer_supplied";
|
||||
|
||||
export function SuppliedOutbound({ cart, onCartClick, saving, outboundType, sourceTable }: SuppliedOutboundProps) {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
const [selectedCustomer, setSelectedCustomer] = useState<Supplier | null>(null);
|
||||
const [customerModalOpen, setCustomerModalOpen] = useState(false);
|
||||
@@ -218,7 +220,7 @@ export function SuppliedOutbound({ cart, onCartClick, saving, outboundType, sour
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/outbound")}
|
||||
onClick={() => router.push(companyPath("/pop/outbound"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
@@ -755,6 +756,7 @@ export function WorkOrderList(props: WorkOrderListProps) {
|
||||
refetch,
|
||||
} = props;
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const { user } = useAuth();
|
||||
const currentUserId = user?.userId || "";
|
||||
|
||||
@@ -1015,7 +1017,7 @@ export function WorkOrderList(props: WorkOrderListProps) {
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
router.push(`/COMPANY_7/pop/production/work/${processId}`);
|
||||
router.push(companyPath(`/pop/production/work/${processId}`));
|
||||
};
|
||||
|
||||
/* ---- Restore activeTab + scrollY on mount ---- */
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { InboundCartPage } from "../../_components/inbound/InboundCartPage";
|
||||
|
||||
function InboundCartContent() {
|
||||
const searchParams = useSearchParams();
|
||||
const backUrl = searchParams.get("backUrl") || "/COMPANY_7/pop/inbound";
|
||||
const companyPath = usePopCompanyPath();
|
||||
const backUrl = searchParams.get("backUrl") || companyPath("/pop/inbound");
|
||||
|
||||
return <InboundCartPage backUrl={backUrl} />;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ChangeInbound } from "../../_components/inbound/ChangeInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ChangeInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ChangeInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/change");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/change")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ErrorInbound } from "../../_components/inbound/ErrorInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ErrorInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ErrorInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/error");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/error")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useRef, useCallback, useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Types */
|
||||
@@ -42,7 +43,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/purchase",
|
||||
href: "/pop/inbound/purchase",
|
||||
},
|
||||
{
|
||||
id: "outsourcing",
|
||||
@@ -54,7 +55,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/subcontractor",
|
||||
href: "/pop/inbound/subcontractor",
|
||||
},
|
||||
{
|
||||
id: "return",
|
||||
@@ -66,7 +67,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/return-external",
|
||||
href: "/pop/inbound/return-external",
|
||||
},
|
||||
{
|
||||
id: "supplied-material",
|
||||
@@ -78,7 +79,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/supplied",
|
||||
href: "/pop/inbound/supplied",
|
||||
},
|
||||
{
|
||||
id: "defect",
|
||||
@@ -90,7 +91,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/error",
|
||||
href: "/pop/inbound/error",
|
||||
},
|
||||
{
|
||||
id: "outsource-return",
|
||||
@@ -102,7 +103,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 00-3.7-3.7 48.678 48.678 0 00-7.324 0 4.006 4.006 0 00-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3l-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 003.7 3.7 48.656 48.656 0 007.324 0 4.006 4.006 0 003.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3l-3 3" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/recovery",
|
||||
href: "/pop/inbound/recovery",
|
||||
},
|
||||
{
|
||||
id: "exchange",
|
||||
@@ -114,7 +115,7 @@ const EXTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/change",
|
||||
href: "/pop/inbound/change",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -130,7 +131,7 @@ const INTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/production",
|
||||
href: "/pop/inbound/production",
|
||||
},
|
||||
{
|
||||
id: "return-internal",
|
||||
@@ -142,7 +143,7 @@ const INTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/return-internal",
|
||||
href: "/pop/inbound/return-internal",
|
||||
},
|
||||
{
|
||||
id: "transfer",
|
||||
@@ -166,7 +167,7 @@ const INTERNAL_ITEMS: InboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9zm3.75 11.625a2.625 2.625 0 11-5.25 0 2.625 2.625 0 015.25 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound/inbound-manage",
|
||||
href: "/pop/inbound/inbound-manage",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -200,6 +201,7 @@ const RECENT_ITEMS: RecentInboundItem[] = [
|
||||
|
||||
function InboundTypeSelect() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* KPI carousel */
|
||||
const [kpiIdx, setKpiIdx] = useState(1);
|
||||
@@ -221,7 +223,7 @@ function InboundTypeSelect() {
|
||||
if (item.href === "#") {
|
||||
alert(`${item.title} 화면은 준비 중입니다.`);
|
||||
} else {
|
||||
router.push(item.href);
|
||||
router.push(companyPath(item.href));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -230,7 +232,7 @@ function InboundTypeSelect() {
|
||||
{/* ===== Back + Title ===== */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/main")}
|
||||
onClick={() => router.push(companyPath("/pop/main"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ProductionInbound } from "../../_components/inbound/ProductionInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ProductionInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ProductionInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/production");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/production")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { PurchaseInbound } from "../../_components/inbound/PurchaseInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function PurchaseInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function PurchaseInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/purchase");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/purchase")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { RecoveryInbound } from "../../_components/inbound/RecoveryInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function RecoveryInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function RecoveryInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/recovery");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/recovery")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ReturnExternalInbound } from "../../_components/inbound/ReturnExternalInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ReturnExternalInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ReturnExternalInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/return-external");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/return-external")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ReturnInternalInbound } from "../../_components/inbound/ReturnInternalInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ReturnInternalInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ReturnInternalInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/return-internal");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/return-internal")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SubcontractorInbound } from "../../_components/inbound/SubcontractorInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function SubcontractorInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function SubcontractorInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/subcontractor");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/subcontractor")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SuppliedInbound } from "../../_components/inbound/SuppliedInbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function SuppliedInboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("inbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function SuppliedInboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/inbound/cart?backUrl=/COMPANY_7/pop/inbound/supplied");
|
||||
router.push(`${companyPath("/pop/inbound/cart")}?backUrl=${companyPath("/pop/inbound/supplied")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useRouter } from "next/navigation";
|
||||
import type React from "react";
|
||||
import { KpiCarousel, RecentActivity } from "@/components/pop/hardcoded";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
|
||||
interface MenuIconItem {
|
||||
id: string;
|
||||
@@ -24,7 +25,7 @@ const MENU_ITEMS: MenuIconItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/inbound",
|
||||
href: "/pop/inbound",
|
||||
},
|
||||
{
|
||||
id: "outgoing",
|
||||
@@ -36,7 +37,7 @@ const MENU_ITEMS: MenuIconItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M8.25 18.75a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m3 0h6m-9 0H3.375a1.125 1.125 0 01-1.125-1.125V14.25m17.25 4.5a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m3 0H6.75m11.25 0h2.625c.621 0 1.125-.504 1.125-1.125v-4.875c0-.621-.504-1.125-1.125-1.125H17.25m-13.5-.375V6.375c0-.621.504-1.125 1.125-1.125h7.5c.621 0 1.125.504 1.125 1.125v7.125" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound",
|
||||
href: "/pop/outbound",
|
||||
},
|
||||
{
|
||||
id: "production",
|
||||
@@ -49,7 +50,7 @@ const MENU_ITEMS: MenuIconItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/production",
|
||||
href: "/pop/production",
|
||||
},
|
||||
{
|
||||
id: "quality",
|
||||
@@ -103,13 +104,14 @@ const MENU_ITEMS: MenuIconItem[] = [
|
||||
|
||||
function LocalMenuIcons() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
const handleClick = (item: MenuIconItem) => {
|
||||
if (item.href === "#") {
|
||||
alert(`${item.title} 화면은 준비 중입니다.`);
|
||||
return;
|
||||
}
|
||||
router.push(item.href);
|
||||
router.push(companyPath(item.href));
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import { Suspense } from "react";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { OutboundCartPage } from "../../_components/outbound/OutboundCartPage";
|
||||
|
||||
function OutboundCartContent() {
|
||||
const searchParams = useSearchParams();
|
||||
const backUrl = searchParams.get("backUrl") || "/COMPANY_7/pop/outbound";
|
||||
const companyPath = usePopCompanyPath();
|
||||
const backUrl = searchParams.get("backUrl") || companyPath("/pop/outbound");
|
||||
|
||||
return <OutboundCartPage backUrl={backUrl} />;
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { EtcOutbound } from "../../_components/outbound/EtcOutbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function EtcOutboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("outbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function EtcOutboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/outbound/cart?backUrl=/COMPANY_7/pop/outbound/etc");
|
||||
router.push(`${companyPath("/pop/outbound/cart")}?backUrl=${companyPath("/pop/outbound/etc")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useRef, useCallback, useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Types */
|
||||
@@ -42,7 +43,7 @@ const EXTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/sales",
|
||||
href: "/pop/outbound/sales",
|
||||
},
|
||||
{
|
||||
id: "return",
|
||||
@@ -54,7 +55,7 @@ const EXTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M9 15L3 9m0 0l6-6M3 9h12a6 6 0 010 12h-3" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/return",
|
||||
href: "/pop/outbound/return",
|
||||
},
|
||||
{
|
||||
id: "subcontractor",
|
||||
@@ -66,7 +67,7 @@ const EXTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/subcontractor",
|
||||
href: "/pop/outbound/subcontractor",
|
||||
},
|
||||
{
|
||||
id: "supplied",
|
||||
@@ -78,7 +79,7 @@ const EXTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/supplied",
|
||||
href: "/pop/outbound/supplied",
|
||||
},
|
||||
{
|
||||
id: "etc",
|
||||
@@ -90,7 +91,7 @@ const EXTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M6.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM12.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM18.75 12a.75.75 0 11-1.5 0 .75.75 0 011.5 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/etc",
|
||||
href: "/pop/outbound/etc",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -106,7 +107,7 @@ const INTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/production",
|
||||
href: "/pop/outbound/production",
|
||||
},
|
||||
{
|
||||
id: "transfer",
|
||||
@@ -130,7 +131,7 @@ const INTERNAL_ITEMS: OutboundMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M12 7.5h1.5m-1.5 3h1.5m-7.5 3h7.5m-7.5 3h7.5m3-9h3.375c.621 0 1.125.504 1.125 1.125V18a2.25 2.25 0 01-2.25 2.25M16.5 7.5V18a2.25 2.25 0 002.25 2.25M16.5 7.5V4.875c0-.621-.504-1.125-1.125-1.125H4.125C3.504 3.75 3 4.254 3 4.875V18a2.25 2.25 0 002.25 2.25h13.5M6 7.5h3v3H6v-3z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/outbound/outbound-manage",
|
||||
href: "/pop/outbound/outbound-manage",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -164,6 +165,7 @@ const RECENT_ITEMS: RecentOutboundItem[] = [
|
||||
|
||||
function OutboundTypeSelect() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* KPI carousel */
|
||||
const [kpiIdx, setKpiIdx] = useState(1);
|
||||
@@ -185,7 +187,7 @@ function OutboundTypeSelect() {
|
||||
if (item.href === "#") {
|
||||
alert(`${item.title} 화면은 준비 중입니다.`);
|
||||
} else {
|
||||
router.push(item.href);
|
||||
router.push(companyPath(item.href));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -194,7 +196,7 @@ function OutboundTypeSelect() {
|
||||
{/* ===== Back + Title ===== */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/main")}
|
||||
onClick={() => router.push(companyPath("/pop/main"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ProductionOutbound } from "../../_components/outbound/ProductionOutbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ProductionOutboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("outbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ProductionOutboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/outbound/cart?backUrl=/COMPANY_7/pop/outbound/production");
|
||||
router.push(`${companyPath("/pop/outbound/cart")}?backUrl=${companyPath("/pop/outbound/production")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { ReturnOutbound } from "../../_components/outbound/ReturnOutbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function ReturnOutboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("outbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function ReturnOutboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/outbound/cart?backUrl=/COMPANY_7/pop/outbound/return");
|
||||
router.push(`${companyPath("/pop/outbound/cart")}?backUrl=${companyPath("/pop/outbound/return")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SalesOutbound } from "../../_components/outbound/SalesOutbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function SalesOutboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("outbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function SalesOutboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/outbound/cart?backUrl=/COMPANY_7/pop/outbound/sales");
|
||||
router.push(`${companyPath("/pop/outbound/cart")}?backUrl=${companyPath("/pop/outbound/sales")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SubcontractorOutbound } from "../../_components/outbound/SubcontractorOutbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function SubcontractorOutboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("outbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function SubcontractorOutboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/outbound/cart?backUrl=/COMPANY_7/pop/outbound/subcontractor");
|
||||
router.push(`${companyPath("/pop/outbound/cart")}?backUrl=${companyPath("/pop/outbound/subcontractor")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SuppliedOutbound } from "../../_components/outbound/SuppliedOutbound";
|
||||
import { useCartSync } from "../../_components/common/useCartSync";
|
||||
|
||||
export default function SuppliedOutboundPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const cart = useCartSync("outbound");
|
||||
const [saving, setSaving] = useState(false);
|
||||
|
||||
@@ -17,7 +19,7 @@ export default function SuppliedOutboundPage() {
|
||||
setSaving(false);
|
||||
if (!ok) return;
|
||||
}
|
||||
router.push("/COMPANY_7/pop/outbound/cart?backUrl=/COMPANY_7/pop/outbound/supplied");
|
||||
router.push(`${companyPath("/pop/outbound/cart")}?backUrl=${companyPath("/pop/outbound/supplied")}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useRef, useCallback, useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Types */
|
||||
@@ -32,7 +33,7 @@ const MENU_ITEMS: ProductionMenuItem[] = [
|
||||
<path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
),
|
||||
href: "/COMPANY_7/pop/production/process",
|
||||
href: "/pop/production/process",
|
||||
},
|
||||
];
|
||||
|
||||
@@ -42,6 +43,7 @@ const MENU_ITEMS: ProductionMenuItem[] = [
|
||||
|
||||
function ProductionMenu() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* KPI carousel */
|
||||
const [kpiIdx, setKpiIdx] = useState(0);
|
||||
@@ -63,7 +65,7 @@ function ProductionMenu() {
|
||||
if (item.href === "#") {
|
||||
alert(`${item.title} 화면은 준비 중입니다.`);
|
||||
} else {
|
||||
router.push(item.href);
|
||||
router.push(companyPath(item.href));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,7 +74,7 @@ function ProductionMenu() {
|
||||
{/* ===== Back + Title ===== */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/main")}
|
||||
onClick={() => router.push(companyPath("/pop/main"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import { SupplierModal, type Supplier, type PartnerSourceConfig } from "../../_components/inbound/SupplierModal";
|
||||
import { EquipmentModal, type EquipmentItem } from "../../_components/common/EquipmentModal";
|
||||
import { getProcessEquipments } from "@/lib/api/processInfo";
|
||||
@@ -40,6 +41,7 @@ const DEFAULT_COLS: ColsKey = 2;
|
||||
|
||||
export default function ProductionProcessPage() {
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
|
||||
/* 카드 열 수 (localStorage 연동) */
|
||||
const [cols, setCols] = useState<ColsKey>(DEFAULT_COLS);
|
||||
@@ -192,7 +194,7 @@ export default function ProductionProcessPage() {
|
||||
{/* ===== Back + Title ===== */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/production")}
|
||||
onClick={() => router.push(companyPath("/pop/production"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { usePopCompanyPath } from "@/hooks/usePopCompanyPath";
|
||||
import {
|
||||
ProcessWork,
|
||||
type ProcessWorkInfo,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
export default function WorkPage() {
|
||||
const params = useParams();
|
||||
const router = useRouter();
|
||||
const companyPath = usePopCompanyPath();
|
||||
const processId = params.processId as string;
|
||||
const [info, setInfo] = useState<ProcessWorkInfo | null>(null);
|
||||
|
||||
@@ -29,7 +31,7 @@ export default function WorkPage() {
|
||||
{/* ===== Back + Title + Status row ===== */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={() => router.push("/COMPANY_7/pop/production/process")}
|
||||
onClick={() => router.push(companyPath("/pop/production/process"))}
|
||||
className="w-10 h-10 rounded-xl bg-white border border-gray-200 flex items-center justify-center text-gray-500 hover:bg-gray-50 active:scale-95 transition-all"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" strokeWidth={2} viewBox="0 0 24 24">
|
||||
|
||||
25
frontend/hooks/usePopCompanyPath.ts
Normal file
25
frontend/hooks/usePopCompanyPath.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
|
||||
/**
|
||||
* POP 화면 내 경로 조립 훅.
|
||||
* `/COMPANY_7/pop/...` 같은 하드코딩 접두사를 제거하고 로그인 사용자의 회사코드로 동적 조립.
|
||||
*
|
||||
* 사용 예:
|
||||
* const companyPath = usePopCompanyPath();
|
||||
* router.push(companyPath("/pop/inbound")); // → /COMPANY_50/pop/inbound (COMPANY_50 사용자인 경우)
|
||||
* href={companyPath("/pop/inbound/purchase")}
|
||||
*/
|
||||
export function usePopCompanyPath() {
|
||||
const { companyCode } = useAuth();
|
||||
return useCallback(
|
||||
(subpath: string) => {
|
||||
const cc = companyCode || "";
|
||||
const normalized = subpath.startsWith("/") ? subpath : `/${subpath}`;
|
||||
return `/${cc}${normalized}`;
|
||||
},
|
||||
[companyCode],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user