Compare commits
5 Commits
bf1388dbd9
...
5641006e2b
Author | SHA1 | Date |
---|---|---|
philipp lang | 5641006e2b | |
philipp lang | 607038af6b | |
philipp lang | 189b83f2a5 | |
philipp lang | 3f4c655e5e | |
philipp lang | 158cd2d352 |
|
@ -1,10 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Form\Models\Form;
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,12 +14,6 @@ return new class extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('forms', function (Blueprint $table) {
|
|
||||||
$table->json('description')->default($this->default())->change();
|
|
||||||
$table->json('mail_top')->default($this->default())->nullable(false)->change();
|
|
||||||
$table->json('mail_bottom')->default($this->default())->nullable(false)->change();
|
|
||||||
});
|
|
||||||
|
|
||||||
foreach (DB::table('forms')->get() as $form) {
|
foreach (DB::table('forms')->get() as $form) {
|
||||||
$mailTop = json_decode($form->mail_top, true);
|
$mailTop = json_decode($form->mail_top, true);
|
||||||
if (!$mailTop || !count($mailTop)) {
|
if (!$mailTop || !count($mailTop)) {
|
||||||
|
@ -34,6 +28,12 @@ return new class extends Migration
|
||||||
DB::table('forms')->where('id', $form->id)->update(['description' => $this->default()]);
|
DB::table('forms')->where('id', $form->id)->update(['description' => $this->default()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Schema::table('forms', function (Blueprint $table) {
|
||||||
|
$table->json('description')->default($this->default())->change();
|
||||||
|
$table->json('mail_top')->default($this->default())->nullable(false)->change();
|
||||||
|
$table->json('mail_bottom')->default($this->default())->nullable(false)->change();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -53,8 +53,8 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js" setup>
|
<script setup>
|
||||||
import { ref, inject, computed } from 'vue';
|
import {ref, inject, computed} from 'vue';
|
||||||
const axios = inject('axios');
|
const axios = inject('axios');
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
@ -70,19 +70,19 @@ const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
required: true,
|
required: true,
|
||||||
type: String,
|
type: String,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const comparatorOptions = ref([
|
const comparatorOptions = ref([
|
||||||
{ id: 'isEqual', name: 'ist gleich', defaultValue: { DropdownField: null, RadioField: null, CheckboxField: false } },
|
{id: 'isEqual', name: 'ist gleich', defaultValue: {DropdownField: null, RadioField: null, CheckboxField: false}},
|
||||||
{ id: 'isNotEqual', name: 'ist ungleich', defaultValue: { DropdownField: null, RadioField: null, CheckboxField: false } },
|
{id: 'isNotEqual', name: 'ist ungleich', defaultValue: {DropdownField: null, RadioField: null, CheckboxField: false}},
|
||||||
{ id: 'isIn', name: 'ist in', defaultValue: { DropdownField: [], RadioField: [], CheckboxField: false } },
|
{id: 'isIn', name: 'ist in', defaultValue: {DropdownField: [], RadioField: [], CheckboxField: false}},
|
||||||
{ id: 'isNotIn', name: 'ist nicht in', defaultValue: { DropdownField: [], RadioField: [], CheckboxField: false } },
|
{id: 'isNotIn', name: 'ist nicht in', defaultValue: {DropdownField: [], RadioField: [], CheckboxField: false}},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const modeOptions = ref([
|
const modeOptions = ref([
|
||||||
{ id: 'all', name: 'alle Bedingungen müssen zutreffen' },
|
{id: 'all', name: 'alle Bedingungen müssen zutreffen'},
|
||||||
{ id: 'any', name: 'mindestens eine Bedingung muss zutreffen' },
|
{id: 'any', name: 'mindestens eine Bedingung muss zutreffen'},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const fields = computed(() => {
|
const fields = computed(() => {
|
||||||
|
@ -133,34 +133,39 @@ function getField(fieldName) {
|
||||||
|
|
||||||
function getOptions(fieldName) {
|
function getOptions(fieldName) {
|
||||||
return getField(fieldName).options.map((o) => {
|
return getField(fieldName).options.map((o) => {
|
||||||
return { id: o, name: o };
|
return {id: o, name: o};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldOptions = computed(() =>
|
const fieldOptions = computed(() =>
|
||||||
fields.value.map((field) => {
|
fields.value.map((field) => {
|
||||||
return { id: field.key, name: field.name };
|
return {id: field.key, name: field.name};
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
function addCondition() {
|
function addCondition() {
|
||||||
emit('update:modelValue', {...props.modelValue, ifs: [
|
emit('update:modelValue', {
|
||||||
...props.modelValue.ifs,
|
...props.modelValue,
|
||||||
{
|
ifs: [
|
||||||
field: null,
|
...props.modelValue.ifs,
|
||||||
comparator: null,
|
{
|
||||||
value: null,
|
field: null,
|
||||||
}
|
comparator: null,
|
||||||
]});
|
value: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const locked = ref(false);
|
const locked = ref(false);
|
||||||
|
|
||||||
async function checkIfDirty() {
|
async function checkIfDirty() {
|
||||||
const response = await axios.post(props.single.links.is_dirty, { config: props.single.config });
|
const response = await axios.post(props.single.links.is_dirty, {config: props.single.config});
|
||||||
|
|
||||||
locked.value = response.data.result;
|
locked.value = response.data.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIfDirty();
|
if (props.single.links && props.single.links.is_dirty) {
|
||||||
|
checkIfDirty();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -228,6 +228,8 @@ const allFields = computed(() => {
|
||||||
function setTemplate(template) {
|
function setTemplate(template) {
|
||||||
active.value = 0;
|
active.value = 0;
|
||||||
single.value.config = template.config;
|
single.value.config = template.config;
|
||||||
|
single.value.mail_top = template.mail_top;
|
||||||
|
single.value.mail_bottom = template.mail_bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveFileConditions(conditions) {
|
async function saveFileConditions(conditions) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ class FormIndexActionTest extends FormTestCase
|
||||||
{
|
{
|
||||||
Carbon::setTestNow(Carbon::parse('2023-03-03'));
|
Carbon::setTestNow(Carbon::parse('2023-03-03'));
|
||||||
$this->login()->loginNami()->withoutExceptionHandling();
|
$this->login()->loginNami()->withoutExceptionHandling();
|
||||||
Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')])->create();
|
|
||||||
$form = Form::factory()
|
$form = Form::factory()
|
||||||
->name('lala')
|
->name('lala')
|
||||||
->excerpt('fff')
|
->excerpt('fff')
|
||||||
|
@ -58,8 +57,6 @@ class FormIndexActionTest extends FormTestCase
|
||||||
->assertInertiaPath('data.data.0.links.export', route('form.export', ['form' => $form]))
|
->assertInertiaPath('data.data.0.links.export', route('form.export', ['form' => $form]))
|
||||||
->assertInertiaPath('data.meta.links.store', route('form.store'))
|
->assertInertiaPath('data.meta.links.store', route('form.store'))
|
||||||
->assertInertiaPath('data.meta.links.formtemplate_index', route('formtemplate.index'))
|
->assertInertiaPath('data.meta.links.formtemplate_index', route('formtemplate.index'))
|
||||||
->assertInertiaPath('data.meta.templates.0.name', 'tname')
|
|
||||||
->assertInertiaPath('data.meta.templates.0.config.sections.0.name', 'sname')
|
|
||||||
->assertInertiaPath('data.meta.default.name', '')
|
->assertInertiaPath('data.meta.default.name', '')
|
||||||
->assertInertiaPath('data.meta.default.prevention_conditions', ['mode' => 'all', 'ifs' => []])
|
->assertInertiaPath('data.meta.default.prevention_conditions', ['mode' => 'all', 'ifs' => []])
|
||||||
->assertInertiaPath('data.meta.default.prevention_text.version', '1.0')
|
->assertInertiaPath('data.meta.default.prevention_text.version', '1.0')
|
||||||
|
@ -76,6 +73,27 @@ class FormIndexActionTest extends FormTestCase
|
||||||
->assertInertiaPath('data.meta.section_default.name', '');
|
->assertInertiaPath('data.meta.section_default.name', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFormtemplatesHaveData(): void
|
||||||
|
{
|
||||||
|
$this->login()->loginNami()->withoutExceptionHandling();
|
||||||
|
Formtemplate::factory()->name('tname')->sections([FormtemplateSectionRequest::new()->name('sname')->fields([
|
||||||
|
$this->textField('vorname')
|
||||||
|
])])
|
||||||
|
->mailTop(EditorRequestFactory::new()->text(10, 'lala'))
|
||||||
|
->mailBottom(EditorRequestFactory::new()->text(10, 'lalb'))
|
||||||
|
->create();
|
||||||
|
|
||||||
|
sleep(1);
|
||||||
|
$this->get(route('form.index'))
|
||||||
|
->assertOk()
|
||||||
|
->assertInertiaPath('data.meta.templates.0.name', 'tname')
|
||||||
|
->assertInertiaPath('data.meta.templates.0.name', 'tname')
|
||||||
|
->assertInertiaPath('data.meta.templates.0.config.sections.0.name', 'sname')
|
||||||
|
->assertInertiaPath('data.meta.templates.0.config.sections.0.fields.0.key', 'vorname')
|
||||||
|
->assertInertiaPath('data.meta.templates.0.mail_top.blocks.0.data.text', 'lala')
|
||||||
|
->assertInertiaPath('data.meta.templates.0.mail_bottom.blocks.0.data.text', 'lalb');
|
||||||
|
}
|
||||||
|
|
||||||
public function testItDisplaysExport(): void
|
public function testItDisplaysExport(): void
|
||||||
{
|
{
|
||||||
$this->login()->loginNami()->withoutExceptionHandling();
|
$this->login()->loginNami()->withoutExceptionHandling();
|
||||||
|
|
Loading…
Reference in New Issue