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

95 lines
3.5 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'}"
2024-03-01 20:37:31 +08:00
class="px-3 pt-3 pb-4 rounded border-solid border border-sn-gray flex flex-col">
<div class="flex items-center gap-4 mb-2">
2023-12-01 07:01:08 +08:00
<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"
2024-03-01 20:37:31 +08:00
:title="params.name"
2023-12-11 16:18:22 +08:00
:class="{'pointer-events-none text-sn-grey': !params.urls.show}"
2024-03-01 20:37:31 +08:00
class="font-bold mb-4 text-sn-blue hover:no-underline line-clamp-3 hover:text-sn-blue h-14">
2023-12-01 07:01:08 +08:00
{{ params.name }}
</a>
2024-03-01 20:37:31 +08:00
<div class="grid gap-x-2 gap-y-3 grid-cols-[90px_auto] mt-auto text-xs">
<span class="text-sn-dark-grey">{{ i18n.t('projects.index.card.start_date') }}</span>
2023-12-01 07:01:08 +08:00
<span class="font-bold">{{ params.created_at }}</span>
2024-03-01 20:37:31 +08:00
<template v-if="dtComponent.currentViewMode == 'archived'">
<span class="text-sn-dark-grey">{{ i18n.t('projects.index.card.archived_date') }}</span>
2023-12-01 07:01:08 +08:00
<span class="font-bold">{{ params.archived_on }}</span>
</template>
2024-03-01 20:37:31 +08:00
<template v-else>
<span class="text-sn-dark-grey">{{ i18n.t('projects.index.card.updated_on') }}</span>
<span class="font-bold">{{ params.updated_at }}</span>
</template>
<span class="text-sn-dark-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="px-3 pt-3 pb-4 rounded border-solid border border-sn-gray flex flex-col"
:class="{
'bg-sn-light-grey': dtComponent.currentViewMode === 'archived',
'bg-sn-super-light-grey': dtComponent.currentViewMode !== 'archived'
}"
>
<div class="flex items-center gap-4 mb-2">
2023-12-01 07:01:08 +08:00
<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 flex-col items-center justify-center"
:class="{
'text-sn-black hover:text-sn-black': dtComponent.currentViewMode === 'archived',
'text-sn-blue hover:text-sn-blue': dtComponent.currentViewMode !== 'archived'
}"
>
<i class="sn-icon sn-icon-folder " style="font-size: 56px !important"></i>
<a :href="params.urls.show"
class="line-clamp-2 font-bold mb-2 text-inherit text-center hover:no-underline ">
{{ params.name }}
</a>
<div class="flex items-center justify-center text-sn-dark-grey">
{{ params.folder_info }}
</div>
2023-12-01 07:01:08 +08:00
</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>