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

110 lines
3.9 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"
2024-04-23 17:16:10 +08:00
:class="{ 'bg-sn-grey-100': dtComponent.currentViewMode === 'archived', [cardMinWidth]: true }"
class="px-3 pt-3 pb-4 rounded border-solid border border-sn-gray-300 flex flex-col" >
2024-03-01 20:37:31 +08:00
<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"
2024-04-01 19:53:45 +08:00
:checked="cardSelected"
2023-12-01 07:01:08 +08:00
@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"
2024-04-23 17:16:10 +08:00
:class="{
'pointer-events-none !text-sn-grey': !params.urls.show,
'!text-sn-black': dtComponent.currentViewMode === 'archived',
}"
class="font-bold mb-4 text-sn-blue shrink-0 hover:no-underline line-clamp-3 hover:text-sn-blue h-[60px]">
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 h-56"
:class="{
2024-04-23 17:16:10 +08:00
'bg-sn-grey-100': dtComponent.currentViewMode === 'archived',
'bg-sn-super-light-grey': dtComponent.currentViewMode !== 'archived',
[cardMinWidth]: true
}"
>
<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"
2024-04-01 19:53:45 +08:00
:checked="cardSelected"
2023-12-01 07:01:08 +08:00
@change="itemSelected"
/>
<label :for="params.id" class="sci-checkbox-label"></label>
</div>
<RowMenuRenderer :params="{data: params, dtComponent: dtComponent}" class="ml-auto"/>
</div>
<div
2024-04-23 17:16:10 +08:00
class="flex flex-col items-center justify-center pt-4"
:class="{
'text-sn-black hover:text-sn-black': dtComponent.currentViewMode === 'archived',
'text-sn-blue hover:text-sn-blue': dtComponent.currentViewMode !== 'archived'
}"
>
2024-04-23 17:16:10 +08:00
<i class="sn-icon sn-icon-folder mb-2" style="font-size: 56px !important"></i>
<a :href="params.urls.show"
2024-04-23 17:16:10 +08:00
class="line-clamp-2 font-bold mb-2 text-inherit text-center hover:no-underline "
:class="{'!text-sn-black': dtComponent.currentViewMode === 'archived'}"
>
{{ 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>
/* global GLOBAL_CONSTANTS */
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
},
computed: {
cardMinWidth() {
2024-03-16 11:51:32 +08:00
return `min-w-[${GLOBAL_CONSTANTS.TABLE_CARD_MIN_WIDTH}px]`;
}
},
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>