Update index.html
1 file changed+32−0
index.html+32−0View file
| @@ -3335,6 +3335,38 @@ | ||
| </span>`; | ||
| } | ||
| + function formatDays(days) { | ||
| + const num = Math.round((Number(days) || 0) * 10) / 10; | ||
| + const formatted = Number.isInteger(num) ? num.toString() : (Math.round(num * 10) / 10).toString(); | ||
| + return `${formatted} ${num === 1 ? 'day' : 'days'}`; | ||
| + } | ||
| + | ||
| + function formatDaysCountOnly(days) { | ||
| + const num = Math.round((Number(days) || 0) * 10) / 10; | ||
| + return Number.isInteger(num) ? num.toString() : (Math.round(num * 10) / 10).toString(); | ||
| + } | ||
| + | ||
| + function getDayWorkBadgeHTML(dayOrAmount) { | ||
| + let amount = 0; | ||
| + if (typeof dayOrAmount === 'object' && dayOrAmount !== null) { | ||
| + if (dayOrAmount.workAmount !== undefined && dayOrAmount.workAmount !== null) { | ||
| + amount = Number(dayOrAmount.workAmount); | ||
| + } else if (dayOrAmount.worked) { | ||
| + amount = 1.0; | ||
| + } | ||
| + } else { | ||
| + amount = Number(dayOrAmount) || 0; | ||
| + } | ||
| + | ||
| + if (amount >= 1.0) { | ||
| + return '<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-bold bg-indigo-100 text-indigo-800 border border-indigo-200">Full Day</span>'; | ||
| + } else if (amount > 0) { | ||
| + return '<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-bold bg-amber-100 text-amber-800 border border-amber-200">Half Day</span>'; | ||
| + } else { | ||
| + return '<span class="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-slate-100 text-slate-500">Off</span>'; | ||
| + } | ||
| + } | ||
| + | ||
| function escapeHtml(str) { | ||
| if (!str) return ''; | ||
| return String(str) | ||