일반근무 이름 바꾸기 (웹 2026-11-25.1, 앱 0.14.2 소스)
달력 표시에서 일반근무를 직장에서 부르는 이름(주간·일근 등)으로 바꿀 수 있게 했다. 근무 식별자 REGULAR는 그대로 두고 보이는 이름만 바꾸므로 근무표와 통계는 그대로다. - 서버: 개인 설정 regularName 검사(8자·제어 문자 거부)와 구버전 저장 때 보존, 구독 제목 반영 - 웹: 달력 표시에 이름 칸, 달력 칸·오늘·고르는 목록·이름 표시 문구에 반영 - 앱: ShiftNames와 Shift.title/shortTitle/choiceTitle, 설정 창 칸, 위젯과 안내 줄 반영, 동기화 - 검사: 서버 93개, 앱 단위 53개, 위젯 기기 검사에 이름 확인 추가 - 근무 관리 기기 검사가 고정 날짜 때문에 날짜가 지나면 실패하던 것을 오늘 기준으로 고침 앱 0.14.2 APK는 외부 검사 뒤 따로 배포한다(release.json 앱 버전은 아직 0.14.1).
This commit is contained in:
1 parent
1982783048
commit
1aa4126727
27 files changed
+267
-41
No files matched your search
@@ -8,7 +8,7 @@ const WorkManagement={
|
||||
plan(){if(!rotation())throw Error('당직 기초 설정을 먼저 저장해 주세요.');return structuredClone(rotation().workPlan||WorkPlan.empty());},
|
||||
save(plan){if(new TextEncoder().encode(JSON.stringify(plan)).length>120000)throw Error('근무 계획이 큽니다. 오래된 메모와 변경 이력을 정리해 주세요.');queue('rotation','rotation',{...rotation(),workPlan:plan});notify('근무 계획을 저장했습니다.');},
|
||||
open(){const box=this.dialog('근무 관리');for(const [name,action] of [['날짜별 변경·여러 날짜 수정',()=>this.overrides()],['근무제 변경 이력',()=>this.history()],['근무시간·휴식 기준',()=>this.hours()],['월간·연간 통계',()=>this.statistics()],['근무표 이미지·PDF',()=>this.export()],['휴지통·변경 기록',()=>this.trash()],['여러 날짜에 일정 복사',()=>this.copyEvent()],['소속 근무 교환·인수인계',()=>WorkTeam.open()]])this.button(box,name,action);},
|
||||
overrides(){const plan=this.plan(),box=this.dialog('날짜별 근무 변경'),first=this.input(box,'시작일',selected,'date'),last=this.input(box,'종료일',selected,'date'),shift=this.select(box,'적용할 근무',[...Object.entries(labels),['CLEAR','날짜별 변경 해제']],shiftOn(selected)),days=this.select(box,'범위에서 적용할 날짜',[['all','매일'],['weekday','월~금'],['weekend','토·일']],'all'),note=this.input(box,'메모 · 대타 담당자 등',plan.overrides?.[selected]?.note||'');box.append(text('p','기본 반복은 유지합니다. 한 번에 366일까지 변경하며 메모는 소속에 공유하지 않습니다.','small'));
|
||||
overrides(){const plan=this.plan(),box=this.dialog('날짜별 근무 변경'),first=this.input(box,'시작일',selected,'date'),last=this.input(box,'종료일',selected,'date'),shift=this.select(box,'적용할 근무',[...shiftChoices(),['CLEAR','날짜별 변경 해제']],shiftOn(selected)),days=this.select(box,'범위에서 적용할 날짜',[['all','매일'],['weekday','월~금'],['weekend','토·일']],'all'),note=this.input(box,'메모 · 대타 담당자 등',plan.overrides?.[selected]?.note||'');box.append(text('p','기본 반복은 유지합니다. 한 번에 366일까지 변경하며 메모는 소속에 공유하지 않습니다.','small'));
|
||||
this.button(box,'적용',()=>{if(!/^20\d\d-\d\d-\d\d$/.test(first.value)||!/^20\d\d-\d\d-\d\d$/.test(last.value)||last.value<first.value||(dayDate(last.value)-dayDate(first.value))/86400000>365)throw Error('2000~2099년의 366일 이내 기간을 지정해 주세요.');const next=this.plan();next.overrides||={};for(let key=first.value;key<=last.value;key=WorkPlan.plus(key,1)){const weekday=dayDate(key).getUTCDay(),weekend=weekday===0||weekday===6;if(days.value==='weekday'&&weekend||days.value==='weekend'&&!weekend)continue;if(shift.value==='CLEAR')delete next.overrides[key];else next.overrides[key]={shift:shift.value,note:note.value.trim()};}if(Object.keys(next.overrides).length>1500)throw Error('날짜별 변경은 1500개까지 보관할 수 있습니다.');this.save(next);box.close();},'primary');},
|
||||
history(){const plan=this.plan(),box=this.dialog('근무제 변경 이력');box.append(text('p','적용일 이전은 이전 제도로 계산합니다. 기본 근무표를 통째로 바꾸려면 당직 기초 설정을 사용하세요.','small'));for(const entry of (plan.changes||[]).toSorted((a,b)=>a.from.localeCompare(b.from))){const card=text('article','','member-row');card.append(text('p',entry.from+'부터 · '+entry.pattern.map(v=>labels[v]).join(' → ')));this.button(card,'수정',()=>this.regime(entry));this.button(card,'삭제',async()=>{if(await confirmAction('이 변경을 지우면 다음 변경일까지 이전 제도로 계산됩니다.','이력 삭제')){const next=this.plan();next.changes=next.changes.filter(v=>v.from!==entry.from);this.save(next);this.history();}},'danger');box.append(card);}this.button(box,'변경 예정 추가',()=>this.regime());},
|
||||
regime(entry){const box=this.dialog('근무제 변경 예약'),from=this.input(box,'적용일',entry?.from||todayKey(),'date'),anchor=this.input(box,'반복 첫째 날',entry?.anchor||todayKey(),'date'),week=this.select(box,'토요일 근무 기준',[['6','주6일제'],['5','주5일제']],String(entry?.workWeek||rotation().workWeek||6)),count=this.input(box,'반복 일수',entry?.pattern.length||rotation().pattern.length,'number'),rows=document.createElement('div');count.min=1;count.max=366;let values=[...(entry?.pattern||rotation().pattern)];box.append(rows);const draw=()=>{rows.replaceChildren();values.forEach((value,index)=>{const select=this.select(rows,(index+1)+'일째',Object.entries(labels),value);select.onchange=()=>values[index]=select.value;});};draw();this.button(box,'반복 일수 적용',()=>{const n=Number(count.value);if(!Number.isInteger(n)||n<1||n>366)throw Error('반복 일수는 1~366일입니다.');values=Array.from({length:n},(_,i)=>values[i]||'REGULAR');draw();});this.button(box,'저장',()=>{if(!/^20\d\d-\d\d-\d\d$/.test(from.value)||!/^20\d\d-\d\d-\d\d$/.test(anchor.value)||values.length!==Number(count.value))throw Error('날짜와 반복 일수를 확인해 주세요.');const plan=this.plan(),kept=(plan.changes||[]).filter(v=>v.from!==entry?.from);if(kept.some(v=>v.from===from.value)||kept.length>=60)throw Error('같은 적용일이 있거나 60개 보관 한도에 도달했습니다.');plan.changes=[...kept,{from:from.value,anchor:anchor.value,pattern:values,workWeek:Number(week.value)}].sort((a,b)=>a.from.localeCompare(b.from));this.save(plan);this.history();},'primary');},
|
||||
|
||||
Reference in new issue
Block a user