Arno Kaimbacher
49bd96ee77
Some checks failed
CI Pipeline / japa-tests (push) Failing after 1m8s
- **AdminuserController.ts**: enable editing `first_name` and `last_name` for user creation and updates - **MimetypeController.ts**: add creation support for mimetypes with selectable extensions - **Models**: add `Mimetype` model (mime_type.ts); add `SnakeCaseNamingStrategy` for User model - **Validators**: - **updateDatasetValidator**: increase title length to 255 and description length to 2500 - **User Validators**: refine `createUserValidator` and `updateUserValidator` to include `first_name` and `last_name` - **vanilla_error_reporter**: improve error reporting for wildcard fields - **SKOS Query**: refine keyword request in `SearchCategoryAutocomplete.vue` - **UI Enhancements**: - improve icon design in wizard (Wizard.vue) - add components for mimetype creation (Create.vue and button in Index.vue) - **Routes**: update `routes.ts` to include new AdonisJS routes
156 lines
6.7 KiB
Vue
156 lines
6.7 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from 'vue';
|
|
import { Head, useForm, router } from '@inertiajs/vue3';
|
|
import { mdiAccountKey, mdiArrowLeftBoldOutline } from '@mdi/js';
|
|
import LayoutAuthenticated from '@/Layouts/LayoutAuthenticated.vue';
|
|
import SectionMain from '@/Components/SectionMain.vue';
|
|
import SectionTitleLineWithButton from '@/Components/SectionTitleLineWithButton.vue';
|
|
import CardBox from '@/Components/CardBox.vue';
|
|
import FormField from '@/Components/FormField.vue';
|
|
import FormControl from '@/Components/FormControl.vue';
|
|
import FormCheckRadioGroup from '@/Components/FormCheckRadioGroup.vue';
|
|
import BaseDivider from '@/Components/BaseDivider.vue';
|
|
import BaseButton from '@/Components/BaseButton.vue';
|
|
import BaseButtons from '@/Components/BaseButtons.vue';
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
|
// import { Inertia } from '@inertiajs/inertia';
|
|
import passwordMeter from '@/Components/SimplePasswordMeter/password-meter.vue';
|
|
|
|
const enabled = ref(false);
|
|
const handleScore = (score: number) => {
|
|
if (score == 4){
|
|
enabled.value = true;
|
|
} else {
|
|
enabled.value = false;
|
|
}
|
|
};
|
|
|
|
const props = defineProps({
|
|
roles: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
errors: {
|
|
type: Object,
|
|
default: () => ({}),
|
|
},
|
|
});
|
|
|
|
const form = useForm({
|
|
login: '',
|
|
first_name: '',
|
|
last_name: '',
|
|
email: '',
|
|
password: '',
|
|
password_confirmation: '',
|
|
roles: [],
|
|
});
|
|
|
|
const submit = async () => {
|
|
await router.post(stardust.route('settings.user.store'), form);
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<LayoutAuthenticated>
|
|
<Head title="Add user" />
|
|
<SectionMain>
|
|
<SectionTitleLineWithButton :icon="mdiAccountKey" title="Add user" main>
|
|
<BaseButton
|
|
:route-name="stardust.route('settings.user.index')"
|
|
:icon="mdiArrowLeftBoldOutline"
|
|
label="Back"
|
|
color="modern"
|
|
rounded-full
|
|
small
|
|
/>
|
|
</SectionTitleLineWithButton>
|
|
<!-- @submit.prevent="form.post(stardust.route('settings.user.store'))" -->
|
|
<CardBox form @submit.prevent="submit()">
|
|
<FormField label="Login" :class="{ 'text-red-400': errors.login }">
|
|
<FormControl v-model="form.login" type="text" placeholder="Enter Login" :errors="errors.login">
|
|
<div class="text-red-400 text-sm" v-if="errors.login && Array.isArray(errors.login)">
|
|
<!-- {{ errors.login }} -->
|
|
{{ errors.login.join(', ') }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<FormField label="First Name" :class="{ 'text-red-400': errors.first_name }">
|
|
<FormControl v-model="form.first_name" type="text" placeholder="Enter First Name" :errors="errors.first_name">
|
|
<div class="text-red-400 text-sm" v-if="errors.first_name && Array.isArray(errors.first_name)">
|
|
{{ errors.first_name.join(', ') }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<FormField label="Last Name" :class="{ 'text-red-400': errors.last_name }">
|
|
<FormControl v-model="form.last_name" type="text" placeholder="Enter Last Name" :errors="errors.last_name">
|
|
<div class="text-red-400 text-sm" v-if="errors.last_name && Array.isArray(errors.last_name)">
|
|
{{ errors.last_name.join(', ') }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<FormField label="Email" :class="{ 'text-red-400': errors.email }">
|
|
<FormControl v-model="form.email" type="text" placeholder="Enter Email" :errors="errors.email">
|
|
<div class="text-red-400 text-sm" v-if="errors.email && Array.isArray(errors.email)">
|
|
<!-- {{ errors.email }} -->
|
|
{{ errors.email.join(', ') }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<FormField label="Password" :class="{ 'text-red-400': errors.password }">
|
|
<FormControl v-model="form.password" type="password" placeholder="Enter Password" :errors="errors.password">
|
|
<div class="text-red-400 text-sm" v-if="errors.password && Array.isArray(errors.password)">
|
|
<!-- {{ errors.password }} -->
|
|
{{ errors.password.join(', ') }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
<password-meter :password="form.password" @score="handleScore" />
|
|
|
|
<FormField label="Password Confirmation" :class="{ 'text-red-400': errors.password_confirmation }">
|
|
<FormControl
|
|
v-model="form.password_confirmation"
|
|
type="password"
|
|
placeholder="Enter Password Confirmation"
|
|
:errors="errors.password"
|
|
>
|
|
<div
|
|
class="text-red-400 text-sm"
|
|
v-if="errors.password_confirmation && Array.isArray(errors.password_confirmation)"
|
|
>
|
|
<!-- {{ errors.password_confirmation }} -->
|
|
{{ errors.password_confirmation.join(', ') }}
|
|
</div>
|
|
</FormControl>
|
|
</FormField>
|
|
|
|
<BaseDivider />
|
|
|
|
<FormField label="Roles" wrap-body :class="{ 'text-red-400': errors.roles }">
|
|
<FormCheckRadioGroup v-model="form.roles" name="roles" is-column :options="props.roles" />
|
|
</FormField>
|
|
<div class="text-red-400 text-sm" v-if="errors.roles && Array.isArray(errors.roles)">
|
|
<!-- {{ errors.password_confirmation }} -->
|
|
{{ errors.roles.join(', ') }}
|
|
</div>
|
|
|
|
<template #footer>
|
|
<BaseButtons>
|
|
<BaseButton
|
|
type="submit"
|
|
color="info"
|
|
label="Submit"
|
|
:class="{ 'opacity-25': form.processing }"
|
|
:disabled="form.processing == true || enabled == false"
|
|
/>
|
|
</BaseButtons>
|
|
</template>
|
|
</CardBox>
|
|
</SectionMain>
|
|
</LayoutAuthenticated>
|
|
</template>
|