|
|
|
|
@@ -36,6 +36,7 @@ const CARRYOVER_CHECK_POLICIES = ['ask', 'all', 'current']
|
|
|
|
|
const screenMode = ref('planner')
|
|
|
|
|
const viewMode = ref('focus')
|
|
|
|
|
const printLayout = ref('single')
|
|
|
|
|
const printDialogOpen = ref(false)
|
|
|
|
|
const demoMode = ref(false)
|
|
|
|
|
const demoDayOffset = ref(0)
|
|
|
|
|
const authDialogOpen = ref(false)
|
|
|
|
|
@@ -59,6 +60,9 @@ const leftPanelOpen = ref(false)
|
|
|
|
|
const rightPanelOpen = ref(false)
|
|
|
|
|
const statsRangeStart = ref(toKey(new Date(new Date().setDate(new Date().getDate() - 6))))
|
|
|
|
|
const statsRangeEnd = ref(toKey(new Date()))
|
|
|
|
|
const printRangeStart = ref(toKey(new Date()))
|
|
|
|
|
const printRangeEnd = ref(toKey(new Date()))
|
|
|
|
|
const printRangeLayout = ref('single')
|
|
|
|
|
const authForm = reactive({
|
|
|
|
|
nickname: '',
|
|
|
|
|
email: '',
|
|
|
|
|
@@ -550,6 +554,56 @@ const calendarDays = computed(() => {
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const normalizedPrintRange = computed(() => {
|
|
|
|
|
const startKey = printRangeStart.value || toKey(selectedDate.value)
|
|
|
|
|
const endKey = printRangeEnd.value || startKey
|
|
|
|
|
|
|
|
|
|
if (startKey <= endKey) {
|
|
|
|
|
return { startKey, endKey }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { startKey: endKey, endKey: startKey }
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const printDateKeys = computed(() => {
|
|
|
|
|
const dateKeys = []
|
|
|
|
|
const currentDate = startOfDay(toDateValue(normalizedPrintRange.value.startKey))
|
|
|
|
|
const endDate = startOfDay(toDateValue(normalizedPrintRange.value.endKey))
|
|
|
|
|
|
|
|
|
|
while (currentDate <= endDate) {
|
|
|
|
|
dateKeys.push(toKey(currentDate))
|
|
|
|
|
currentDate.setDate(currentDate.getDate() + 1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dateKeys
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const printPages = computed(() =>
|
|
|
|
|
printDateKeys.value.map((dateKey) => createPrintPage(dateKey)),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const printPapers = computed(() => {
|
|
|
|
|
if (printLayout.value === 'single') {
|
|
|
|
|
return printPages.value.map((page) => [page])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const papers = []
|
|
|
|
|
|
|
|
|
|
for (let index = 0; index < printPages.value.length; index += 2) {
|
|
|
|
|
papers.push(printPages.value.slice(index, index + 2))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return papers
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const printPageCountLabel = computed(() => {
|
|
|
|
|
const dayCount = printDateKeys.value.length
|
|
|
|
|
const paperCount = printRangeLayout.value === 'double' ? Math.ceil(dayCount / 2) : dayCount
|
|
|
|
|
const layoutLabel = printRangeLayout.value === 'double' ? '2페이지씩' : '1페이지씩'
|
|
|
|
|
|
|
|
|
|
return `${dayCount}일치 / ${paperCount}장 (${layoutLabel})`
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const markedDateKeys = computed(() =>
|
|
|
|
|
Object.entries(plannerRecords)
|
|
|
|
|
.filter(([, record]) => hasPlannerContent(record))
|
|
|
|
|
@@ -801,6 +855,12 @@ function closeCarryoverCheckPrompt() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleGlobalKeydown(event) {
|
|
|
|
|
if (event.key === 'Escape' && printDialogOpen.value) {
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
closePrintDialog()
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event.key === 'Escape' && carryoverCheckPrompt.value) {
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
closeCarryoverCheckPrompt()
|
|
|
|
|
@@ -971,6 +1031,56 @@ function createDateLabel(dateKey) {
|
|
|
|
|
return `${display.main} ${display.weekday}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function findPlannerGoalForDate(dateKey) {
|
|
|
|
|
const activeGoals = goals.value
|
|
|
|
|
.filter((goal) => {
|
|
|
|
|
if (!goal.activeFrom || !goal.activeUntil) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dateKey >= goal.activeFrom && dateKey <= goal.activeUntil
|
|
|
|
|
})
|
|
|
|
|
.sort((left, right) => {
|
|
|
|
|
const currentDate = startOfDay(toDateValue(dateKey))
|
|
|
|
|
const leftDistance = Math.abs(startOfDay(toDateValue(left.targetDate)).getTime() - currentDate.getTime())
|
|
|
|
|
const rightDistance = Math.abs(startOfDay(toDateValue(right.targetDate)).getTime() - currentDate.getTime())
|
|
|
|
|
return leftDistance - rightDistance
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return activeGoals[0] ?? null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createPlannerDdayForDate(dateKey) {
|
|
|
|
|
if (isDdayDisabledForDate(dateKey)) {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const goal = findPlannerGoalForDate(dateKey)
|
|
|
|
|
|
|
|
|
|
if (!goal) {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const targetDate = startOfDay(toDateValue(goal.targetDate))
|
|
|
|
|
const currentDate = startOfDay(toDateValue(dateKey))
|
|
|
|
|
const diffDays = Math.round((targetDate.getTime() - currentDate.getTime()) / (24 * 60 * 60 * 1000))
|
|
|
|
|
const badge =
|
|
|
|
|
diffDays === 0 ? 'D-DAY' : diffDays > 0 ? `D-${diffDays}` : `D+${Math.abs(diffDays)}`
|
|
|
|
|
|
|
|
|
|
return `${badge} ${goal.title}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function createPrintPage(dateKey) {
|
|
|
|
|
const date = toDateValue(dateKey)
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
key: dateKey,
|
|
|
|
|
display: getDateDisplay(date),
|
|
|
|
|
record: getPlannerRecord(date),
|
|
|
|
|
dday: createPlannerDdayForDate(dateKey),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const weeklyRecords = computed(() => {
|
|
|
|
|
const entries = rangeEntries.value.map(([key, record]) => {
|
|
|
|
|
const date = toDateValue(key)
|
|
|
|
|
@@ -1211,6 +1321,19 @@ function closeRightPanel() {
|
|
|
|
|
rightPanelOpen.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openPrintDialog() {
|
|
|
|
|
const selectedKey = toKey(selectedDate.value)
|
|
|
|
|
printRangeStart.value = selectedKey
|
|
|
|
|
printRangeEnd.value = selectedKey
|
|
|
|
|
printRangeLayout.value = viewMode.value === 'spread' ? 'double' : 'single'
|
|
|
|
|
printDialogOpen.value = true
|
|
|
|
|
closeLeftPanel()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closePrintDialog() {
|
|
|
|
|
printDialogOpen.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function applyStatsQuickRange(days) {
|
|
|
|
|
const endDate = new Date()
|
|
|
|
|
const startDate = new Date(endDate)
|
|
|
|
|
@@ -1845,6 +1968,13 @@ async function printSelectedPlanner(layout = 'single') {
|
|
|
|
|
window.print()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function printPlannerRange() {
|
|
|
|
|
printLayout.value = printRangeLayout.value
|
|
|
|
|
applyPrintPageStyle(printRangeLayout.value)
|
|
|
|
|
await nextTick()
|
|
|
|
|
window.print()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
resetGoalForm()
|
|
|
|
|
setSyncFeedback('local', '로그인 후 클라우드 저장을 사용할 수 있습니다.', {
|
|
|
|
|
@@ -2058,16 +2188,9 @@ onBeforeUnmount(() => {
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
|
|
|
|
@click="printSelectedPlanner('single')"
|
|
|
|
|
@click="openPrintDialog"
|
|
|
|
|
>
|
|
|
|
|
1장 인쇄
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
|
|
|
|
@click="printSelectedPlanner('double')"
|
|
|
|
|
>
|
|
|
|
|
2장 인쇄
|
|
|
|
|
PRINT
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
@@ -2226,16 +2349,9 @@ onBeforeUnmount(() => {
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
|
|
|
|
@click="printSelectedPlanner('single')"
|
|
|
|
|
@click="openPrintDialog"
|
|
|
|
|
>
|
|
|
|
|
1장 인쇄
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-2xl border border-stone-200 px-4 py-3 text-xs font-bold tracking-[0.14em] text-stone-600 transition hover:border-stone-400 hover:text-ink"
|
|
|
|
|
@click="printSelectedPlanner('double')"
|
|
|
|
|
>
|
|
|
|
|
2장 인쇄
|
|
|
|
|
PRINT
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
@@ -2832,79 +2948,35 @@ onBeforeUnmount(() => {
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<section v-if="isAuthenticated" class="print-only">
|
|
|
|
|
<div v-if="printLayout === 'single'" class="print-paper print-paper--single">
|
|
|
|
|
<div class="print-sheet-frame">
|
|
|
|
|
<div
|
|
|
|
|
v-for="(paper, paperIndex) in printPapers"
|
|
|
|
|
:key="`${printLayout}-${paperIndex}`"
|
|
|
|
|
class="print-paper"
|
|
|
|
|
:class="printLayout === 'single' ? 'print-paper--single' : 'print-paper--double'"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-for="page in paper"
|
|
|
|
|
:key="page.key"
|
|
|
|
|
class="print-sheet-frame"
|
|
|
|
|
>
|
|
|
|
|
<PlannerPage
|
|
|
|
|
:date-main="selectedDateDisplay.main"
|
|
|
|
|
:date-weekday="selectedDateDisplay.weekday"
|
|
|
|
|
:date-weekday-tone="selectedDateDisplay.weekdayTone"
|
|
|
|
|
:dday="plannerDday"
|
|
|
|
|
:show-dday="showPlannerDday"
|
|
|
|
|
:comment="planner.comment"
|
|
|
|
|
:total-time="formatTotalTimeKorean(planner)"
|
|
|
|
|
:tasks="planner.tasks"
|
|
|
|
|
:memo="planner.memo"
|
|
|
|
|
:date-main="page.display.main"
|
|
|
|
|
:date-weekday="page.display.weekday"
|
|
|
|
|
:date-weekday-tone="page.display.weekdayTone"
|
|
|
|
|
:dday="page.dday"
|
|
|
|
|
:show-dday="Boolean(page.dday)"
|
|
|
|
|
:comment="page.record.comment"
|
|
|
|
|
:total-time="formatTotalTimeKorean(page.record)"
|
|
|
|
|
:tasks="page.record.tasks"
|
|
|
|
|
:memo="page.record.memo"
|
|
|
|
|
:hours="hours"
|
|
|
|
|
:timetable="planner.timetable"
|
|
|
|
|
@update:comment="updateComment(planner, $event)"
|
|
|
|
|
@update:task-label="updateTaskLabel(planner, $event)"
|
|
|
|
|
@update:task-title="updateTaskTitle(planner, $event)"
|
|
|
|
|
@toggle:task="toggleTask(planner, $event)"
|
|
|
|
|
@clear:tasks="clearTasks(planner, $event)"
|
|
|
|
|
@update:memo-label="updateMemoLabel(planner, $event)"
|
|
|
|
|
@update:memo="updateMemo(planner, $event)"
|
|
|
|
|
@update:timetable="updateTimetable(planner, $event)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div v-else class="print-paper print-paper--double">
|
|
|
|
|
<div class="print-sheet-frame">
|
|
|
|
|
<PlannerPage
|
|
|
|
|
:date-main="selectedDateDisplay.main"
|
|
|
|
|
:date-weekday="selectedDateDisplay.weekday"
|
|
|
|
|
:date-weekday-tone="selectedDateDisplay.weekdayTone"
|
|
|
|
|
:dday="plannerDday"
|
|
|
|
|
:show-dday="showPlannerDday"
|
|
|
|
|
:comment="planner.comment"
|
|
|
|
|
:total-time="formatTotalTimeKorean(planner)"
|
|
|
|
|
:tasks="planner.tasks"
|
|
|
|
|
:memo="planner.memo"
|
|
|
|
|
:hours="hours"
|
|
|
|
|
:timetable="planner.timetable"
|
|
|
|
|
@update:comment="updateComment(planner, $event)"
|
|
|
|
|
@update:task-label="updateTaskLabel(planner, $event)"
|
|
|
|
|
@update:task-title="updateTaskTitle(planner, $event)"
|
|
|
|
|
@toggle:task="toggleTask(planner, $event)"
|
|
|
|
|
@clear:tasks="clearTasks(planner, $event)"
|
|
|
|
|
@update:memo-label="updateMemoLabel(planner, $event)"
|
|
|
|
|
@update:memo="updateMemo(planner, $event)"
|
|
|
|
|
@update:timetable="updateTimetable(planner, $event)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="print-sheet-frame">
|
|
|
|
|
<PlannerPage
|
|
|
|
|
:date-main="secondaryDateDisplay.main"
|
|
|
|
|
:date-weekday="secondaryDateDisplay.weekday"
|
|
|
|
|
:date-weekday-tone="secondaryDateDisplay.weekdayTone"
|
|
|
|
|
:dday="''"
|
|
|
|
|
:show-dday="false"
|
|
|
|
|
:comment="secondaryPlanner.comment"
|
|
|
|
|
:total-time="formatTotalTimeKorean(secondaryPlanner)"
|
|
|
|
|
:tasks="secondaryPlanner.tasks"
|
|
|
|
|
:memo="secondaryPlanner.memo"
|
|
|
|
|
:hours="hours"
|
|
|
|
|
:timetable="secondaryPlanner.timetable"
|
|
|
|
|
@update:comment="updateComment(secondaryPlanner, $event)"
|
|
|
|
|
@update:task-label="updateTaskLabel(secondaryPlanner, $event)"
|
|
|
|
|
@update:task-title="updateTaskTitle(secondaryPlanner, $event)"
|
|
|
|
|
@toggle:task="toggleTask(secondaryPlanner, $event)"
|
|
|
|
|
@clear:tasks="clearTasks(secondaryPlanner, $event)"
|
|
|
|
|
@update:memo-label="updateMemoLabel(secondaryPlanner, $event)"
|
|
|
|
|
@update:memo="updateMemo(secondaryPlanner, $event)"
|
|
|
|
|
@update:timetable="updateTimetable(secondaryPlanner, $event)"
|
|
|
|
|
:timetable="page.record.timetable"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-if="printLayout === 'double' && paper.length === 1"
|
|
|
|
|
class="print-sheet-frame print-sheet-frame--blank"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
@@ -2922,6 +2994,93 @@ onBeforeUnmount(() => {
|
|
|
|
|
@update:field="updateAuthField"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
v-if="printDialogOpen"
|
|
|
|
|
class="print-hidden fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"
|
|
|
|
|
@click.self="closePrintDialog"
|
|
|
|
|
>
|
|
|
|
|
<section class="w-full max-w-lg rounded-[30px] border border-white/70 bg-[#f7f2ea] p-5 shadow-[0_24px_80px_rgba(28,25,23,0.2)] sm:p-6">
|
|
|
|
|
<div class="flex items-start justify-between gap-4">
|
|
|
|
|
<div>
|
|
|
|
|
<p class="text-[10px] font-bold uppercase tracking-[0.24em] text-stone-500">Print Planner</p>
|
|
|
|
|
<h2 class="mt-3 text-2xl font-semibold tracking-[-0.05em] text-stone-900">
|
|
|
|
|
출력할 날짜 범위 선택
|
|
|
|
|
</h2>
|
|
|
|
|
<p class="mt-3 text-sm font-semibold leading-6 text-stone-600">
|
|
|
|
|
선택한 기간을 1페이지씩 또는 2페이지씩 묶어서 바로 출력합니다.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-full border border-stone-200 bg-white px-3 py-2 text-[10px] font-bold tracking-[0.14em] text-stone-500 transition hover:border-stone-400 hover:text-stone-900"
|
|
|
|
|
@click="closePrintDialog"
|
|
|
|
|
>
|
|
|
|
|
CLOSE
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mt-6 grid gap-4 sm:grid-cols-2">
|
|
|
|
|
<label class="flex flex-col gap-2 text-[11px] font-bold tracking-[0.14em] text-stone-500">
|
|
|
|
|
시작일
|
|
|
|
|
<input
|
|
|
|
|
v-model="printRangeStart"
|
|
|
|
|
type="date"
|
|
|
|
|
class="rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-400"
|
|
|
|
|
/>
|
|
|
|
|
</label>
|
|
|
|
|
<label class="flex flex-col gap-2 text-[11px] font-bold tracking-[0.14em] text-stone-500">
|
|
|
|
|
종료일
|
|
|
|
|
<input
|
|
|
|
|
v-model="printRangeEnd"
|
|
|
|
|
type="date"
|
|
|
|
|
class="rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm font-semibold text-stone-800 outline-none transition focus:border-stone-400"
|
|
|
|
|
/>
|
|
|
|
|
</label>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mt-5 grid gap-2 sm:grid-cols-2">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
|
|
|
|
|
:class="printRangeLayout === 'single' ? 'bg-stone-900 text-white' : 'border border-stone-200 bg-white text-stone-500'"
|
|
|
|
|
@click="printRangeLayout = 'single'"
|
|
|
|
|
>
|
|
|
|
|
1페이지씩
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-2xl px-4 py-3 text-xs font-bold tracking-[0.14em] transition"
|
|
|
|
|
:class="printRangeLayout === 'double' ? 'bg-stone-900 text-white' : 'border border-stone-200 bg-white text-stone-500'"
|
|
|
|
|
@click="printRangeLayout = 'double'"
|
|
|
|
|
>
|
|
|
|
|
2페이지씩
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mt-5 rounded-2xl border border-stone-200 bg-white/78 px-4 py-3">
|
|
|
|
|
<p class="text-[11px] font-bold tracking-[0.12em] text-stone-500">출력 예정</p>
|
|
|
|
|
<p class="mt-1 text-sm font-semibold text-stone-900">{{ printPageCountLabel }}</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="mt-6 grid gap-2 sm:grid-cols-[1fr_auto]">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-full border border-stone-900 bg-stone-900 px-5 py-3 text-xs font-bold tracking-[0.16em] text-white transition hover:bg-stone-700"
|
|
|
|
|
@click="printPlannerRange"
|
|
|
|
|
>
|
|
|
|
|
PRINT
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class="rounded-full border border-stone-300 bg-white px-5 py-3 text-xs font-bold tracking-[0.16em] text-stone-700 transition hover:border-stone-500 hover:text-stone-900"
|
|
|
|
|
@click="closePrintDialog"
|
|
|
|
|
>
|
|
|
|
|
취소
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
v-if="carryoverCheckPrompt"
|
|
|
|
|
class="fixed inset-0 z-50 flex items-center justify-center bg-stone-900/45 px-4 py-6 backdrop-blur-sm"
|
|
|
|
|
|