add nova
This commit is contained in:
13
nova/resources/js/pages/AppError.vue
Normal file
13
nova/resources/js/pages/AppError.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<CustomAppError />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Guest from '@/layouts/Guest'
|
||||
|
||||
export default {
|
||||
name: 'AppErrorPage',
|
||||
|
||||
layout: Guest,
|
||||
}
|
||||
</script>
|
||||
54
nova/resources/js/pages/Attach.vue
Normal file
54
nova/resources/js/pages/Attach.vue
Normal file
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<AttachResource
|
||||
:resource-name="resourceName"
|
||||
:resource-id="resourceId"
|
||||
:related-resource-name="relatedResourceName"
|
||||
:via-resource="viaResource"
|
||||
:via-resource-id="viaResourceId"
|
||||
:parent-resource="parentResource"
|
||||
:via-relationship="viaRelationship"
|
||||
:polymorphic="polymorphic"
|
||||
:form-unique-id="formUniqueId"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { uid } from 'uid/single'
|
||||
|
||||
export default {
|
||||
name: 'Attach',
|
||||
|
||||
props: {
|
||||
resourceName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
resourceId: {
|
||||
required: true,
|
||||
},
|
||||
relatedResourceName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
viaResource: {
|
||||
default: '',
|
||||
},
|
||||
viaResourceId: {
|
||||
default: '',
|
||||
},
|
||||
parentResource: {
|
||||
type: Object,
|
||||
},
|
||||
viaRelationship: {
|
||||
default: '',
|
||||
},
|
||||
polymorphic: {
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
formUniqueId: uid(),
|
||||
}),
|
||||
}
|
||||
</script>
|
||||
29
nova/resources/js/pages/Create.vue
Normal file
29
nova/resources/js/pages/Create.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<template>
|
||||
<ResourceCreate
|
||||
:resource-name="resourceName"
|
||||
:via-resource="viaResource"
|
||||
:via-resource-id="viaResourceId"
|
||||
:via-relationship="viaRelationship"
|
||||
mode="form"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapProps } from '@/mixins'
|
||||
import ResourceCreate from '@/views/Create'
|
||||
|
||||
export default {
|
||||
name: 'Create',
|
||||
|
||||
components: {
|
||||
ResourceCreate,
|
||||
},
|
||||
|
||||
props: mapProps([
|
||||
'resourceName',
|
||||
'viaResource',
|
||||
'viaResourceId',
|
||||
'viaRelationship',
|
||||
]),
|
||||
}
|
||||
</script>
|
||||
23
nova/resources/js/pages/Dashboard.vue
Normal file
23
nova/resources/js/pages/Dashboard.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<DashboardView :name="name" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DashboardView from '@/views/Dashboard'
|
||||
|
||||
export default {
|
||||
name: 'Dashboard',
|
||||
|
||||
components: {
|
||||
DashboardView,
|
||||
},
|
||||
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'main',
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
18
nova/resources/js/pages/Detail.vue
Normal file
18
nova/resources/js/pages/Detail.vue
Normal file
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<ResourceDetail
|
||||
:resourceName="resourceName"
|
||||
:resourceId="resourceId"
|
||||
:shouldOverrideMeta="true"
|
||||
:shouldEnableShortcut="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapProps } from '@/mixins'
|
||||
|
||||
export default {
|
||||
name: 'Detail',
|
||||
|
||||
props: mapProps(['resourceName', 'resourceId']),
|
||||
}
|
||||
</script>
|
||||
13
nova/resources/js/pages/Error403.vue
Normal file
13
nova/resources/js/pages/Error403.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<CustomError403 />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Guest from '@/layouts/Guest'
|
||||
|
||||
export default {
|
||||
name: 'Error403Page',
|
||||
|
||||
layout: Guest,
|
||||
}
|
||||
</script>
|
||||
13
nova/resources/js/pages/Error404.vue
Normal file
13
nova/resources/js/pages/Error404.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<CustomError404 />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Guest from '@/layouts/Guest'
|
||||
|
||||
export default {
|
||||
name: 'Error404Page',
|
||||
|
||||
layout: Guest,
|
||||
}
|
||||
</script>
|
||||
88
nova/resources/js/pages/ForgotPassword.vue
Normal file
88
nova/resources/js/pages/ForgotPassword.vue
Normal file
@@ -0,0 +1,88 @@
|
||||
<template>
|
||||
<LoadingView :loading="false">
|
||||
<Head :title="__('Forgot Password')" />
|
||||
|
||||
<form
|
||||
@submit.prevent="attempt"
|
||||
class="bg-white dark:bg-gray-800 shadow rounded-lg p-8 w-[25rem] mx-auto"
|
||||
>
|
||||
<h2 class="text-2xl text-center font-normal mb-6">
|
||||
{{ __('Forgot your password?') }}
|
||||
</h2>
|
||||
|
||||
<DividerLine />
|
||||
|
||||
<div class="mb-6">
|
||||
<label class="block mb-2" for="email">{{ __('Email Address') }}</label>
|
||||
<input
|
||||
v-model="form.email"
|
||||
class="form-control form-input form-control-bordered w-full"
|
||||
:class="{ 'form-control-bordered-error': form.errors.has('email') }"
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
required=""
|
||||
autofocus=""
|
||||
/>
|
||||
|
||||
<HelpText class="mt-2 text-red-500" v-if="form.errors.has('email')">
|
||||
{{ form.errors.first('email') }}
|
||||
</HelpText>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
class="w-full flex justify-center"
|
||||
type="submit"
|
||||
:loading="form.processing"
|
||||
>
|
||||
{{ __('Send Password Reset Link') }}
|
||||
</Button>
|
||||
</form>
|
||||
</LoadingView>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Auth from '@/layouts/Auth'
|
||||
import { Button } from 'laravel-nova-ui'
|
||||
|
||||
export default {
|
||||
layout: Auth,
|
||||
|
||||
components: {
|
||||
Button,
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
form: Nova.form({
|
||||
email: '',
|
||||
}),
|
||||
}),
|
||||
|
||||
methods: {
|
||||
async attempt() {
|
||||
const { message } = await this.form.post(Nova.url('/password/email'))
|
||||
|
||||
Nova.$toasted.show(message, {
|
||||
action: {
|
||||
onClick: () => Nova.redirectToLogin(),
|
||||
text: this.__('Reload'),
|
||||
},
|
||||
duration: null,
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
setTimeout(() => Nova.redirectToLogin(), 5000)
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
supportsPasswordReset() {
|
||||
return Nova.config('withPasswordReset')
|
||||
},
|
||||
|
||||
forgotPasswordPath() {
|
||||
return Nova.config('forgotPasswordPath')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
17
nova/resources/js/pages/Index.vue
Normal file
17
nova/resources/js/pages/Index.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<ResourceIndex
|
||||
:resourceName="resourceName"
|
||||
:shouldOverrideMeta="true"
|
||||
:shouldEnableShortcut="true"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapProps } from '@/mixins'
|
||||
|
||||
export default {
|
||||
name: 'Index',
|
||||
|
||||
props: mapProps(['resourceName']),
|
||||
}
|
||||
</script>
|
||||
34
nova/resources/js/pages/Lens.vue
Normal file
34
nova/resources/js/pages/Lens.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<ResourceLens
|
||||
:resourceName="resourceName"
|
||||
:lens="lens"
|
||||
:searchable="searchable"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapProps } from '@/mixins'
|
||||
import ResourceLens from '@/views/Lens'
|
||||
|
||||
export default {
|
||||
name: 'Lens',
|
||||
|
||||
components: {
|
||||
ResourceLens,
|
||||
},
|
||||
|
||||
props: {
|
||||
lens: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
|
||||
searchable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
...mapProps(['resourceName']),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
144
nova/resources/js/pages/Login.vue
Normal file
144
nova/resources/js/pages/Login.vue
Normal file
@@ -0,0 +1,144 @@
|
||||
<template>
|
||||
<div>
|
||||
<Head :title="__('Log In')" />
|
||||
|
||||
<form
|
||||
@submit.prevent="attempt"
|
||||
class="bg-white dark:bg-gray-800 shadow rounded-lg p-8 max-w-[25rem] mx-auto"
|
||||
>
|
||||
<h2 class="text-2xl text-center font-normal mb-6">
|
||||
{{ __('Welcome Back!') }}
|
||||
</h2>
|
||||
|
||||
<DividerLine />
|
||||
|
||||
<div class="mb-6">
|
||||
<label class="block mb-2" for="email">{{ __('Email Address') }}</label>
|
||||
<input
|
||||
v-model="form.email"
|
||||
class="form-control form-input form-control-bordered w-full"
|
||||
:class="{ 'form-control-bordered-error': form.errors.has('email') }"
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
autofocus=""
|
||||
required
|
||||
/>
|
||||
|
||||
<HelpText class="mt-2 text-red-500" v-if="form.errors.has('email')">
|
||||
{{ form.errors.first('email') }}
|
||||
</HelpText>
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
<label class="block mb-2" for="password">{{ __('Password') }}</label>
|
||||
<input
|
||||
v-model="form.password"
|
||||
class="form-control form-input form-control-bordered w-full"
|
||||
:class="{
|
||||
'form-control-bordered-error': form.errors.has('password'),
|
||||
}"
|
||||
id="password"
|
||||
type="password"
|
||||
name="password"
|
||||
required
|
||||
/>
|
||||
|
||||
<HelpText class="mt-2 text-red-500" v-if="form.errors.has('password')">
|
||||
{{ form.errors.first('password') }}
|
||||
</HelpText>
|
||||
</div>
|
||||
|
||||
<div class="flex mb-6">
|
||||
<Checkbox
|
||||
@change="() => (form.remember = !form.remember)"
|
||||
:model-value="form.remember"
|
||||
dusk="remember-button"
|
||||
:label="__('Remember me')"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="supportsPasswordReset || forgotPasswordPath !== false"
|
||||
class="ml-auto"
|
||||
>
|
||||
<Link
|
||||
v-if="forgotPasswordPath === false"
|
||||
:href="$url('/password/reset')"
|
||||
class="text-gray-500 font-bold no-underline"
|
||||
v-text="__('Forgot your password?')"
|
||||
/>
|
||||
<a
|
||||
v-else
|
||||
:href="forgotPasswordPath"
|
||||
class="text-gray-500 font-bold no-underline"
|
||||
v-text="__('Forgot your password?')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
class="w-full flex justify-center"
|
||||
type="submit"
|
||||
:loading="form.processing"
|
||||
>
|
||||
<span>
|
||||
{{ __('Log In') }}
|
||||
</span>
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Auth from '@/layouts/Auth'
|
||||
import { Button, Checkbox } from 'laravel-nova-ui'
|
||||
|
||||
export default {
|
||||
name: 'LoginPage',
|
||||
|
||||
layout: Auth,
|
||||
|
||||
components: {
|
||||
Checkbox,
|
||||
Button,
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
form: Nova.form({
|
||||
email: '',
|
||||
password: '',
|
||||
remember: false,
|
||||
}),
|
||||
}),
|
||||
|
||||
methods: {
|
||||
async attempt() {
|
||||
try {
|
||||
const { redirect } = await this.form.post(Nova.url('/login'))
|
||||
|
||||
let path = { url: Nova.url('/'), remote: true }
|
||||
|
||||
if (redirect !== undefined && redirect !== null) {
|
||||
path = { url: redirect, remote: true }
|
||||
}
|
||||
|
||||
Nova.visit(path)
|
||||
} catch (error) {
|
||||
if (error.response?.status === 500) {
|
||||
Nova.error(this.__('There was a problem submitting the form.'))
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
supportsPasswordReset() {
|
||||
return Nova.config('withPasswordReset')
|
||||
},
|
||||
|
||||
forgotPasswordPath() {
|
||||
return Nova.config('forgotPasswordPath')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
28
nova/resources/js/pages/Replicate.vue
Normal file
28
nova/resources/js/pages/Replicate.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<CreateForm
|
||||
@resource-created="handleResourceCreated"
|
||||
@create-cancelled="handleCreateCancelled"
|
||||
mode="form"
|
||||
:resource-name="resourceName"
|
||||
:from-resource-id="resourceId"
|
||||
:via-resource="viaResource"
|
||||
:via-resource-id="viaResourceId"
|
||||
:via-relationship="viaRelationship"
|
||||
@update-form-status="onUpdateFormStatus"
|
||||
:should-override-meta="true"
|
||||
:form-unique-id="formUniqueId"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapProps } from '@/mixins'
|
||||
import ResourceCreate from '@/views/Create'
|
||||
|
||||
export default {
|
||||
name: 'Replicate',
|
||||
|
||||
extends: ResourceCreate,
|
||||
|
||||
props: mapProps(['resourceName', 'resourceId']),
|
||||
}
|
||||
</script>
|
||||
134
nova/resources/js/pages/ResetPassword.vue
Normal file
134
nova/resources/js/pages/ResetPassword.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<div>
|
||||
<Head :title="__('Reset Password')" />
|
||||
|
||||
<form
|
||||
@submit.prevent="attempt"
|
||||
class="bg-white dark:bg-gray-800 shadow rounded-lg p-8 w-[25rem] mx-auto"
|
||||
>
|
||||
<h2 class="text-2xl text-center font-normal mb-6">
|
||||
{{ __('Reset Password') }}
|
||||
</h2>
|
||||
|
||||
<DividerLine />
|
||||
|
||||
<div class="mb-6">
|
||||
<label class="block mb-2" for="email">{{ __('Email Address') }}</label>
|
||||
<input
|
||||
v-model="form.email"
|
||||
class="form-control form-input form-control-bordered w-full"
|
||||
:class="{ 'form-control-bordered-error': form.errors.has('email') }"
|
||||
id="email"
|
||||
type="email"
|
||||
name="email"
|
||||
required=""
|
||||
autofocus=""
|
||||
/>
|
||||
|
||||
<HelpText class="mt-2 text-red-500" v-if="form.errors.has('email')">
|
||||
{{ form.errors.first('email') }}
|
||||
</HelpText>
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
<label class="block mb-2" for="password">{{ __('Password') }}</label>
|
||||
<input
|
||||
v-model="form.password"
|
||||
class="form-control form-input form-control-bordered w-full"
|
||||
:class="{
|
||||
'form-control-bordered-error': form.errors.has('password'),
|
||||
}"
|
||||
id="password"
|
||||
type="password"
|
||||
name="password"
|
||||
required=""
|
||||
/>
|
||||
|
||||
<HelpText class="mt-2 text-red-500" v-if="form.errors.has('password')">
|
||||
{{ form.errors.first('password') }}
|
||||
</HelpText>
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
<label class="block mb-2" for="password_confirmation">{{
|
||||
__('Confirm Password')
|
||||
}}</label>
|
||||
<input
|
||||
v-model="form.password_confirmation"
|
||||
class="form-control form-input form-control-bordered w-full"
|
||||
:class="{
|
||||
'form-control-bordered-error': form.errors.has(
|
||||
'password_confirmation'
|
||||
),
|
||||
}"
|
||||
id="password_confirmation"
|
||||
type="password"
|
||||
name="password_confirmation"
|
||||
required=""
|
||||
/>
|
||||
|
||||
<HelpText
|
||||
class="mt-2 text-red-500"
|
||||
v-if="form.errors.has('password_confirmation')"
|
||||
>
|
||||
{{ form.errors.first('password_confirmation') }}
|
||||
</HelpText>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
class="w-full flex justify-center"
|
||||
type="submit"
|
||||
:loading="form.processing"
|
||||
>
|
||||
{{ __('Reset Password') }}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Cookies from 'js-cookie'
|
||||
import Auth from '@/layouts/Auth'
|
||||
import { Button } from 'laravel-nova-ui'
|
||||
|
||||
export default {
|
||||
layout: Auth,
|
||||
|
||||
components: {
|
||||
Button,
|
||||
},
|
||||
|
||||
props: ['email', 'token'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
form: Nova.form({
|
||||
email: this.email,
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
token: this.token,
|
||||
}),
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async attempt() {
|
||||
const { message } = await this.form.post(Nova.url('/password/reset'))
|
||||
const redirect = { url: Nova.url('/'), remote: true }
|
||||
|
||||
Cookies.set('token', Math.random().toString(36), { expires: 365 })
|
||||
|
||||
Nova.$toasted.show(message, {
|
||||
action: {
|
||||
onClick: () => Nova.visit(redirect),
|
||||
text: this.__('Reload'),
|
||||
},
|
||||
duration: null,
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
setTimeout(() => Nova.visit(redirect), 5000)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
36
nova/resources/js/pages/Update.vue
Normal file
36
nova/resources/js/pages/Update.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<ResourceUpdate
|
||||
:resource-name="resourceName"
|
||||
:resource-id="resourceId"
|
||||
:via-resource="viaResource"
|
||||
:via-resource-id="viaResourceId"
|
||||
:via-relationship="viaRelationship"
|
||||
:form-unique-id="formUniqueId"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapProps } from '@/mixins'
|
||||
import ResourceUpdate from '@/views/Update'
|
||||
import { uid } from 'uid/single'
|
||||
|
||||
export default {
|
||||
name: 'Update',
|
||||
|
||||
components: {
|
||||
ResourceUpdate,
|
||||
},
|
||||
|
||||
props: mapProps([
|
||||
'resourceName',
|
||||
'resourceId',
|
||||
'viaResource',
|
||||
'viaResourceId',
|
||||
'viaRelationship',
|
||||
]),
|
||||
|
||||
data: () => ({
|
||||
formUniqueId: uid(),
|
||||
}),
|
||||
}
|
||||
</script>
|
||||
62
nova/resources/js/pages/UpdateAttached.vue
Normal file
62
nova/resources/js/pages/UpdateAttached.vue
Normal file
@@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<UpdateAttachedResource
|
||||
:resource-name="resourceName"
|
||||
:resource-id="resourceId"
|
||||
:related-resource-name="relatedResourceName"
|
||||
:related-resource-id="relatedResourceId"
|
||||
:via-resource="viaResource"
|
||||
:via-resource-id="viaResourceId"
|
||||
:parent-resource="parentResource"
|
||||
:via-relationship="viaRelationship"
|
||||
:via-pivot-id="viaPivotId"
|
||||
:polymorphic="polymorphic"
|
||||
:form-unique-id="formUniqueId"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { uid } from 'uid/single'
|
||||
|
||||
export default {
|
||||
name: 'UpdateAttached',
|
||||
|
||||
props: {
|
||||
resourceName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
resourceId: {
|
||||
required: true,
|
||||
},
|
||||
relatedResourceName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
relatedResourceId: {
|
||||
required: true,
|
||||
},
|
||||
viaResource: {
|
||||
default: '',
|
||||
},
|
||||
viaResourceId: {
|
||||
default: '',
|
||||
},
|
||||
parentResource: {
|
||||
type: Object,
|
||||
},
|
||||
viaRelationship: {
|
||||
default: '',
|
||||
},
|
||||
viaPivotId: {
|
||||
default: null,
|
||||
},
|
||||
polymorphic: {
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
formUniqueId: uid(),
|
||||
}),
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user