Fix calendar style
This commit is contained in:
@@ -11,6 +11,7 @@ import { ProgressChart } from '@/components/dashboard/ProgressChart'
|
||||
import { ParentalLeaveBreakdown } from '@/components/dashboard/ParentalLeaveBreakdown'
|
||||
import { ChildBirthdayInput } from '@/components/inputs/ChildBirthdayInput'
|
||||
import { QRCodeModal } from '@/components/modals/QRCodeModal'
|
||||
import { ManualFetchModal } from '@/components/modals/ManualFetchModal'
|
||||
|
||||
export function Dashboard(): ReactNode {
|
||||
const { workspace, isLoading: wsLoading, selectedChildId, children, personalDataUuid, refreshContext } = useWorkspace()
|
||||
@@ -28,6 +29,9 @@ export function Dashboard(): ReactNode {
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
const [submitError, setSubmitError] = useState<string | null>(null)
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const [showManualFetchModal, setShowManualFetchModal] = useState(false)
|
||||
const [isManualFetchSaving, setIsManualFetchSaving] = useState(false)
|
||||
const [manualFetchError, setManualFetchError] = useState<string | null>(null)
|
||||
|
||||
const isLoading = wsLoading || analyticsLoading || pdLoading || bpLoading
|
||||
|
||||
@@ -64,6 +68,44 @@ export function Dashboard(): ReactNode {
|
||||
await scraper.start(selectedChildId ?? undefined)
|
||||
}
|
||||
|
||||
const handleSaveManualFetch = async (data: {
|
||||
totalDays: number
|
||||
daysUsed: number
|
||||
reservedDaysLeft: number
|
||||
transferableDaysLeft: number
|
||||
dubbeldagarLeft: number
|
||||
sjukpenningUsed: number
|
||||
lagstaNivaUsed: number
|
||||
}) => {
|
||||
if (!workspace?.id || !selectedChildId || !personalDataUuid) return
|
||||
|
||||
try {
|
||||
setIsManualFetchSaving(true)
|
||||
setManualFetchError(null)
|
||||
|
||||
await api.saveManualFetch({
|
||||
personalDataUuid,
|
||||
workspaceId: workspace.id,
|
||||
childId: selectedChildId,
|
||||
totalDays: data.totalDays,
|
||||
daysUsed: data.daysUsed,
|
||||
reservedDaysLeft: data.reservedDaysLeft,
|
||||
transferableDaysLeft: data.transferableDaysLeft,
|
||||
dubbeldagarLeft: data.dubbeldagarLeft,
|
||||
sjukpenningUsed: data.sjukpenningUsed,
|
||||
lagstaNivaUsed: data.lagstaNivaUsed,
|
||||
})
|
||||
|
||||
await refreshParentalLeave()
|
||||
await refreshAnalytics()
|
||||
setShowManualFetchModal(false)
|
||||
} catch (err) {
|
||||
setManualFetchError(err instanceof Error ? err.message : 'Failed to save manual data')
|
||||
} finally {
|
||||
setIsManualFetchSaving(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleModalClose = () => {
|
||||
if (scraper.isRunning) return
|
||||
setShowModal(false)
|
||||
@@ -135,13 +177,22 @@ export function Dashboard(): ReactNode {
|
||||
)}
|
||||
|
||||
<section className="dashboard__section">
|
||||
<button
|
||||
onClick={handleFetchFK}
|
||||
disabled={!selectedChildId}
|
||||
style={{ padding: '0.5rem 1rem', cursor: selectedChildId ? 'pointer' : 'not-allowed' }}
|
||||
>
|
||||
Hämta från Försäkringskassan
|
||||
</button>
|
||||
<div style={{ display: 'flex', gap: '10px' }}>
|
||||
<button
|
||||
onClick={handleFetchFK}
|
||||
disabled={!selectedChildId}
|
||||
style={{ padding: '0.5rem 1rem', cursor: selectedChildId ? 'pointer' : 'not-allowed' }}
|
||||
>
|
||||
Hämta från Försäkringskassan
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setShowManualFetchModal(true)}
|
||||
disabled={!selectedChildId}
|
||||
style={{ padding: '0.5rem 1rem', cursor: selectedChildId ? 'pointer' : 'not-allowed' }}
|
||||
>
|
||||
Ange uppgifter manuellt
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="dashboard__section">
|
||||
@@ -199,6 +250,14 @@ export function Dashboard(): ReactNode {
|
||||
isRunning={scraper.isRunning}
|
||||
onCancel={scraper.cancel}
|
||||
/>
|
||||
|
||||
<ManualFetchModal
|
||||
isOpen={showManualFetchModal}
|
||||
onSave={handleSaveManualFetch}
|
||||
onClose={() => setShowManualFetchModal(false)}
|
||||
isSaving={isManualFetchSaving}
|
||||
error={manualFetchError}
|
||||
/>
|
||||
</div>
|
||||
</Layout>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user