feat(라이브): 호스트 간단한 이름과 수정 권한 칩

호스트에 간단한 이름(display_name, 필수)을 추가하고 달력 카드·스케줄표·방송 창에 표시한다.
달력 카드 머리 아래에 그 방송의 틱톡 계정을 작게 보여 준다.
관리자 페이지 칩 live_host_edit 로 호스트 수정을 허용한다. 지우기는 관리자만이고,
개인정보는 페이지에 싣지 않아 빈칸으로 열리며 비워 두면 값이 유지된다.
마이그레이션 004: live_hosts.display_name 추가.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 18:15:30 +09:00
parent 43771edd77
commit e6ebf2188b
19 changed files with 173 additions and 52 deletions
+1
View File
@@ -69,6 +69,7 @@ MODULE_LABELS: dict[str, str] = {
"outreach": "안내문 발송",
"live": "라이브 커머스",
"live_host": "라이브 호스트 등록",
"live_host_edit": "라이브 호스트 수정",
"expense_approver": "개인경비",
"vacation_approver": "휴가",
}
+3 -2
View File
@@ -5,9 +5,10 @@
> 다른 모듈과 연결: 이미지 검사 = 자산 모듈 `app/modules/asset/media.py prepare_photo` 재사용(바꾸면 양쪽 확인).
- 말레이시아 라이브 커머스 방송의 호스트 정보·방송 스케줄. 권한키 `live`, DB `LIVE_DB_URL`(없으면 "설정 필요" 안내).
- **호스트 설정** `/live/settings` — Full Name (as per IC)(필수)·Phone Number·Email·Address·Bank Name·Bank Account Number.
- **호스트 설정** `/live/settings` — 간단한 이름(필수, `display_name`, 마이그레이션 004 — 말레이 이름은 끝이 아버지 이름이라 자동으로 줄이지 않고 사람이 입력, 빈 예전 호스트는 화면에 Full Name)·Full Name (as per IC)(필수)·Phone Number·Email·Address·Bank Name·Bank Account Number.
**계좌 등 개인정보라 ERP 관리자만**(`is_admin`) — 화면·저장·지우기 모두. 스케줄 화면에는 `db.host_choices`(이름·사용 여부)만 넘긴다.
**틱톡 계정은 호스트가 아니라 방송마다**(2026-11-05, 마이그레이션 003 `live_broadcasts.tiktok_handle`) — 호스트가 여러 계정에서 방송하므로. 방송 창에서 입력(선택), `@`·주소를 붙여 넣어도 계정명만 저장, 쓴 적 있는 계정을 제안(`db.account_choices`). `live_hosts.tiktok_handle` 은 값만 남아 있고 안 씀. 달력에서 옮기거나 맞바꿔도 계정은 그 방송에 그대로.
**틱톡 계정은 호스트가 아니라 방송마다**(2026-11-05, 마이그레이션 003 `live_broadcasts.tiktok_handle`) — 호스트가 여러 계정에서 방송하므로. 방송 창에서 입력(선택), `@`·주소를 붙여 넣어도 계정명만 저장, 쓴 적 있는 계정을 제안(`db.account_choices`). `live_hosts.tiktok_handle` 은 값만 남아 있고 안 씀. 달력에서 옮기거나 맞바꿔도 계정은 그 방송에 그대로. 달력 카드 머리·스케줄표·방송 창의 호스트 = 간단한 이름, 카드 머리 아래 작은 글자 = 계정.
**`live_host_edit` 칩**(+ `live`, 관리자 페이지 토글) = 호스트 **고치기**(사용 여부 포함): 지우기 불가, 개인정보는 페이지에 싣지 않아 빈칸으로 열리고 비워 두면 그대로·입력하면 바뀜(이 칩으로는 지울 수 없음).
**`live_host` 칩**(+ `live` 칩 필요) = 새 호스트 **등록만**: 설정 화면에 이름·상태만 보이고, 입력한 계좌 등은 저장 후 못 봄. 고치기·지우기 불가, 사용 여부 못 고름(항상 사용).
사용 안 함 = 새 방송에서 못 고름(그 호스트로 이미 등록된 방송을 고칠 때만 보임). 방송 기록이 있는 호스트는 못 지움(FK RESTRICT).
- **스케줄표** `/live/?month=YYYY-MM`(`live` 권한자 모두) — 호스트·날짜·시작/끝 시간·방송 장소·판매금액·커미션·호스트 비용·결과 이미지. 호스트·날짜·시작·끝 시간 필수(판매금액은 방송 후 입력).
+10 -6
View File
@@ -18,7 +18,7 @@ from psycopg_pool import ConnectionPool
from . import store
from .i18n import LiveError
_HOST_COLUMNS = ("full_name", "phone", "email", "address", "bank_name", "bank_account")
_HOST_COLUMNS = ("display_name", "full_name", "phone", "email", "address", "bank_name", "bank_account")
class LiveDBStore:
@@ -39,7 +39,11 @@ class LiveDBStore:
def host_choices(self) -> list[dict[str, Any]]:
"""스케줄 화면 호스트 고르기 — 개인정보·계좌는 뺀다."""
with self._pool.connection() as conn:
return conn.execute("SELECT id, full_name, is_active FROM live_hosts ORDER BY full_name, id").fetchall()
return conn.execute("SELECT id, display_name, full_name, is_active FROM live_hosts ORDER BY full_name, id").fetchall()
def get_host(self, host_id: int) -> dict[str, Any] | None:
with self._pool.connection() as conn:
return conn.execute("SELECT * FROM live_hosts WHERE id=%s", (host_id,)).fetchone()
def account_choices(self) -> list[str]:
"""방송 창 틱톡 계정 입력 제안 — 지금까지 방송에 쓴 계정."""
@@ -52,12 +56,12 @@ class LiveDBStore:
with self._pool.connection() as conn:
if host_id is None:
row = conn.execute(
"INSERT INTO live_hosts (full_name, phone, email, address, bank_name, bank_account, "
"is_active, created_by, updated_by) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s) RETURNING id",
"INSERT INTO live_hosts (display_name, full_name, phone, email, address, bank_name, bank_account, "
"is_active, created_by, updated_by) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) RETURNING id",
(*cols, is_active, by, by)).fetchone()
else:
row = conn.execute(
"UPDATE live_hosts SET full_name=%s, phone=%s, email=%s, address=%s, bank_name=%s, bank_account=%s, "
"UPDATE live_hosts SET display_name=%s, full_name=%s, phone=%s, email=%s, address=%s, bank_name=%s, bank_account=%s, "
"is_active=%s, updated_by=%s WHERE id=%s RETURNING id",
(*cols, is_active, by, host_id)).fetchone()
if not row:
@@ -78,7 +82,7 @@ class LiveDBStore:
"""start 이상 end 미만, 날짜·시간 순. 줄마다 images = [{id, filename}](내용 제외)."""
with self._pool.connection() as conn:
rows = conn.execute(
"SELECT b.*, h.full_name AS host_name FROM live_broadcasts b JOIN live_hosts h ON h.id = b.host_id "
"SELECT b.*, COALESCE(NULLIF(h.display_name, ''), h.full_name) AS host_name FROM live_broadcasts b JOIN live_hosts h ON h.id = b.host_id "
"WHERE b.broadcast_date >= %s AND b.broadcast_date < %s ORDER BY b.broadcast_date, b.start_time, b.id",
(start, end)).fetchall()
images = conn.execute(
+3 -2
View File
@@ -37,7 +37,7 @@ EN: dict[str, str] = {
"{date} 광고비 고치기": "Edit ad spend for {date}", "방송 결과 이미지": "Result images", "이미지 {n}": "IMG {n}",
# 호스트 설정
"◀ 스케줄표": "◀ Schedule", "+ 호스트 등록": "+ Add Host", "호스트 등록": "Add Host", "호스트 고치기": "Edit Host",
"이름 (IC 기준)": "Full Name (as per IC)", "전화번호": "Phone Number", "이메일": "Email", "주소": "Address", "은행명": "Bank Name",
"간단한 이름": "Short Name", "이름 (IC 기준)": "Full Name (as per IC)", "전화번호": "Phone Number", "이메일": "Email", "주소": "Address", "은행명": "Bank Name",
"계좌번호": "Bank Account Number", "틱톡 핸들": "Tiktok Handle", "상태": "Status", "사용": "Active",
"{name} 호스트를 지울까요?": "Delete host {name}?", "등록한 호스트가 없습니다.": "No hosts registered.",
"사용 (끄면 새 방송에서 고를 수 없습니다)": "Active (when off, the host can't be selected for new broadcasts)",
@@ -48,7 +48,8 @@ EN: dict[str, str] = {
"저장했습니다.": "Saved.", "옮겼습니다.": "Moved.", "광고비를 저장했습니다.": "Ad spend saved.", "방송을 지웠습니다.": "Broadcast deleted.",
"이미지를 지웠습니다.": "Image deleted.", "호스트를 저장했습니다.": "Host saved.", "호스트를 지웠습니다.": "Host deleted.",
"잘못된 요청입니다.": "Invalid request.",
"이름 (IC 기준)을 입력하세요.": "Enter the Full Name (as per IC).", "{label} 이(가) 너무 깁니다({limit}자까지).": "{label} is too long (up to {limit} characters).",
"간단한 이름을 입력하세요.": "Enter the Short Name.", "이름 (IC 기준)을 입력하세요.": "Enter the Full Name (as per IC).",
"개인정보는 보이지 않습니다. 비워 두면 그대로 유지됩니다.": "Personal details are hidden. Leave them blank to keep the current values.", "{label} 이(가) 너무 깁니다({limit}자까지).": "{label} is too long (up to {limit} characters).",
"이메일 형식이 올바르지 않습니다.": "The email format is invalid.", "전화번호는 숫자·+·-·괄호만 입력하세요.": "Phone Number may contain only digits, +, - and brackets.",
"계좌번호는 숫자·-만 입력하세요.": "Bank Account Number may contain only digits and -.",
"틱톡 핸들은 영문·숫자·밑줄·점만 입력하세요.": "Tiktok Handle may contain only letters, digits, underscores and dots.",
+23 -10
View File
@@ -8,7 +8,7 @@
GET /live/images/{id} 결과 이미지(?thumb=1 = 작은 그림) · POST /live/images/{id}/delete
GET /live/settings 설정 — 호스트 정보(ERP 관리자만, 계좌 등 개인정보. `live_host` 칩은 이름·틱톡·상태만)
POST /live/settings/hosts 호스트 추가·고치기 · POST /live/settings/hosts/{id}/delete
권한: 모듈 권한키 `live`(스케줄), 설정은 ERP 관리자, `live` + `live_host` 칩 = 새 호스트 등록만.
권한: 모듈 권한키 `live`(스케줄), 설정은 ERP 관리자, `live` + `live_host` 칩 = 새 호스트 등록, `live` + `live_host_edit` 칩 = 고치기(둘 다 개인정보는 안 보임).
DB: LIVE_DB_URL(live_db) — 없으면 "설정 필요" 안내.
저장 요청은 live.js 가 fetch 로 보내고 JSON {ok, message} 를 받는다(틀려도 입력한 값이 창에 남게).
"""
@@ -68,6 +68,12 @@ def _can_add_host(user: dict[str, Any]) -> bool:
return is_admin(user) or has_module(user, "live_host")
def _can_edit_host(user: dict[str, Any]) -> bool:
from app.store import has_module, is_admin # noqa: WPS433
return is_admin(user) or has_module(user, "live_host_edit")
def _db(request: Request) -> Any:
st = _store(request)
if st is None:
@@ -100,7 +106,8 @@ def _render(request: Request, name: str, user: dict[str, Any], ctx: dict[str, An
from app.store import is_admin # noqa: WPS433
lang = _lang(request)
return render_template(request, name, {"user": user, "is_admin": is_admin(user), "can_add_host": _can_add_host(user), "lang": lang,
return render_template(request, name, {"user": user, "is_admin": is_admin(user), "can_add_host": _can_add_host(user),
"can_edit_host": _can_edit_host(user), "lang": lang,
"t": lambda text: i18n.t(text, lang), "js_text": i18n.js_text(lang),
"nav_items": build_erp_nav(user, active="live"), **ctx})
@@ -260,29 +267,35 @@ def settings(request: Request) -> Any:
if not isinstance(got, tuple):
return got
st, user = got
if not _can_add_host(user):
if not (_can_add_host(user) or _can_edit_host(user)):
return render_template(request, "denied.html", {"reason": _t(request, "호스트 정보는 ERP 관리자만 볼 수 있습니다."), "is_admin": False},
status_code=403)
# host_choices = 이름·틱톡·상태뿐 — 계좌 등 개인정보는 관리자에게만
# host_choices = 이름·상태뿐 — 계좌 등 개인정보는 칩이 있어도 관리자에게만
return _render(request, "live/settings.html", user, {"hosts": st.list_hosts() if is_admin(user) else st.host_choices()})
@router.post("/settings/hosts")
def host_save(request: Request, id: str = Form(""), full_name: str = Form(""), phone: str = Form(""), email: str = Form(""),
def host_save(request: Request, id: str = Form(""), display_name: str = Form(""), full_name: str = Form(""), phone: str = Form(""), email: str = Form(""),
address: str = Form(""), bank_name: str = Form(""), bank_account: str = Form(""),
is_active: str = Form("")) -> JSONResponse:
from app.store import is_admin # noqa: WPS433
# `live_host` 칩은 새 등록만 — id 가 있으면 고치기라 관리자 검사로
# `live_host` 칩 = 새 등록, `live_host_edit` 칩 = 고치기(개인정보는 안 보이고, 비워 두면 그대로)
user = _user(request)
if id.strip() or not _can_add_host(user):
if not (_can_edit_host(user) if id.strip() else _can_add_host(user)):
_admin(request)
st = _db(request)
try:
values = store.clean_host({"full_name": full_name, "phone": phone, "email": email, "address": address, "bank_name": bank_name,
values = store.clean_host({"display_name": display_name, "full_name": full_name, "phone": phone, "email": email, "address": address, "bank_name": bank_name,
"bank_account": bank_account})
# 칩 권한자 화면엔 사용 여부 칸이 없다 — 항상 사용(사용 안 함으로 만들면 본인이 되돌릴 수 없음)
st.save_host(_opt_id(id), values, is_active=bool(is_active) or not is_admin(user), by=user.get("email", ""))
host_id = _opt_id(id)
if host_id is not None and not is_admin(user): # 개인정보를 못 보므로 빈칸 = 지우기가 아니라 그대로
old = st.get_host(host_id)
if not old:
raise i18n.LiveError("호스트를 찾을 수 없습니다.")
values.update({k: values[k] or old[k] for k in store.PRIVATE_HOST_FIELDS})
# 등록만 되는 칩 화면엔 사용 여부 칸이 없다 — 항상 사용(사용 안 함으로 만들면 본인이 되돌릴 수 없음)
st.save_host(host_id, values, is_active=bool(is_active) or not _can_edit_host(user), by=user.get("email", ""))
except ValueError as exc:
return _fail(request, exc)
return _ok(request, "호스트를 저장했습니다.")
+7 -4
View File
@@ -25,9 +25,10 @@ _CENT = Decimal("0.01")
_WEEKDAYS = ("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY")
_MONTHS = ("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
HOST_LIMITS = {"full_name": 200, "phone": 40, "email": 254, "address": 500, "bank_name": 100, "bank_account": 40}
HOST_LIMITS = {"display_name": 50, "full_name": 200, "phone": 40, "email": 254, "address": 500, "bank_name": 100, "bank_account": 40}
HANDLE_LIMIT = 64
_LABELS = {"full_name": "이름 (IC 기준)", "phone": "전화번호", "email": "이메일", "address": "주소", "bank_name": "은행명",
PRIVATE_HOST_FIELDS = ("phone", "email", "address", "bank_name", "bank_account") # 화면에 보이는 사람 = ERP 관리자만
_LABELS = {"display_name": "간단한 이름", "full_name": "이름 (IC 기준)", "phone": "전화번호", "email": "이메일", "address": "주소", "bank_name": "은행명",
"bank_account": "계좌번호"}
_EMAIL_RE = re.compile(r"^[A-Za-z0-9._%+\-']+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}$")
_PHONE_RE = re.compile(r"^\+?[0-9()\-\s]+$")
@@ -45,8 +46,10 @@ def clean_handle(raw: Any) -> str:
def clean_host(values: dict[str, Any]) -> dict[str, str]:
"""호스트 입력 검사 — 이름만 필수, 나머지는 있으면 형식 확인. 틀리면 ValueError."""
"""호스트 입력 검사 — 간단한 이름·이름만 필수, 나머지는 있으면 형식 확인. 틀리면 ValueError."""
out = {k: str(values.get(k) or "").strip() for k in HOST_LIMITS}
if not out["display_name"]:
raise LiveError("간단한 이름을 입력하세요.")
if not out["full_name"]:
raise LiveError("이름 (IC 기준)을 입력하세요.")
for key, limit in HOST_LIMITS.items():
@@ -156,7 +159,7 @@ def broadcast_view(b: dict[str, Any], lang: str = "ko") -> dict[str, Any]:
"host_name": b["host_name"], "tiktok_handle": b["tiktok_handle"], "venue": b["venue"],
"sales": fmt_money(b["sales_amount"]), "commission": fmt_money(pay["commission"]), "fee": fmt_money(pay["fee"]),
"images": b["images"], "pay": pay, "id": b["id"],
"label": b["tiktok_handle"] or b["host_name"], "color": HOST_COLORS[b["host_id"] % len(HOST_COLORS)],
"label": b["host_name"], "color": HOST_COLORS[b["host_id"] % len(HOST_COLORS)],
"card_sales": fmt_short(b["sales_amount"] or Decimal(0)), "card_commission": fmt_short(pay["commission"]),
"card_fee": fmt_short(pay["fee"]),
"edit": {"id": b["id"], "host_id": b["host_id"], "broadcast_date": b["broadcast_date"].isoformat(),
+1 -1
View File
@@ -11,7 +11,7 @@
</nav>
<span class="lv-gap"></span>
{% include "live/_lang.html" %}
{% if can_add_host %}<a class="erp-btn erp-btn-outline" href="/live/settings">{{ t('호스트 설정') }}</a>{% endif %}
{% if can_add_host or can_edit_host %}<a class="erp-btn erp-btn-outline" href="/live/settings">{{ t('호스트 설정') }}</a>{% endif %}
<button type="button" class="erp-btn erp-btn-primary" id="lv-add"{% if not can_add %} disabled{% endif %}>{{ t('+ 방송 추가') }}</button>
</div>
{% if not can_add %}
+1 -1
View File
@@ -6,7 +6,7 @@
<label class="lv-field">{{ t('호스트') }}
<select class="erp-select" name="host_id" required>
<option value="">{{ t('호스트를 고르세요') }}</option>
{% for h in hosts %}<option value="{{ h.id }}"{% if not h.is_active %} data-inactive="1"{% endif %}>{{ h.full_name }}{% if not h.is_active %} — {{ t('사용 안 함') }}{% endif %}</option>{% endfor %}
{% for h in hosts %}<option value="{{ h.id }}"{% if not h.is_active %} data-inactive="1"{% endif %}>{{ h.display_name or h.full_name }}{% if not h.is_active %} — {{ t('사용 안 함') }}{% endif %}</option>{% endfor %}
</select>
</label>
<label class="lv-field">{{ t('틱톡 핸들') }} <input class="erp-input" type="text" name="tiktok_handle" maxlength="200" placeholder="@handle" list="lv-accounts" autocomplete="off" /></label>
@@ -1,2 +1,2 @@
<script>window.LV_T = {{ js_text | tojson }};</script>
<script src="/static/live.js?v=20261104c" defer></script>
<script src="/static/live.js?v=20261105a" defer></script>
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{#- 라이브 커머스 달력 보기(2026-11-04) — 줄 = 2시간 칸, 열 = 날짜, 맨 아래 = 날짜별 합계. 카드 머리 = Tiktok Handle(없으면 이름).
{#- 라이브 커머스 달력 보기(2026-11-04) — 줄 = 2시간 칸, 열 = 날짜, 맨 아래 = 날짜별 합계. 카드 머리 = 호스트 간단한 이름 + 그 방송의 틱톡 계정.
카드 머리를 끌어 빈 칸으로 옮기거나 다른 카드 위에 놓아 맞바꾼다(live.js). 문구 = t()(i18n.py), 영문은 CSS 로 대문자(받은 화면과 같게). -#}
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261104c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261105a" />{% endblock %}
{% block content %}
<section class="lv" lang="{{ lang }}">
@@ -43,7 +43,7 @@
<article class="lv-card" data-card="{{ c.id }}">
<header class="lv-card-head" draggable="true" style="background:{{ c.color }}" title="{{ c.host_name }} · {{ c.times }}{% if c.venue %} · {{ c.venue }}{% endif %}">
<span class="lv-card-grip" aria-hidden="true">✥</span>
<span class="lv-card-name">{{ c.label }}</span>
<span class="lv-card-name">{{ c.label }}{% if c.tiktok_handle %}<small>@{{ c.tiktok_handle }}</small>{% endif %}</span>
<button type="button" class="lv-card-edit" data-edit='{{ c.edit | tojson }}' aria-label="{{ t('{name} {date} {times} 고치기').format(name=c.label, date=c.date, times=c.times) }}">✎</button>
</header>
<div class="lv-card-nums">
+1 -1
View File
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{#- 라이브 커머스 스케줄표(2026-11-04) — 달마다 방송 목록. 추가·고치기 창은 달력과 공용(_dialog.html, live.js). 문구 = t()(i18n.py). -#}
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261104c" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261105a" />{% endblock %}
{% block content %}
<section class="lv" lang="{{ lang }}">
+16 -8
View File
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{#- 라이브 커머스 설정(2026-11-04) — 호스트 정보. 계좌 등 개인정보·고치기·지우기는 ERP 관리자만(router.settings), `live_host` 칩은 이름·상태 + 새 등록만. 추가·고치기는 같은 창(live.js). 문구 = t()(i18n.py). -#}
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261104c" />{% endblock %}
{#- 라이브 커머스 설정(2026-11-04) — 호스트 정보. 계좌 등 개인정보·지우기는 ERP 관리자만(router.settings), 칩 권한자는 이름·상태만 보임 — `live_host` = 새 등록, `live_host_edit` = 고치기(개인정보는 빈칸으로 열림, 비워 두면 그대로). 추가·고치기는 같은 창(live.js). 문구 = t()(i18n.py). -#}
{% block head_extra %}<link rel="stylesheet" href="/static/live.css?v=20261105a" />{% endblock %}
{% block content %}
<section class="lv" lang="{{ lang }}">
@@ -9,16 +9,17 @@
<h2 class="lv-month">{{ t('호스트 설정') }}</h2>
<span class="lv-gap"></span>
{% include "live/_lang.html" %}
<button type="button" class="erp-btn erp-btn-primary" id="lv-add">{{ t('+ 호스트 등록') }}</button>
{% if can_add_host %}<button type="button" class="erp-btn erp-btn-primary" id="lv-add">{{ t('+ 호스트 등록') }}</button>{% endif %}
</div>
<div class="erp-card-block">
<div class="erp-table-wrap">
<table class="erp-table lv-table">
<thead><tr><th>{{ t('이름 (IC 기준)') }}</th>{% if is_admin %}<th>{{ t('전화번호') }}</th><th>{{ t('이메일') }}</th><th>{{ t('주소') }}</th><th>{{ t('은행명') }}</th><th>{{ t('계좌번호') }}</th>{% endif %}<th>{{ t('상태') }}</th>{% if is_admin %}<th></th>{% endif %}</tr></thead>
<thead><tr><th>{{ t('간단한 이름') }}</th><th>{{ t('이름 (IC 기준)') }}</th>{% if is_admin %}<th>{{ t('전화번호') }}</th><th>{{ t('이메일') }}</th><th>{{ t('주소') }}</th><th>{{ t('은행명') }}</th><th>{{ t('계좌번호') }}</th>{% endif %}<th>{{ t('상태') }}</th>{% if can_edit_host %}<th></th>{% endif %}</tr></thead>
<tbody>
{% for h in hosts %}
<tr{% if not h.is_active %} class="lv-off"{% endif %}>
<td data-label="{{ t('간단한 이름') }}">{{ h.display_name }}</td>
<td data-label="{{ t('이름 (IC 기준)') }}">{{ h.full_name }}</td>
{% if is_admin %}
<td class="lv-nowrap" data-label="{{ t('전화번호') }}">{{ h.phone }}</td>
@@ -28,15 +29,20 @@
<td class="lv-nowrap" data-label="{{ t('계좌번호') }}">{{ h.bank_account }}</td>
{% endif %}
<td class="lv-nowrap" data-label="{{ t('상태') }}">{{ t('사용') if h.is_active else t('사용 안 함') }}</td>
{% if is_admin %}
{% if can_edit_host %}
<td class="lv-actions">
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" data-edit='{{ {"id": h.id, "full_name": h.full_name, "phone": h.phone, "email": h.email, "address": h.address, "bank_name": h.bank_name, "bank_account": h.bank_account, "is_active": h.is_active} | tojson }}'>{{ t('고치기') }}</button>
{% if is_admin %}
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" data-edit='{{ {"id": h.id, "display_name": h.display_name, "full_name": h.full_name, "phone": h.phone, "email": h.email, "address": h.address, "bank_name": h.bank_name, "bank_account": h.bank_account, "is_active": h.is_active} | tojson }}'>{{ t('고치기') }}</button>
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" data-post="/live/settings/hosts/{{ h.id }}/delete" data-confirm="{{ t('{name} 호스트를 지울까요?').format(name=h.full_name) }}">{{ t('지우기') }}</button>
{% else %}
{#- 개인정보를 페이지에 싣지 않는다 -#}
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" data-edit='{{ {"id": h.id, "display_name": h.display_name, "full_name": h.full_name, "is_active": h.is_active} | tojson }}'>{{ t('고치기') }}</button>
{% endif %}
</td>
{% endif %}
</tr>
{% else %}
<tr><td colspan="{{ 8 if is_admin else 2 }}" class="erp-empty">{{ t('등록한 호스트가 없습니다.') }}</td></tr>
<tr><td colspan="{{ 9 if is_admin else 4 if can_edit_host else 3 }}" class="erp-empty">{{ t('등록한 호스트가 없습니다.') }}</td></tr>
{% endfor %}
</tbody>
</table>
@@ -48,7 +54,9 @@
<form id="lv-form" action="/live/settings/hosts">
<h3 id="lv-dlg-title" data-add="{{ t('호스트 등록') }}" data-edit="{{ t('호스트 고치기') }}"></h3>
<input type="hidden" name="id" />
<label class="lv-field">{{ t('간단한 이름') }} <input class="erp-input" type="text" name="display_name" maxlength="50" required /></label>
<label class="lv-field">{{ t('이름 (IC 기준)') }} <input class="erp-input" type="text" name="full_name" maxlength="200" required /></label>
{% if not is_admin %}<p class="lv-sub" data-edit-only hidden>{{ t('개인정보는 보이지 않습니다. 비워 두면 그대로 유지됩니다.') }}</p>{% endif %}
<label class="lv-field">{{ t('전화번호') }} <input class="erp-input" type="tel" name="phone" maxlength="40" /></label>
<label class="lv-field">{{ t('이메일') }} <input class="erp-input" type="email" name="email" maxlength="254" /></label>
<label class="lv-field">{{ t('주소') }} <textarea class="erp-input" name="address" rows="2" maxlength="500"></textarea></label>
@@ -56,7 +64,7 @@
<label class="lv-field">{{ t('은행명') }} <input class="erp-input" type="text" name="bank_name" maxlength="100" /></label>
<label class="lv-field">{{ t('계좌번호') }} <input class="erp-input" type="text" name="bank_account" maxlength="40" inputmode="numeric" /></label>
</div>
{% if is_admin %}<label class="lv-check"><input type="checkbox" name="is_active" value="1" checked /> {{ t('사용 (끄면 새 방송에서 고를 수 없습니다)') }}</label>{% endif %}
{% if can_edit_host %}<label class="lv-check"><input type="checkbox" name="is_active" value="1" checked /> {{ t('사용 (끄면 새 방송에서 고를 수 없습니다)') }}</label>{% endif %}
<p class="lv-msg" data-msg role="alert" hidden></p>
<div class="lv-foot">
<button type="button" class="erp-btn erp-btn-outline" data-close>{{ t('취소') }}</button>
+1
View File
@@ -66,6 +66,7 @@
.lv-card { margin-bottom: 4px; border: 1.5px solid #1f2937; border-radius: 6px; background: #fff; overflow: hidden; }
.lv-card-head { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-bottom: 1px solid #1f2937; cursor: grab; }
.lv-card-head:active { cursor: grabbing; }
.lv-card-name small { display: block; overflow: hidden; text-overflow: ellipsis; text-transform: none; font-size: 10px; font-weight: 600; letter-spacing: 0; }
.lv-card-grip { font-size: 12px; color: #374151; }
.lv-card-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; font-size: 13px; font-weight: 800; letter-spacing: .03em; color: #111; }
.lv-card-edit { padding: 0 2px; border: 0; background: none; color: #374151; font-size: 13px; cursor: pointer; }
+1
View File
@@ -78,6 +78,7 @@
say("");
const editing = !!(row && row.id);
title.textContent = editing ? title.dataset.edit : title.dataset.add;
form.querySelectorAll("[data-edit-only]").forEach(function (el) { el.hidden = !editing; });
form.elements.id.value = "";
Array.from(form.elements).forEach(function (el) {
if (!row || !el.name || !(el.name in row)) return;
+1
View File
@@ -41,6 +41,7 @@ MODULE_KEYS: tuple[str, ...] = (
"outreach",
"live",
"live_host",
"live_host_edit",
"expense_approver",
"vacation_approver",
)