2023-10-24 02:57:12 +08:00
|
|
|
<template>
|
2023-10-31 00:30:23 +08:00
|
|
|
<div v-if="permissions && customColumns?.length > 0" class="flex flex-col gap-4 w-[350px] h-auto">
|
2023-10-24 21:49:37 +08:00
|
|
|
<div v-for="(column, index) in customColumns" :key="column.id" class="flex flex-col gap-4 w-[350px] h-auto relative">
|
2023-10-24 02:57:12 +08:00
|
|
|
<component
|
|
|
|
:is="column.data_type"
|
|
|
|
:key="index"
|
2023-10-27 16:31:38 +08:00
|
|
|
:actions="actions"
|
2023-10-24 02:57:12 +08:00
|
|
|
:data_type="column.data_type"
|
|
|
|
:colId="column.id"
|
|
|
|
:colName="column.name"
|
|
|
|
:colVal="column.value"
|
|
|
|
:repositoryRowId="repositoryRowId"
|
|
|
|
:repositoryId="repositoryId"
|
|
|
|
:permissions="permissions"
|
|
|
|
:updatePath="updatePath"
|
2023-10-24 21:49:37 +08:00
|
|
|
:optionsPath="column.options_path"
|
|
|
|
:inArchivedRepositoryRow="inArchivedRepositoryRow"
|
2023-11-24 00:45:50 +08:00
|
|
|
:decimals="column.decimals"
|
2023-10-31 00:30:23 +08:00
|
|
|
:canEdit="permissions.can_manage && !inArchivedRepositoryRow"
|
2023-10-24 02:57:12 +08:00
|
|
|
:editingField="editingField"
|
|
|
|
@setEditingField="editingField = $event"
|
2023-10-24 21:49:37 +08:00
|
|
|
@update="update"
|
2023-10-24 02:57:12 +08:00
|
|
|
/>
|
|
|
|
<div class="sci-divider" :class="{ 'hidden': index === customColumns?.length - 1 }"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-10-24 21:49:37 +08:00
|
|
|
<div v-else class="text-sn-dark-grey font-inter text-sm font-normal leading-5">
|
|
|
|
{{ i18n.t('repositories.item_card.no_custom_columns_label') }}
|
|
|
|
</div>
|
2023-10-24 02:57:12 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import RepositoryStockValue from './repository_values/RepositoryStockValue.vue';
|
|
|
|
import RepositoryTextValue from './repository_values/RepositoryTextValue.vue';
|
|
|
|
import RepositoryNumberValue from './repository_values/RepositoryNumberValue.vue';
|
|
|
|
import RepositoryAssetValue from './repository_values/RepositoryAssetValue.vue';
|
|
|
|
import RepositoryListValue from './repository_values/RepositoryListValue.vue';
|
|
|
|
import RepositoryChecklistValue from './repository_values/RepositoryChecklistValue.vue';
|
|
|
|
import RepositoryStatusValue from './repository_values/RepositoryStatusValue.vue';
|
|
|
|
import RepositoryDateTimeValue from './repository_values/RepositoryDateTimeValue.vue';
|
|
|
|
import RepositoryDateTimeRangeValue from './repository_values/RepositoryDateTimeRangeValue.vue';
|
|
|
|
import RepositoryDateValue from './repository_values/RepositoryDateValue.vue';
|
|
|
|
import RepositoryDateRangeValue from './repository_values/RepositoryDateRangeValue.vue';
|
|
|
|
import RepositoryTimeRangeValue from './repository_values/RepositoryTimeRangeValue.vue'
|
|
|
|
import RepositoryTimeValue from './repository_values/RepositoryTimeValue.vue'
|
|
|
|
|
|
|
|
export default {
|
2023-10-24 21:49:37 +08:00
|
|
|
name: 'CustomColumns',
|
2023-10-24 02:57:12 +08:00
|
|
|
components: {
|
|
|
|
RepositoryStockValue,
|
|
|
|
RepositoryTextValue,
|
|
|
|
RepositoryNumberValue,
|
|
|
|
RepositoryAssetValue,
|
|
|
|
RepositoryListValue,
|
|
|
|
RepositoryChecklistValue,
|
|
|
|
RepositoryStatusValue,
|
|
|
|
RepositoryDateTimeValue,
|
|
|
|
RepositoryDateTimeRangeValue,
|
|
|
|
RepositoryDateValue,
|
|
|
|
RepositoryDateRangeValue,
|
|
|
|
RepositoryTimeRangeValue,
|
|
|
|
RepositoryTimeValue
|
|
|
|
},
|
|
|
|
props: {
|
2023-10-24 21:49:37 +08:00
|
|
|
customColumns: { type: Array, default: () => [] },
|
|
|
|
permissions: { type: Object, default: () => {} },
|
|
|
|
updatePath: { type: String, default: '' },
|
|
|
|
repositoryRowId: { type: Number, default: null },
|
|
|
|
repositoryId: { type: Number, default: null },
|
|
|
|
inArchivedRepositoryRow: { type: Boolean, default: false },
|
2023-10-26 18:59:11 +08:00
|
|
|
actions: {type: Object, default: () => {}}
|
2023-10-24 02:57:12 +08:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
editingField: null
|
|
|
|
}
|
2023-10-24 21:49:37 +08:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
update(params) {
|
|
|
|
this.$emit('update', params);
|
|
|
|
}
|
2023-10-24 02:57:12 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|