m/orders 페이지의 거래명세표 DetailModal 에서 "이미지 공유" 버튼이 모든 사용자에게 노출되던 문제. useAuthStore 의 user.role === "USER" 이면 버튼 hide. ADMIN 은 그대로 표시. 엑셀 다운로드 버튼은 그대로 유지 (사용자가 자기 주문 명세는 엑셀로 받을 수 있음). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { Download, Image as ImageIcon, X, Eye, Trash2 } from "lucide-react";
|
||||
import Swal from "sweetalert2";
|
||||
import { downloadXlsx } from "@/lib/xlsx-export";
|
||||
import { captureAndShare as captureAndShareLib } from "@/lib/capture-share";
|
||||
import { useAuthStore } from "@/store/auth-store";
|
||||
|
||||
interface Order {
|
||||
OBJID: string;
|
||||
@@ -238,6 +239,9 @@ function DetailModal({ order, items, supplier, onClose, onCancel, onReload }: {
|
||||
else Swal.fire({ icon: "error", title: "삭제 실패", text: j.message });
|
||||
};
|
||||
|
||||
const user = useAuthStore((s) => s.user);
|
||||
const isUserRole = user?.role === "USER";
|
||||
|
||||
const captureAndShare = async () => {
|
||||
if (!ref.current) return;
|
||||
await captureAndShareLib({
|
||||
@@ -254,10 +258,12 @@ function DetailModal({ order, items, supplier, onClose, onCancel, onReload }: {
|
||||
<div className="bg-white rounded-xl shadow-xl max-w-3xl w-full max-h-[92vh] overflow-y-auto p-5" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="flex justify-between items-center mb-3 print:hidden">
|
||||
<div className="flex gap-2">
|
||||
<button onClick={captureAndShare}
|
||||
className="inline-flex items-center gap-1 h-9 px-3 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold hover:bg-amber-200">
|
||||
<ImageIcon size={14} /> 이미지 공유
|
||||
</button>
|
||||
{!isUserRole && (
|
||||
<button onClick={captureAndShare}
|
||||
className="inline-flex items-center gap-1 h-9 px-3 rounded-lg bg-amber-100 text-amber-800 text-xs font-bold hover:bg-amber-200">
|
||||
<ImageIcon size={14} /> 이미지 공유
|
||||
</button>
|
||||
)}
|
||||
<a href={`/api/m/orders/statement/${order.OBJID}`}
|
||||
className="inline-flex items-center gap-1 h-9 px-3 rounded-lg bg-emerald-100 text-emerald-800 text-xs font-bold hover:bg-emerald-200">
|
||||
<Download size={14} /> 엑셀 다운로드
|
||||
|
||||
Reference in New Issue
Block a user