This commit is contained in:
Geriano
2022-07-31 10:36:50 +07:00
parent 70e779c8a4
commit 63ab66b06c
4 changed files with 400 additions and 392 deletions

View File

@@ -159,130 +159,130 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</div>
</template>
</Card>
</DashboardLayout>
<Modal :show="open">
<form @submit.prevent="submit" class="w-full max-w-xl sm:max-w-5xl h-fit rounded-md shadow-xl">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100">
<Modal :show="open">
<form @submit.prevent="submit" class="w-full max-w-xl sm:max-w-5xl h-fit rounded-md shadow-xl">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100">
<template #header>
<div class="flex items-center space-x-2 p-2 justify-end bg-gray-200 dark:bg-gray-800">
<Close @click.prevent="close" />
</div>
</template>
<template #body>
<div class="flex flex-col space-y-2 p-4">
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="name" class="lowercase first-letter:capitalize w-1/3">name</label>
<Input v-model="form.name" type="text" name="name" placeholder="name" required autofocus />
</div>
<InputError :error="form.errors.name" />
</div>
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="route_or_url" class="lowercase first-letter:capitalize w-1/3">route name or url</label>
<Select
v-model="form.route_or_url"
:options="routes"
:searchable="true"
:createOption="true"
:value="form.route_or_url"
ref="route_or_url"
class="text-gray-800 placeholder:capitalize"
placeholder="route name or url" />
</div>
<InputError :error="form.errors.route_or_url" />
</div>
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="actives" class="lowercase first-letter:capitalize w-1/3">actives</label>
<Select
v-model="form.actives"
:options="[...routes, ...form.actives.filter(active => ! routes.includes(active))]"
:searchable="true"
:closeOnSelect="false"
:clearOnSelect="false"
:createTag="true"
mode="tags"
ref="actives"
class="text-gray-800 placeholder:capitalize"
placeholder="actives" />
</div>
<InputError :error="form.errors.actives" />
</div>
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="permissions" class="lowercase first-letter:capitalize w-1/3">permissions</label>
<Select
v-model="form.permissions"
:options="permissions.map(p => ({
label: p.name,
value: p.id,
}))"
:searchable="true"
:closeOnSelect="false"
:clearOnSelect="false"
mode="tags"
ref="permissions"
class="text-gray-800 placeholder:capitalize"
placeholder="permissions" />
</div>
<InputError :error="form.errors.permissions" />
</div>
<div class="flex items-center space-x-2">
<label class="flex-none lowercase first-letter:capitalize w-1/4">icon</label>
<div class="flex items-center justify-between w-full">
<p class="text-3xl">
<Icon :name="form.icon" class="dark:text-white" />
</p>
<p class="text-sm uppercase">{{ form.icon }}</p>
<ButtonBlue @click.prevent="icon = true" type="button">
<Icon name="edit" />
<p class="uppercase font-semibold">change</p>
</ButtonBlue>
</div>
</div>
</div>
</template>
<template #footer>
<div class="flex items-center justify-end space-x-2 bg-gray-200 dark:bg-gray-800 py-1 px-2">
<ButtonGreen type="submit">
<Icon name="check" />
<p class="uppercase font-semibold">{{ form.id ? 'update' : 'create' }}</p>
</ButtonGreen>
</div>
</template>
</Card>
</form>
</Modal>
<Modal :show="icon">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100 w-full max-w-xl sm:max-w-5xl max-h-96 overflow-auto">
<template #header>
<div class="flex items-center space-x-2 p-2 justify-end bg-gray-200 dark:bg-gray-800">
<Close @click.prevent="close" />
<div class="flex items-center space-x-2 p-2 justify-end bg-gray-200 dark:bg-gray-800 sticky top-0 left-0">
<input type="search" v-model="search" class="py-1 w-full bg-white dark:bg-transparent rounded-md text-sm uppercase" placeholder="search something">
<Icon @click.prevent="icon = false" name="times" class="px-2 py-1 bg-gray-300 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-md transition-all cursor-pointer" />
</div>
</template>
<template #body>
<div class="flex flex-col space-y-2 p-4">
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="name" class="lowercase first-letter:capitalize w-1/3">name</label>
<Input v-model="form.name" type="text" name="name" placeholder="name" required autofocus />
</div>
<InputError :error="form.errors.name" />
</div>
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="route_or_url" class="lowercase first-letter:capitalize w-1/3">route name or url</label>
<Select
v-model="form.route_or_url"
:options="routes"
:searchable="true"
:createOption="true"
:value="form.route_or_url"
ref="route_or_url"
class="text-gray-800 placeholder:capitalize"
placeholder="route name or url" />
</div>
<InputError :error="form.errors.route_or_url" />
</div>
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="actives" class="lowercase first-letter:capitalize w-1/3">actives</label>
<Select
v-model="form.actives"
:options="[...routes, ...form.actives.filter(active => ! routes.includes(active))]"
:searchable="true"
:closeOnSelect="false"
:clearOnSelect="false"
:createTag="true"
mode="tags"
ref="actives"
class="text-gray-800 placeholder:capitalize"
placeholder="actives" />
</div>
<InputError :error="form.errors.actives" />
</div>
<div class="flex flex-col space-y-1">
<div class="flex items-center space-x-2">
<label for="permissions" class="lowercase first-letter:capitalize w-1/3">permissions</label>
<Select
v-model="form.permissions"
:options="permissions.map(p => ({
label: p.name,
value: p.id,
}))"
:searchable="true"
:closeOnSelect="false"
:clearOnSelect="false"
mode="tags"
ref="permissions"
class="text-gray-800 placeholder:capitalize"
placeholder="permissions" />
</div>
<InputError :error="form.errors.permissions" />
</div>
<div class="flex items-center space-x-2">
<label class="flex-none lowercase first-letter:capitalize w-1/4">icon</label>
<div class="flex items-center justify-between w-full">
<p class="text-3xl">
<Icon :name="form.icon" class="dark:text-white" />
</p>
<p class="text-sm uppercase">{{ form.icon }}</p>
<ButtonBlue @click.prevent="icon = true" type="button">
<Icon name="edit" />
<p class="uppercase font-semibold">change</p>
</ButtonBlue>
</div>
</div>
</div>
</template>
<template #footer>
<div class="flex items-center justify-end space-x-2 bg-gray-200 dark:bg-gray-800 py-1 px-2">
<ButtonGreen type="submit">
<Icon name="check" />
<p class="uppercase font-semibold">{{ form.id ? 'update' : 'create' }}</p>
</ButtonGreen>
<div class="flex-wrap p-4">
<Icon v-for="(icx, i) in icons.filter(icx => icx.includes(search.trim().toLocaleLowerCase()))" :key="i" @click.prevent="form.icon = icx; icon = false" :name="icx" class="m-1 text-5xl px-2 py-1 text-gray-800 bg-gray-200 hover:bg-gray-100 dark:text-white dark:bg-gray-600 dark:hover:bg-gray-700 rounded-md cursor-pointer transition-all" />
</div>
</template>
</Card>
</form>
</Modal>
<Modal :show="icon">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100 w-full max-w-xl sm:max-w-5xl max-h-96 overflow-auto">
<template #header>
<div class="flex items-center space-x-2 p-2 justify-end bg-gray-200 dark:bg-gray-800 sticky top-0 left-0">
<input type="search" v-model="search" class="py-1 w-full bg-white dark:bg-transparent rounded-md text-sm uppercase" placeholder="search something">
<Icon @click.prevent="icon = false" name="times" class="px-2 py-1 bg-gray-300 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-md transition-all cursor-pointer" />
</div>
</template>
<template #body>
<div class="flex-wrap p-4">
<Icon v-for="(icx, i) in icons.filter(icx => icx.includes(search.trim().toLocaleLowerCase()))" :key="i" @click.prevent="form.icon = icx; icon = false" :name="icx" class="m-1 text-5xl px-2 py-1 text-gray-800 bg-gray-200 hover:bg-gray-100 dark:text-white dark:bg-gray-600 dark:hover:bg-gray-700 rounded-md cursor-pointer transition-all" />
</div>
</template>
</Card>
</Modal>
</Modal>
</DashboardLayout>
</template>