Skip to content

Commit

Permalink
Applying eslint format
Browse files Browse the repository at this point in the history
  • Loading branch information
eiresendez committed Feb 1, 2024
1 parent 724ff0b commit 6532e30
Showing 1 changed file with 74 additions and 27 deletions.
101 changes: 74 additions & 27 deletions resources/js/components/templates/TemplateAssetTable.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
<template>
<div class="mt-4 mb-5 data-card-container">
<b-table-simple v-for="group in filteredAssetGroups" :key="group.type" :id="'group-' + group.type + 'table' " class="simple-table" :name="group.type + '-table'">
<b-table-simple
v-for="group in filteredAssetGroups"
:id="`group-${group.type}table`"
:key="group.type"
:name="`${group.type}-table`"
class="simple-table"
>
<colgroup><col><col></colgroup>
<colgroup><col><col></colgroup>
<colgroup><col><col></colgroup>
<colgroup><col><col></colgroup>
<b-thead>
<b-tr>
<b-td class="border-top-0 column-width" colspan="2"/>
<b-td v-for="action in actions" class="border-top-0 text-center" :key="action.value">
{{ action.label }}
<b-td
class="border-top-0 column-width"
colspan="2"
/>
<b-td
v-for="action in actions"
:key="action.value"
class="border-top-0 text-center"
>
{{ action.label }}
</b-td>
</b-tr>
<b-tr class="card-header border-left border-right">
<b-th class="align-middle column-width" colspan="2">
<b-th
class="align-middle column-width"
colspan="2"
>
<div>
<i class="d-inline align-middle mr-1 fas" :class="group.icon"/>
<h5 class="d-inline align-middle">{{ formatName(group.type) }}</h5>
<i
class="d-inline align-middle mr-1 fas"
:class="group.icon"
/>
<h5 class="d-inline align-middle">
{{ formatName(group.type) }}
</h5>
</div>
</b-th>
<b-td class="text-center align-middle" v-for="action in actions" :key="group.type + '-' + action.value">
<b-form-group :id="'group-' + group.type + '-' + action.value + '-action'">
<b-form-radio v-model="group.mode" @change="setGroupAction(group, action)" :value="action.value" :name="group.type + '-' + action.value"></b-form-radio>
<b-td
v-for="action in actions"
:key="`${group.type}-${action.value}`"
class="text-center align-middle"
>
<b-form-group :id="`group-${group.type}-${action.value}-action`" />
<b-form-radio
v-model="group.mode"
:value="action.value"
:name="`${group.type}-${action.value}`"
@change="setGroupAction(group, action)"
/>
</b-form-group>
</b-td>
</b-tr>
Expand All @@ -32,12 +62,24 @@
:key="asset.name"
class="border-left border-right border-bottom"
>
<b-td class="align-middle" colspan="2">
<b-td
class="align-middle"
colspan="2"
>
{{ asset.name }}
</b-td>
<b-td class="text-center align-middle" v-for="action in actions" :key="group.type + '-' + asset.name + '-' + action.value">
<b-td
v-for="action in actions"
:key="`${group.type}-${asset.name}-${action.value}`"
class="text-center align-middle"
>
<b-form-group>
<b-form-radio v-model="asset.mode" @change="setAssetAction(group, asset, action)" :value="action.value" :name="group.type + '-' + asset.name + '-' + action.value"></b-form-radio>
<b-form-radio
v-model="asset.mode"
:value="action.value"
:name="`${group.type}-${asset.name}-${action.value}`"
@change="setAssetAction(group, asset, action)"
/>
</b-form-group>
</b-td>
</b-tr>
Expand All @@ -47,17 +89,22 @@
</template>

<script>
import ImportExportIcons from "../../components/shared/ImportExportIcons";
import ImportExportIcons from "../shared/ImportExportIcons";
export default {
props: ["assets"],
props: {
assets: {
type: Array,
default: () => [],
},
},
data() {
return {
filteredAssetGroups: null,
actions: [
{label: "Update", value: 'update'},
{label: "Keep Previous", value: 'discard'},
{label: "Duplicate", value: 'copy'},
actions: [
{ label: "Update", value: "update" },
{ label: "Keep Previous", value: "discard" },
{ label: "Duplicate", value: "copy" },
],
};
},
Expand All @@ -72,13 +119,13 @@ export default {
handler() {
this.$emit("assetChanged", this.filteredAssetGroups);
},
deep: true,
},
deep: true,
},
},
methods: {
setGroupAction(group, action) {
group.mode = action.value;
group.items.forEach(item => {
group.items.forEach((item) => {
item.mode = group.mode;
});
},
Expand All @@ -89,14 +136,14 @@ export default {
filterAssetsByGroup() {
const groupedItems = [];
this.assets.forEach(asset => {
const existingGroup = groupedItems.find(group => group.type === asset.type);
this.assets.forEach((asset) => {
const existingGroup = groupedItems.find((group) => group.type === asset.type);
if (existingGroup) {
existingGroup.items.push(asset);
existingGroup.mode = 'copy';
existingGroup.mode = "copy";
} else {
groupedItems.push({ type: asset.type, mode: 'copy', items: [asset] });
groupedItems.push({ type: asset.type, mode: "copy", items: [asset] });
}
});
Expand All @@ -111,7 +158,7 @@ export default {
return groupedItemsWithIcons;
},
formatName(value) {
return value.replace(/([a-z])([A-Z])/g, '$1 $2');
return value.replace(/([a-z])([A-Z])/g, "$1 $2");
},
},
};
Expand Down

0 comments on commit 6532e30

Please sign in to comment.