일반근무 이름 바꾸기 (웹 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
+2
-1
@@ -11,7 +11,7 @@ import site_admin
|
||||
import work_team
|
||||
from work_plan import validate_plan, SHIFTS
|
||||
from work_names import validate_name_rule
|
||||
from personal import validate_personal, mirror_display, validate_event_options, validate_week_start, preserve_week_start
|
||||
from personal import validate_personal, mirror_display, validate_event_options, validate_week_start, preserve_week_start, preserve_regular_name
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
@@ -593,6 +593,7 @@ async def mutations(request: Request):
|
||||
if previous_plan is not None: op["data"]["workPlan"]=previous_plan
|
||||
if not op["deleted"]:
|
||||
preserve_week_start(conn, client["calendar"], op["kind"], op["data"], current)
|
||||
preserve_regular_name(op["kind"], op["data"], current)
|
||||
if op["deleted"] and not op["data"] and current:
|
||||
op["data"]=json.loads(current["data"])
|
||||
conn.execute("INSERT INTO items VALUES(?,?,?,?,?,?) ON CONFLICT(calendar,id) DO UPDATE SET version=excluded.version,deleted=excluded.deleted,data=excluded.data", (client["calendar"], op["id"], op["kind"], version + 1, int(op["deleted"]), json.dumps(op["data"], ensure_ascii=False)))
|
||||
|
||||
@@ -65,6 +65,9 @@ def project(state,chosen,today,holidays):
|
||||
for person in (state.get('company') or {}).get('members',[]):
|
||||
if not person['isSelf'] and person.get('rotation'):people['company:'+person['id']]={**person['rotation'],'name':person['name']}
|
||||
rules=[item['data'] for item in items if item['kind']=='name_rule'];output={}
|
||||
# 회원이 일반근무 이름을 바꿨으면 구독 제목도 그 이름을 쓴다. 근무 계산은 식별자로 하므로 바뀌지 않는다.
|
||||
regular=next((item['data'].get('regularName') for item in items if item['kind']=='preferences'),'')
|
||||
labels={**LABELS,'REGULAR':regular} if isinstance(regular,str) and regular.strip() else LABELS
|
||||
def put(key,title,notes,start,end,all_day):
|
||||
output[key]={'key':key,'title':title,'notes':notes,'start':start,'end':end,'allDay':all_day}
|
||||
if len(output)>10000:raise ValueError('내보낼 일정이 10,000개를 넘습니다. 선택 항목을 줄여 주세요.')
|
||||
@@ -79,7 +82,7 @@ def project(state,chosen,today,holidays):
|
||||
if name_matches(rule,day,own,holiday,shift(person,day) if person else None):
|
||||
name=person['name'] if rule['mode']=='PERSON' else rule['name']
|
||||
if name not in names:names.append(name)
|
||||
put('rotation:'+day.isoformat(),LABELS[own]+(' · '+' · '.join(names) if names else ''),'',day,day+timedelta(days=1),True)
|
||||
put('rotation:'+day.isoformat(),labels[own]+(' · '+' · '.join(names) if names else ''),'',day,day+timedelta(days=1),True)
|
||||
if chosen['anniversaries']:
|
||||
for item in items:
|
||||
d=item['data']
|
||||
|
||||
+31
-1
@@ -1,9 +1,11 @@
|
||||
"""회원의 기념일과 표시 설정을 검증한다. 모든 조회와 쓰기의 소유 범위는 인증된 캘린더다."""
|
||||
from datetime import date
|
||||
import json
|
||||
import unicodedata
|
||||
|
||||
DISPLAY_FIELDS = ('dutyAsWeekday', 'showLunar', 'offAsHoliday')
|
||||
REMINDER_MINUTES = (-1, 0, 10, 30, 60, 1440)
|
||||
REGULAR_NAME_MAX = 8
|
||||
|
||||
|
||||
def validate_week_start(data):
|
||||
@@ -15,6 +17,34 @@ def validate_week_start(data):
|
||||
return {'weekStart': data['weekStart']}
|
||||
|
||||
|
||||
def validate_regular_name(data):
|
||||
"""일반근무를 부르는 이름(예: 주간, 일근). 근무 식별자 REGULAR는 그대로 두고 표시 이름만 바꾼다.
|
||||
|
||||
값 생략은 구버전 요청이라 저장된 이름을 보존하고 빈 값은 기본 이름(일반근무)으로 되돌린다.
|
||||
빈칸은 하나로 줄이고 제어 문자와 보이지 않는 서식 문자는 받지 않는다. 글자 수는 앱과 같게 코드 포인트로 센다.
|
||||
"""
|
||||
if 'regularName' not in data:
|
||||
return {}
|
||||
value = data['regularName']
|
||||
if not isinstance(value, str):
|
||||
raise ValueError('일반근무 이름을 확인해 주세요.')
|
||||
value = ' '.join(value.split())
|
||||
if len(value) > REGULAR_NAME_MAX:
|
||||
raise ValueError('일반근무 이름은 8자까지 입력할 수 있습니다.')
|
||||
if any(unicodedata.category(char).startswith('C') for char in value):
|
||||
raise ValueError('일반근무 이름에 쓸 수 없는 글자가 있습니다.')
|
||||
return {'regularName': value}
|
||||
|
||||
|
||||
def preserve_regular_name(kind, data, current):
|
||||
"""구버전 앱이나 열려 있던 옛 웹이 이름 없이 표시 설정을 저장해도 이미 정한 이름을 지우지 않는다."""
|
||||
if kind != 'preferences' or 'regularName' in data or not current:
|
||||
return
|
||||
saved = json.loads(current['data']).get('regularName')
|
||||
if isinstance(saved, str):
|
||||
data['regularName'] = saved
|
||||
|
||||
|
||||
def preserve_week_start(conn, calendar, kind, data, current):
|
||||
"""구버전이 주 시작 값을 생략하면 이미 저장한 개인 선택을 보존한다.
|
||||
|
||||
@@ -51,7 +81,7 @@ def validate_personal(kind, data):
|
||||
if kind == 'preferences':
|
||||
if any(type(data.get(key)) is not bool for key in DISPLAY_FIELDS):
|
||||
raise ValueError('개인 표시 설정을 확인해 주세요.')
|
||||
return {**{key: data[key] for key in DISPLAY_FIELDS}, **validate_week_start(data)}
|
||||
return {**{key: data[key] for key in DISPLAY_FIELDS}, **validate_week_start(data), **validate_regular_name(data)}
|
||||
if not isinstance(data.get('title'), str) or not 1 <= len(data['title'].strip()) <= 60:
|
||||
raise ValueError('기념일 이름은 1~60자로 입력해 주세요.')
|
||||
if data.get('category') not in ('BIRTHDAY', 'ANNIVERSARY') or data.get('calendar') not in ('SOLAR', 'LUNAR'):
|
||||
|
||||
+2
-1
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"appVersion": "0.14.1",
|
||||
"appVersionCode": 21,
|
||||
"webVersion": "2026-11-24.2",
|
||||
"webVersion": "2026-11-25.1",
|
||||
"apkFile": "duty-calendar-0.14.1.apk",
|
||||
"notes": [
|
||||
"달력 표시에서 일반근무 이름을 직장에서 부르는 이름(주간·일근 등)으로 바꿀 수 있습니다. 근무 순서는 그대로입니다.",
|
||||
"홈페이지 로고와 아이콘을 새로 다듬었습니다. 휴대폰 브라우저에서 홈 화면에 추가하면 새 아이콘으로 보입니다.",
|
||||
"로그인하면 화면 위쪽 메뉴와 내 정보 창에서 바로 로그아웃할 수 있습니다.",
|
||||
"연차·월차·일반휴가·공가·경조휴가를 각각 선택하고 통계와 위젯 및 기본 달력에 반영할 수 있습니다.",
|
||||
|
||||
@@ -136,6 +136,32 @@ class CalendarTests(unittest.TestCase):
|
||||
for value in (1,None,'true'):
|
||||
self.assertEqual(self.write([self.personal_op('preferences',showLunar=value)]).status_code,400)
|
||||
|
||||
def test_regular_name_saved_preserved_reset_and_used_in_feed(self):
|
||||
self.write_rotation(pattern=['DUTY','OFF','REGULAR'])
|
||||
prefs=lambda:next(i for i in self.state()['items'] if i['kind']=='preferences')
|
||||
self.assertEqual(self.write([self.personal_op('preferences',regularName=' 주간 근무 ')]).status_code,200)
|
||||
self.assertEqual(prefs()['data']['regularName'],'주간 근무')
|
||||
# 구버전 앱과 열려 있던 옛 웹은 이름 없이 저장한다. 이미 정한 이름을 지우지 않는다.
|
||||
self.assertEqual(self.write([self.personal_op('preferences',version=prefs()['version'],showLunar=False)]).status_code,200)
|
||||
self.assertEqual(prefs()['data']['regularName'],'주간 근무');self.assertFalse(prefs()['data']['showLunar'])
|
||||
rotation=next(i for i in self.state()['items'] if i['kind']=='rotation')
|
||||
self.assertNotIn('regularName',rotation['data']);self.assertEqual(rotation['data']['pattern'],['DUTY','OFF','REGULAR'])
|
||||
# 구독 제목은 바꾼 이름을 쓰고 근무 순서 계산은 그대로다.
|
||||
options=dict(rotation=True,events=False,anniversaries=False,names=False,notes=False)
|
||||
feed=self.client.post('/calendar/api/calendar-sharing',json={'action':'create','options':options},headers=self.auth()).json()['url']
|
||||
text=self.client.get(feed).text;self.assertIn('SUMMARY:주간 근무',text);self.assertNotIn('SUMMARY:일반근무',text);self.assertIn('SUMMARY:당직',text)
|
||||
# 다른 회원과 같은 소속에도 이름은 나가지 않는다.
|
||||
self.assertEqual(self.state(self.other_member())['items'],[])
|
||||
for value in ('가'*9,1,None,['주간'],'주간\x07','주간\u200b','\ue000'):
|
||||
self.assertEqual(self.write([self.personal_op('preferences',version=prefs()['version'],regularName=value)]).status_code,400,repr(value))
|
||||
# 줄바꿈과 겹친 빈칸은 빈칸 하나로 정리한다(앱과 웹도 같은 규칙).
|
||||
self.assertEqual(self.write([self.personal_op('preferences',version=prefs()['version'],regularName='주간\n\t근무')]).status_code,200)
|
||||
self.assertEqual(prefs()['data']['regularName'],'주간 근무')
|
||||
self.assertEqual(self.write([self.personal_op('preferences',version=prefs()['version'],regularName='가'*8)]).status_code,200)
|
||||
self.assertEqual(self.write([self.personal_op('preferences',version=prefs()['version'],regularName='')]).status_code,200)
|
||||
self.assertEqual(prefs()['data']['regularName'],'')
|
||||
self.assertIn('SUMMARY:일반근무',self.client.get(feed).text)
|
||||
|
||||
def test_anniversary_edit_delete_and_replay(self):
|
||||
op=self.personal_op();self.write([op]);replay=self.write([op]).json();self.assertEqual(replay['state']['items'][0]['version'],1)
|
||||
edit=self.personal_op(key=op['id'],version=1,title='변경한 기념일');self.write([edit])
|
||||
|
||||
+18
-5
@@ -4,6 +4,14 @@
|
||||
* 충돌한 내용은 별도로 보관하며 사용자가 선택하기 전에는 서버 값을 덮어쓰지 않는다. */
|
||||
const $ = id => document.getElementById(id);
|
||||
const labels = {DUTY:'당직',OFF:'비번',REGULAR:'일반근무',DAY:'주간',EVENING:'오후',NIGHT:'야간',REST:'휴무',LEAVE:'연차·휴가',SICK:'병가',TRAINING:'교육',ANNUAL_LEAVE:'연차',MONTHLY_LEAVE:'월차',VACATION:'일반휴가',OFFICIAL_LEAVE:'공가',FAMILY_LEAVE:'경조휴가'};
|
||||
// 일반근무는 회원이 정한 이름(달력 표시의 일반근무 이름)으로 보인다. 근무 식별자 REGULAR는 그대로라 근무표와 다른 사람 자료는 바뀌지 않는다.
|
||||
const DEFAULT_REGULAR = labels.REGULAR, REGULAR_NAME_MAX = 8;
|
||||
let regularShort = '일반';
|
||||
function cleanRegularName(value){return String(value??'').trim().split(/\s+/).filter(Boolean).join(' ');}
|
||||
function shortRegular(name){const chars=[...name];return chars.length<=3?name:chars.slice(0,2).join('');}
|
||||
function applyShiftNames(){const name=cleanRegularName(displaySettings().regularName);labels.REGULAR=name||DEFAULT_REGULAR;regularShort=name?shortRegular(name):'일반';for(const node of document.querySelectorAll('.regular-name'))node.textContent=labels.REGULAR;}
|
||||
// 고르는 목록에서는 바꾼 이름이 다른 근무 이름과 같을 때 원래 이름을 덧붙여 구분한다(예: 주간 (일반근무)).
|
||||
function shiftChoices(){return Object.entries(labels).map(([value,name])=>[value,value==='REGULAR'&&name!==DEFAULT_REGULAR&&Object.entries(labels).some(([other,label])=>other!=='REGULAR'&&label===name)?name+' ('+DEFAULT_REGULAR+')':name]);}
|
||||
const classes = {DUTY:'duty',OFF:'off',REGULAR:'regular',DAY:'daytime',EVENING:'evening',NIGHT:'night',REST:'rest',LEAVE:'rest',SICK:'rest',TRAINING:'night',ANNUAL_LEAVE:'rest',MONTHLY_LEAVE:'rest',VACATION:'rest',OFFICIAL_LEAVE:'rest',FAMILY_LEAVE:'rest'};
|
||||
const categories = {GENERAL:'개인 일정',WORK:'업무',PARTTIME:'알바·시간근무',LEAVE:'휴가·휴무',BIRTHDAY:'생일',ANNIVERSARY:'기념일'};
|
||||
const todayKey = () => new Intl.DateTimeFormat('sv-SE',{timeZone:'Asia/Seoul',year:'numeric',month:'2-digit',day:'2-digit'}).format(new Date());
|
||||
@@ -92,6 +100,7 @@ async function enter(){
|
||||
if(location.hash==='#work-team'&&typeof WorkTeam!=='undefined')WorkTeam.open().catch(error=>notify(error.message));
|
||||
}
|
||||
function render(){
|
||||
applyShiftNames();
|
||||
if(typeof renderCompany==='function')renderCompany();
|
||||
const today=todayKey(),day=dayDate(today),r=rotation(),display=displaySettings(),current=shiftOn(today);
|
||||
document.body.classList.toggle('five-day',false);
|
||||
@@ -103,7 +112,7 @@ function render(){
|
||||
$('month').textContent=Number(month.slice(0,4))+'년 '+Number(month.slice(5))+'월';
|
||||
const companions=people();document.body.classList.toggle('with-people',companions.length>0);$('grid').replaceChildren();const first=calendarFirstDate(month,display.weekStart);
|
||||
$('calendar-weekdays').replaceChildren();for(const day of calendarWeekdays(display.weekStart))$('calendar-weekdays').append(text('span',['일','월','화','수','목','금','토'][day],day===0?'sun':day===6?'sat':''));
|
||||
for(let i=0;i<42;i++){const date=new Date(first);date.setUTCDate(first.getUTCDate()+i);const key=dateKey(date),shift=shiftOn(key),name=holiday(key),events=eventsOn(key);const button=document.createElement('button');button.type='button';button.className='day'+(key.slice(0,7)!==month?' outside':'')+(key===selected?' selected':'')+(key===today?' current':'')+(date.getUTCDay()===0?' sun':date.getUTCDay()===6?(r&&WorkPlan.regime(r,key).workWeek===5?' sat holiday':' sat'):'')+(name?' holiday':'')+(display.dutyAsWeekday===true&&shift==='DUTY'?' duty-weekday':'')+(display.offAsHoliday===true&&shift==='OFF'?' off-red':'');button.setAttribute('aria-label',`${key} ${shift?labels[shift]:''} ${name} 일정 ${events.length}개`);button.append(text('span',String(date.getUTCDate()),'day-number'));const lunar=display.showLunar?lunarLabel(key):null;if(lunar){button.classList.add('with-lunar');button.append(text('span',lunar,'lunar-date'));button.setAttribute('aria-label',button.getAttribute('aria-label')+' '+lunar);}if(shift)button.append(text('span',shift==='REGULAR'?'일반':labels[shift],'shift '+classes[shift]));for(const workName of workNamesOn(key).slice(0,2))button.append(text('span',workName.name,'work-name person-'+workName.color.toLowerCase()));if(name)button.append(text('span',name.includes('대체공휴일')?'대체휴일':name.replace('기독탄신일','성탄절').replace('1월 1일','신정'),'holiday-name'));if(events.length)button.append(text('span','일정 '+events.length+'개','event-count'));const annual=events.find(item=>item.kind==='anniversary');if(annual)button.append(text('span',annual.data.title,'anniversary-badge'));const duties=companions.filter(item=>WorkPlan.working(personShift(item,key)));for(const item of duties.slice(0,2))button.append(text('span',item.data.name,'person-badge person-'+item.data.color.toLowerCase()));if(duties.length>2)button.append(text('span','외 '+(duties.length-2)+'명','event-count'));button.setAttribute('aria-label',button.getAttribute('aria-label')+' 일반근무 이름 '+workNamesOn(key).map(item=>item.name).join(' ')+' 함께 근무 '+duties.map(item=>item.data.name).join(' '));button.onclick=()=>{selected=key;render();};$('grid').append(button);}
|
||||
for(let i=0;i<42;i++){const date=new Date(first);date.setUTCDate(first.getUTCDate()+i);const key=dateKey(date),shift=shiftOn(key),name=holiday(key),events=eventsOn(key);const button=document.createElement('button');button.type='button';button.className='day'+(key.slice(0,7)!==month?' outside':'')+(key===selected?' selected':'')+(key===today?' current':'')+(date.getUTCDay()===0?' sun':date.getUTCDay()===6?(r&&WorkPlan.regime(r,key).workWeek===5?' sat holiday':' sat'):'')+(name?' holiday':'')+(display.dutyAsWeekday===true&&shift==='DUTY'?' duty-weekday':'')+(display.offAsHoliday===true&&shift==='OFF'?' off-red':'');button.setAttribute('aria-label',`${key} ${shift?labels[shift]:''} ${name} 일정 ${events.length}개`);button.append(text('span',String(date.getUTCDate()),'day-number'));const lunar=display.showLunar?lunarLabel(key):null;if(lunar){button.classList.add('with-lunar');button.append(text('span',lunar,'lunar-date'));button.setAttribute('aria-label',button.getAttribute('aria-label')+' '+lunar);}if(shift)button.append(text('span',shift==='REGULAR'?regularShort:labels[shift],'shift '+classes[shift]));for(const workName of workNamesOn(key).slice(0,2))button.append(text('span',workName.name,'work-name person-'+workName.color.toLowerCase()));if(name)button.append(text('span',name.includes('대체공휴일')?'대체휴일':name.replace('기독탄신일','성탄절').replace('1월 1일','신정'),'holiday-name'));if(events.length)button.append(text('span','일정 '+events.length+'개','event-count'));const annual=events.find(item=>item.kind==='anniversary');if(annual)button.append(text('span',annual.data.title,'anniversary-badge'));const duties=companions.filter(item=>WorkPlan.working(personShift(item,key)));for(const item of duties.slice(0,2))button.append(text('span',item.data.name,'person-badge person-'+item.data.color.toLowerCase()));if(duties.length>2)button.append(text('span','외 '+(duties.length-2)+'명','event-count'));button.setAttribute('aria-label',button.getAttribute('aria-label')+' '+labels.REGULAR+' 아래 이름 '+workNamesOn(key).map(item=>item.name).join(' ')+' 함께 근무 '+duties.map(item=>item.data.name).join(' '));button.onclick=()=>{selected=key;render();};$('grid').append(button);}
|
||||
const selectedDay=dayDate(selected);$('selected-date').textContent=new Intl.DateTimeFormat('ko-KR',{month:'long',day:'numeric',weekday:'short',timeZone:'UTC'}).format(selectedDay);$('day-detail').textContent=[labels[shiftOn(selected)],holiday(selected)].filter(Boolean).join(' · ')||'등록한 일정을 확인하고 새로 추가하세요.';
|
||||
$('agenda').replaceChildren();const events=eventsOn(selected);if(!events.length)$('agenda').append(text('div','등록된 일정이 없습니다.\n가벼운 메모부터 시작해 보세요.','empty'));for(const item of events){const node=document.createElement('button');node.className='event-item '+(item.data.category==='PARTTIME'?'parttime':item.data.category==='WORK'?'work':item.data.category==='LEAVE'?'leave':'');node.append(text('strong',item.data.title),text('span',eventTimeSummary(item.data)),text('span',categories[item.data.category]));node.onclick=()=>openEvent(item);$('agenda').append(node);}
|
||||
$('people-list').replaceChildren();if(!companions.length)$('people-list').append(text('p','이름과 근무 주기를 등록해 함께 볼 수 있습니다.','small'));for(const item of companions){const node=text('button',item.data.name+' · '+labels[personShift(item,selected)],'person-row person-'+item.data.color.toLowerCase());node.append(text('small','주'+(item.data.workWeek||6)+'일제 · '+WorkPlan.regime(item.data,selected).pattern.length+'일 반복 · '+personColors[item.data.color]));if(item.shared)node.append(text('small','소속 공유 · 본인만 수정 가능'));node.onclick=()=>item.shared?openCompany():openPerson(item);$('people-list').append(node);}
|
||||
@@ -121,7 +130,7 @@ $('event-delete').onclick=async()=>{if(await confirmAction('이 일정을 삭제
|
||||
$('add').onclick=()=>openEvent();$('day-add').onclick=()=>openEvent();
|
||||
function moveMonth(step){const d=dayDate(month+'-01');d.setUTCMonth(d.getUTCMonth()+step);month=dateKey(d).slice(0,7);render();}
|
||||
$('prev').onclick=()=>moveMonth(-1);$('next').onclick=()=>moveMonth(1);$('today').onclick=()=>{selected=todayKey();month=selected.slice(0,7);render();};
|
||||
function drawRotation(pattern){$('rotation-count').value=pattern.length;$('rotation-days').replaceChildren();pattern.forEach((shift,index)=>{const label=text('label',(index+1)+'일째');const select=document.createElement('select');for(const [value,name] of Object.entries(labels)){const option=text('option',name);option.value=value;select.append(option);}select.value=shift;label.append(select);$('rotation-days').append(label);});}
|
||||
function drawRotation(pattern){$('rotation-count').value=pattern.length;$('rotation-days').replaceChildren();pattern.forEach((shift,index)=>{const label=text('label',(index+1)+'일째');const select=document.createElement('select');for(const [value,name] of shiftChoices()){const option=text('option',name);option.value=value;select.append(option);}select.value=shift;label.append(select);$('rotation-days').append(label);});}
|
||||
$('rotation').onclick=()=>{const r=rotation()??{anchor:todayKey(),pattern:['DUTY','OFF']};$('rotation-anchor').value=r.anchor;$('rotation-work-week').value=String(r.workWeek||6);resetPatternMode('rotation');drawRotation(r.pattern);$('rotation-error').textContent='';$('rotation-dialog').showModal();};
|
||||
$('rotation-form').onsubmit=event=>{event.preventDefault();const pattern=[...$('rotation-days').querySelectorAll('select')].map(node=>node.value);if(pattern.length!==Number($('rotation-count').value)){$('rotation-error').textContent='반복 일수를 확인해 주세요.';return;}queue('rotation','rotation',{...rotation(),...displaySettings(),anchor:$('rotation-anchor').value,pattern,workWeek:Number($('rotation-work-week').value)});$('rotation-dialog').close();notify('반복 근무를 저장했습니다.');};
|
||||
// 저장 시 최신 근무표에서 표시 항목만 바꾼다. 기초 설정과 옵션이 서로의 값을 되돌리지 않게 한다.
|
||||
@@ -131,10 +140,14 @@ function openDisplayOptions(){
|
||||
$('rotation-show-lunar').checked=r.showLunar===true;
|
||||
$('rotation-off-red').checked=r.offAsHoliday===true;
|
||||
$('rotation-week-start').value=String(r.weekStart===1?1:0);
|
||||
$('regular-name').value=cleanRegularName(r.regularName);$('options-error').textContent='';
|
||||
$('options-dialog').showModal();
|
||||
};
|
||||
$('options-form').onsubmit=event=>{
|
||||
event.preventDefault();queue('preferences','preferences',{dutyAsWeekday:$('rotation-duty-weekday').checked,showLunar:$('rotation-show-lunar').checked,offAsHoliday:$('rotation-off-red').checked,weekStart:Number($('rotation-week-start').value)});
|
||||
event.preventDefault();const regularName=cleanRegularName($('regular-name').value);
|
||||
if([...regularName].length>REGULAR_NAME_MAX){$('options-error').textContent='일반근무 이름은 '+REGULAR_NAME_MAX+'자까지 입력할 수 있습니다.';return;}
|
||||
if(/\p{C}/u.test(regularName)){$('options-error').textContent='일반근무 이름에 쓸 수 없는 글자가 있습니다.';return;}
|
||||
queue('preferences','preferences',{dutyAsWeekday:$('rotation-duty-weekday').checked,showLunar:$('rotation-show-lunar').checked,offAsHoliday:$('rotation-off-red').checked,weekStart:Number($('rotation-week-start').value),regularName});
|
||||
$('options-dialog').close();notify('개인 설정을 저장했습니다.');
|
||||
};
|
||||
let authMode='login', personId=null;
|
||||
@@ -151,7 +164,7 @@ $('password-form').onsubmit=async event=>{event.preventDefault();if($('password-
|
||||
async function logoutNow(){if($('account-dialog').open)$('account-dialog').close();if(pending.length){notify('전송 대기 중인 내용이 있습니다. 동기화를 마친 뒤 로그아웃해 주세요.');return;}if(!await confirmAction('이 브라우저에서 로그아웃할까요? 다시 로그인하면 저장한 일정을 볼 수 있습니다.','로그아웃'))return;try{await api('logout',{});connected=false;watchGeneration++;localStorage.removeItem(cacheKey());localStorage.removeItem(stateCacheKey());location.reload();}catch(error){notify(error.message);}}
|
||||
$('logout').onclick=logoutNow;$('account-logout').onclick=logoutNow;
|
||||
|
||||
function drawPerson(pattern){$('person-count').value=pattern.length;$('person-days').replaceChildren();pattern.forEach((shift,index)=>{const label=text('label',(index+1)+'일째'),select=document.createElement('select');for(const [value,name] of Object.entries(labels)){const option=text('option',name);option.value=value;select.append(option);}select.value=shift;label.append(select);$('person-days').append(label);});}
|
||||
function drawPerson(pattern){$('person-count').value=pattern.length;$('person-days').replaceChildren();pattern.forEach((shift,index)=>{const label=text('label',(index+1)+'일째'),select=document.createElement('select');for(const [value,name] of shiftChoices()){const option=text('option',name);option.value=value;select.append(option);}select.value=shift;label.append(select);$('person-days').append(label);});}
|
||||
function openPerson(item){if(!item&&personalPeople().length>=20){notify('함께 볼 사람은 20명까지 등록할 수 있습니다.');return;}personId=item?.id??null;const d=item?.data??{name:'',color:'BLUE',anchor:selected,pattern:['DUTY','OFF','REGULAR']};$('person-heading').textContent=item?'함께 보는 근무표 수정':'함께 볼 사람 추가';$('person-name').value=d.name;$('person-color').value=d.color;$('person-anchor').value=d.anchor;$('person-work-week').value=String(d.workWeek||6);$('person-duty-weekday').checked=d.dutyAsWeekday===true;resetPatternMode('person');drawPerson(d.pattern);$('person-delete').hidden=!item;$('person-error').textContent='';$('person-dialog').showModal();}
|
||||
$('person-add').onclick=()=>openPerson();
|
||||
$('person-form').onsubmit=event=>{event.preventDefault();const pattern=[...$('person-days').querySelectorAll('select')].map(node=>node.value),name=$('person-name').value.trim();if(!name||pattern.length!==Number($('person-count').value)){$('person-error').textContent='이름과 반복 일수를 확인해 주세요.';return;}queue(personId??crypto.randomUUID(),'person',{name,color:$('person-color').value,anchor:$('person-anchor').value,pattern,workWeek:Number($('person-work-week').value),dutyAsWeekday:$('person-duty-weekday').checked});$('person-dialog').close();notify('함께 보는 근무표를 저장했습니다.');};
|
||||
@@ -160,7 +173,7 @@ $('person-delete').onclick=async()=>{if(await confirmAction('이 캘린더에
|
||||
// 회원·소속·홈페이지 설정은 관리자 페이지(admin)에서 다룬다. 이 화면에서는 이동 버튼만 둔다.
|
||||
$('admin-open').onclick=()=>{location.href='admin';};
|
||||
|
||||
function describe(item){if(!item||item.deleted)return '삭제된 일정';const d=item.data;if(item.kind==='anniversary')return d.title+'\n'+annualDescription(d)+'\n'+d.notes;if(item.kind==='preferences')return '당직일 평일색: '+(d.dutyAsWeekday?'켜짐':'꺼짐')+'\n비번 빨간색: '+(d.offAsHoliday?'켜짐':'꺼짐')+'\n음력 표시: '+(d.showLunar?'켜짐':'꺼짐')+'\n주 시작: '+(d.weekStart===1?'월요일':'일요일');if(item.kind==='name_rule')return d.name+'\n'+nameRuleDescription(d);if(item.kind==='person')return `${d.name} · ${personColors[d.color]}\n첫째 날: ${d.anchor}\n${d.pattern.map(key=>labels[key]).join(' → ')}`;if(item.kind==='rotation')return `첫째 날: ${d.anchor}\n${d.pattern.map(key=>labels[key]).join(' → ')}`;return `${d.title}\n${d.date} ~ ${d.endDate}\n${d.allDay?'하루 종일':d.startTime+' ~ '+d.endTime}\n${categories[d.category]}\n${d.notes}`;}
|
||||
function describe(item){if(!item||item.deleted)return '삭제된 일정';const d=item.data;if(item.kind==='anniversary')return d.title+'\n'+annualDescription(d)+'\n'+d.notes;if(item.kind==='preferences')return '당직일 평일색: '+(d.dutyAsWeekday?'켜짐':'꺼짐')+'\n비번 빨간색: '+(d.offAsHoliday?'켜짐':'꺼짐')+'\n음력 표시: '+(d.showLunar?'켜짐':'꺼짐')+'\n주 시작: '+(d.weekStart===1?'월요일':'일요일')+'\n일반근무 이름: '+(cleanRegularName(d.regularName)||DEFAULT_REGULAR+' (기본)');if(item.kind==='name_rule')return d.name+'\n'+nameRuleDescription(d);if(item.kind==='person')return `${d.name} · ${personColors[d.color]}\n첫째 날: ${d.anchor}\n${d.pattern.map(key=>labels[key]).join(' → ')}`;if(item.kind==='rotation')return `첫째 날: ${d.anchor}\n${d.pattern.map(key=>labels[key]).join(' → ')}`;return `${d.title}\n${d.date} ~ ${d.endDate}\n${d.allDay?'하루 종일':d.startTime+' ~ '+d.endTime}\n${categories[d.category]}\n${d.notes}`;}
|
||||
function showConflict(){const op=pending.find(item=>conflicts.includes(item.changeId));if(!op){$('conflict-dialog').close();return;}$('conflict-local').textContent=describe(op);$('conflict-remote').textContent=describe(model.items.find(item=>item.id===op.id));if(!$('conflict-dialog').open)$('conflict-dialog').showModal();}
|
||||
$('resolve').onclick=showConflict;
|
||||
function resolveConflict(useLocal){const op=pending.find(item=>conflicts.includes(item.changeId));if(!op)return;pending=pending.filter(item=>item.changeId!==op.changeId);conflicts=conflicts.filter(id=>id!==op.changeId);if(useLocal)pending.push({...op,baseVersion:model.items.find(item=>item.id===op.id)?.version??0,changeId:crypto.randomUUID()});persist();render();showConflict();sync();}
|
||||
|
||||
@@ -34,22 +34,22 @@
|
||||
<dialog id="calendar-sharing-dialog"><div class="dialog-heading"><h2>달력 연동·공유</h2><button class="icon-button close" aria-label="닫기">×</button></div>
|
||||
<section class="settings-note"><h3>휴대폰 기본 달력</h3><p>안드로이드 앱 → 설정 → 달력 연동·공유 → 기본 달력에 자동 반영에서 대상 달력을 고르세요. 위젯 없이 기본 달력에 근무와 일정을 표시합니다.</p><p class="small">당직근무에서 수정한 내용을 기본 달력으로 보냅니다. 반대 방향의 자동 수정은 지원하지 않습니다. 휴대폰 달력에서 선택한 일정을 가져오는 기능은 별도로 사용할 수 있습니다.</p></section>
|
||||
<h3>다른 달력에서 구독하기</h3><p class="small">지난 30일부터 앞으로 1년까지 읽기 전용으로 제공합니다. 구독 주소를 아는 사람은 선택한 항목을 볼 수 있습니다. 주소를 전달하기 전에 공유 범위를 확인하세요.</p>
|
||||
<fieldset><legend>내보낼 항목</legend><label class="check-label"><input id="share-rotation" type="checkbox" checked>나의 근무표</label><label class="check-label"><input id="share-names" type="checkbox">일반근무 아래 이름 포함</label><label class="check-label"><input id="share-events" type="checkbox">개인 일정과 알바</label><label class="check-label"><input id="share-anniversaries" type="checkbox">생일·기념일</label><label class="check-label"><input id="share-notes" type="checkbox">일정과 기념일 메모 포함</label></fieldset>
|
||||
<fieldset><legend>내보낼 항목</legend><label class="check-label"><input id="share-rotation" type="checkbox" checked>나의 근무표</label><label class="check-label"><input id="share-names" type="checkbox"><span class="regular-name">일반근무</span> 아래 이름 포함</label><label class="check-label"><input id="share-events" type="checkbox">개인 일정과 알바</label><label class="check-label"><input id="share-anniversaries" type="checkbox">생일·기념일</label><label class="check-label"><input id="share-notes" type="checkbox">일정과 기념일 메모 포함</label></fieldset>
|
||||
<p id="share-state" class="small" role="status"></p><div id="share-address-box" hidden><label>구독 주소 · 이 창에서 복사해 보관<input id="share-address" readonly autocomplete="off"></label><button id="share-copy" class="secondary">주소 복사</button></div>
|
||||
<p class="small">외부 달력의 ‘URL로 추가’ 또는 ‘웹에서 구독’에 주소를 붙여 넣으세요. 구독 갱신 주기는 외부 달력 서비스가 정하므로 즉시 반영되지 않을 수 있습니다. 파일로 가져오기는 저장 시점의 사본이며 이후 변경을 자동으로 받지 않습니다.</p>
|
||||
<p id="share-error" class="form-error" role="alert"></p><div class="dialog-actions"><button id="share-disable" class="danger" hidden>주소 종료</button><button id="share-file" class="secondary">달력 파일 받기</button><button id="share-create">구독 주소 만들기</button></div><div class="dialog-actions"><button class="secondary close">닫기</button></div></dialog>
|
||||
<dialog id="agenda-tools-dialog"><div class="dialog-heading"><h2>일정·알림</h2><button class="icon-button close" aria-label="닫기">×</button></div><div class="dialog-actions"><button data-agenda-action="add">일정 추가</button><button data-agenda-action="parttime-add" class="secondary">알바·시간근무</button><button data-agenda-action="anniversary-open" class="secondary">생일·기념일</button></div><p class="small">알림은 일정 편집에서 선택합니다. 휴대폰 알림은 안드로이드 앱의 알림 허용이 필요합니다.</p><h3>일정 찾기 · 다가오는 일정</h3><label>제목이나 메모 검색<input id="agenda-search" type="search" placeholder="근무지 · 약속 · 메모"></label><div class="field-row"><label>조회 시작일<input id="agenda-from" type="date" min="2000-01-01" max="2099-12-31"></label><label>조회 기간<select id="agenda-range"><option value="30">30일</option><option value="90">90일</option><option value="366">1년</option></select></label></div><p id="agenda-results-count" class="small" role="status"></p><div id="agenda-results"></div><div class="dialog-actions"><button class="secondary close">닫기</button></div></dialog>
|
||||
<dialog id="settings-dialog"><div class="dialog-heading"><h2>설정</h2><button class="icon-button close" aria-label="닫기">×</button></div><div class="settings-groups">
|
||||
<button data-setting="rotation"><strong>당직 기초 설정</strong><span>근무 유형 · 반복 순서 · 기준일 · 주5일·주6일제</span></button>
|
||||
<button data-setting="display"><strong>달력 표시</strong><span>주 시작 · 날짜 색상 · 음력</span></button>
|
||||
<button data-setting="name-open"><strong>이름 표시</strong><span>일반근무 아래 이름 · 다른 사람 주기 · 요일과 간격</span></button>
|
||||
<button data-setting="display"><strong>달력 표시</strong><span>주 시작 · 날짜 색상 · 음력 · 일반근무 이름</span></button>
|
||||
<button data-setting="name-open"><strong>이름 표시</strong><span><span class="regular-name">일반근무</span> 아래 이름 · 다른 사람 주기 · 요일과 간격</span></button>
|
||||
<button data-setting="agenda-tools-open"><strong>일정·알림</strong><span>일정 찾기 · 다가오는 일정 · 반복 · 기념일</span></button>
|
||||
<button data-setting="calendar-sharing-open"><strong>달력 연동·공유</strong><span>기본 달력 자동 반영 · 구독 주소 · 파일 내보내기</span></button>
|
||||
<button data-setting="widget"><strong>위젯 꾸미기</strong><span>안드로이드 앱에서 크기와 투명도 설정</span></button>
|
||||
</div><div class="dialog-actions"><button class="secondary close">닫기</button></div></dialog>
|
||||
<dialog id="widget-help-dialog"><div class="dialog-heading"><h2>위젯 꾸미기</h2><button class="icon-button close" aria-label="닫기">×</button></div><p>안드로이드 앱의 설정 → 위젯 꾸미기에서 바꿀 수 있습니다.</p><p>월간 4×4 · 가로 4×2 · 세로 2×4 · 오늘 2×2를 지원합니다. 배경과 투명도 및 글자 크기와 표시 항목을 위젯마다 따로 정할 수 있습니다.</p><p class="small">위젯 모양은 해당 휴대폰에 보관합니다. 회원의 근무표와 표시 옵션은 같은 계정으로 공유됩니다.</p><button class="secondary close">닫기</button></dialog>
|
||||
<button id="name-open" hidden>이름 표시 관리</button>
|
||||
<dialog id="name-list-dialog"><div class="dialog-heading"><h2>일반근무 아래 이름 표시</h2><button class="icon-button close" aria-label="닫기">×</button></div><p class="small">월~금 중 내 일반근무일에 이름을 작게 표시합니다. 공휴일과 당직·비번·휴무에는 표시하지 않습니다. 내 계정에만 저장합니다.</p><div id="name-rules"></div><div class="dialog-actions"><button class="secondary close">닫기</button><button id="name-add">이름 추가</button></div></dialog>
|
||||
<dialog id="name-list-dialog"><div class="dialog-heading"><h2><span class="regular-name">일반근무</span> 아래 이름 표시</h2><button class="icon-button close" aria-label="닫기">×</button></div><p class="small">월~금 중 내 <span class="regular-name">일반근무</span> 날에 이름을 작게 표시합니다. 공휴일과 당직·비번·휴무에는 표시하지 않습니다. 내 계정에만 저장합니다.</p><div id="name-rules"></div><div class="dialog-actions"><button class="secondary close">닫기</button><button id="name-add">이름 추가</button></div></dialog>
|
||||
<dialog id="name-rule-dialog"><form id="name-form"><div class="dialog-heading"><h2 id="name-rule-heading">이름 표시 추가</h2><button type="button" class="icon-button close" aria-label="닫기">×</button></div>
|
||||
<label class="check-label"><input id="name-enabled" type="checkbox">이름 표시 사용</label>
|
||||
<label>표시 기준<select id="name-mode"><option value="PERSON">다른 사람의 당직 주기</option><option value="WEEKLY">매주 선택한 요일</option><option value="INTERVAL">기준일부터 며칠 간격</option></select></label>
|
||||
@@ -57,7 +57,7 @@
|
||||
<label id="name-text-label">표시 이름<input id="name-text" maxlength="30" placeholder="예: 김민수"></label><label>이름 색상<select id="name-color"></select></label>
|
||||
<div id="name-manual"><label>기준일 · 이날부터 표시<input id="name-anchor" type="date" min="2000-01-01" max="2099-12-31" required></label><label id="name-interval-label">반복 간격 · 1~366일<input id="name-interval" type="number" min="1" max="366" required></label><fieldset><legend>표시할 평일</legend><label class="check-label"><input type="checkbox" name="name-weekday" value="1">월요일</label><label class="check-label"><input type="checkbox" name="name-weekday" value="2">화요일</label><label class="check-label"><input type="checkbox" name="name-weekday" value="3">수요일</label><label class="check-label"><input type="checkbox" name="name-weekday" value="4">목요일</label><label class="check-label"><input type="checkbox" name="name-weekday" value="5">금요일</label></fieldset><p class="small">간격은 달력 날짜로 셉니다. 주말이나 공휴일을 건너뛰어도 다음 표시 날짜는 당기지 않습니다.</p></div>
|
||||
<p id="name-error" class="form-error" role="alert"></p><div class="dialog-actions"><button id="name-delete" type="button" class="danger" hidden>삭제</button><button type="button" class="secondary close">취소</button><button type="submit">저장</button></div></form></dialog>
|
||||
<dialog id="options-dialog"><form id="options-form"><div class="dialog-heading"><h2>달력 표시</h2><button type="button" class="icon-button close" aria-label="닫기">×</button></div><h3>달력 표시</h3><p class="small">내 계정의 개인 설정으로 서버에 보관합니다. 같은 계정으로 로그인한 앱과 홈 위젯에도 적용합니다. 근무 순서와 기준일은 바뀌지 않습니다.</p><label>주 시작 요일<select id="rotation-week-start"><option value="1">월요일 시작</option><option value="0">일요일 시작</option></select></label><label class="check-label"><input id="rotation-duty-weekday" type="checkbox">당직일은 평일색으로 표시</label><p class="small">주말·공휴일이어도 당직 날짜는 평일색으로 표시합니다. 공휴일 이름과 근무 순서는 유지됩니다.</p><label class="check-label"><input id="rotation-off-red" type="checkbox">비번을 빨간색으로 표시</label><p class="small">비번 날짜와 비번 글씨를 빨간색으로 표시합니다.</p><label class="check-label"><input id="rotation-show-lunar" type="checkbox">음력 날짜 함께 보기</label><p class="small">양력 아래에 작은 글씨로 표시합니다. 윤달은 윤으로 구분합니다.</p><div class="dialog-actions"><button type="button" class="secondary close">취소</button><button type="submit">저장</button></div></form></dialog>
|
||||
<dialog id="options-dialog"><form id="options-form"><div class="dialog-heading"><h2>달력 표시</h2><button type="button" class="icon-button close" aria-label="닫기">×</button></div><h3>달력 표시</h3><p class="small">내 계정의 개인 설정으로 서버에 보관합니다. 같은 계정으로 로그인한 앱과 홈 위젯에도 적용합니다. 근무 순서와 기준일은 바뀌지 않습니다.</p><label>주 시작 요일<select id="rotation-week-start"><option value="1">월요일 시작</option><option value="0">일요일 시작</option></select></label><label class="check-label"><input id="rotation-duty-weekday" type="checkbox">당직일은 평일색으로 표시</label><p class="small">주말·공휴일이어도 당직 날짜는 평일색으로 표시합니다. 공휴일 이름과 근무 순서는 유지됩니다.</p><label class="check-label"><input id="rotation-off-red" type="checkbox">비번을 빨간색으로 표시</label><p class="small">비번 날짜와 비번 글씨를 빨간색으로 표시합니다.</p><label class="check-label"><input id="rotation-show-lunar" type="checkbox">음력 날짜 함께 보기</label><p class="small">양력 아래에 작은 글씨로 표시합니다. 윤달은 윤으로 구분합니다.</p><h3>일반근무 이름</h3><label>달력에 보일 이름<input id="regular-name" maxlength="16" placeholder="일반근무" autocomplete="off"></label><p class="small">주간·일근처럼 직장에서 부르는 이름으로 바꿀 수 있습니다. 8자까지 쓰고 비우면 일반근무로 돌아갑니다. 달력 칸에는 세 글자까지 그대로 보이고 더 길면 앞 두 글자만 보입니다. 근무 순서는 바뀌지 않습니다.</p><p id="options-error" class="form-error" role="alert"></p><div class="dialog-actions"><button type="button" class="secondary close">취소</button><button type="submit">저장</button></div></form></dialog>
|
||||
<dialog id="rotation-dialog"><form id="rotation-form"><div class="dialog-heading"><h2>당직 기초 설정</h2><button type="button" class="icon-button close" aria-label="닫기">×</button></div><p class="small">기준 날짜를 첫째 날로 삼아 같은 순서로 반복합니다. 날짜 색상과 음력은 옵션에서 바꿀 수 있습니다.</p><label>토요일 근무제<select id="rotation-work-week"><option value="6">주6일제 · 토요일 기존 근무</option><option value="5">주5일제 · 토요일 당직만 근무</option></select></label><p class="small">주5일제는 토요일을 빨간색으로 표시하며 당직이 아니면 휴무입니다. 주6일제는 파란색으로 표시하고 원래 근무를 따릅니다.</p><label>근무 유형<select id="rotation-mode"><option value="custom">직접 설정</option><option value="duty">일당직 · 숫자로 입력</option></select></label><label id="rotation-remainder-label" hidden>당직·비번 다음 남은 날<select id="rotation-remainder"><option value="REGULAR">일반근무</option><option value="OFF">비번</option><option value="REST">휴무</option></select></label><p class="small">일당직은 숫자만 입력하면 당직·비번 다음의 근무를 채웁니다. 교대 유형은 예시이며 아래 순서를 직접 고칠 수 있습니다.</p><label>반복 일수<input id="rotation-count" type="number" min="1" max="366" required></label><div id="rotation-days" class="rotation-days"></div><label>첫째 날의 날짜<input id="rotation-anchor" type="date" min="2000-01-01" max="2099-12-31" required></label><p id="rotation-error" class="form-error" role="alert"></p><div class="dialog-actions"><button type="button" class="secondary close">취소</button><button type="submit">저장</button></div></form></dialog>
|
||||
<dialog id="auth-dialog"><form id="auth-form"><div class="dialog-heading"><h2 id="auth-heading">회원 로그인</h2><button type="button" class="icon-button close" aria-label="닫기">×</button></div><p id="auth-help" class="small"></p><label>아이디<input id="auth-username" autocomplete="username" minlength="3" maxlength="32" pattern="[a-zA-Z0-9_]{3,32}" required></label><label id="auth-name-label" hidden>이름<input id="auth-name" maxlength="40" autocomplete="name"></label><label id="auth-code-label" hidden>복구 코드<input id="auth-code" maxlength="32" autocomplete="off"></label><label>비밀번호<input id="auth-password" type="password" maxlength="128" autocomplete="current-password" required></label><label id="auth-repeat-label" hidden>비밀번호 확인<input id="auth-repeat" type="password" maxlength="128" autocomplete="new-password"></label><p id="auth-error" class="form-error" role="alert"></p><div class="dialog-actions"><button id="auth-recovery" type="button" class="text-button">비밀번호 복구</button><button id="auth-submit" type="submit">로그인</button></div></form></dialog>
|
||||
<dialog id="account-dialog"><div class="dialog-heading"><h2>내 정보</h2><button class="icon-button close" aria-label="닫기">×</button></div><p id="account-description"></p><p class="small">앱의 웹 연동을 켠 뒤 같은 아이디로 로그인하면 일정과 함께 보는 근무표가 동기화됩니다.</p><div class="dialog-actions"><button id="account-logout" class="secondary">로그아웃</button><button id="password-open">비밀번호 변경</button></div></dialog>
|
||||
|
||||
@@ -10,7 +10,7 @@ main{max-width:1320px;margin:auto;padding:40px}.welcome{padding:12px 0 0}.welcom
|
||||
.page-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:25px}.summary-row{display:grid;grid-template-columns:1.3fr 1fr;border-top:2px solid var(--ink);border-bottom:1px solid #cbd0d2;margin-bottom:22px;background:var(--paper)}.today-card{padding:21px 25px;border-left:4px solid var(--accent)}.today-card h2{font-size:25px;margin:5px 0 7px}.today-card p{color:var(--muted);font-size:12px}.month-summary{padding:21px 25px;border-left:1px solid var(--line);display:grid;grid-template-columns:1fr auto;align-items:center;gap:3px}.month-summary strong{font-size:31px;font-weight:550;grid-row:span 2;font-variant-numeric:tabular-nums}.month-summary span:nth-child(3){font-size:12px;color:var(--muted)}.month-summary button{justify-self:start;padding:3px 0;min-height:32px}.company-start{display:flex;justify-content:space-between;align-items:center;gap:22px;padding:3px 0 21px;border-bottom:1px solid #d6dadb;margin-bottom:25px}.company-start h2{font-size:14px;margin-bottom:6px}.company-start p{font-size:12px;line-height:1.7;color:var(--muted)}.company-start button{font-size:12px;flex-shrink:0;background:transparent;color:var(--ink);border-color:#bfc6cd}.calendar-layout{display:grid;grid-template-columns:minmax(0,1fr) 270px;gap:30px;align-items:start}.calendar-card{background:var(--paper);border:1px solid #d6d7d4;border-top:4px solid var(--ink);border-radius:3px;padding:23px}.agenda-card{padding:5px 0;background:transparent}.month-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:19px}.month-heading h2{font-size:26px;letter-spacing:-1px}.month-controls{display:flex;gap:3px;align-items:center}.week,.grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.week{font-size:11px;color:var(--muted);text-align:center;border-top:1px solid #818b95;padding:12px 0}.week span.sun{color:var(--red)}.week span.sat{color:var(--blue)}.day{background:transparent;border:0;border-top:1px solid #e5e5df;border-radius:0;min-height:98px;padding:9px 2px 6px;color:var(--ink);display:flex;align-items:center;flex-direction:column;gap:5px;overflow:hidden;min-width:0;font-weight:450}.day:hover{background:#efeee7}.day.selected{background:#f4efe5;box-shadow:inset 0 0 0 1px #c1a484}.day.outside{opacity:.35}.day-number{font-size:15px;min-width:25px;line-height:25px;border-radius:3px;text-align:center;font-variant-numeric:tabular-nums}.day.current .day-number{background:var(--ink);color:white!important}.day.sun .day-number,.day.holiday .day-number{color:var(--red)}.day.sat:not(.holiday) .day-number{color:var(--blue)}.five-day .week span.sat,.five-day .day.sat:not(.holiday) .day-number{color:var(--red)}.shift{border-radius:2px;padding:2px 5px;font-size:10px;line-height:16px}.duty{color:#aa4c2e;background:#faeadd}.off{color:#666f7c;background:#edf0f2}.regular{color:#365fad;background:#eaf0fc}.shift.daytime{color:#9b561d;background:#fff1df}.shift.evening{color:#ad3d6e;background:#fbeaf0}.shift.night{color:#79459d;background:#f1eaf8}.shift.rest{color:#64748b;background:#f0f3f5}.holiday-name{font-size:9px;color:var(--red);white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis}.event-count{font-size:10px;font-weight:650;color:#885c2e;white-space:nowrap}.legend{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:17px;font-size:10px;color:var(--muted)}.legend span{padding:3px 5px;border-radius:2px}.legend span:last-child{padding:3px 0;width:100%}.agenda-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.agenda-heading h2{margin-top:7px;font-size:22px}.agenda-card>p{font-size:12px;line-height:1.8;color:var(--muted);margin:13px 0 20px}.event-item{width:100%;text-align:left;background:#fffefa;color:var(--ink);border:1px solid #d5d7d6;border-left:3px solid #7c899a;margin:0 0 10px;padding:13px;border-radius:2px;font-weight:500;overflow-wrap:anywhere}.event-item:hover{background:#eaeef2}.event-item.work{border-left-color:#365fad}.event-item.leave{border-left-color:var(--accent)}.event-item strong{display:block;font-size:14px;line-height:1.5}.event-item span{display:block;font-size:11px;color:var(--muted);margin-top:6px}.empty{padding:23px 0;color:var(--muted);font-size:12px;line-height:1.9;border-top:1px solid var(--line)}.source-note{font-size:10px;color:var(--muted);margin-top:18px;line-height:1.8}.source-note span{display:block}.people-panel{border-top:1px solid #bfc5ca;margin-top:22px;padding-top:20px}.people-panel h3{font-size:15px}.people-panel>p{margin:8px 0 15px}.person-row{display:block;text-align:left;width:100%;background:var(--paper);margin:8px 0;border:1px solid var(--line);border-left:3px solid currentColor;border-radius:2px;overflow-wrap:anywhere}.person-row:hover{background:#eaeef2}.person-row small{display:block;color:var(--muted);font-weight:400;font-size:11px;margin-top:5px}.person-badge{font-size:10px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}.person-blue{color:#365fad}.persLine truncated
|
||||
footer{max-width:1240px;margin:15px auto 0;padding:24px 0 34px;border-top:1px solid #bec4c7;display:flex;align-items:center;gap:20px;color:var(--muted);font-size:11px}footer span:first-child{font-weight:700;margin-right:auto;color:var(--ink)}
|
||||
/* 입력 창은 제목과 입력칸의 경계를 분명히 둔다. 키보드와 화면 읽기 기능의 기본 동작을 유지한다. */
|
||||
dialog{border:1px solid #c2c8cd;border-top:4px solid var(--ink);border-radius:5px;padding:27px;width:min(540px,calc(100% - 28px));max-height:90dvh;color:var(--ink);background:var(--paper);box-shadow:0 18px 60px #16203024}dialog::backdrop{background:#18243780}.dialog-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.dialog-heading .close{font-size:26px}.dialog-actions{display:flex;gap:9px;justify-content:flex-end;margin-top:23px}.dialog-actions .danger{margin-right:auto}.danger{background:#f8e9e6;color:#9e3934;border-color:#e4c3be}.danger:hover{background:#eed2cd}label{display:flex;flex-direction:column;gap:8px;font-size:13px;font-weight:650;margin-top:18px}input,select,textarea{width:100%;min-width:0;border:1px solid #b8c0c9;border-radius:4px;background:#fff;padding:11px 12px;color:var(--ink);font-size:15px;line-height:1.5}textarea{resize:vertical}.field-row{display:flex;gap:12px}.field-row>label{flex:1;min-width:0}.check-label{flex-direction:row;align-items:center}.check-label input{width:19px;height:19px;accent-color:var(--ink)}.form-error{color:#9e3934;font-size:13px;line-height:1.7;margin-top:12px}.rotation-days{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}.rotation-days label{margin-top:12px}.pair-code{font-size:28px;letter-spacing:4px}.pair-code+p,dialog p{line-height:1.8}.toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);z-index:10;max-width:calc(100% - 30px);padding:13px 22px;background:var(--ink);color:white;border-radius:4px;font-size:13px;box-shadow:0 5px 15px #0002}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-family:inherit;font-size:13px;line-height:1.8;padding:15px;background:#f0efe9;border:1px solid var(--line)}#conflict-notice{padding:18px 0;margin-top:20px;border-top:2px solid var(--accent)}#conflict-notice p{margin:10px 0;font-size:12px}#conflict-dialog h3{margin-top:18px}.wide-dialog{width:min(850px,calc(100% - 28px))}.member-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 0;border-bottom:1px solid var(--line)}.member-row strong{overflow-wrap:anywhere}.member-row>div{min-width:0}.member-row button{flex-shrink:0}#member-total{margin:16px 0 4px}#member-delete{margin-top:20px;width:100%}#confirm-message{margin-top:15px}#account-description{margin-bottom:14px}#member-reset-code,#company-invite-code{font-family:monospace}#account-notice:empty{display:none}.company-member{display:flex;justify-content:space-between;gap:14px;padding:15px 0;border-bottom:1px solid var(--line)}.company-member>div{min-width:0}.company-member p{overflow-wrap:anywhere}.company-actions{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap}.company-actions button{font-size:12px;padding:9px}#company-dialog h3{margin-top:24px}#company-dialog form>button,#company-invite,#company-delete,#company-leave{margin-top:14px}#company-dialog hr{margin:24px 0;border:0;border-top:1px solid var(--line)}#company-code-box{padding:10px 16px;background:#e9edf3;border-radius:4px;margin-top:16px}
|
||||
dialog{border:1px solid #c2c8cd;border-top:4px solid var(--ink);border-radius:5px;padding:27px;width:min(540px,calc(100% - 28px));max-height:90dvh;color:var(--ink);background:var(--paper);box-shadow:0 18px 60px #16203024}dialog::backdrop{background:#18243780}.dialog-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.dialog-heading .close{font-size:26px}.dialog-actions{display:flex;gap:9px;justify-content:flex-end;margin-top:23px}.dialog-actions .danger{margin-right:auto}.danger{background:#f8e9e6;color:#9e3934;border-color:#e4c3be}.danger:hover{background:#eed2cd}label{display:flex;flex-direction:column;gap:8px;font-size:13px;font-weight:650;margin-top:18px}input,select,textarea{width:100%;min-width:0;border:1px solid #b8c0c9;border-radius:4px;background:#fff;padding:11px 12px;color:var(--ink);font-size:15px;line-height:1.5}textarea{resize:vertical}.field-row{display:flex;gap:12px}.field-row>label{flex:1;min-width:0}.check-label{flex-direction:row;align-items:center}.check-label input{width:19px;height:19px;accent-color:var(--ink)}.form-error{color:#9e3934;font-size:13px;line-height:1.7;margin-top:12px}.rotation-days{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}.rotation-days label{margin-top:12px}.pair-code{font-size:28px;letter-spacing:4px}.pair-code+p,dialog p{line-height:1.8}.toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);z-index:10;max-width:calc(100% - 30px);padding:13px 22px;background:var(--ink);color:white;border-radius:4px;font-size:13px;box-shadow:0 5px 15px #0002}pre{white-space:pre-wrap;overflow-wrap:anywhere;font-family:inherit;font-size:13px;line-height:1.8;padding:15px;background:#f0efe9;border:1px solid var(--line)}#conflict-notice{padding:18px 0;margin-top:20px;border-top:2px solid var(--accent)}#conflict-notice p{margin:10px 0;font-size:12px}#conflict-dialog h3{margin-top:18px}#options-dialog p+h3{margin-top:22px}.wide-dialog{width:min(850px,calc(100% - 28px))}.member-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px 0;border-bottom:1px solid var(--line)}.member-row strong{overflow-wrap:anywhere}.member-row>div{min-width:0}.member-row button{flex-shrink:0}#member-total{margin:16px 0 4px}#member-delete{margin-top:20px;width:100%}#confirm-message{margin-top:15px}#account-description{margin-bottom:14px}#member-reset-code,#company-invite-code{font-family:monospace}#account-notice:empty{display:none}.company-member{display:flex;justify-content:space-between;gap:14px;padding:15px 0;border-bottom:1px solid var(--line)}.company-member>div{min-width:0}.company-member p{overflow-wrap:anywhere}.company-actions{display:flex;gap:8px;align-items:flex-start;flex-wrap:wrap}.company-actions button{font-size:12px;padding:9px}#company-dialog h3{margin-top:24px}#company-dialog form>button,#company-invite,#company-delete,#company-leave{margin-top:14px}#company-dialog hr{margin:24px 0;border:0;border-top:1px solid var(--line)}#company-code-box{padding:10px 16px;background:#e9edf3;border-radius:4px;margin-top:16px}
|
||||
@media(max-width:1100px){.welcome-hero{gap:42px;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr)}.welcome-copy h1{font-size:43px}.welcome-actions{gap:15px;flex-wrap:wrap}.calendar-paper{padding:20px 18px 15px}.calendar-layout{gap:22px;grid-template-columns:minmax(0,1fr) 245px}.top-actions{gap:10px}.topbar{padding-left:30px;padding-right:30px}main{padding:35px 30px}footer{margin-left:30px;margin-right:30px}.feature-ledger,.install-guide{gap:35px}}
|
||||
@media(max-width:760px){.topbar{padding:18px 20px;gap:15px;min-height:86px;align-items:flex-start}.brand{font-size:19px;gap:10px}.brand-mark{width:30px;height:34px}.brand small{font-size:10px}.top-actions{gap:7px;max-width:240px}.top-actions button{font-size:11px;padding:7px 10px}.top-actions .download-small{display:none}#status{display:none}#public-auth{gap:1px}main{padding:30px 20px}.welcome{padding:5px 0 0}.welcome-hero{grid-template-columns:1fr;gap:38px;padding-bottom:38px}.welcome-copy h1{font-size:43px;letter-spacing:-2px;margin:17px 0}.intro{font-size:14px;line-height:1.8}.welcome-actions{gap:20px;margin:23px 0 10px}.download-button{font-size:13px;padding:14px 18px;min-height:50px}.welcome-caption{margin-top:24px}.welcome-caption p br{display:none}.calendar-preview{padding-right:8px;max-width:530px;width:100%;margin:0 auto}.calendar-paper{padding:19px 16px 14px}.paper-heading{margin-bottom:16px}.paper-heading strong{font-size:47px}.sample-day{min-height:55px}.preview-detail{margin-left:20px}.feature-ledger,.install-guide{grid-template-columns:1fr;gap:25px;padding-top:25px}.feature-ledger{padding-bottom:35px}.ledger-heading p{margin-top:7px}.feature-rows article{gap:17px;padding:21px 0}.feature-rows h2{font-size:15px}.feature-rows p{font-size:12px}.feature-label{display:none}.install-guide h2{font-size:27px}.install-guide h2 br,.install-guide>div>p br{display:none}.install-guide .install-link{margin-top:5px}.install-guide li{padding-bottom:23px}.page-heading{margin-bottom:20px}.page-heading h1{font-size:28px}.page-heading button{font-size:12px}.summary-row{grid-template-columns:1fr}.today-card{padding:18px 20px}.today-card h2{font-size:23px}.month-summary{border-left:0;border-top:1px solid var(--line);padding:12px 20px;grid-template-columns:1fr auto 1fr;gap:8px}.month-summary strong{font-size:24px;grid-row:auto}.month-summary span:nth-child(3){display:none}.month-summary button{justify-self:end;font-size:12px}.company-start{align-items:flex-start;gap:12px}.company-start h2{font-size:13px}.company-start p{font-size:11px}.company-start button{font-size:11px;padding:8px 10px;max-width:120px}.calendar-layout{grid-template-columns:1fr;gap:28px}.calendar-card{padding:18px 9px}.month-heading{padding:0 6px;margin-bottom:16px}.month-heading h2{font-size:23px}.month-controls .secondary{font-size:11px;padding:8px 10px;min-height:38px}.day{min-height:85px;padding:8px 1px 4px;gap:4px}.shift{font-size:9px;padding:1px 4px}.day-number{font-size:14px}.holiday-name{font-size:8px}.event-count{font-size:9px}.legend{gap:5px;padding:0 4px}.with-people .day{min-height:124px}.person-badge{font-size:9px}.agenda-card{padding:0}.agenda-heading h2{font-size:23px}.people-panel{margin-top:20px}.source-note{font-size:10px}footer{margin:15px 20px 0;padding:21px 0 25px;gap:8px;flex-wrap:wrap;font-size:10px}footer button{width:100%;text-align:right}dialog{padding:20px}.dialog-actions button{padding:10px 13px;font-size:13px}.member-row{align-items:flex-start}.member-row strong{font-size:14px}.company-member{flex-direction:column}.field-row{gap:9px}}
|
||||
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
const WEB_BUILD = '2026-11-24.2';
|
||||
const WEB_BUILD = '2026-11-25.1';
|
||||
let offeredRelease=null, versionChecking=false;
|
||||
const versionDeferKey='duty-web-update-later';
|
||||
const versionSeenKey='duty-web-update-seen';
|
||||
|
||||
@@ -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