From 8526354052b755926b645829a181cac72f64b8f2 Mon Sep 17 00:00:00 2001 From: jnzioka <nziokajohn254@gmail.com> Date: Wed, 10 Jan 2024 17:58:28 +0300 Subject: [PATCH] cleanup --- main/app/Http/Controllers/Dashboard/BallotController.php | 2 +- .../Dashboard/Ballots/Services/admin-ballot-service.ts | 2 +- .../js/Pages/Dashboard/Snapshot/Partials/SnapshotPicker.vue | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main/app/Http/Controllers/Dashboard/BallotController.php b/main/app/Http/Controllers/Dashboard/BallotController.php index 66fe0f8..271b9aa 100755 --- a/main/app/Http/Controllers/Dashboard/BallotController.php +++ b/main/app/Http/Controllers/Dashboard/BallotController.php @@ -114,7 +114,7 @@ public function view(Ballot $ballot) return Inertia::render( 'Dashboard/Ballots/View', [ 'crumbs' => $crumbs, - 'ballot' => BallotData::from($ballot->load('questions.choices')), + 'ballot' => BallotData::from($ballot->load('questions.choices','snapshot')), ] ); } diff --git a/main/resources/js/Pages/Dashboard/Ballots/Services/admin-ballot-service.ts b/main/resources/js/Pages/Dashboard/Ballots/Services/admin-ballot-service.ts index a18ecb1..13ddddc 100644 --- a/main/resources/js/Pages/Dashboard/Ballots/Services/admin-ballot-service.ts +++ b/main/resources/js/Pages/Dashboard/Ballots/Services/admin-ballot-service.ts @@ -8,7 +8,7 @@ export default class AdminBallotService { public static async getBallotStatuses(): Promise<string[]> { return AdminService.getEnums('model-status'); } - public static async linkSnapshot(data: { ballot: number, snapshot: string}): Promise<boolean> { + public static async linkSnapshot(data: { ballot: string, snapshot: string}): Promise<boolean> { await axios.post(route('dashboard.ballots.snapshots.link', data), {}); return true; } diff --git a/main/resources/js/Pages/Dashboard/Snapshot/Partials/SnapshotPicker.vue b/main/resources/js/Pages/Dashboard/Snapshot/Partials/SnapshotPicker.vue index 1064956..f353a2a 100644 --- a/main/resources/js/Pages/Dashboard/Snapshot/Partials/SnapshotPicker.vue +++ b/main/resources/js/Pages/Dashboard/Snapshot/Partials/SnapshotPicker.vue @@ -7,7 +7,7 @@ <div class="w-full"> <Multiselect placeholder="Search for snapshot" noOptionsText="Try typing more chars" noResultsText="Try typing more chars" v-model="selectedRef" value-prop="hash" label="title" - mode="tags" @search-change="search" :closeOnSelect="true" :minChars="3" + mode="tags" @search-change="search" :closeOnSelect="true" :minChars="3" :max="1" :options="searchResults" :searchable="true" :classes="{ container: 'multiselect border border-lg px-1 py-2 flex-wrap w-full dark:bg-gray-900 dark:border-gray-900 rounded-t-xl', containerOpen: 'rounded-t-xl', @@ -64,10 +64,10 @@ let search = (search: string) => { let selectedRef: Ref<string | null> = ref(null); let addSnapshot = async () => { - if (!selectedRef.value?.[0] || !props.ballot?.id) return; + if (!selectedRef.value?.[0] || !props.ballot?.hash) return; const data = { snapshot: selectedRef.value?.[0], - ballot: props.ballot?.id, + ballot: props.ballot?.hash, } await AdminBallotService.linkSnapshot(data); AlertService.show(['Snapshot added successfully'], 'success'); -- GitLab