style(inout): 발주 메일 첫 요약 표 칸 높이를 글자 한 줄에 맞춤 · 두 표 사이 18px

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 14:30:16 +09:00
parent 52e21a3a68
commit d4e4bc5dbf
2 changed files with 16 additions and 8 deletions
+13 -7
View File
@@ -302,16 +302,20 @@ def order_mail(order: dict[str, Any], *, sender_name: str, sender_email: str) ->
td = "padding:6px 10px;border:1px solid #d9dce1;"
r = "text-align:right;white-space:nowrap;"
# 요약 표 = 항목·값 두 쌍씩 한 줄(4열, 2026-10-19 — 예전 2열 × 8행). 요청 사항(길 수 있음)은 맨 아래 한 줄 전체.
fth = f"{td}background:#f6f7f9;text-align:left;white-space:nowrap"
# 칸 높이는 글자 한 줄에 맞게 — 받은 메일(메일 프로그램)에서 칸이 크게 늘어나 보여 줄 높이·글자 크기·위아래 여백을 칸마다 못 박는다.
ftd = "padding:4px 10px;border:1px solid #d9dce1;font-size:14px;line-height:20px;height:20px;vertical-align:middle;white-space:nowrap;"
fth = f"{ftd}background:#f6f7f9;text-align:left;font-weight:700;"
pairs = [(k, v) for k, v in facts if k != "요청 사항"]
fact_rows = ""
for i in range(0, len(pairs), 2):
cols = "".join(f'<th style="{fth}">{e(k)}</th><td style="{td}">{e(str(v))}</td>' for k, v in pairs[i:i + 2])
cols = "".join(f'<th style="{fth}">{e(k)}</th><td style="{ftd}">{e(str(v))}</td>' for k, v in pairs[i:i + 2])
if len(pairs[i:i + 2]) == 1:
cols += f'<th style="{fth}"></th><td style="{td}"></td>'
cols += f'<th style="{fth}"></th><td style="{ftd}"></td>'
fact_rows += f"<tr>{cols}</tr>"
if order.get("memo"):
fact_rows += f'<tr><th style="{fth}">요청 사항</th><td colspan="3" style="{td}">{e(str(order["memo"]))}</td></tr>'
if order.get("memo"): # 요청 사항은 길면 줄을 바꿔야 하므로 높이를 고정하지 않는다
memo_td = "padding:4px 10px;border:1px solid #d9dce1;font-size:14px;line-height:20px;vertical-align:middle;"
fact_rows += (f'<tr><th style="{fth}">요청 사항</th>'
f'<td colspan="3" style="{memo_td}">{e(str(order["memo"]))}</td></tr>')
rows = []
for i, x in enumerate(lines, start=1):
c = cells(x)
@@ -329,8 +333,10 @@ def order_mail(order: dict[str, Any], *, sender_name: str, sender_email: str) ->
html = (
'<div style="font-family:\'Malgun Gothic\',\'Apple SD Gothic Neo\',sans-serif;font-size:14px;color:#1d1d1f;line-height:1.6">'
f"<p>{e(greet)}<br>아래와 같이 제품 제작을 발주합니다.</p>"
f'<table style="border-collapse:collapse;margin:8px 0 16px">{fact_rows}</table>'
'<table style="border-collapse:collapse;min-width:640px">'
f'<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;margin:8px 0 0">{fact_rows}</table>'
# 두 표 사이 18px — 표 margin 은 메일 프로그램마다 무시되기도 해서 높이 18px 빈 줄로 띄운다
'<div style="height:18px;line-height:18px;font-size:1px">&nbsp;</div>'
'<table style="border-collapse:collapse;min-width:640px;margin:0">'
f'<thead><tr style="{bg}"><th style="{td}">No</th><th style="{td}">제품 코드</th><th style="{td}">제품명</th>'
f'<th style="{td}">수량</th><th style="{td}">단가(원)</th><th style="{td}">금액(원)</th>'
f'<th style="{td}">전체 무게(kg)</th><th style="{td}">PP 사용량(kg)</th><th style="{td}">은(Ag) 함유량</th>'