From d559d16977e7f321236c7c2747dd7ca7430e33e1 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sun, 5 Jan 2025 01:18:36 +0400 Subject: [PATCH] Replaced simple button with checkbox for profile activity --- .../features/maintenance/[id]/+page.svelte | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/routes/features/maintenance/[id]/+page.svelte b/src/routes/features/maintenance/[id]/+page.svelte index a469331..3ad416a 100644 --- a/src/routes/features/maintenance/[id]/+page.svelte +++ b/src/routes/features/maintenance/[id]/+page.svelte @@ -5,18 +5,18 @@ import {goto} from "$app/navigation"; import {activeProfileStore, maintenanceProfilesStore} from "$stores/maintenance-profiles-store.js"; import ProfileView from "$components/maintenance/ProfileView.svelte"; + import MenuCheckboxItem from "$components/ui/menu/MenuCheckboxItem.svelte"; const profileId = $page.params.id; /** @type {import('$entities/MaintenanceProfile.ts').default|null} */ let profile = null; - let isActiveProfile = false; - if (profileId === 'new') { + if (profileId==='new') { goto('/maintenance/profiles/new/edit'); } $: { - const resolvedProfile = $maintenanceProfilesStore.find(profile => profile.id === profileId); + const resolvedProfile = $maintenanceProfilesStore.find(profile => profile.id===profileId); if (resolvedProfile) { profile = resolvedProfile; @@ -26,14 +26,16 @@ } } - $: isActiveProfile = $activeProfileStore === profileId; + let isActiveProfile = $activeProfileStore===profileId; - function activateProfile() { - if (isActiveProfile) { - return; + $: { + if (isActiveProfile && $activeProfileStore!==profileId) { + $activeProfileStore = profileId; } - $activeProfileStore = profileId; + if (!isActiveProfile && $activeProfileStore===profileId) { + $activeProfileStore = null; + } } @@ -47,13 +49,9 @@
Edit Profile - - {#if isActiveProfile} - Profile is Active - {:else} - Activate Profile - {/if} - + + Activate Profile + Export Profile