Files
myprojplanet_vite/src/components/CHours/CHours.ts

103 lines
2.2 KiB
TypeScript
Raw Normal View History

2025-12-05 17:56:05 +01:00
import { colTableHours } from '@/store/Modules/fieldsTable'
2021-09-16 21:08:02 +02:00
2025-12-05 17:56:05 +01:00
import { shared_consts } from '@/common/shared_vuejs'
2021-09-16 21:08:02 +02:00
import { defineComponent, ref } from 'vue'
2025-03-01 14:14:43 +01:00
import type { IPagination } from 'model'
2025-12-05 17:56:05 +01:00
import { CImgText } from '@/components/CImgText'
2021-09-16 21:08:02 +02:00
import { CCard } from '../CCard'
2025-12-05 17:56:05 +01:00
import { CMyPage } from '@/components/CMyPage'
import { CTitleBanner } from '@/components/CTitleBanner'
import { CGridTableRec } from '@/components/CGridTableRec'
2021-09-16 21:08:02 +02:00
import { useUserStore } from '@store/UserStore'
export default defineComponent({
name: 'CHours',
components: { CImgText, CCard, CMyPage, CTitleBanner, CGridTableRec },
props: {
todoId: {
type: String,
required: true,
},
},
2025-03-01 14:14:43 +01:00
setup(props) {
2021-09-16 21:08:02 +02:00
const userStore = useUserStore()
2025-03-01 14:14:43 +01:00
const pagination = ref(<IPagination>{
2021-09-16 21:08:02 +02:00
sortBy: 'descr',
descending: false,
page: 2,
rowsPerPage: 5
// rowsNumber: xx if getting data from a server
})
function extraparams() {
return {
lookup1: {
lk_tab: 'users',
lk_LF: 'userId',
lk_FF: '_id',
lk_as: 'user',
af_objId_tab: 'myId',
lk_proj: {
todoId: 1, userId: 1, descr: 1, date: 1, time_start: 1, time_end: 1, hours: 1,
username: 1, name: 1, surname: 1
}
2021-09-16 21:08:02 +02:00
}
}
}
const arrfilterand = [
{
label: 'Tutte le ore',
value: shared_consts.FILTER_HOURS_ALL
}
]
function myfilterdef() {
return [shared_consts.FILTER_HOURS_MYLIST]
}
function myarrfilterand() {
const myfiltrodef = {
label: 'Mie Ore',
value: shared_consts.FILTER_HOURS_MYLIST,
hide: true,
default: true
}
let myarr = []
myarr.push(myfiltrodef)
if (arrfilterand)
myarr = [...myarr, ...arrfilterand]
return myarr
}
// const selected = []
function getcolHours() {
return colTableHours
}
function getdefaultnewrec() {
const myrec: any = {
todoId: props.todoId,
userId: userStore.my._id,
descr: ''
}
return myrec
}
return {
myfilterdef,
myarrfilterand,
extraparams,
getcolHours,
getdefaultnewrec,
pagination,
}
},
})