fix: change column color and save it
This commit is contained in:
parent
d5edfe27f8
commit
b9961b0ba0
@ -79,7 +79,9 @@ const fields = createResource({
|
|||||||
function apply() {
|
function apply() {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
showDialog.value = false
|
showDialog.value = false
|
||||||
emit('update', column_field.value)
|
emit('update', {
|
||||||
|
column_field: column_field.value.name,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -10,8 +10,40 @@
|
|||||||
class="flex flex-col gap-2.5 min-w-[268px] hover:bg-gray-100 rounded-lg p-2.5 transition-all duration-300 ease-in-out"
|
class="flex flex-col gap-2.5 min-w-[268px] hover:bg-gray-100 rounded-lg p-2.5 transition-all duration-300 ease-in-out"
|
||||||
>
|
>
|
||||||
<div class="flex gap-2 items-center justify-between">
|
<div class="flex gap-2 items-center justify-between">
|
||||||
<div class="flex gap-2 items-center text-base py-1.5">
|
<div class="flex items-center text-base">
|
||||||
<IndicatorIcon :class="colorClasses(column.column.color)" />
|
<NestedPopover>
|
||||||
|
<template #target>
|
||||||
|
<Button variant="ghost" size="sm" class="hover:!bg-gray-100">
|
||||||
|
<IndicatorIcon
|
||||||
|
:class="colorClasses(column.column.color, true)"
|
||||||
|
/>
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
|
<template #body="{ close }">
|
||||||
|
<div
|
||||||
|
class="flex flex-col gap-3 px-3 py-2.5 rounded-lg border border-gray-100 bg-white shadow-xl"
|
||||||
|
>
|
||||||
|
<div class="flex gap-1">
|
||||||
|
<Button
|
||||||
|
:class="colorClasses(color)"
|
||||||
|
variant="ghost"
|
||||||
|
v-for="color in colors"
|
||||||
|
:key="color"
|
||||||
|
@click="() => (column.column.color = color)"
|
||||||
|
>
|
||||||
|
<IndicatorIcon />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row-reverse">
|
||||||
|
<Button
|
||||||
|
variant="solid"
|
||||||
|
:label="__('Apply')"
|
||||||
|
@click="updateColor"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</NestedPopover>
|
||||||
<div>{{ column.column.name }}</div>
|
<div>{{ column.column.name }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@ -39,10 +71,13 @@
|
|||||||
</Draggable>
|
</Draggable>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import NestedPopover from '@/components/NestedPopover.vue'
|
||||||
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
import IndicatorIcon from '@/components/Icons/IndicatorIcon.vue'
|
||||||
import Draggable from 'vuedraggable'
|
import Draggable from 'vuedraggable'
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
|
const emit = defineEmits(['update'])
|
||||||
|
|
||||||
const kanban = defineModel()
|
const kanban = defineModel()
|
||||||
|
|
||||||
const columns = computed(() => {
|
const columns = computed(() => {
|
||||||
@ -59,14 +94,26 @@ const columns = computed(() => {
|
|||||||
return _columns
|
return _columns
|
||||||
})
|
})
|
||||||
|
|
||||||
function colorClasses(color) {
|
function updateColor() {
|
||||||
|
let _columns = []
|
||||||
|
columns.value.forEach((col) => {
|
||||||
|
_columns.push(col.column)
|
||||||
|
})
|
||||||
|
|
||||||
|
emit('update', { columns: _columns })
|
||||||
|
}
|
||||||
|
|
||||||
|
function colorClasses(color, onlyIcon = false) {
|
||||||
let textColor = `!text-${color}-600`
|
let textColor = `!text-${color}-600`
|
||||||
if (color == 'black') {
|
if (color == 'black') {
|
||||||
textColor = '!text-gray-900'
|
textColor = '!text-gray-900'
|
||||||
} else if (['gray', 'green'].includes(color)) {
|
} else if (['gray', 'green'].includes(color)) {
|
||||||
textColor = `!text-${color}-700`
|
textColor = `!text-${color}-700`
|
||||||
}
|
}
|
||||||
return [textColor]
|
|
||||||
|
let bgColor = `!bg-${color}-100 hover:!bg-${color}-200 active:!bg-${color}-300`
|
||||||
|
|
||||||
|
return [textColor, onlyIcon ? '' : bgColor]
|
||||||
}
|
}
|
||||||
|
|
||||||
const colors = [
|
const colors = [
|
||||||
|
|||||||
@ -713,16 +713,18 @@ function updateColumns(obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateKanbanSettings(column_field) {
|
function updateKanbanSettings(data) {
|
||||||
viewUpdated.value = true
|
viewUpdated.value = true
|
||||||
if (!defaultParams.value) {
|
if (!defaultParams.value) {
|
||||||
defaultParams.value = getParams()
|
defaultParams.value = getParams()
|
||||||
}
|
}
|
||||||
list.value.params = defaultParams.value
|
list.value.params = defaultParams.value
|
||||||
list.value.params.view.column_field = column_field.name
|
if (data.column_field) {
|
||||||
list.value.params.view.columns = ''
|
list.value.params.view.column_field = data.column_field
|
||||||
view.value.column_field = column_field.name
|
view.value.column_field = data.column_field
|
||||||
view.value.columns = ''
|
}
|
||||||
|
list.value.params.view.columns = data.columns ? data.columns : ''
|
||||||
|
view.value.columns = data.columns ? data.columns : ''
|
||||||
list.value.reload()
|
list.value.reload()
|
||||||
|
|
||||||
if (!route.query.view) {
|
if (!route.query.view) {
|
||||||
@ -976,7 +978,7 @@ function likeDoc({ name, liked }) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({ applyFilter, applyLikeFilter, likeDoc })
|
defineExpose({ applyFilter, applyLikeFilter, likeDoc, updateKanbanSettings })
|
||||||
|
|
||||||
// Watchers
|
// Watchers
|
||||||
watch(
|
watch(
|
||||||
|
|||||||
@ -28,7 +28,11 @@
|
|||||||
allowedViews: ['list', 'group_by', 'kanban'],
|
allowedViews: ['list', 'group_by', 'kanban'],
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<KanbanView v-if="route.params.viewType == 'kanban'" v-model="deals" />
|
<KanbanView
|
||||||
|
v-if="route.params.viewType == 'kanban'"
|
||||||
|
v-model="deals"
|
||||||
|
@update="(data) => viewControls.updateKanbanSettings(data)"
|
||||||
|
/>
|
||||||
<DealsListView
|
<DealsListView
|
||||||
ref="dealsListView"
|
ref="dealsListView"
|
||||||
v-else-if="deals.data && rows.length"
|
v-else-if="deals.data && rows.length"
|
||||||
|
|||||||
@ -29,7 +29,11 @@
|
|||||||
allowedViews: ['list', 'group_by', 'kanban'],
|
allowedViews: ['list', 'group_by', 'kanban'],
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<KanbanView v-if="route.params.viewType == 'kanban'" v-model="leads" />
|
<KanbanView
|
||||||
|
v-if="route.params.viewType == 'kanban'"
|
||||||
|
v-model="leads"
|
||||||
|
@update="(data) => viewControls.updateKanbanSettings(data)"
|
||||||
|
/>
|
||||||
<LeadsListView
|
<LeadsListView
|
||||||
ref="leadsListView"
|
ref="leadsListView"
|
||||||
v-else-if="leads.data && rows.length"
|
v-else-if="leads.data && rows.length"
|
||||||
|
|||||||
@ -24,7 +24,11 @@
|
|||||||
allowedViews: ['list', 'kanban'],
|
allowedViews: ['list', 'kanban'],
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
<KanbanView v-if="$route.params.viewType == 'kanban'" v-model="tasks" />
|
<KanbanView
|
||||||
|
v-if="$route.params.viewType == 'kanban'"
|
||||||
|
v-model="tasks"
|
||||||
|
@update="(data) => viewControls.updateKanbanSettings(data)"
|
||||||
|
/>
|
||||||
<TasksListView
|
<TasksListView
|
||||||
ref="tasksListView"
|
ref="tasksListView"
|
||||||
v-else-if="tasks.data && rows.length"
|
v-else-if="tasks.data && rows.length"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user