Add history + more components

This commit is contained in:
2024-10-03 22:29:32 +02:00
parent 8f9c83dc2a
commit d7f0d2a7f2
18 changed files with 352 additions and 30 deletions
@@ -8,14 +8,82 @@
<v-container fluid v-if="object">
<template v-for="field in headers">
<v-row v-if="field.details">
<v-col cols="4">
<v-subheader>[[ field.text ]]</v-subheader>
</v-col>
<v-col cols="8">
<v-text-field :value="object[field.value]" readonly dense></v-text-field>
</v-col>
<template v-if="field.value == 'type'">
<v-col cols="4">
<v-subheader>[[ field.text ]]</v-subheader>
</v-col>
<v-col cols="6">
<v-text-field :value="object[field.value]" readonly dense></v-text-field>
</v-col>
<v-col cols="2" class="d-flex">
<v-btn color="primary" dark class="mb-2 flex-grow-1 flex-shrink-1" @click="showType">
<v-icon small class="mr-2">mdi-eye</v-icon>
{% trans "Link" %}
</v-btn>
</v-col>
</template>
<template v-else>
<v-col cols="4">
<v-subheader>[[ field.text ]]</v-subheader>
</v-col>
<v-col cols="8">
<v-text-field :value="object[field.value]" readonly dense></v-text-field>
</v-col>
</template>
</v-row>
</template>
<v-row v-if="object?.history">
<v-col cols="4">
<v-subheader>{% trans "History version" %}</v-subheader>
</v-col>
<v-col cols="6">
<v-text-field :value="object.history.length" readonly dense></v-text-field>
</v-col>
<v-col cols="2" class="d-flex">
<v-btn color="primary" dark class="mb-2 flex-grow-1 flex-shrink-1" @click="showHistory">
<v-icon small class="mr-2">mdi-eye</v-icon>
{% trans "View history" %}
</v-btn>
<v-dialog v-model="dialog" max-width="1200px">
<v-card>
<v-card-title>
<span class="text-h5">{% trans "History for" %} [[ $route.params.id ]]</span>
</v-card-title>
<v-card-text>
<v-container>
<v-data-table
:headers="headers.filter(i => i.value != 'id')"
:items="history"
:items-per-page="50"
dense>
<template v-slot:item.actions="{ item }">
<v-icon small class="mr-2" @click="deleteVersion(item)">mdi-delete</v-icon>
<v-icon small @click="useVersion(item)">mdi-content-save-edit</v-icon>
</template>
</v-data-table>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="blue darken-1" text @click="closeDialog">
<v-icon small class="mr-2">mdi-arrow-left</v-icon>
{% trans "Go back" %}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-col>
</v-row>
</v-container>
</div>