feat: Enhance Dataset Edit Page with Unsaved Changes Indicator and Improved Structure
Some checks failed
build.yaml / feat: Enhance Dataset Edit Page with Unsaved Changes Indicator and Improved Structure (push) Failing after 0s
Some checks failed
build.yaml / feat: Enhance Dataset Edit Page with Unsaved Changes Indicator and Improved Structure (push) Failing after 0s
- Added a progress indicator for unsaved changes at the top of the dataset edit page. - Enhanced the title section with a dataset status badge and improved layout. - Introduced collapsible sections for better organization of form fields. - Improved notifications for success/error messages. - Refactored form fields into distinct sections: Basic Information, Licenses, Titles, Descriptions, Creators & Contributors, Additional Metadata, Geographic Coverage, and Files. - Enhanced loading spinner with a more visually appealing overlay. - Added new project validation logic in the backend with create and update validators.
This commit is contained in:
parent
f39fe75340
commit
3d8f2354cb
9 changed files with 863 additions and 625 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { usePage } from '@inertiajs/vue3';
|
||||
import { mdiAccountKey, mdiSquareEditOutline, mdiAlertBoxOutline } from '@mdi/js';
|
||||
import { Head, usePage } from '@inertiajs/vue3';
|
||||
import { mdiLicense, mdiCheckCircle, mdiCloseCircle, mdiAlertBoxOutline } from '@mdi/js';
|
||||
import { computed, ComputedRef } from 'vue';
|
||||
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
|
||||
import SectionMain from '@/Components/SectionMain.vue';
|
||||
|
|
@ -9,107 +9,150 @@ import BaseButton from '@/Components/BaseButton.vue';
|
|||
import CardBox from '@/Components/CardBox.vue';
|
||||
import BaseButtons from '@/Components/BaseButtons.vue';
|
||||
import NotificationBar from '@/Components/NotificationBar.vue';
|
||||
// import Pagination from '@/Components/Admin/Pagination.vue';
|
||||
// import Sort from '@/Components/Admin/Sort.vue';
|
||||
import { stardust } from '@eidellev/adonis-stardust/client';
|
||||
// import CardBoxModal from '@/Components/CardBoxModal.vue';
|
||||
|
||||
// const isModalDangerActive = ref(false);
|
||||
// const deleteId = ref();
|
||||
interface License {
|
||||
id: number;
|
||||
name: string;
|
||||
sort_order: number;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
licenses: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
type: Array<License>,
|
||||
default: () => [],
|
||||
},
|
||||
// filters: {
|
||||
// type: Object,
|
||||
// default: () => ({}),
|
||||
// },
|
||||
can: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const flash: ComputedRef<any> = computed(() => {
|
||||
// let test = usePage();
|
||||
// console.log(test);
|
||||
return usePage().props.flash;
|
||||
});
|
||||
const flash: ComputedRef<any> = computed(() => usePage().props.flash);
|
||||
|
||||
const licenseCount = computed(() => props.licenses.length);
|
||||
|
||||
const getLicenseColor = (index: number) => {
|
||||
const colors = [
|
||||
'bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-300',
|
||||
'bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-300',
|
||||
'bg-violet-100 text-violet-800 dark:bg-violet-900 dark:text-violet-300',
|
||||
'bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-300',
|
||||
'bg-rose-100 text-rose-800 dark:bg-rose-900 dark:text-rose-300',
|
||||
'bg-cyan-100 text-cyan-800 dark:bg-cyan-900 dark:text-cyan-300',
|
||||
];
|
||||
return colors[index % colors.length];
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<LayoutAuthenticated>
|
||||
|
||||
<Head title="Licenses" />
|
||||
<SectionMain>
|
||||
<SectionTitleLineWithButton :icon="mdiAccountKey" title="Licenses" main>
|
||||
<!-- <BaseButton
|
||||
v-if="can.create"
|
||||
:route-name="stardust.route('settings.role.create')"
|
||||
:icon="mdiPlus"
|
||||
label="Add"
|
||||
color="info"
|
||||
rounded-full
|
||||
small
|
||||
/> -->
|
||||
<SectionTitleLineWithButton :icon="mdiLicense" title="Licenses" main>
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="text-sm text-gray-500 dark:text-gray-400 font-medium">
|
||||
{{ licenseCount }} {{ licenseCount === 1 ? 'license' : 'licenses' }}
|
||||
</span>
|
||||
</div>
|
||||
</SectionTitleLineWithButton>
|
||||
|
||||
<NotificationBar v-if="flash.message" color="success" :icon="mdiAlertBoxOutline">
|
||||
{{ flash.message }}
|
||||
</NotificationBar>
|
||||
|
||||
<CardBox class="mb-6" has-table>
|
||||
</CardBox>
|
||||
<CardBox class="mb-6" has-form-data>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<!-- <Sort label="Name" attribute="name" /> -->
|
||||
Name
|
||||
</th>
|
||||
<th>
|
||||
<!-- <Sort label="Sort Order" attribute="sort_order" /> -->
|
||||
Sort Order
|
||||
</th>
|
||||
<th>Name</th>
|
||||
<th>Sort Order</th>
|
||||
<th>Status</th>
|
||||
<th v-if="can.edit">Actions</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr v-for="license in licenses" :key="license.id">
|
||||
<tr v-if="licenses.length === 0">
|
||||
<td colspan="4" class="text-center py-12">
|
||||
<div class="flex flex-col items-center justify-center text-gray-500 dark:text-gray-400">
|
||||
<p class="text-lg font-medium mb-2">No licenses found</p>
|
||||
<p class="text-sm">Licenses will appear here once configured</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="(license, index) in licenses"
|
||||
:key="license.id"
|
||||
class="hover:bg-gray-50 dark:hover:bg-slate-800 transition-colors"
|
||||
>
|
||||
<td data-label="Name">
|
||||
<!-- <Link
|
||||
:href="stardust.route('settings.role.show', [role.id])"
|
||||
class="no-underline hover:underline text-cyan-600 dark:text-cyan-400"
|
||||
<span
|
||||
class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium transition-all hover:shadow-md"
|
||||
:class="getLicenseColor(index)"
|
||||
>
|
||||
{{ license.name }}
|
||||
</Link> -->
|
||||
{{ license.name }}
|
||||
</span>
|
||||
</td>
|
||||
<td data-label="Description">
|
||||
{{ license.sort_order }}
|
||||
<td data-label="Sort Order">
|
||||
<span
|
||||
class="inline-flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 dark:bg-slate-700 text-gray-700 dark:text-gray-300 font-semibold text-sm"
|
||||
>
|
||||
{{ license.sort_order }}
|
||||
</span>
|
||||
</td>
|
||||
<td data-label="Status">
|
||||
<span
|
||||
v-if="license.active"
|
||||
class="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"
|
||||
>
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
Active
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
class="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300"
|
||||
>
|
||||
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
Inactive
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td v-if="can.edit" class="before:hidden lg:w-1 whitespace-nowrap">
|
||||
<BaseButtons type="justify-start lg:justify-end" no-wrap>
|
||||
<BaseButton v-if="license.active"
|
||||
<BaseButton
|
||||
v-if="license.active"
|
||||
:route-name="stardust.route('settings.license.down', [license.id])"
|
||||
color="warning" :icon="mdiSquareEditOutline" label="deactivate" small />
|
||||
<BaseButton v-else :route-name="stardust.route('settings.license.up', [license.id])"
|
||||
color="success" :icon="mdiSquareEditOutline" label="activate" small />
|
||||
color="warning"
|
||||
:icon="mdiCloseCircle"
|
||||
label="Deactivate"
|
||||
small
|
||||
/>
|
||||
<BaseButton
|
||||
v-else
|
||||
:route-name="stardust.route('settings.license.up', [license.id])"
|
||||
color="success"
|
||||
:icon="mdiCheckCircle"
|
||||
label="Activate"
|
||||
small
|
||||
/>
|
||||
</BaseButtons>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <div class="py-4">
|
||||
<Pagination v-bind:data="roles.meta" />
|
||||
</div> -->
|
||||
</CardBox>
|
||||
</SectionMain>
|
||||
</LayoutAuthenticated>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue