refactor(cupang): 입고센터 이름 수정 기능 제거

이름을 바꾸면 그 센터를 쓰던 기존 출고 건과 어긋날 수 있어 수정 경로를
막는다. 잘못 등록한 센터는 삭제 후 새로 등록.

- 목록 행: 이름 input+저장 버튼 → 읽기 전용 텍스트
- center_edit 라우터에서 name 폼 파라미터 제거(활성/정렬만 수정)
- 행이 좁아져 그리드 최소폭 340px → 240px

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-31 12:02:57 +09:00
parent 026a9ab526
commit 7b358b0189
9 changed files with 28 additions and 26 deletions
+1 -3
View File
@@ -453,7 +453,6 @@ async def center_create(
async def center_edit( async def center_edit(
request: Request, request: Request,
center_id: int, center_id: int,
name: str = Form(""),
active: str = Form(""), active: str = Form(""),
sort_order: str = Form(""), sort_order: str = Form(""),
user: dict[str, Any] = Depends(_require_user), user: dict[str, Any] = Depends(_require_user),
@@ -461,9 +460,8 @@ async def center_edit(
store = _store(request) store = _store(request)
if store is None: if store is None:
raise HTTPException(status_code=503, detail="cupang_db 미설정") raise HTTPException(status_code=503, detail="cupang_db 미설정")
# 이름 변경은 지원하지 않는다(기존 출고 이력과 어긋날 수 있음). 활성/정렬만 수정.
kwargs: dict[str, Any] = {"center_id": center_id} kwargs: dict[str, Any] = {"center_id": center_id}
if name.strip():
kwargs["name"] = name
if active != "": if active != "":
kwargs["active"] = active in ("1", "true", "on", "True") kwargs["active"] = active in ("1", "true", "on", "True")
if sort_order.strip(): if sort_order.strip():
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
@@ -24,25 +24,25 @@
<div class="cpg-card-head cpg-center-head"> <div class="cpg-card-head cpg-center-head">
<h2>센터 목록 <span class="erp-muted" id="cpgCenterCount">({{ centers|length }})</span></h2> <h2>센터 목록 <span class="erp-muted" id="cpgCenterCount">({{ centers|length }})</span></h2>
<span class="erp-muted">이름을 고치면 저장, 쓰지 않는 센터는 비활성 또는 삭제.</span> <span class="erp-muted">쓰지 않는 센터는 비활성 또는 삭제. 이름 변경은 지원하지 않음 — 새로 등록.</span>
</div> </div>
<!-- 목록: 여러 열로 한 화면에 --> <!-- 목록: 여러 열로 한 화면에 -->
<div class="cpg-center-grid" id="cpgCenterGrid"> <div class="cpg-center-grid" id="cpgCenterGrid">
{% for c in centers %} {% for c in centers %}
<form method="post" action="/cupang/centers/{{ c.id }}/edit" <div class="cpg-center-row {% if not c.active %}is-inactive{% endif %}" data-name="{{ c.name|lower }}">
class="cpg-center-row {% if not c.active %}is-inactive{% endif %}"
data-name="{{ c.name|lower }}">
<span class="cpg-center-dot" title="{% if c.active %}활성{% else %}비활성{% endif %}"></span> <span class="cpg-center-dot" title="{% if c.active %}활성{% else %}비활성{% endif %}"></span>
<input class="erp-input cpg-center-name" type="text" name="name" value="{{ c.name }}" /> <span class="cpg-center-name">{{ c.name }}</span>
<button type="submit" class="erp-btn erp-btn-outline cpg-btn-sm" title="이름 저장">저장</button> <form method="post" action="/cupang/centers/{{ c.id }}/edit" class="cpg-inline-form">
<button type="submit" name="active" value="{% if c.active %}0{% else %}1{% endif %}" <input type="hidden" name="active" value="{% if c.active %}0{% else %}1{% endif %}" />
class="erp-btn erp-btn-outline cpg-btn-sm" <button type="submit" class="erp-btn erp-btn-outline cpg-btn-sm"
title="{% if c.active %}비활성으로 전환{% else %}활성으로 전환{% endif %}">{% if c.active %}비활성{% else %}활성{% endif %}</button> title="{% if c.active %}비활성으로 전환{% else %}활성으로 전환{% endif %}">{% if c.active %}비활성{% else %}활성{% endif %}</button>
<button type="submit" formaction="/cupang/centers/{{ c.id }}/delete" formnovalidate </form>
class="erp-btn erp-btn-danger cpg-btn-sm" <form method="post" action="/cupang/centers/{{ c.id }}/delete" class="cpg-inline-form"
onclick="return confirm('{{ c.name }} 센터를 삭제할까요?');">삭제</button> onsubmit="return confirm('{{ c.name }} 센터를 삭제할까요?');">
</form> <button type="submit" class="erp-btn erp-btn-danger cpg-btn-sm">삭제</button>
</form>
</div>
{% endfor %} {% endfor %}
</div> </div>
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %} {% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831a" />{% endblock %} {% block head_extra %}<link rel="stylesheet" href="/static/cupang.css?v=20260831b" />{% endblock %}
{% block content %} {% block content %}
<section class="cpg"> <section class="cpg">
+7 -3
View File
@@ -184,7 +184,7 @@
.cpg-center-grid { .cpg-center-grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 6px; gap: 6px;
max-height: 70vh; overflow-y: auto; max-height: 70vh; overflow-y: auto;
padding-right: 4px; padding-right: 4px;
@@ -192,7 +192,7 @@
.cpg-center-row { .cpg-center-row {
display: flex; align-items: center; gap: 6px; display: flex; align-items: center; gap: 6px;
margin: 0; padding: 5px 8px; margin: 0; padding: 7px 10px;
border: 1px solid var(--color-subtle-ash); border-radius: 10px; border: 1px solid var(--color-subtle-ash); border-radius: 10px;
min-width: 0; min-width: 0;
} }
@@ -202,7 +202,11 @@
} }
.cpg-center-row.is-inactive { opacity: .55; } .cpg-center-row.is-inactive { opacity: .55; }
.cpg-center-row.is-inactive .cpg-center-dot { background: var(--color-subtle-ash); } .cpg-center-row.is-inactive .cpg-center-dot { background: var(--color-subtle-ash); }
.cpg-center-name { flex: 1 1 auto; min-width: 0; } .cpg-center-name {
flex: 1 1 auto; min-width: 0;
font-size: 14px; font-weight: 500;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cpg-btn-sm { padding: 3px 8px; font-size: 12px; flex: 0 0 auto; } .cpg-btn-sm { padding: 3px 8px; font-size: 12px; flex: 0 0 auto; }
/* ── 라인 테이블 ── */ /* ── 라인 테이블 ── */