feat(dispatch): 배치 삭제 버튼(슈퍼 관리자 전용)
- 배치 목록에 삭제 버튼 추가, is_super 일 때만 표시 + 확인창 - 삭제 라우터 권한을 admin → 슈퍼 관리자 전용으로 강화 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -284,11 +284,9 @@ async def batch_create(
|
|||||||
async def batch_delete(
|
async def batch_delete(
|
||||||
request: Request, batch_id: int, user: dict[str, Any] = Depends(_require_user)
|
request: Request, batch_id: int, user: dict[str, Any] = Depends(_require_user)
|
||||||
) -> RedirectResponse:
|
) -> RedirectResponse:
|
||||||
"""배치 삭제 — 관리자 전용(박스/상품/로그 CASCADE)."""
|
"""배치 삭제 — 슈퍼 관리자 전용(박스/상품/로그 CASCADE)."""
|
||||||
from app.store import is_admin # noqa: WPS433
|
if not bool(user.get("is_super_admin")):
|
||||||
|
raise HTTPException(status_code=403, detail="배치 삭제는 슈퍼 관리자만 가능합니다.")
|
||||||
if not is_admin(user):
|
|
||||||
raise HTTPException(status_code=403, detail="배치 삭제는 관리자만 가능합니다.")
|
|
||||||
st = _store(request)
|
st = _store(request)
|
||||||
if st is None:
|
if st is None:
|
||||||
raise HTTPException(status_code=503, detail="dispatch_db 미설정")
|
raise HTTPException(status_code=503, detail="dispatch_db 미설정")
|
||||||
|
|||||||
@@ -37,6 +37,12 @@
|
|||||||
<a class="erp-btn erp-btn-outline" href="/dispatch/batches/{{ b.id }}/picking">피킹</a>
|
<a class="erp-btn erp-btn-outline" href="/dispatch/batches/{{ b.id }}/picking">피킹</a>
|
||||||
<a class="erp-btn erp-btn-outline" href="/dispatch/batches/{{ b.id }}/handover">전달</a>
|
<a class="erp-btn erp-btn-outline" href="/dispatch/batches/{{ b.id }}/handover">전달</a>
|
||||||
<a class="erp-btn erp-btn-outline" href="/dispatch/batches/{{ b.id }}/download">다운로드</a>
|
<a class="erp-btn erp-btn-outline" href="/dispatch/batches/{{ b.id }}/download">다운로드</a>
|
||||||
|
{% if is_super %}
|
||||||
|
<form method="post" action="/dispatch/batches/{{ b.id }}/delete" style="display:inline;"
|
||||||
|
onsubmit="return confirm('배치 「{{ b.batch_name or '(이름없음)' }}」 와 모든 박스/상품/로그를 삭제합니다. 되돌릴 수 없습니다. 계속할까요?');">
|
||||||
|
<button type="submit" class="erp-btn erp-btn-outline" style="color:#dc2626;border-color:#fca5a5;">삭제</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user