151 lines
5.4 KiB
Vue
151 lines
5.4 KiB
Vue
<script setup lang="ts">
|
|
import { Head, useForm } from '@inertiajs/vue3';
|
|
import { route } from 'ziggy-js';
|
|
|
|
defineOptions({
|
|
layout: (props: any) => ({
|
|
breadcrumbs: [
|
|
{
|
|
title: 'Dynamics',
|
|
href: route('dynamics.index'),
|
|
},
|
|
{
|
|
title: props.dynamic.name,
|
|
href: route('dynamics.show', props.dynamic.id),
|
|
},
|
|
{
|
|
title: props.ledger.name,
|
|
href: route('dynamics.ledgers.show', [props.dynamic.id, props.ledger.id]),
|
|
},
|
|
{
|
|
title: 'Predefined Mutations',
|
|
href: route('dynamics.ledgers.predefined-mutations.index', [props.dynamic.id, props.ledger.id]),
|
|
},
|
|
{
|
|
title: 'Edit',
|
|
href: route('dynamics.ledgers.predefined-mutations.edit', [props.dynamic.id, props.ledger.id, props.predefined_mutation.uuid]),
|
|
},
|
|
],
|
|
}),
|
|
});
|
|
|
|
const props = defineProps<{
|
|
dynamic: {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
ledger: {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
predefined_mutation: {
|
|
id: number;
|
|
name: string;
|
|
description: string;
|
|
amount: number;
|
|
uuid: string;
|
|
};
|
|
}>();
|
|
|
|
const form = useForm({
|
|
name: props.predefined_mutation.name,
|
|
description: props.predefined_mutation.description,
|
|
amount: props.predefined_mutation.amount,
|
|
});
|
|
|
|
function submit() {
|
|
form.put(route('dynamics.ledgers.predefined-mutations.update', [props.dynamic.id, props.ledger.id, props.predefined_mutation.uuid]));
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<Head title="Edit Predefined Mutation" />
|
|
|
|
<div class="c-predefined-mutation-edit">
|
|
<div class="c-predefined-mutation-edit__container">
|
|
<div class="c-predefined-mutation-edit__card">
|
|
<div class="c-predefined-mutation-edit__body">
|
|
<h3 class="c-predefined-mutation-edit__title">
|
|
Edit {{ predefined_mutation.name }} on {{ ledger.name }}
|
|
</h3>
|
|
|
|
<form @submit.prevent="submit" class="c-predefined-mutation-edit__form">
|
|
<div class="c-predefined-mutation-edit__field">
|
|
<label for="name" class="c-predefined-mutation-edit__label">Name</label>
|
|
<input v-model="form.name" id="name" type="text" class="c-predefined-mutation-edit__input" />
|
|
</div>
|
|
|
|
<div class="c-predefined-mutation-edit__field">
|
|
<label for="description" class="c-predefined-mutation-edit__label">Description</label>
|
|
<textarea v-model="form.description" id="description" rows="4" class="c-predefined-mutation-edit__textarea"></textarea>
|
|
</div>
|
|
|
|
<div class="c-predefined-mutation-edit__field">
|
|
<label for="amount" class="c-predefined-mutation-edit__label">Amount</label>
|
|
<input v-model="form.amount" id="amount" type="number" class="c-predefined-mutation-edit__input" />
|
|
</div>
|
|
|
|
<div class="c-predefined-mutation-edit__actions">
|
|
<button type="submit" :disabled="form.processing" class="c-predefined-mutation-edit__submit-btn">
|
|
Save
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
@reference "../../../../css/app.css";
|
|
|
|
.c-predefined-mutation-edit {
|
|
@apply py-12;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__container {
|
|
@apply mx-auto max-w-7xl sm:px-6 lg:px-8;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__card {
|
|
@apply overflow-hidden bg-white shadow-sm sm:rounded-lg dark:bg-gray-800;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__body {
|
|
@apply p-6 text-gray-900 dark:text-gray-100;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__title {
|
|
@apply text-lg font-medium;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__form {
|
|
@apply mt-6 space-y-6;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__field {
|
|
@apply block;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__label {
|
|
@apply block text-sm font-medium text-gray-700 dark:text-gray-300;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__input {
|
|
@apply mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:focus:border-indigo-600 dark:focus:ring-indigo-600;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__textarea {
|
|
@apply mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:focus:border-indigo-600 dark:focus:ring-indigo-600;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__actions {
|
|
@apply flex items-center gap-4;
|
|
}
|
|
|
|
.c-predefined-mutation-edit__submit-btn {
|
|
@apply inline-flex items-center rounded-md border border-transparent bg-gray-800 px-4 py-2 text-xs font-semibold tracking-widest text-white uppercase transition duration-150 ease-in-out hover:bg-gray-700 focus:bg-gray-700 focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 focus:outline-none active:bg-gray-900 dark:bg-gray-200 dark:text-gray-800 dark:hover:bg-white dark:focus:bg-white dark:focus:ring-offset-gray-800 dark:active:bg-gray-300;
|
|
}
|
|
</style>
|