|
| 1 | +<script setup> |
| 2 | +import AppLayout from '@/Layouts/AppLayout.vue'; |
| 3 | +import PrimaryButton from '@/Components/PrimaryButton.vue'; |
| 4 | +import SecondaryButton from '@/Components/SecondaryButton.vue'; |
| 5 | +import { ref } from 'vue'; |
| 6 | +import Intro from '@/Components/Intro.vue'; |
| 7 | +import SecondaryLink from '@/Components/SecondaryLink.vue'; |
| 8 | +import Resources from './Components/Resources.vue'; |
| 9 | +import { useForm } from '@inertiajs/vue3'; |
| 10 | +import {useToast} from "vue-toastification"; |
| 11 | +import Generate from "@/Pages/Outputs/WebPage/Components/Generate.vue"; |
| 12 | +import Delete from "@/Pages/Outputs/Components/Delete.vue"; |
| 13 | +import Templates from "@/Components/Templates.vue"; |
| 14 | +
|
| 15 | +const toast = useToast(); |
| 16 | +
|
| 17 | +const props = defineProps({ |
| 18 | + collection: { |
| 19 | + type: Object, |
| 20 | + required: true, |
| 21 | + }, |
| 22 | + output: { |
| 23 | + type: Object |
| 24 | + }, |
| 25 | +}); |
| 26 | +
|
| 27 | +const form = useForm({ |
| 28 | + title: props.output.title, |
| 29 | + summary: props.output.summary, |
| 30 | + active: props.output.active, |
| 31 | + public: props.output.public, |
| 32 | +}); |
| 33 | +
|
| 34 | +
|
| 35 | +const submit = () => { |
| 36 | + form.put( |
| 37 | + route('collections.outputs.calendar_output.update', { |
| 38 | + collection: props.collection.data.id, |
| 39 | + output: props.output.id |
| 40 | + }), { |
| 41 | + preserveScroll: true, |
| 42 | + onSuccess: params => { |
| 43 | + toast.info("Updated"); |
| 44 | + } |
| 45 | + }); |
| 46 | +} |
| 47 | +</script> |
| 48 | + |
| 49 | +<template> |
| 50 | + <AppLayout title="Edit Web Page"> |
| 51 | + <div class="py-12"> |
| 52 | + <div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> |
| 53 | + <div class="overflow-hidden shadow-xl rounded-none p-5"> |
| 54 | + <Intro></Intro> |
| 55 | + |
| 56 | + <form @submit.prevent="submit" class="p-10 "> |
| 57 | + <div class="flex"> |
| 58 | + <div class="w-3/4 border border-secondary rounded-none p-5 rounded-lg"> |
| 59 | + |
| 60 | + <Resources |
| 61 | + v-model="form"> |
| 62 | + </Resources> |
| 63 | + |
| 64 | + <div class="flex justify-end items-center gap-4"> |
| 65 | + <PrimaryButton type="submit"> |
| 66 | + Save |
| 67 | + </PrimaryButton> |
| 68 | + <SecondaryLink :href="route('collections.outputs.index', { |
| 69 | + collection: collection.data.id |
| 70 | +
|
| 71 | + })"> |
| 72 | + Back |
| 73 | + </SecondaryLink> |
| 74 | + <Delete :output="output"></Delete> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + </form> |
| 79 | + |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + </AppLayout> |
| 84 | +</template> |
0 commit comments