scinote-web/app/javascript/vue/projects/card.vue

84 lines
3 KiB
Vue
Raw Normal View History

2023-12-01 07:01:08 +08:00
<template>
2023-12-12 19:17:38 +08:00
<div v-if="!params.folder"
:class="{'bg-sn-light-grey': dtComponent.currentViewMode === 'archived'}"
class="p-4 rounded sn-shadow-flyout flex flex-col">
2023-12-01 07:01:08 +08:00
<div class="flex items-center gap-2 mb-2">
<div class="sci-checkbox-container">
<input
type="checkbox"
class="sci-checkbox"
@change="itemSelected"
/>
<label :for="params.id" class="sci-checkbox-label"></label>
</div>
<div>{{ params.code }}</div>
<RowMenuRenderer :params="{data: params, dtComponent: dtComponent}" class="ml-auto"/>
</div>
2023-12-11 16:18:22 +08:00
<a :href="params.urls.show"
:class="{'pointer-events-none text-sn-grey': !params.urls.show}"
class="font-bold mb-4 text-sn-black hover:no-underline hover:text-sn-black">
2023-12-01 07:01:08 +08:00
{{ params.name }}
</a>
<div class="grid gap-2 grid-cols-[80px_auto] mt-auto">
<span class="text-sn-grey">{{ i18n.t('projects.index.card.start_date') }}</span>
<span class="font-bold">{{ params.created_at }}</span>
2023-12-12 19:17:38 +08:00
<template v-if="dtComponent.viewMode == 'archived'">
2023-12-01 07:01:08 +08:00
<span class="text-sn-grey">{{ i18n.t('projects.index.card.archived_date') }}</span>
<span class="font-bold">{{ params.archived_on }}</span>
</template>
<span class="text-sn-grey">{{ i18n.t('projects.index.card.visibility') }}</span>
2023-12-11 16:18:22 +08:00
<span class="font-bold">
{{ params.hidden ? i18n.t('projects.index.hidden') : i18n.t('projects.index.visible') }}
</span>
2023-12-01 07:01:08 +08:00
<span class="text-sn-grey">{{ i18n.t('projects.index.card.users') }}</span>
2023-12-05 03:59:16 +08:00
<UsersRenderer :params="{data: params, value: params.users, dtComponent: dtComponent}" class="-mt-2.5" />
2023-12-01 07:01:08 +08:00
</div>
</div>
<div v-else class="p-4 rounded sn-shadow-flyout flex flex-col">
<div class="flex items-center gap-2 mb-2">
<div class="sci-checkbox-container">
<input
type="checkbox"
class="sci-checkbox"
@change="itemSelected"
/>
<label :for="params.id" class="sci-checkbox-label"></label>
</div>
<RowMenuRenderer :params="{data: params, dtComponent: dtComponent}" class="ml-auto"/>
</div>
<div class="flex-grow flex items-center justify-center min-h-[6rem] text-sn-blue">
<i class="sn-icon sn-icon-folder"></i>
</div>
2023-12-11 16:18:22 +08:00
<a :href="params.urls.show"
class="flex items-center justify-center gap-1 font-bold mb-2
text-sn-black hover:no-underline hover:text-sn-black">
2023-12-01 07:01:08 +08:00
<i class="sn-icon mini sn-icon-mini-folder-left"></i>
{{ params.name }}
</a>
<div class="flex items-center justify-center">
{{ params.folder_info }}
</div>
</div>
</template>
<script>
2023-12-11 16:18:22 +08:00
import RowMenuRenderer from '../shared/datatable/row_menu_renderer.vue';
import UsersRenderer from './renderers/users.vue';
import CardSelectorMixin from '../shared/datatable/mixins/card_selector.js';
2023-12-01 07:01:08 +08:00
export default {
2023-12-11 16:18:22 +08:00
name: 'ProjectCard',
2023-12-01 07:01:08 +08:00
props: {
params: Object,
2023-12-11 16:18:22 +08:00
dtComponent: Object,
2023-12-01 07:01:08 +08:00
},
components: {
RowMenuRenderer,
2023-12-11 16:18:22 +08:00
UsersRenderer,
2023-12-01 07:01:08 +08:00
},
2023-12-11 16:18:22 +08:00
mixins: [CardSelectorMixin],
};
2023-12-01 07:01:08 +08:00
</script>