fix(tkpurchase): 협력업체 포탈 활성 일정 전체 표시로 변경
오늘 날짜 범위 필터 제거 → 마감/취소되지 않은 모든 일정 표시. 체크인 날짜 제한도 상태 기반 검증으로 변경하여 일정 기간 외에도 체크인 가능. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -216,4 +216,17 @@ async function findHistoryByCompany(companyId, { dateFrom, dateTo, page = 1, lim
|
||||
return { data: checkins, total, page, limit };
|
||||
}
|
||||
|
||||
module.exports = { findBySchedule, findById, findTodayByCompany, checkIn, checkOut, update, resetCheckout, countActive, deleteCheckin, checkOutWithReport, findHistoryByCompany };
|
||||
async function findActiveByCompany(companyId) {
|
||||
const db = getPool();
|
||||
const [rows] = await db.query(
|
||||
`SELECT pc.*, ps.work_description, ps.workplace_name,
|
||||
(SELECT COUNT(*) FROM partner_work_reports WHERE checkin_id = pc.id) AS work_report_count
|
||||
FROM partner_work_checkins pc
|
||||
LEFT JOIN partner_schedules ps ON pc.schedule_id = ps.id
|
||||
WHERE pc.company_id = ?
|
||||
AND (pc.check_out_time IS NULL OR DATE(pc.check_in_time) = CURDATE())
|
||||
ORDER BY pc.check_in_time DESC`, [companyId]);
|
||||
return rows;
|
||||
}
|
||||
|
||||
module.exports = { findBySchedule, findById, findTodayByCompany, findActiveByCompany, checkIn, checkOut, update, resetCheckout, countActive, deleteCheckin, checkOutWithReport, findHistoryByCompany };
|
||||
|
||||
@@ -117,4 +117,17 @@ async function deleteSchedule(id) {
|
||||
await db.query('DELETE FROM partner_schedules WHERE id = ?', [id]);
|
||||
}
|
||||
|
||||
module.exports = { findAll, findById, findByCompanyToday, findRequestsByCompany, findByProject, create, update, updateStatus, deleteSchedule };
|
||||
async function findActiveByCompany(companyId) {
|
||||
const db = getPool();
|
||||
const [rows] = await db.query(
|
||||
`SELECT ps.*, pc.company_name, p.project_name, p.job_no
|
||||
FROM partner_schedules ps
|
||||
LEFT JOIN partner_companies pc ON ps.company_id = pc.id
|
||||
LEFT JOIN projects p ON ps.project_id = p.project_id
|
||||
WHERE ps.company_id = ?
|
||||
AND ps.status NOT IN ('cancelled','rejected','requested','completed')
|
||||
ORDER BY ps.start_date ASC, ps.created_at DESC`, [companyId]);
|
||||
return rows;
|
||||
}
|
||||
|
||||
module.exports = { findAll, findById, findByCompanyToday, findActiveByCompany, findRequestsByCompany, findByProject, create, update, updateStatus, deleteSchedule };
|
||||
|
||||
Reference in New Issue
Block a user