type error fix
This commit is contained in:
parent
b01ad415f1
commit
8d2961c50d
|
|
@ -0,0 +1,132 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
||||||
|
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||||
|
function step(op) {
|
||||||
|
if (f) throw new TypeError("Generator is already executing.");
|
||||||
|
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
||||||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||||
|
switch (op[0]) {
|
||||||
|
case 0: case 1: t = op; break;
|
||||||
|
case 4: _.label++; return { value: op[1], done: false };
|
||||||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||||
|
default:
|
||||||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||||
|
if (t[2]) _.ops.pop();
|
||||||
|
_.trys.pop(); continue;
|
||||||
|
}
|
||||||
|
op = body.call(thisArg, _);
|
||||||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var test_1 = require("@playwright/test");
|
||||||
|
var electronApp;
|
||||||
|
var mainPage;
|
||||||
|
function waitForPreloadScript() {
|
||||||
|
return __awaiter(this, void 0, void 0, function () {
|
||||||
|
var _this = this;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
return [2 /*return*/, new Promise(function (resolve) {
|
||||||
|
var interval = setInterval(function () { return __awaiter(_this, void 0, void 0, function () {
|
||||||
|
var electronBridge;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, mainPage.evaluate(function () {
|
||||||
|
return window.electron;
|
||||||
|
})];
|
||||||
|
case 1:
|
||||||
|
electronBridge = _a.sent();
|
||||||
|
if (electronBridge) {
|
||||||
|
clearInterval(interval);
|
||||||
|
resolve(true);
|
||||||
|
}
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); }, 100);
|
||||||
|
})];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
test_1.test.beforeEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, test_1._electron.launch({
|
||||||
|
args: ['.'],
|
||||||
|
env: { NODE_ENV: 'development' },
|
||||||
|
})];
|
||||||
|
case 1:
|
||||||
|
electronApp = _a.sent();
|
||||||
|
return [4 /*yield*/, electronApp.firstWindow()];
|
||||||
|
case 2:
|
||||||
|
mainPage = _a.sent();
|
||||||
|
return [4 /*yield*/, waitForPreloadScript()];
|
||||||
|
case 3:
|
||||||
|
_a.sent();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); });
|
||||||
|
test_1.test.afterEach(function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, electronApp.close()];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); });
|
||||||
|
(0, test_1.test)('custom frame should minimize the mainWindow', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
var isMinimized;
|
||||||
|
return __generator(this, function (_a) {
|
||||||
|
switch (_a.label) {
|
||||||
|
case 0: return [4 /*yield*/, mainPage.click('#minimize')];
|
||||||
|
case 1:
|
||||||
|
_a.sent();
|
||||||
|
return [4 /*yield*/, electronApp.evaluate(function (electron) {
|
||||||
|
return electron.BrowserWindow.getAllWindows()[0].isMinimized();
|
||||||
|
})];
|
||||||
|
case 2:
|
||||||
|
isMinimized = _a.sent();
|
||||||
|
(0, test_1.expect)(isMinimized).toBeTruthy();
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); });
|
||||||
|
(0, test_1.test)('should create a custom menu', function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
|
var menu;
|
||||||
|
var _a, _b;
|
||||||
|
return __generator(this, function (_c) {
|
||||||
|
switch (_c.label) {
|
||||||
|
case 0: return [4 /*yield*/, electronApp.evaluate(function (electron) {
|
||||||
|
return electron.Menu.getApplicationMenu();
|
||||||
|
})];
|
||||||
|
case 1:
|
||||||
|
menu = _c.sent();
|
||||||
|
(0, test_1.expect)(menu).not.toBeNull();
|
||||||
|
(0, test_1.expect)(menu === null || menu === void 0 ? void 0 : menu.items).toHaveLength(2);
|
||||||
|
(0, test_1.expect)((_a = menu === null || menu === void 0 ? void 0 : menu.items[0].submenu) === null || _a === void 0 ? void 0 : _a.items).toHaveLength(2);
|
||||||
|
(0, test_1.expect)((_b = menu === null || menu === void 0 ? void 0 : menu.items[1].submenu) === null || _b === void 0 ? void 0 : _b.items).toHaveLength(3);
|
||||||
|
(0, test_1.expect)(menu === null || menu === void 0 ? void 0 : menu.items[1].label).toBe('View');
|
||||||
|
return [2 /*return*/];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}); });
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
"use strict";
|
||||||
|
var __assign = (this && this.__assign) || function () {
|
||||||
|
__assign = Object.assign || function(t) {
|
||||||
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||||
|
s = arguments[i];
|
||||||
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||||
|
t[p] = s[p];
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
return __assign.apply(this, arguments);
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var test_1 = require("@playwright/test");
|
||||||
|
/**
|
||||||
|
* Read environment variables from file.
|
||||||
|
* https://github.com/motdotla/dotenv
|
||||||
|
*/
|
||||||
|
// require('dotenv').config();
|
||||||
|
/**
|
||||||
|
* See https://playwright.dev/docs/test-configuration.
|
||||||
|
*/
|
||||||
|
exports.default = (0, test_1.defineConfig)({
|
||||||
|
testDir: './e2e',
|
||||||
|
/* Run tests in files in parallel */
|
||||||
|
fullyParallel: true,
|
||||||
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
/* Retry on CI only */
|
||||||
|
retries: process.env.CI ? 2 : 0,
|
||||||
|
/* Opt out of parallel tests on CI. */
|
||||||
|
workers: process.env.CI ? 1 : undefined,
|
||||||
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||||
|
reporter: 'html',
|
||||||
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||||
|
use: {
|
||||||
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||||
|
// baseURL: 'http://127.0.0.1:3000',
|
||||||
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
|
trace: 'on-first-retry',
|
||||||
|
},
|
||||||
|
/* Configure projects for major browsers */
|
||||||
|
projects: [
|
||||||
|
{
|
||||||
|
name: 'chromium',
|
||||||
|
use: __assign({}, test_1.devices['Desktop Chrome']),
|
||||||
|
},
|
||||||
|
/* Test against mobile viewports. */
|
||||||
|
// {
|
||||||
|
// name: 'Mobile Chrome',
|
||||||
|
// use: { ...devices['Pixel 5'] },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Mobile Safari',
|
||||||
|
// use: { ...devices['iPhone 12'] },
|
||||||
|
// },
|
||||||
|
/* Test against branded browsers. */
|
||||||
|
// {
|
||||||
|
// name: 'Microsoft Edge',
|
||||||
|
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// name: 'Google Chrome',
|
||||||
|
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
/* Run your local dev server before starting the tests */
|
||||||
|
webServer: {
|
||||||
|
command: 'npm run dev:react',
|
||||||
|
url: 'http://localhost:5123',
|
||||||
|
reuseExistingServer: !process.env.CI,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -196,7 +196,7 @@ ipcMain.handle("get-project-logs", async (event, { projectID, fromDate, toDate }
|
||||||
const response = await api.get(url);
|
const response = await api.get(url);
|
||||||
console.log("✅ response-logs:", response);
|
console.log("✅ response-logs:", response);
|
||||||
|
|
||||||
return response;
|
return { success: true, data: response.data };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("❌ Error fetching project logs:", error);
|
console.error("❌ Error fetching project logs:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var electron_1 = require("electron");
|
||||||
|
console.log("setting PreLoad");
|
||||||
|
electron_1.contextBridge.exposeInMainWorld('electron', {
|
||||||
|
login: function (credentials) { return electron_1.ipcRenderer.invoke('login-request', credentials); },
|
||||||
|
logout: function () { return electron_1.ipcRenderer.invoke('logout-request'); },
|
||||||
|
forgotPassword: function (email) { return electron_1.ipcRenderer.invoke("forgot-password", email); },
|
||||||
|
getToken: function (TOKEN_KEY) { return electron_1.ipcRenderer.invoke('get-token', TOKEN_KEY); },
|
||||||
|
uploadScreenshot: function () { return electron_1.ipcRenderer.invoke('upload-screenshot'); },
|
||||||
|
getActiveAppDetails: function () { return electron_1.ipcRenderer.invoke('get-active-app'); },
|
||||||
|
toggleCloseBtn: function (shouldEnable) { return electron_1.ipcRenderer.invoke('toggle-close-btn', shouldEnable); },
|
||||||
|
resizeWindow: function (width, height) { return electron_1.ipcRenderer.invoke('resize-window', width, height); },
|
||||||
|
getProjectList: function () { return electron_1.ipcRenderer.invoke("get-project-list"); },
|
||||||
|
onWindowUpdate: function (callback) {
|
||||||
|
return electron_1.ipcRenderer.on("window:updated", function (_, data) { return callback(data); });
|
||||||
|
},
|
||||||
|
startProjectTracking: function (data) { return electron_1.ipcRenderer.invoke("start-project-tracking", data); },
|
||||||
|
stopProjectTracking: function (data) { return electron_1.ipcRenderer.invoke("stop-project-tracking", data); },
|
||||||
|
trackingTabsOpeningClosing: function (data) {
|
||||||
|
return electron_1.ipcRenderer.invoke("tracking-tabs-opening-and-closing", data);
|
||||||
|
},
|
||||||
|
getProjectLogs: function (projectID, fromDate, toDate) { return electron_1.ipcRenderer.invoke("get-project-logs", { projectID: projectID, fromDate: fromDate, toDate: toDate }); },
|
||||||
|
});
|
||||||
|
// function ipcInvoke<Key extends keyof EventPayloadMapping>(
|
||||||
|
// key: Key
|
||||||
|
// ): Promise<EventPayloadMapping[Key]> {
|
||||||
|
// return ipcRenderer.invoke(key);
|
||||||
|
// }
|
||||||
|
// function ipcOn<Key extends keyof EventPayloadMapping>(
|
||||||
|
// key: Key,
|
||||||
|
// callback: (payload: EventPayloadMapping[Key]) => void
|
||||||
|
// ) {
|
||||||
|
// const cb = (_: Electron.IpcRendererEvent, payload: any) => callback(payload);
|
||||||
|
// ipcRenderer.on(key, cb);
|
||||||
|
// return () => ipcRenderer.off(key, cb);
|
||||||
|
// }
|
||||||
|
// function ipcSend<Key extends keyof EventPayloadMapping>(
|
||||||
|
// key: Key,
|
||||||
|
// payload: EventPayloadMapping[Key]
|
||||||
|
// ) {
|
||||||
|
// ipcRenderer.send(key, payload);
|
||||||
|
// }
|
||||||
|
|
@ -6,13 +6,13 @@ export const useActiveAppTracker = (
|
||||||
isTracking: boolean,
|
isTracking: boolean,
|
||||||
activeProjectLogId: string | null,
|
activeProjectLogId: string | null,
|
||||||
projectId: string | null,
|
projectId: string | null,
|
||||||
projectName: string
|
projectName: string | null
|
||||||
) => {
|
) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const lastActiveRef = useRef<WindowInfo | null>(null);
|
const lastActiveRef = useRef<WindowInfo | null>(null);
|
||||||
const lastLogIdRef = useRef<string | null>(null);
|
const lastLogIdRef = useRef<string | null>(null);
|
||||||
const lastTitleRef = useRef<string | null>(null);
|
const lastTitleRef = useRef<string | null>(null);
|
||||||
const intervalIdRef = useRef<NodeJS.Timeout | null>(null);
|
const intervalIdRef = useRef<number | null>(null);
|
||||||
const finalizeTrackingRef = useRef<(() => Promise<void>) | null>(null);
|
const finalizeTrackingRef = useRef<(() => Promise<void>) | null>(null);
|
||||||
|
|
||||||
// ✅ Common guard to check if we can send
|
// ✅ Common guard to check if we can send
|
||||||
|
|
@ -31,15 +31,27 @@ export const useActiveAppTracker = (
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload: {
|
||||||
id: !isNew ? lastLogIdRef.current : undefined,
|
id?: string;
|
||||||
|
logId: string;
|
||||||
|
projectId: string;
|
||||||
|
title: string;
|
||||||
|
appName: string;
|
||||||
|
} = {
|
||||||
logId: projectLogId,
|
logId: projectLogId,
|
||||||
projectId,
|
projectId,
|
||||||
title,
|
title,
|
||||||
appName,
|
appName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ✅ only attach `id` if it’s non-null and not undefined
|
||||||
|
if (!isNew && lastLogIdRef.current) {
|
||||||
|
payload.id = lastLogIdRef.current;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log(isNew ? "➡️ POST new log" : "✏️ PATCH update log", payload);
|
console.log(isNew ? "➡️ POST new log" : "✏️ PATCH update log", payload);
|
||||||
|
|
||||||
const res = await window.electron.trackingTabsOpeningClosing(payload);
|
const res = await window.electron.trackingTabsOpeningClosing(payload);
|
||||||
|
|
||||||
if (isNew && res?._id) lastLogIdRef.current = res._id;
|
if (isNew && res?._id) lastLogIdRef.current = res._id;
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@ const DashboardLayout = () => {
|
||||||
const { finalizeTracking } = useActiveAppTracker(
|
const { finalizeTracking } = useActiveAppTracker(
|
||||||
isTracking,
|
isTracking,
|
||||||
activeProjectLogId,
|
activeProjectLogId,
|
||||||
selectedProject?.projectId,
|
selectedProject?.projectId ?? null,
|
||||||
selectedProject?.projectName
|
selectedProject?.projectName ?? null
|
||||||
);
|
);
|
||||||
|
|
||||||
const [projectsData, setProjectsData] = useState<Project[]>([]);
|
const [projectsData, setProjectsData] = useState<Project[]>([]);
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
const [ptoLeave, setPtoLeave] = useState({
|
const [ptoLeave, setPtoLeave] = useState({
|
||||||
fromDate: '',
|
fromDate: '',
|
||||||
toDate: '',
|
toDate: '',
|
||||||
|
// description:""
|
||||||
});
|
});
|
||||||
const [ptoErrors, setPtoErrors] = useState<Partial<LeaveFormData>>({});
|
const [ptoErrors, setPtoErrors] = useState<Partial<LeaveFormData>>({});
|
||||||
|
|
||||||
|
|
@ -49,6 +50,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
const [sickLeave, setSickLeave] = useState<LeaveFormData>({
|
const [sickLeave, setSickLeave] = useState<LeaveFormData>({
|
||||||
fromDate: '',
|
fromDate: '',
|
||||||
toDate: '',
|
toDate: '',
|
||||||
|
|
||||||
});
|
});
|
||||||
const [sickErrors, setSickErrors] = useState<Partial<LeaveFormData>>({});
|
const [sickErrors, setSickErrors] = useState<Partial<LeaveFormData>>({});
|
||||||
const [selectedProjectId, setSelectedProjectId] = useState("")
|
const [selectedProjectId, setSelectedProjectId] = useState("")
|
||||||
|
|
@ -80,9 +82,6 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
errors.toDate = 'To date must be after from date';
|
errors.toDate = 'To date must be after from date';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.description.trim()) {
|
|
||||||
errors.description = 'Description/Reason is required';
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
};
|
};
|
||||||
|
|
@ -100,7 +99,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
console.log('Submitting PTO:', ptoLeave);
|
console.log('Submitting PTO:', ptoLeave);
|
||||||
alert('PTO request submitted successfully!');
|
alert('PTO request submitted successfully!');
|
||||||
|
|
||||||
setPtoLeave({ fromDate: '', toDate: '', description: '' });
|
setPtoLeave({ fromDate: '', toDate: '' });
|
||||||
setPtoErrors({});
|
setPtoErrors({});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert('Failed to submit request. Please try again.');
|
alert('Failed to submit request. Please try again.');
|
||||||
|
|
@ -128,7 +127,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
console.log('Submitting Sick Leave:', sickLeave);
|
console.log('Submitting Sick Leave:', sickLeave);
|
||||||
alert('Sick Leave request submitted successfully!');
|
alert('Sick Leave request submitted successfully!');
|
||||||
|
|
||||||
setSickLeave({ fromDate: '', toDate: '', description: '' });
|
setSickLeave({ fromDate: '', toDate: '' });
|
||||||
setSickErrors({});
|
setSickErrors({});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert('Failed to submit request. Please try again.');
|
alert('Failed to submit request. Please try again.');
|
||||||
|
|
@ -173,35 +172,35 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const fetchLogs = async () => {
|
// const fetchLogs = async () => {
|
||||||
const res = await window.electron.getProjectLogs(
|
// const res = await window.electron.getProjectLogs(
|
||||||
selectedProjectId,
|
// selectedProjectId,
|
||||||
selectedDate || undefined,
|
// selectedDate || undefined,
|
||||||
selectedDate || undefined,
|
// selectedDate || undefined,
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (res.success) {
|
// if (res.success) {
|
||||||
console.log("✅ Logs: fetchLogs", res);
|
// console.log("✅ Logs: fetchLogs", res);
|
||||||
|
|
||||||
// Safely extract time if from/to exist
|
// // Safely extract time if from/to exist
|
||||||
const fromTime = res.from ? new Date(res.from).toISOString().slice(11, 16) : "";
|
// const fromTime = res.from ? new Date(res.from).toISOString().slice(11, 16) : "";
|
||||||
const toTime = res.to ? new Date(res.to).toISOString().slice(11, 16) : "";
|
// const toTime = res.to ? new Date(res.to).toISOString().slice(11, 16) : "";
|
||||||
|
|
||||||
setPtoLeave({
|
// setPtoLeave({
|
||||||
fromDate: fromTime,
|
// fromDate: fromTime,
|
||||||
toDate: toTime,
|
// toDate: toTime,
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
console.warn("⚠️ Failed to fetch project logs");
|
// console.warn("⚠️ Failed to fetch project logs");
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (selectedProjectId && selectedDate) {
|
// if (selectedProjectId && selectedDate) {
|
||||||
fetchLogs()
|
// fetchLogs()
|
||||||
}
|
// }
|
||||||
}, [selectedProjectId, selectedDate])
|
// }, [selectedProjectId, selectedDate])
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -386,16 +385,12 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
<span className="label-text font-semibold text-sm ">Description / Reason</span>
|
<span className="label-text font-semibold text-sm ">Description / Reason</span>
|
||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
value={ptoLeave.description}
|
// value={ptoLeave.description}
|
||||||
// onChange={(e) => handlePtoChange('description', e.target.value)}
|
// onChange={(e) => handlePtoChange('description', e.target.value)}
|
||||||
className={`textarea text-xs textarea-bordered h-40 w-full focus:textarea-primary transition-all ${ptoErrors.description ? 'textarea-error' : ''}`}
|
className={`textarea text-xs textarea-bordered h-40 w-full focus:textarea-primary transition-all
|
||||||
|
`}
|
||||||
placeholder="Please enter the task name or leave notes to help us better understand your request."
|
placeholder="Please enter the task name or leave notes to help us better understand your request."
|
||||||
/>
|
/>
|
||||||
{ptoErrors.description && (
|
|
||||||
<label className="label">
|
|
||||||
<span className="label-text-alt text-error font-medium">{ptoErrors.description}</span>
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
|
|
@ -410,7 +405,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setPtoLeave({ fromDate: '', toDate: '', description: '' });
|
setPtoLeave({ fromDate: '', toDate: '' });
|
||||||
setPtoErrors({});
|
setPtoErrors({});
|
||||||
}}
|
}}
|
||||||
className="btn btn-secondary transition-all"
|
className="btn btn-secondary transition-all"
|
||||||
|
|
@ -468,7 +463,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="form-control flex flex-col gap-1">
|
{/* <div className="form-control flex flex-col gap-1">
|
||||||
<label className="label">
|
<label className="label">
|
||||||
<span className="label-text font-semibold ">Description / Reason</span>
|
<span className="label-text font-semibold ">Description / Reason</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
@ -483,7 +478,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
<span className="label-text-alt text-error font-medium">{sickErrors.description}</span>
|
<span className="label-text-alt text-error font-medium">{sickErrors.description}</span>
|
||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<div className="flex gap-3 ">
|
<div className="flex gap-3 ">
|
||||||
<button
|
<button
|
||||||
|
|
@ -497,7 +492,7 @@ const LeaveAndAdjustments: React.FC = () => {
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSickLeave({ fromDate: '', toDate: '', description: '' });
|
// setSickLeave({ fromDate: '', toDate: '', description: '' });
|
||||||
setSickErrors({});
|
setSickErrors({});
|
||||||
}}
|
}}
|
||||||
className="btn btn-secondary transition-all"
|
className="btn btn-secondary transition-all"
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ const Timesheets: React.FC = () => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleViewLogs = async (projectID: string, projectName: string) => {
|
const handleViewLogs = async (projectID: string, projectName: string) => {
|
||||||
try {
|
try {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setSelectedProject(projectID);
|
setSelectedProject(projectID);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const initialState: WindowState = {
|
||||||
interface SetActiveWindowPayload {
|
interface SetActiveWindowPayload {
|
||||||
window: WindowInfo;
|
window: WindowInfo;
|
||||||
projectId: string;
|
projectId: string;
|
||||||
projectName: string;
|
projectName: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const windowSlice = createSlice({
|
const windowSlice = createSlice({
|
||||||
|
|
|
||||||
|
|
@ -96,13 +96,16 @@ interface Window {
|
||||||
appName: string;
|
appName: string;
|
||||||
}) => Promise<any>;
|
}) => Promise<any>;
|
||||||
|
|
||||||
// getProjectLogs: (projectId: string) => Promise<{ success: boolean; logs: ProjectLogResponse[] }>;
|
getProjectLogs: (
|
||||||
getProjectLogs: (
|
|
||||||
projectId: string,
|
projectId: string,
|
||||||
fromDate?: string,
|
fromDate?: string,
|
||||||
toDate?: string
|
toDate?: string
|
||||||
) => Promise<{ success: boolean; logs: ProjectLogResponse[] }>;
|
) => Promise<{
|
||||||
|
success: boolean;
|
||||||
|
data: any;
|
||||||
|
message?: string;
|
||||||
|
}
|
||||||
|
>;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue