feat: add date formatting utility and enhance filtering in registro-pontos
- Introduced a new utility function `formatarDataDDMMAAAA` to format dates in DD/MM/AAAA format, supporting various input types. - Updated the `registro-pontos` page to utilize the new date formatting function for displaying dates consistently. - Implemented advanced filtering options for status and location, allowing users to filter records based on their criteria. - Enhanced CSV export functionality to include formatted dates and additional filtering capabilities, improving data management for users.
This commit is contained in:
36
apps/web/src/lib/components/ponto/SaldoDiarioBadge.svelte
Normal file
36
apps/web/src/lib/components/ponto/SaldoDiarioBadge.svelte
Normal file
@@ -0,0 +1,36 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
saldo?: {
|
||||
saldoMinutos: number;
|
||||
horas: number;
|
||||
minutos: number;
|
||||
positivo: boolean;
|
||||
} | null;
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}
|
||||
|
||||
let { saldo, size = 'md' }: Props = $props();
|
||||
|
||||
function formatarSaldo(saldo: NonNullable<Props['saldo']>): string {
|
||||
const sinal = saldo.positivo ? '+' : '-';
|
||||
return `${sinal}${saldo.horas}h ${saldo.minutos}min`;
|
||||
}
|
||||
|
||||
const sizeClasses = {
|
||||
sm: 'badge-sm',
|
||||
md: 'badge-lg',
|
||||
lg: 'badge-xl'
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if saldo}
|
||||
<span
|
||||
class="badge font-semibold shadow-sm {sizeClasses[size]} {saldo.positivo
|
||||
? 'badge-success'
|
||||
: 'badge-error'}"
|
||||
>
|
||||
{formatarSaldo(saldo)}
|
||||
</span>
|
||||
{:else}
|
||||
<span class="badge badge-ghost {sizeClasses[size]}">-</span>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user