fix simpletable

shift-build-2464
Nadim Salloum 2021-05-12 18:32:59 +02:00
parent f280e3d6a3
commit 1476f0333a
3 changed files with 34 additions and 28 deletions

36
public/js/app.js vendored
View File

@ -18017,12 +18017,19 @@ __webpack_require__.r(__webpack_exports__);
country: this.contact.country, country: this.contact.country,
notes: this.contact.notes notes: this.contact.notes
}), }),
contractColumns: { contractColumns: [{
car: 'Auto', key: 'car',
sold_at: 'Verkaufsdatum', value: 'Auto'
sell_price: 'Verkaufspreis', }, {
insurance_type: 'Versicherungstyp' key: 'sold_at',
} value: 'Verkaufsdatum'
}, {
key: 'sell_price',
value: 'Verkaufspreis'
}, {
key: 'insurance_type',
value: 'Versicherungstyp'
}]
}; };
}, },
computed: { computed: {
@ -19092,28 +19099,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("th", { return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("th", {
key: col.key, key: col.key,
"class": "px-6 pt-4 pb-4" "class": "px-6 pt-4 pb-4"
}, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(col), 1 }, (0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(col.value), 1
/* TEXT */ /* TEXT */
); );
}), 128 }), 128
/* KEYED_FRAGMENT */ /* KEYED_FRAGMENT */
))]), ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.data.data, function (index, row) { ))]), ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.data.data, function (row) {
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("tr", { return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("tr", {
key: row.link, key: row.link,
"class": "hover:bg-gray-100 focus-within:bg-gray-100" "class": "hover:bg-gray-100 focus-within:bg-gray-100"
}, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.columns, function (val, col) { }, [((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(true), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(vue__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,vue__WEBPACK_IMPORTED_MODULE_0__.renderList)($props.columns, function (col) {
return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("td", { return (0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)("td", {
key: col, key: col.key,
"class": "border-t" "class": "border-t"
}, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_inertia_link, { }, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_inertia_link, {
"class": "px-6 py-4 flex items-center focus:text-indigo-500", "class": "px-6 py-4 flex items-center focus:text-indigo-500",
href: row.link, href: row.link
tabindex: "{ '-1': index !== 0 }"
}, { }, {
"default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () { "default": (0,vue__WEBPACK_IMPORTED_MODULE_0__.withCtx)(function () {
return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(row[col]) + " ", 1 return [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createTextVNode)((0,vue__WEBPACK_IMPORTED_MODULE_0__.toDisplayString)(row[col.key]) + " ", 1
/* TEXT */ /* TEXT */
), $props.columns[col] == $props.columns[$props.columns.length - 1] ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_unicon, { ), col.key == $props.columns[$props.columns.length - 1].key ? ((0,vue__WEBPACK_IMPORTED_MODULE_0__.openBlock)(), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createBlock)(_component_unicon, {
key: 0, key: 0,
"class": "m-2", "class": "m-2",
height: "22", height: "22",
@ -22587,7 +22593,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
, ["onSubmitted"])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_23, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_24, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_simple_table, { , ["onSubmitted"])])]), (0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_23, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)("div", _hoisted_24, [(0,vue__WEBPACK_IMPORTED_MODULE_0__.createVNode)(_component_simple_table, {
title: 'An \'' + $options.title + '\' verkaufte Autos', title: 'An \'' + $options.title + '\' verkaufte Autos',
data: $props.contact.contracts, data: $props.contact.contracts,
columns: Array.from($data.contractColumns) columns: $data.contractColumns
}, null, 8 }, null, 8
/* PROPS */ /* PROPS */
, ["title", "data", "columns"])])])]; , ["title", "data", "columns"])])])];

View File

@ -7,13 +7,13 @@
<div class="bg-white rounded-md shadow overflow-x-auto"> <div class="bg-white rounded-md shadow overflow-x-auto">
<table class="w-full whitespace-nowrap"> <table class="w-full whitespace-nowrap">
<tr class="text-left font-bold"> <tr class="text-left font-bold">
<th v-for="col in columns" :key="col.key" class="px-6 pt-4 pb-4">{{ col }}</th> <th v-for="col in columns" :key="col.key" class="px-6 pt-4 pb-4">{{ col.value }}</th>
</tr> </tr>
<tr v-for="(index, row) in data.data" :key="row.link" class="hover:bg-gray-100 focus-within:bg-gray-100"> <tr v-for="row in data.data" :key="row.link" class="hover:bg-gray-100 focus-within:bg-gray-100">
<td v-for="(val, col) in columns" :key="col" class="border-t"> <td v-for="col in columns" :key="col.key" class="border-t">
<inertia-link class="px-6 py-4 flex items-center focus:text-indigo-500" :href="row.link" tabindex="{ '-1': index !== 0 }"> <inertia-link class="px-6 py-4 flex items-center focus:text-indigo-500" :href="row.link">
{{ row[col] }} {{ row[col.key] }}
<unicon v-if="columns[col] == columns[columns.length - 1]" class="m-2" height="22" width="22" name="angle-right"></unicon> <unicon v-if="col.key == columns[columns.length - 1].key" class="m-2" height="22" width="22" name="angle-right"></unicon>
</inertia-link> </inertia-link>
</td> </td>
</tr> </tr>

View File

@ -103,7 +103,7 @@
</div> </div>
<div class="py-12"> <div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8"> <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<simple-table :title="'An \'' + title + '\' verkaufte Autos'" :data="contact.contracts" :columns="Array.from(contractColumns)" /> <simple-table :title="'An \'' + title + '\' verkaufte Autos'" :data="contact.contracts" :columns="contractColumns" />
</div> </div>
</div> </div>
</app-layout> </app-layout>
@ -151,12 +151,12 @@ export default {
country: this.contact.country, country: this.contact.country,
notes: this.contact.notes, notes: this.contact.notes,
}), }),
contractColumns: { contractColumns: [
car: 'Auto', {key: 'car', value: 'Auto'},
sold_at: 'Verkaufsdatum', {key: 'sold_at', value: 'Verkaufsdatum'},
sell_price: 'Verkaufspreis', {key: 'sell_price', value: 'Verkaufspreis'},
insurance_type: 'Versicherungstyp', {key: 'insurance_type', value: 'Versicherungstyp'},
} ]
} }
}, },
computed: { computed: {