sozsoft-platform/configs/seeds/data/Sas.DeveloperKit.CustomComponents/3b7b16c6-aa96-5765-8e19-fe5e727feb52.json
2026-10-19 17:35:08 +03:00

29 lines
5.3 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"ListFormCode": "Sas.DeveloperKit.CustomComponents",
"KeyFieldName": "Id",
"GeneratedAt": "2026-10-04T15:00:00Z",
"Order": 0,
"Rows": [
{
"Id": "3b7b16c6-aa96-5765-8e19-fe5e727feb52",
"Name": "TeamLeaveWidget",
"RoutePath": null,
"Description": "Intranet panosu: departman müdürünün onayını bekleyen izin talepleri ve bugün izinde olanlar",
"IsActive": true,
"Dependencies": [],
"Code": "// Departman muduru icin ekibin izin ozeti. Satirlar ekranin kendi sorgusundan gelir: liste\n// yalniz muduru oldugu departmanin taleplerini dondurur (ManagerIds suzmesi ListForm'da).\nconst REQUESTS = 'Hr.TeamLeaveRequest'\nconst MANAGER_STEP = 'Müdür Onayı'\nconst APPROVED = 'Onaylandı'\n\nconst loadRows = async (listFormCode) => {\n const response = await apiService.fetchData({\n method: 'GET',\n url: '/api/app/list-form-select/select',\n params: { listFormCode, take: 500 },\n })\n return response.data?.data ?? []\n}\n\nconst formatDays = (value) => {\n const number = Number(value ?? 0)\n return Number.isInteger(number) ? String(number) : number.toFixed(1)\n}\n\nconst formatDate = (value) => {\n if (!value) return '-'\n const [year, month, day] = String(value).slice(0, 10).split('-')\n return `${day}.${month}.${year}`\n}\n\nconst Stat = ({ label, value, className }) => (\n <div className=\"rounded-lg border border-gray-200 bg-gray-50 p-2 text-center dark:border-gray-700 dark:bg-gray-900/40\">\n <div className={'text-lg font-semibold ' + className}>{value}</div>\n <div className=\"truncate text-xs text-gray-500 dark:text-gray-400\">{label}</div>\n </div>\n)\n\nconst TeamLeaveWidget = () => {\n const [rows, setRows] = useState([])\n const [loading, setLoading] = useState(true)\n\n useEffect(() => {\n let active = true\n loadRows(REQUESTS)\n .then((result) => active && setRows(result))\n .catch(() => {})\n .finally(() => active && setLoading(false))\n return () => {\n active = false\n }\n }, [])\n\n const today = new Date().toISOString().slice(0, 10)\n const awaiting = rows\n .filter((row) => row.ApprovalStatus === MANAGER_STEP)\n .sort((a, b) => String(a.StartDate).localeCompare(String(b.StartDate)))\n const onLeave = rows.filter(\n (row) =>\n row.ApprovalStatus === APPROVED &&\n String(row.StartDate).slice(0, 10) <= today &&\n String(row.EndDate).slice(0, 10) >= today,\n )\n\n return (\n <div className=\"overflow-hidden rounded-xl border border-gray-200/50 bg-white shadow-lg dark:border-gray-700/50 dark:bg-gray-800\">\n <div className=\"flex items-center gap-2 border-b border-gray-200 p-4 dark:border-gray-700\">\n <PlatformIcon name=\"FaUserCheck\" className=\"h-5 w-5 text-indigo-500\" />\n <h2 className=\"text-base font-semibold text-gray-900 dark:text-white\">\n {translate('::Sas.DashboardWidget.TeamLeave')}\n </h2>\n </div>\n <div className=\"space-y-3 p-3\">\n {loading ? (\n <div className=\"p-4 text-center text-sm text-gray-500\">...</div>\n ) : (\n <>\n <div className=\"grid grid-cols-2 gap-2\">\n <Stat\n label={translate('::Sas.DashboardWidget.Leave.AwaitingMe')}\n value={awaiting.length}\n className=\"text-orange-500\"\n />\n <Stat\n label={translate('::Sas.DashboardWidget.Leave.OnLeaveToday')}\n value={onLeave.length}\n className=\"text-indigo-600 dark:text-indigo-400\"\n />\n </div>\n {awaiting.length === 0 ? (\n <div className=\"text-sm text-gray-500 dark:text-gray-400\">\n {translate('::Sas.DashboardWidget.Leave.NoPending')}\n </div>\n ) : (\n <ul className=\"space-y-1\">\n {awaiting.slice(0, 5).map((row) => (\n <li\n key={row.Id}\n className=\"flex items-center justify-between gap-2 rounded-md bg-gray-50 px-2 py-1 text-xs dark:bg-gray-900/40\"\n >\n <span className=\"truncate font-medium text-gray-800 dark:text-gray-100\">{row.EmployeeName}</span>\n <span className=\"shrink-0 text-gray-600 dark:text-gray-300\">\n {formatDate(row.StartDate)} · {formatDays(row.Days)} {translate('::Sas.DashboardWidget.Leave.Days')}\n </span>\n </li>\n ))}\n </ul>\n )}\n </>\n )}\n <div className=\"pt-1\">\n <a\n href={'/admin/list/' + REQUESTS}\n className=\"text-sm font-medium text-indigo-600 hover:underline dark:text-indigo-400\"\n >\n {translate('::Sas.DashboardWidget.Leave.OpenApprovals')} →\n </a>\n </div>\n </div>\n </div>\n )\n}\n\nexport default TeamLeaveWidget\n",
"Props": null,
"DataSources": [],
"SeoTitle": null,
"SeoDescription": null,
"SeoKeywords": null,
"SeoOgImage": null,
"SeoCanonicalUrl": null,
"SeoNoIndex": true,
"SeoIncludeInSitemap": false,
"SeoChangeFrequency": null,
"SeoPriority": null,
"SeoStructuredData": null
}
]
}