Compare commits
16 Commits
v1.3.6
...
7b6365f6b3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b6365f6b3 | ||
|
|
44867c79f8 | ||
|
|
09a9e8c2f0 | ||
|
|
b26a6f40b9 | ||
|
|
40cb5a4d76 | ||
|
|
ecd97ae5a3 | ||
|
|
d14e97d7bd | ||
|
|
ef891f8e01 | ||
|
|
96ba5d034f | ||
|
|
2402b7cbc8 | ||
|
|
79b2fa5570 | ||
|
|
35fa172d36 | ||
|
|
000a77ccf4 | ||
|
|
ecd9f6a181 | ||
|
|
68e6d80903 | ||
|
|
af1b41994c |
28
package-lock.json
generated
28
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.6",
|
"version": "1.4.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.6",
|
"version": "1.4.4",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
@@ -2089,9 +2089,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "5.0.4",
|
"version": "5.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz",
|
||||||
"integrity": "sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==",
|
"integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"balanced-match": "^4.0.2"
|
"balanced-match": "^4.0.2"
|
||||||
@@ -3086,9 +3086,9 @@
|
|||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
},
|
},
|
||||||
"node_modules/fastify": {
|
"node_modules/fastify": {
|
||||||
"version": "5.8.2",
|
"version": "5.8.4",
|
||||||
"resolved": "https://registry.npmjs.org/fastify/-/fastify-5.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/fastify/-/fastify-5.8.4.tgz",
|
||||||
"integrity": "sha512-lZmt3navvZG915IE+f7/TIVamxIwmBd+OMB+O9WBzcpIwOo6F0LTh0sluoMFk5VkrKTvvrwIaoJPkir4Z+jtAg==",
|
"integrity": "sha512-sa42J1xylbBAYUWALSBoyXKPDUvM3OoNOibIefA+Oha57FryXKKCZarA1iDntOCWp3O35voZLuDg2mdODXtPzQ==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -4282,9 +4282,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/nodemailer": {
|
"node_modules/nodemailer": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-8.0.4.tgz",
|
||||||
"integrity": "sha512-zbj002pZAIkWQFxyAaqoxvn+zoIwRnS40hgjqTXudKOOJkiFFgBeNqjgD3/YCR12sZnrghWYBY+yP1ZucdDRpw==",
|
"integrity": "sha512-k+jf6N8PfQJ0Fe8ZhJlgqU5qJU44Lpvp2yvidH3vp1lPnVQMgi4yEEMPXg5eJS1gFIJTVq1NHBk7Ia9ARdSBdQ==",
|
||||||
"license": "MIT-0",
|
"license": "MIT-0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
@@ -4540,9 +4540,9 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/picomatch": {
|
"node_modules/picomatch": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
|
||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "app-ts",
|
"name": "app-ts",
|
||||||
"version": "1.3.6",
|
"version": "1.4.4",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/server.js",
|
"main": "dist/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -561,7 +561,9 @@ export default function useAttendanceAdmin({ alert }: AlertContext) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadUsers = async () => {
|
const loadUsers = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(`${API_BASE}/users?limit=1000`);
|
const response = await apiFetch(
|
||||||
|
`${API_BASE}/attendance?action=attendance_users`,
|
||||||
|
);
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const apiUsers: ApiUser[] = result.data;
|
const apiUsers: ApiUser[] = result.data;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default function LeaveRequests() {
|
|||||||
|
|
||||||
const fetchRequests = useCallback(async () => {
|
const fetchRequests = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const response = await apiFetch(`${API_BASE}/leave-requests`);
|
const response = await apiFetch(`${API_BASE}/leave-requests?mine=1`);
|
||||||
if (response.status === 401) return;
|
if (response.status === 401) return;
|
||||||
const result = await response.json();
|
const result = await response.json();
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export default function TripsAdmin() {
|
|||||||
try {
|
try {
|
||||||
const [vRes, uRes, csRes] = await Promise.all([
|
const [vRes, uRes, csRes] = await Promise.all([
|
||||||
apiFetch(`${API_BASE}/vehicles`),
|
apiFetch(`${API_BASE}/vehicles`),
|
||||||
apiFetch(`${API_BASE}/users?limit=1000`),
|
apiFetch(`${API_BASE}/trips/users`),
|
||||||
apiFetch(`${API_BASE}/company-settings`),
|
apiFetch(`${API_BASE}/company-settings`),
|
||||||
]);
|
]);
|
||||||
const vJson = await vRes.json();
|
const vJson = await vRes.json();
|
||||||
@@ -136,14 +136,7 @@ export default function TripsAdmin() {
|
|||||||
if (vJson.success) setVehicles(vJson.data);
|
if (vJson.success) setVehicles(vJson.data);
|
||||||
if (csJson.success) setCompanyName(csJson.data.company_name || "");
|
if (csJson.success) setCompanyName(csJson.data.company_name || "");
|
||||||
if (uJson.success) {
|
if (uJson.success) {
|
||||||
setUsers(
|
setUsers(uJson.data);
|
||||||
uJson.data.map(
|
|
||||||
(u: { id: number; first_name: string; last_name: string }) => ({
|
|
||||||
id: u.id,
|
|
||||||
name: `${u.first_name} ${u.last_name}`,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// silently fail, filters will just be empty
|
// silently fail, filters will just be empty
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { FastifyInstance } from "fastify";
|
import { FastifyInstance } from "fastify";
|
||||||
|
import prisma from "../../config/database";
|
||||||
import { requireAuth, requirePermission } from "../../middleware/auth";
|
import { requireAuth, requirePermission } from "../../middleware/auth";
|
||||||
import { logAudit } from "../../services/audit";
|
import { logAudit } from "../../services/audit";
|
||||||
import { success, error, parseId } from "../../utils/response";
|
import { success, error, parseId } from "../../utils/response";
|
||||||
@@ -132,6 +133,38 @@ export default async function attendanceRoutes(
|
|||||||
return reply.send({ success: true, data });
|
return reply.send({ success: true, data });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- action=attendance_users: users with attendance.record permission ---
|
||||||
|
if (action === "attendance_users") {
|
||||||
|
const users = await prisma.users.findMany({
|
||||||
|
where: {
|
||||||
|
is_active: true,
|
||||||
|
roles: {
|
||||||
|
is: {
|
||||||
|
OR: [
|
||||||
|
{ name: "admin" },
|
||||||
|
{
|
||||||
|
role_permissions: {
|
||||||
|
some: { permissions: { name: "attendance.record" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: { id: true, first_name: true, last_name: true, username: true },
|
||||||
|
orderBy: { last_name: "asc" },
|
||||||
|
});
|
||||||
|
return reply.send({
|
||||||
|
success: true,
|
||||||
|
data: users.map((u) => ({
|
||||||
|
id: u.id,
|
||||||
|
first_name: u.first_name,
|
||||||
|
last_name: u.last_name,
|
||||||
|
username: u.username,
|
||||||
|
})),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// --- action=projects: active projects for attendance project switching ---
|
// --- action=projects: active projects for attendance project switching ---
|
||||||
if (action === "projects") {
|
if (action === "projects") {
|
||||||
const data = await attendanceService.getActiveProjects();
|
const data = await attendanceService.getActiveProjects();
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ export default async function invoicesPdfRoutes(
|
|||||||
return `<tr>
|
return `<tr>
|
||||||
<td class="row-num">${i + 1}</td>
|
<td class="row-num">${i + 1}</td>
|
||||||
<td class="desc">${escapeHtml(item.description)}</td>
|
<td class="desc">${escapeHtml(item.description)}</td>
|
||||||
<td class="center">${formatNum(qty, qtyDecimals)}</td>
|
<td class="center">${formatNum(qty, qtyDecimals)}${item.unit ? ` / ${escapeHtml(item.unit)}` : ""}</td>
|
||||||
<td class="right">${formatNum(unitPrice)}</td>
|
<td class="right">${formatNum(unitPrice)}</td>
|
||||||
<td class="right">${formatNum(lineSubtotal)}</td>
|
<td class="right">${formatNum(lineSubtotal)}</td>
|
||||||
<td class="center">${applyVat ? Math.floor(vatRate) : 0}%</td>
|
<td class="center">${applyVat ? Math.floor(vatRate) : 0}%</td>
|
||||||
@@ -699,7 +699,7 @@ export default async function invoicesPdfRoutes(
|
|||||||
}
|
}
|
||||||
table.items tbody td.desc {
|
table.items tbody td.desc {
|
||||||
font-size: 9.5pt;
|
font-size: 9.5pt;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
}
|
}
|
||||||
table.items tbody td.total-cell { font-weight: 700; }
|
table.items tbody td.total-cell { font-weight: 700; }
|
||||||
@@ -944,9 +944,9 @@ ${indentCSS}
|
|||||||
<table class="items">
|
<table class="items">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="center" style="width:5%">${escapeHtml(t.col_no)}</th>
|
<th class="center" style="width:4%">${escapeHtml(t.col_no)}</th>
|
||||||
<th style="width:30%">${escapeHtml(t.col_desc)}</th>
|
<th style="width:28%">${escapeHtml(t.col_desc)}</th>
|
||||||
<th class="center" style="width:9%">${escapeHtml(t.col_qty)}</th>
|
<th class="center" style="width:12%">${escapeHtml(t.col_qty)}</th>
|
||||||
<th class="right" style="width:11%">${escapeHtml(t.col_unit_price)}</th>
|
<th class="right" style="width:11%">${escapeHtml(t.col_unit_price)}</th>
|
||||||
<th class="right" style="width:11%">${escapeHtml(t.col_price)}</th>
|
<th class="right" style="width:11%">${escapeHtml(t.col_price)}</th>
|
||||||
<th class="center" style="width:7%">${escapeHtml(t.col_vat_pct)}</th>
|
<th class="center" style="width:7%">${escapeHtml(t.col_vat_pct)}</th>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default async function leaveRequestsRoutes(
|
|||||||
const isAdmin = authData.permissions.includes("attendance.approve");
|
const isAdmin = authData.permissions.includes("attendance.approve");
|
||||||
|
|
||||||
const where: Record<string, unknown> = {};
|
const where: Record<string, unknown> = {};
|
||||||
if (!isAdmin) where.user_id = authData.userId;
|
if (!isAdmin || query.mine === "1") where.user_id = authData.userId;
|
||||||
else if (query.user_id) where.user_id = Number(query.user_id);
|
else if (query.user_id) where.user_id = Number(query.user_id);
|
||||||
if (query.status) where.status = String(query.status);
|
if (query.status) where.status = String(query.status);
|
||||||
|
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ ${indentCSS}
|
|||||||
}
|
}
|
||||||
table.items tbody td.desc {
|
table.items tbody td.desc {
|
||||||
font-size: 10pt;
|
font-size: 10pt;
|
||||||
font-weight: 500;
|
font-weight: 600;
|
||||||
color: #1a1a1a;
|
color: #1a1a1a;
|
||||||
}
|
}
|
||||||
table.items tbody td.total-cell {
|
table.items tbody td.total-cell {
|
||||||
|
|||||||
@@ -66,6 +66,45 @@ export default async function tripsRoutes(
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// GET /api/admin/trips/users — users with trips.record permission
|
||||||
|
fastify.get(
|
||||||
|
"/users",
|
||||||
|
{ preHandler: requireAuth },
|
||||||
|
async (_request, reply) => {
|
||||||
|
const users = await prisma.users.findMany({
|
||||||
|
where: {
|
||||||
|
is_active: true,
|
||||||
|
roles: {
|
||||||
|
is: {
|
||||||
|
OR: [
|
||||||
|
{ name: "admin" },
|
||||||
|
{
|
||||||
|
role_permissions: {
|
||||||
|
some: { permissions: { name: "trips.record" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
first_name: true,
|
||||||
|
last_name: true,
|
||||||
|
username: true,
|
||||||
|
},
|
||||||
|
orderBy: { last_name: "asc" },
|
||||||
|
});
|
||||||
|
return success(
|
||||||
|
reply,
|
||||||
|
users.map((u) => ({
|
||||||
|
id: u.id,
|
||||||
|
name: `${u.first_name} ${u.last_name}`.trim() || u.username,
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// GET /api/admin/trips/print — print data for trip report
|
// GET /api/admin/trips/print — print data for trip report
|
||||||
fastify.get(
|
fastify.get(
|
||||||
"/print",
|
"/print",
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ export const AttendanceBalancesSchema = z.object({
|
|||||||
|
|
||||||
export const AttendanceBulkSchema = z.object({
|
export const AttendanceBulkSchema = z.object({
|
||||||
month: z.string().regex(/^\d{4}-\d{2}$/, "Měsíc je povinný (formát YYYY-MM)"),
|
month: z.string().regex(/^\d{4}-\d{2}$/, "Měsíc je povinný (formát YYYY-MM)"),
|
||||||
user_ids: z.array(z.number()).min(1, "Vyberte alespoň jednoho zaměstnance"),
|
user_ids: z
|
||||||
|
.array(z.union([z.number(), z.string()]).transform((v) => Number(v)))
|
||||||
|
.min(1, "Vyberte alespoň jednoho zaměstnance"),
|
||||||
arrival_time: z.string().optional().default("08:00"),
|
arrival_time: z.string().optional().default("08:00"),
|
||||||
departure_time: z.string().optional().default("16:30"),
|
departure_time: z.string().optional().default("16:30"),
|
||||||
break_start_time: z.string().optional().default("12:00"),
|
break_start_time: z.string().optional().default("12:00"),
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ export const CreateUserSchema = z.object({
|
|||||||
export const UpdateUserSchema = z.object({
|
export const UpdateUserSchema = z.object({
|
||||||
username: z.string().optional(),
|
username: z.string().optional(),
|
||||||
email: z.string().email("Neplatný formát e-mailu").optional(),
|
email: z.string().email("Neplatný formát e-mailu").optional(),
|
||||||
password: z.string().min(8, "Heslo musí mít alespoň 8 znaků").optional(),
|
password: z.preprocess(
|
||||||
|
(v) => (v === "" ? undefined : v),
|
||||||
|
z.string().min(8, "Heslo musí mít alespoň 8 znaků").optional(),
|
||||||
|
),
|
||||||
first_name: z.string().optional(),
|
first_name: z.string().optional(),
|
||||||
last_name: z.string().optional(),
|
last_name: z.string().optional(),
|
||||||
role_id: z.union([z.number(), z.string(), z.null()]).optional(),
|
role_id: z.union([z.number(), z.string(), z.null()]).optional(),
|
||||||
|
|||||||
@@ -1,9 +1,32 @@
|
|||||||
import { attendance_leave_type, Prisma } from "@prisma/client";
|
import { attendance_leave_type, Prisma } from "@prisma/client";
|
||||||
import prisma from "../config/database";
|
import prisma from "../config/database";
|
||||||
import { getBusinessDaysInMonth } from "../utils/czech-holidays";
|
import { getBusinessDaysInMonth, isHoliday } from "../utils/czech-holidays";
|
||||||
import { localDateStr } from "../utils/date";
|
import { localDateStr } from "../utils/date";
|
||||||
import { getSystemSettings } from "./system-settings";
|
import { getSystemSettings } from "./system-settings";
|
||||||
|
|
||||||
|
/** Get active users whose role has attendance.record permission (or admin role) */
|
||||||
|
async function getAttendanceUsers() {
|
||||||
|
return prisma.users.findMany({
|
||||||
|
where: {
|
||||||
|
is_active: true,
|
||||||
|
roles: {
|
||||||
|
is: {
|
||||||
|
OR: [
|
||||||
|
{ name: "admin" },
|
||||||
|
{
|
||||||
|
role_permissions: {
|
||||||
|
some: { permissions: { name: "attendance.record" } },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
select: { id: true, first_name: true, last_name: true },
|
||||||
|
orderBy: { last_name: "asc" },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
type AttendanceWithRelations = Prisma.attendanceGetPayload<{
|
type AttendanceWithRelations = Prisma.attendanceGetPayload<{
|
||||||
include: {
|
include: {
|
||||||
users: { select: { id: true; first_name: true; last_name: true } };
|
users: { select: { id: true; first_name: true; last_name: true } };
|
||||||
@@ -421,11 +444,7 @@ export async function switchProject(userId: number, projectId: number | null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getBalances(year: number) {
|
export async function getBalances(year: number) {
|
||||||
const users = await prisma.users.findMany({
|
const users = await getAttendanceUsers();
|
||||||
where: { is_active: true },
|
|
||||||
select: { id: true, first_name: true, last_name: true },
|
|
||||||
orderBy: { last_name: "asc" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const balances: Record<
|
const balances: Record<
|
||||||
string,
|
string,
|
||||||
@@ -463,11 +482,7 @@ export async function getBalances(year: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getWorkfund(year: number) {
|
export async function getWorkfund(year: number) {
|
||||||
const users = await prisma.users.findMany({
|
const users = await getAttendanceUsers();
|
||||||
where: { is_active: true },
|
|
||||||
select: { id: true, first_name: true, last_name: true },
|
|
||||||
orderBy: { last_name: "asc" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const currentYear = now.getFullYear();
|
const currentYear = now.getFullYear();
|
||||||
@@ -734,11 +749,7 @@ export async function getPrintData(
|
|||||||
const monthStart = new Date(yr, mo - 1, 1);
|
const monthStart = new Date(yr, mo - 1, 1);
|
||||||
const monthEnd = new Date(yr, mo, 0, 23, 59, 59);
|
const monthEnd = new Date(yr, mo, 0, 23, 59, 59);
|
||||||
|
|
||||||
const users = await prisma.users.findMany({
|
const users = await getAttendanceUsers();
|
||||||
where: { is_active: true },
|
|
||||||
select: { id: true, first_name: true, last_name: true },
|
|
||||||
orderBy: { last_name: "asc" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const where: Record<string, unknown> = {
|
const where: Record<string, unknown> = {
|
||||||
shift_date: { gte: monthStart, lte: monthEnd },
|
shift_date: { gte: monthStart, lte: monthEnd },
|
||||||
@@ -1083,6 +1094,20 @@ export async function bulkCreateAttendance(data: BulkAttendanceData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const shiftDate = new Date(Date.UTC(yr, mo - 1, day, 12, 0, 0));
|
const shiftDate = new Date(Date.UTC(yr, mo - 1, day, 12, 0, 0));
|
||||||
|
|
||||||
|
if (isHoliday(dateStr)) {
|
||||||
|
await prisma.attendance.create({
|
||||||
|
data: {
|
||||||
|
user_id: userId,
|
||||||
|
shift_date: shiftDate,
|
||||||
|
leave_type: "holiday",
|
||||||
|
leave_hours: 8,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
inserted++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
await prisma.attendance.create({
|
await prisma.attendance.create({
|
||||||
data: {
|
data: {
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
|
|||||||
Reference in New Issue
Block a user