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:
26
apps/web/src/lib/components/ponto/LocalizacaoIcon.svelte
Normal file
26
apps/web/src/lib/components/ponto/LocalizacaoIcon.svelte
Normal file
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
import { MapPin, AlertCircle, HelpCircle } from 'lucide-svelte';
|
||||
|
||||
interface Props {
|
||||
dentroRaioPermitido: boolean | null | undefined;
|
||||
showTooltip?: boolean;
|
||||
}
|
||||
|
||||
let { dentroRaioPermitido, showTooltip = true }: Props = $props();
|
||||
</script>
|
||||
|
||||
{#if dentroRaioPermitido === true}
|
||||
<div class="tooltip tooltip-top" data-tip={showTooltip ? 'Dentro do Raio' : ''}>
|
||||
<MapPin class="h-5 w-5 text-success" strokeWidth={2.5} />
|
||||
</div>
|
||||
{:else if dentroRaioPermitido === false}
|
||||
<div class="tooltip tooltip-top" data-tip={showTooltip ? 'Fora do Raio' : ''}>
|
||||
<AlertCircle class="h-5 w-5 text-error" strokeWidth={2.5} />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="tooltip tooltip-top" data-tip={showTooltip ? 'Não Validado' : ''}>
|
||||
<HelpCircle class="h-5 w-5 text-base-content/40" strokeWidth={2.5} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
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