Riattivato il Calendario (ma ancora non lo rendo visibile)

aggiunto campi: DateTimeStart e DateTimeEnd negli Eventi
Aggiunto Filtro Data
This commit is contained in:
paoloar77
2022-02-24 19:13:06 +01:00
parent 7b3a5a2ba8
commit 430408f7bf
64 changed files with 1061 additions and 473 deletions

View File

@@ -43,15 +43,17 @@ export const addAuthHeaders = () => {
// axiosInstance.defaults.headers.Authorization = `Bearer ${LoginModule.userInfos.userToken}`
}
export const removeAuthHeaders = () => {
delete axiosInstance.defaults.headers.Authorization
}
//export const removeAuthHeaders = () => {
// delete axiosInstance.defaults.headers.Authorization
//}
async function Request(type: string, path: string, payload: any): Promise<Types.AxiosSuccess | Types.AxiosError | undefined> {
let ricevuto = false
const userStore = useUserStore()
const globalStore = useGlobalStore()
try {
if (tools.isDebug()) console.log('Axios Request', path, type, tools.notshowPwd(payload))
let response: AxiosResponse
@@ -102,7 +104,7 @@ async function Request(type: string, path: string, payload: any): Promise<Types.
}
return new Types.AxiosSuccess(response.data, response.status)
} if (type === 'get' || type === 'delete') {
} else if (type === 'get' || type === 'delete') {
// @ts-ignore
response = await axiosInstance[type](path, {
baseURL: globalStore.getServerHost(),
@@ -114,7 +116,7 @@ async function Request(type: string, path: string, payload: any): Promise<Types.
})
ricevuto = true
return new Types.AxiosSuccess(response.data, response.status)
} if (type === 'postFormData') {
} else if (type === 'postFormData') {
response = await axiosInstance.post(path, payload, {
baseURL: globalStore.getServerHost(),
headers: {

View File

@@ -4,7 +4,7 @@ import { useUserStore } from '@store/UserStore'
export * from './ApiTypes'
import axios from 'axios'
export { addAuthHeaders, removeAuthHeaders, API_URL } from './Instance'
export { addAuthHeaders, API_URL } from './Instance'
// import {AlgoliaSearch} from './AlgoliaController'
import Paths from '@paths'
import { tools } from '@src/store/Modules/tools'

View File

@@ -45,12 +45,12 @@ export const costanti = {
disable: true,
},
{
title: 'Alimenti',
to: '/foods',
icon: 'fas fa-utensils',
color: 'green-5',
hint: '',
disable: true,
title: 'Eventi',
to: '/events',
icon: 'event',
color: 'green',
hint: 'eventi, last minute, offerte di lavoro',
disable: false,
},
{
title: 'Luoghi',
@@ -71,11 +71,11 @@ export const costanti = {
small: true,
},
{
title: 'Eventi',
to: '/bacheca',
icon: 'event',
title: 'Help',
to: '/help',
icon: 'fas fa-users',
color: 'green-7',
hint: 'eventi, last minute, offerte di lavoro',
hint: '',
disable: true,
small: true,
},

View File

@@ -69,6 +69,7 @@ function AddCol(params: IColGridTable) {
action: (params.action === undefined) ? '' : params.action,
foredit: (params.foredit === undefined) ? true : params.foredit,
fieldtype: (params.fieldtype === undefined) ? costanti.FieldType.string : params.fieldtype,
fieldtype_real: (params.fieldtype_real === undefined) ? ((params.fieldtype === undefined) ? costanti.FieldType.string : params.fieldtype) : params.fieldtype_real,
field_outtype: (params.field_outtype === undefined) ? costanti.FieldType.string : params.field_outtype,
tipovisu: (params.tipovisu === undefined) ? costanti.TipoVisu.TESTO : params.tipovisu,
link: (params.link === undefined) ? '' : params.link,
@@ -557,6 +558,11 @@ export const colmyUserGroup = [
jointable: 'friendsandme',
field_outtype: costanti.FieldType.object,
}),
AddCol({ name: 'date_created', label_trans: 'event.dateCreated', fieldtype: costanti.FieldType.onlydate,
required: false,
visible: false,
sortable: true,
showWhen: 0}),
AddCol({
name: 'photos',
label_trans: 'skill.photos',
@@ -579,7 +585,9 @@ export const colmyUserGroup = [
}),
AddCol({
name: 'date_created', label_trans: 'reg.date_created', fieldtype: costanti.FieldType.onlydate,
showWhen: costanti.showWhen.InPage + costanti.showWhen.InView_OnlyifExist
showWhen: costanti.showWhen.InPage + costanti.showWhen.InView_OnlyifExist,
visible: false,
required: false,
}),
AddCol({
name: 'note', label_trans: 'proj.longdescr', fieldtype: costanti.FieldType.html,
@@ -630,8 +638,9 @@ export const colmyGoods = [
fieldtype: costanti.FieldType.string,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true,
maxlength: 200,
maxlength: 90,
required: true,
sortable: false,
}),
AddCol({
name: 'idSectorGood',
@@ -678,6 +687,11 @@ export const colmyGoods = [
//icon: 'fas fa-hands-helping',
// isadvanced_field: true,
}),
AddCol({ name: 'date_created', label_trans: 'event.dateCreated', fieldtype: costanti.FieldType.onlydate,
required: false,
visible: false,
sortable: true,
showWhen: 0}),
AddCol({
name: 'photos',
label_trans: 'skill.photos',
@@ -778,8 +792,9 @@ export const colmySkills = [
fieldtype: costanti.FieldType.string,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true,
maxlength: 200,
maxlength: 90,
required: true,
sortable: false,
}),
AddCol({
name: 'idSector',
@@ -822,6 +837,8 @@ export const colmySkills = [
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
visible: false,
}),
/*AddCol({
name: 'idSubSkill',
label_trans: 'skill.subskill',
@@ -850,6 +867,11 @@ export const colmySkills = [
icon: 'grading',
isadvanced_field: true,
}),
AddCol({ name: 'date_created', label_trans: 'event.dateCreated', fieldtype: costanti.FieldType.onlydate,
required: false,
visible: false,
sortable: true,
showWhen: 0}),
AddCol({
name: 'photos',
label_trans: 'skill.photos',
@@ -885,6 +907,7 @@ export const colmyBachecas = [
noshowlabel: true,
icon: 'mood',
isadvanced_field: true,
sortable: false,
}),
AddCol({
@@ -896,6 +919,7 @@ export const colmyBachecas = [
link: '/my/username',
noshowlabel: true,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
sortable: false,
}),
AddCol({
name: 'idCity',
@@ -909,6 +933,7 @@ export const colmyBachecas = [
remote_table: 'mycities',
remote_key: '_id',
remote_field: 'comune',
sortable: false,
}),
AddCol({
name: 'adType',
@@ -919,15 +944,39 @@ export const colmyBachecas = [
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
icon: 'fas fa-bullhorn',
noshowlabel: true,
sortable: false,
}),
AddCol(
{
name: 'dateTimeStart',
label_trans: 'event.dateTimeStart',
// jointable: toolsext.TABCALALLDATE,
fieldtype: costanti.FieldType.date,
// fieldtype: costanti.FieldType.select,
// fieldtype_real: costanti.FieldType.onlydate,
// fieldtype: costanti.FieldType.onlydate,
icon: 'fas fa-calendar-day',
}),
AddCol(
{
name: 'dateTimeEnd',
label_trans: 'event.dateTimeEnd',
fieldtype: costanti.FieldType.date,
// jointable: toolsext.TABCALALLDATE,
// fieldtype: costanti.FieldType.select,
// fieldtype_real: costanti.FieldType.onlydate,
icon: 'fas fa-calendar-day',
sortable: false,
}),
AddCol({
name: 'descr',
label_trans: 'proj.shortdescr',
fieldtype: costanti.FieldType.string,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
noshowlabel: true,
maxlength: 200,
maxlength: 90,
required: true,
sortable: false,
}),
AddCol({
name: 'idSector',
@@ -938,6 +987,7 @@ export const colmyBachecas = [
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
visible: true,
icon: 'category',
sortable: false,
}),
AddCol({
name: 'idSkill',
@@ -951,6 +1001,7 @@ export const colmyBachecas = [
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
allowNewValue: false,
required: false,
sortable: false,
}),
AddCol({
name: 'idContribType',
@@ -962,15 +1013,21 @@ export const colmyBachecas = [
icon: 'fas fa-hand-holding',
//icon: 'fas fa-hands-helping',
isadvanced_field: false,
sortable: false,
}),
AddCol({
/*AddCol({
name: '',
fieldtype: costanti.FieldType.separator,
required: false,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit,
visible: false,
}),
sortable: false,
}),*/
AddCol({ name: 'date_created', label_trans: 'event.dateCreated', fieldtype: costanti.FieldType.onlydate,
required: false,
visible: false,
sortable: true,
showWhen: 0}),
AddCol({
name: 'photos',
label_trans: 'skill.photos',
@@ -979,17 +1036,20 @@ export const colmyBachecas = [
showpicprofile_ifnotset: true,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit + costanti.showWhen.InView,
isadvanced_field: true,
sortable: false,
}),
AddCol({
name: 'note', label_trans: 'proj.longdescr', fieldtype: costanti.FieldType.html,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
titlepopupedit: 'Dettagli', field_extra1: 'username', subfield_extra1: '',
isadvanced_field: true,
sortable: false,
}),
//**ADDFIELD_MYBACHECAS
AddCol({
name: 'website', label_trans: 'reg.website', isadvanced_field: true, fieldtype: costanti.FieldType.link,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InEdit + costanti.showWhen.InView_OnlyifExist,
sortable: false,
}),
AddCol(DuplicateRec),
AddCol(ModifRec),
@@ -1291,6 +1351,12 @@ const colTablePermission = [
AddCol(DuplicateRec),
]
const colCalDate = [
AddCol({ name: '_id', label_trans: 'rec.date', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'datestr', label_trans: 'reg.date', fieldtype: costanti.FieldType.string }),
AddCol({ name: 'filter', label_trans: 'reg.filter', fieldtype: costanti.FieldType.object }),
]
const colTableGeneric = [
AddCol({ name: 'value', label_trans: 'others.value' }),
AddCol({ name: 'label', label_trans: 'proj.longdescr' }),
@@ -1445,7 +1511,7 @@ export const colTableUsersBase = [
AddCol(DuplicateRec),
]
// IColGridTable
// IColGridTable
export const colTableUsers = [
// AddCol({ name: '_id', label_trans: 'reg.id' }),
AddCol({ name: 'index', label_trans: 'reg.index', fieldtype: costanti.FieldType.number }),
@@ -1973,6 +2039,7 @@ export const colTableUsersISP = [
}),
AddCol({ name: 'date_reg', label_trans: 'reg.date_reg', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'lasttimeonline', label_trans: 'reg.lasttimeonline', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'useragent', label_trans: 'reg.useragent', fieldtype: costanti.FieldType.string }),
AddCol({
name: 'perm',
label_trans: 'reg.perm',
@@ -2434,6 +2501,22 @@ export const fieldsTable = {
colkey: '_id',
collabel: 'descr',
},
{
value: toolsext.TABCALDATE,
label: 'Date',
columns: colCalDate,
colkey: '_id',
collabel: 'datestr',
noshow: true,
},
{
value: toolsext.TABCALALLDATE,
label: 'Date',
columns: colCalDate,
colkey: '_id',
collabel: 'datestr',
noshow: true,
},
/*{
value: 'subskills',
label: 'Specializzazione',

View File

@@ -15,6 +15,8 @@ import {
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery,
} from '@model'
import { addToDate } from '@quasar/quasar-ui-qcalendar'
import { lists } from '@store/Modules/lists'
import { costanti } from '@store/Modules/costanti'
import { copyToClipboard, date, Screen, useQuasar, colors, Cookies, scroll } from 'quasar'
@@ -2842,6 +2844,7 @@ export const tools = {
},
addDays(mydate: Date, days: number) {
//++ addToDate ?
return date.addToDate(mydate, { days })
},
@@ -4944,7 +4947,6 @@ export const tools = {
_id: 0,
idSector: 0,
idSkill: 0,
// idSubSkill: [],
idStatusSkill: [],
idContribType: [],
idCity: [],
@@ -4997,9 +4999,10 @@ export const tools = {
_id: 0,
idSector: 0,
idSkill: 0,
// idSubSkill: [],
idStatusSkill: [],
idContribType: [],
dateTimeStart: new Date(),
dateTimeEnd: new Date(),
idCity: [],
NumLevel: 0,
adType: 0,

View File

@@ -63,6 +63,8 @@ export const toolsext = {
TABMYSKILLS: 'myskills',
TABMYGOODS: 'mygoods',
TABMYBACHECAS: 'mybachecas',
TABCALDATE: 'caldate',
TABCALALLDATE: 'calalldate',
TABNAVI: 'navi',
TABLISTAINGRESSO: 'listaingressos',
TABGRADUATORIA: 'graduatorias',

View File

@@ -799,7 +799,7 @@ export const useUserStore = defineStore('UserStore', {
if (isLogged) {
// console.log('this.isLogged', this.isLogged)
globalStore.setleftDrawerOpen(localStorage.getItem(toolsext.localStorage.leftDrawerOpen) === 'true')
// globalStore.setleftDrawerOpen(localStorage.getItem(toolsext.localStorage.leftDrawerOpen) === 'true')
globalStore.setCategorySel(localStorage.getItem(toolsext.localStorage.categorySel))
globalStore.checkUpdates()

View File

@@ -1351,11 +1351,20 @@ export const useGlobalStore = defineStore('GlobalStore', {
return []
},
getValueByTable(col: IColGridTable, val: any) {
if (col.jointable) {
const mylist = this.getTableJoinByName(col.jointable)
const key = fieldsTable.getKeyByTable(col.jointable)
const collab = fieldsTable.getLabelByTable(col.jointable)
getRecordByTableSingle(table: string, val: any) {
if (table) {
const mylist = this.getTableJoinByName(table)
const key = fieldsTable.getKeyByTable(table)
return mylist.find((myrec: any) => myrec[key] === val)
}
},
getValueByTableSingle(table: string, val: any) {
if (table) {
const mylist = this.getTableJoinByName(table)
const key = fieldsTable.getKeyByTable(table)
const collab = fieldsTable.getLabelByTable(table)
// console.table(mylist)
let risultato = ''
@@ -1378,6 +1387,11 @@ export const useGlobalStore = defineStore('GlobalStore', {
return ''
},
getValueByTable(col: IColGridTable, val: any) {
return this.getValueByTableSingle(col.jointable!, val)
},
getMultiValueByTable(col: IColGridTable, arrval: any) {
// console.log('getMultiValueByTable')
if (col.jointable) {
@@ -1400,18 +1414,81 @@ export const useGlobalStore = defineStore('GlobalStore', {
return ''
},
async getStatSite() {
const userStore = useUserStore()
const paramquery = {
locale: tools.getLocale(),
username: userStore.my.username
}
return Api.SendReq('/site/load', 'POST', paramquery)
.then((res) => {
console.log('res', res)
this.datastat = res.data.datastat
return this.datastat
}).catch((error) => {
return null
})
},
getItemDate(num: number, day: number, mystr: string) {
let mydate = tools.addDays(tools.getDateNow(), day);
let mydateend = tools.addDays(mydate, 7);
mydate = tools.getstrYYMMDDDate(mydate)
mydateend = tools.getstrYYMMDDDate(mydateend)
let filter = { dateTimeStart: {$gte: mydate, $lte: mydateend } }
let obj = {_id: num, datestr: mystr, filter }
return obj
},
getArrDateEvent() {
const arr = []
let obj = {}
arr.push(this.getItemDate(1, -7, 'Settimana Scorsa'))
arr.push(this.getItemDate(2, 0, 'Da Oggi a 7 gg.'))
arr.push(this.getItemDate(3, 7, 'La settimana prossima'))
// console.log('Days', arr)
return arr
},
getArrAllDateEvent() {
const arr = []
let obj = {}
for (let i = 0; i < 120; i++) {
let mydate = tools.addDays(tools.getDateNow(), i - 30);
obj ={_id: mydate, datestr: tools.getstrVeryShortDate(mydate) }
arr.push(obj)
}
// console.log('Days', arr)
return arr
},
getTableJoinByName(table: string, addall?: boolean, filter?: any) {
if (table === 'permissions') return [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Tutor, shared_consts.Permissions.Editor, shared_consts.Permissions.Zoomeri, shared_consts.Permissions.Department]
if (table === 'accepted') return [shared_consts.Accepted.CHECK_READ_GUIDELINES, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI]
if (table === 'fieldstype') return costanti.FieldTypeArr
if (table === 'metodo_pagamento') return tools.SelectMetodiPagamento
if (table === 'bottype') return shared_consts.BotType
if (table === 'visibility') return shared_consts.Visibility
if (table === 'visibilGroup') return shared_consts.VisibilGroup
if (table === 'lang') return shared_consts.Lang
if (table === 'regions') return shared_consts.Regions
if (table === 'provinces') return shared_consts.Provinces
if (table === 'shippings') return shared_consts.Shippings
else if (table === 'accepted') return [shared_consts.Accepted.CHECK_READ_GUIDELINES, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI]
else if (table === 'fieldstype') return costanti.FieldTypeArr
else if (table === 'metodo_pagamento') return tools.SelectMetodiPagamento
else if (table === 'bottype') return shared_consts.BotType
else if (table === 'visibility') return shared_consts.Visibility
else if (table === 'visibilGroup') return shared_consts.VisibilGroup
else if (table === 'lang') return shared_consts.Lang
else if (table === 'regions') return shared_consts.Regions
else if (table === 'provinces') return shared_consts.Provinces
else if (table === 'shippings') return shared_consts.Shippings
else if (table === toolsext.TABCALDATE) return this.getArrDateEvent()
else if (table === toolsext.TABCALALLDATE) return this.getArrAllDateEvent()
let myarr = this.getListByTable(table)