feat(dispatch): 일괄 버튼을 토글로 변경(전부 완료면 해제)
- 모두 라벨부착/모두 Kagayaku 전달 버튼이 현재 상태를 보고 토글 · 전 박스 완료면 → 모두 해제, 아니면 → 모두 완료 - 버튼 색으로 현재 상태 표시(전부 완료 시 초록), 개별 토글/로드 시 동기화 - bulk 라우터에 value 파라미터 추가(완료/해제) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -508,19 +508,21 @@ async def parcels_bulk(
|
||||
request: Request,
|
||||
batch_id: int,
|
||||
field: str = Form(...),
|
||||
value: str = Form("true"),
|
||||
user: dict[str, Any] = Depends(_require_user),
|
||||
) -> JSONResponse:
|
||||
"""배치 내 모든 박스의 작업 상태 1개를 완료(TRUE)로 일괄 설정. JSON 반환."""
|
||||
"""배치 내 모든 박스의 작업 상태 1개를 value(완료/해제)로 일괄 설정. JSON 반환."""
|
||||
st = _store(request)
|
||||
if st is None:
|
||||
raise HTTPException(status_code=503, detail="dispatch_db 미설정")
|
||||
target = str(value).strip().lower() in ("true", "1", "on", "yes")
|
||||
try:
|
||||
count = st.bulk_set_status(
|
||||
batch_id=batch_id, field=field, value=True, worker_name=user.get("email", "")
|
||||
batch_id=batch_id, field=field, value=target, worker_name=user.get("email", "")
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
return JSONResponse({"ok": True, "field": field, "count": count})
|
||||
return JSONResponse({"ok": True, "field": field, "value": target, "count": count})
|
||||
|
||||
|
||||
@router.get("/api/batches/{batch_id:int}/parcels")
|
||||
|
||||
Reference in New Issue
Block a user