2023-10-29 15:13:01 +01:00
|
|
|
<template>
|
|
|
|
|
<v-card>
|
|
|
|
|
<v-card-title>Groups</v-card-title>
|
2023-11-15 16:19:09 +01:00
|
|
|
<v-card-subtitle>For <abbr title="Permanent Reservoir Monitoring">PRM</abbr> and 4D operations, each project can be assigned to one or more groups sharing the same (or substantially the same) preplots.</v-card-subtitle>
|
2023-10-29 15:13:01 +01:00
|
|
|
<v-card-text>
|
|
|
|
|
<v-form>
|
|
|
|
|
<v-combobox
|
2023-11-15 16:19:09 +01:00
|
|
|
v-model="groups"
|
2023-10-29 15:13:01 +01:00
|
|
|
:items="items"
|
|
|
|
|
multiple
|
|
|
|
|
:search-input.sync="search"
|
|
|
|
|
:hide-no-data="!search"
|
|
|
|
|
hide-selected
|
|
|
|
|
chips
|
|
|
|
|
hint="Project group(s). Type a value to create a new group (case sensitive)"
|
|
|
|
|
persistent-hint
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:no-data>
|
|
|
|
|
<v-list-item>
|
|
|
|
|
<small>New group: </small>
|
|
|
|
|
<v-chip class="ml-3"
|
|
|
|
|
:color="`grey lighten-2`"
|
2023-11-02 20:44:07 +01:00
|
|
|
light
|
2023-10-29 15:13:01 +01:00
|
|
|
label
|
|
|
|
|
small
|
|
|
|
|
>
|
|
|
|
|
{{ search }}
|
|
|
|
|
</v-chip>
|
|
|
|
|
</v-list-item>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:selection="{ attrs, item, parent, selected }">
|
|
|
|
|
<v-chip
|
|
|
|
|
v-if="item === Object(item)"
|
|
|
|
|
v-bind="attrs"
|
|
|
|
|
:color="`${item.colour} lighten-3`"
|
|
|
|
|
:input-value="selected"
|
|
|
|
|
label
|
|
|
|
|
small
|
|
|
|
|
>
|
|
|
|
|
<span class="pr-2">
|
|
|
|
|
{{ item.text }}
|
|
|
|
|
</span>
|
|
|
|
|
<v-icon
|
|
|
|
|
small
|
|
|
|
|
@click="parent.selectItem(item)"
|
|
|
|
|
>
|
|
|
|
|
$delete
|
|
|
|
|
</v-icon>
|
|
|
|
|
</v-chip>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:item="{ index, item }">
|
|
|
|
|
<v-chip
|
|
|
|
|
:color="`${item.colour} lighten-3`"
|
|
|
|
|
label
|
|
|
|
|
small
|
|
|
|
|
>{{ item.text }}</v-chip>
|
|
|
|
|
</template>
|
|
|
|
|
</v-combobox>
|
|
|
|
|
</v-form>
|
|
|
|
|
</v-card-text>
|
|
|
|
|
<v-card-actions>
|
2023-11-15 16:19:09 +01:00
|
|
|
<!--
|
2023-10-29 15:13:01 +01:00
|
|
|
<v-btn
|
|
|
|
|
color="primary"
|
|
|
|
|
@click="save"
|
|
|
|
|
>Save</v-btn>
|
|
|
|
|
<v-spacer></v-spacer>
|
|
|
|
|
<v-btn
|
|
|
|
|
color="warning"
|
|
|
|
|
@click="reset"
|
|
|
|
|
>Reset</v-btn>
|
2023-11-15 16:19:09 +01:00
|
|
|
-->
|
2023-10-29 15:13:01 +01:00
|
|
|
<v-spacer></v-spacer>
|
|
|
|
|
<v-btn
|
|
|
|
|
color="secondary"
|
|
|
|
|
@click="back"
|
|
|
|
|
>Back</v-btn>
|
|
|
|
|
</v-card-actions>
|
|
|
|
|
</v-card>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { mapGetters } from 'vuex'
|
2023-11-15 16:19:09 +01:00
|
|
|
import { deepSet } from '@/lib/utils';
|
2023-10-29 15:13:01 +01:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "DougalProjectSettingsGroups",
|
|
|
|
|
|
2023-11-15 16:19:09 +01:00
|
|
|
props: [ "value" ],
|
2023-10-29 15:13:01 +01:00
|
|
|
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
search: null
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
|
|
colours () {
|
|
|
|
|
return [ "green", "purple", "indigo", "cyan", "teal", "orange" ];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
nextColour () {
|
2023-11-15 16:19:09 +01:00
|
|
|
// FIXME Fix colour when adding a new group
|
|
|
|
|
return this.colours[(this.items.length + (this.value?.groups?.length ?? 0)) % this.colours.length];
|
2023-10-29 15:13:01 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items () {
|
|
|
|
|
return this.projectGroups.map((item, idx) => {
|
|
|
|
|
return {
|
|
|
|
|
text: item,
|
|
|
|
|
colour: this.colours[idx % this.colours.length]
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2023-11-15 16:19:09 +01:00
|
|
|
groups: {
|
|
|
|
|
|
|
|
|
|
get () {
|
|
|
|
|
return this.value?.groups?.map(i => {
|
|
|
|
|
return typeof i === "string"
|
|
|
|
|
? { text: i, colour: this.nextColour}
|
|
|
|
|
: i
|
|
|
|
|
}) ?? [];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
set (v) {
|
|
|
|
|
if (this.value) {
|
|
|
|
|
this.value.groups = v?.map( i => i?.text ?? i );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
2023-10-29 15:13:01 +01:00
|
|
|
...mapGetters(["projectGroups"])
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
|
|
reset () {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
save () {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
back () {
|
|
|
|
|
this.$emit('close');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mounted () {
|
|
|
|
|
this.reset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</script>
|