Project e Todos sistemati...
aggiunti Gruppi
This commit is contained in:
@@ -8,7 +8,7 @@ import { toolsext } from '@src/store/Modules/toolsext'
|
||||
|
||||
export const OtherTables = ['categories', 'config', 'swmsg']
|
||||
export const MainTables = ['todos', 'projects']
|
||||
export const allMethod = ['sync_post_', 'sync_patch_', 'delete_']
|
||||
export const allMethod = ['sync_post_', 'sync_patch_', 'delete_', 'hide_']
|
||||
|
||||
export function getLinkByTableName(nametable) {
|
||||
if (nametable === 'todos') {
|
||||
@@ -24,9 +24,11 @@ export const DB = {
|
||||
CMD_SYNC: 'sync',
|
||||
CMD_SYNC_NEW: 'sync-new',
|
||||
CMD_DELETE: 'sync-delete',
|
||||
CMD_HIDE: 'sync-hide',
|
||||
TABLE_SYNC_POST: 'sync_post_',
|
||||
TABLE_SYNC_PATCH: 'sync_patch_',
|
||||
TABLE_DELETE: 'delete_'
|
||||
TABLE_DELETE: 'delete_',
|
||||
TABLE_HIDE: 'hide_'
|
||||
}
|
||||
|
||||
export function allTables() {
|
||||
@@ -82,7 +84,7 @@ async function dbDeleteItem(call, item) {
|
||||
|
||||
call = '/' + call
|
||||
|
||||
const res = await Api.SendReq(call + item._id, 'DELETE', item)
|
||||
const res = await Api.SendReq(call + item._id, 'DELETE', null)
|
||||
.then((myres) => {
|
||||
console.log('dbdeleteItem to the Server')
|
||||
return myres
|
||||
@@ -96,6 +98,37 @@ async function dbDeleteItem(call, item) {
|
||||
}
|
||||
}
|
||||
|
||||
async function dbHideItem(call, item) {
|
||||
|
||||
if (!('serviceWorker' in navigator)) {
|
||||
// console.log('dbdeleteItem', item)
|
||||
if (UserStore.getters.isUserInvalid) {
|
||||
return false
|
||||
} // Login not made
|
||||
|
||||
item = {
|
||||
...item,
|
||||
hide: true
|
||||
}
|
||||
|
||||
console.log('dbHideItem', item)
|
||||
|
||||
call = '/' + call
|
||||
|
||||
const res = await Api.SendReq(call + item._id + '/true', 'DELETE', null)
|
||||
.then((myres) => {
|
||||
console.log('dbHideItem to the Server')
|
||||
return myres
|
||||
})
|
||||
.catch((error) => {
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return UserStore.getters.getServerCode
|
||||
})
|
||||
|
||||
return res
|
||||
}
|
||||
}
|
||||
|
||||
async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, msg: String) {
|
||||
// Send to Server to Sync
|
||||
|
||||
@@ -105,7 +138,7 @@ async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, ms
|
||||
}
|
||||
|
||||
let cmdSw = cmd
|
||||
if ((cmd === DB.CMD_SYNC_NEW) || (cmd === DB.CMD_DELETE)) {
|
||||
if ((cmd === DB.CMD_SYNC_NEW) || (cmd === DB.CMD_DELETE) || (cmd === DB.CMD_HIDE)) {
|
||||
cmdSw = DB.CMD_SYNC
|
||||
}
|
||||
|
||||
@@ -161,7 +194,7 @@ async function Sync_Execute(cmd, tablesync, nametab, method, item: ITodo, id, ms
|
||||
}
|
||||
}
|
||||
|
||||
async function Sync_ExecuteCmd(cmd, nametab: string, method, item: ITodo, id, msg: String) {
|
||||
async function Sync_ExecuteCmd(cmd, nametab: string, method, item: ITodo, id, msg: string) {
|
||||
// Send to Server to Sync
|
||||
|
||||
let tablesync = ''
|
||||
@@ -171,6 +204,8 @@ async function Sync_ExecuteCmd(cmd, nametab: string, method, item: ITodo, id, ms
|
||||
tablesync = DB.TABLE_SYNC_PATCH + nametab
|
||||
} else if (method === 'DELETE') {
|
||||
tablesync = DB.TABLE_DELETE + nametab
|
||||
} else if (method === 'HIDE') {
|
||||
tablesync = DB.TABLE_HIDE + nametab
|
||||
}
|
||||
|
||||
const risdata = await Sync_Execute(cmd, tablesync, nametab, method, item, id, msg)
|
||||
@@ -181,6 +216,8 @@ async function Sync_ExecuteCmd(cmd, nametab: string, method, item: ITodo, id, ms
|
||||
}
|
||||
} else if (cmd === DB.CMD_DELETE) {
|
||||
await dbDeleteItem(nametab, item)
|
||||
} else if (cmd === DB.CMD_HIDE) {
|
||||
await dbHideItem(nametab, item)
|
||||
}
|
||||
|
||||
return risdata
|
||||
@@ -194,6 +231,10 @@ export function Sync_DeleteItem(nametab: string, item, id) {
|
||||
Sync_ExecuteCmd(DB.CMD_DELETE, nametab, 'DELETE', item, id, '')
|
||||
}
|
||||
|
||||
export function Sync_HideItem(nametab: string, item, id) {
|
||||
Sync_ExecuteCmd(DB.CMD_HIDE, nametab, 'HIDE', item, id, '')
|
||||
}
|
||||
|
||||
export async function aftercalling(ris, checkPending: boolean, nametabindex: string) {
|
||||
|
||||
if (ris.status !== 200) {
|
||||
@@ -387,13 +428,14 @@ function setmodifiedIfchanged(recOut, recIn, field) {
|
||||
}
|
||||
|
||||
export async function table_ModifyRecord(nametable, myitem, listFieldsToChange, field) {
|
||||
console.log('table_ModifyRecord ... ', nametable)
|
||||
if (myitem === null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
|
||||
console.log('--> table_ModifyRecord', nametable, myitem.descr)
|
||||
// console.log('--> table_ModifyRecord', nametable, myitem.descr)
|
||||
|
||||
if ((field === 'status') && (nametable === 'todos') && (myitem.status === tools.Status.COMPLETED)) {
|
||||
myitem.completed_at = tools.getDateNow()
|
||||
@@ -412,8 +454,10 @@ export async function table_ModifyRecord(nametable, myitem, listFieldsToChange,
|
||||
setmodifiedIfchanged(miorec, myobjsaved, myfield)
|
||||
})
|
||||
|
||||
console.log( ' ... 4 ')
|
||||
|
||||
if (miorec.modified) {
|
||||
// console.log(' ' + nametable + ' MODIFICATO! ', miorec.descr, miorec.pos, 'SALVALO SULLA IndexedDB')
|
||||
console.log(' ' + nametable + ' MODIFICATO! ', miorec.descr, miorec.pos, 'SALVALO SULLA IndexedDB')
|
||||
miorec.modify_at = tools.getDateNow()
|
||||
miorec.modified = false
|
||||
|
||||
@@ -429,7 +473,7 @@ export async function table_ModifyRecord(nametable, myitem, listFieldsToChange,
|
||||
return Sync_SaveItem(nametable, 'PATCH', miorec)
|
||||
|
||||
})
|
||||
// } else {
|
||||
// } else {
|
||||
// console.log(' ', miorec.descr, 'NON MODIF!')
|
||||
}
|
||||
}
|
||||
@@ -448,3 +492,18 @@ export function table_DeleteRecord(nametable, myobjtrov, id) {
|
||||
Sync_DeleteItem(nametable, myobjtrov, id)
|
||||
|
||||
}
|
||||
|
||||
export function table_HideRecord(nametable, myobjtrov, id) {
|
||||
|
||||
const mymodule = tools.getModulesByTable(nametable)
|
||||
|
||||
// 1) Delete from the Todos Array
|
||||
mymodule.mutations.deletemyitem(myobjtrov)
|
||||
|
||||
// 2) Delete from the IndexedDb
|
||||
globalroutines(null, 'delete', nametable, null, id)
|
||||
|
||||
// 3) Hide from the Server (call)
|
||||
Sync_DeleteItem(nametable, myobjtrov, id)
|
||||
|
||||
}
|
||||
|
||||
@@ -83,7 +83,9 @@ const state: IGlobalState = {
|
||||
mypage: [],
|
||||
calzoom: [],
|
||||
producers: [],
|
||||
groups: [],
|
||||
storehouses: [],
|
||||
departments: [],
|
||||
sharewithus: []
|
||||
}
|
||||
|
||||
@@ -133,8 +135,7 @@ namespace Getters {
|
||||
const config = state.arrConfig.find((item) => item._id === costanti.CONFIG_ID_SHOW_TYPE_TODOS)
|
||||
if (config) {
|
||||
return config.value
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
|
||||
@@ -205,6 +206,10 @@ namespace Getters {
|
||||
return GlobalStore.state.producers
|
||||
else if (table === 'storehouses')
|
||||
return GlobalStore.state.storehouses
|
||||
else if (table === 'groups')
|
||||
return GlobalStore.state.groups
|
||||
else if (table === 'departments')
|
||||
return GlobalStore.state.departments
|
||||
else if (table === 'sharewithus')
|
||||
return GlobalStore.state.sharewithus
|
||||
else if (table === 'paymenttypes')
|
||||
@@ -1042,7 +1047,7 @@ namespace Actions {
|
||||
})
|
||||
}
|
||||
|
||||
async function GetFlotta(context, { riga, col_prima, col_ultima}) {
|
||||
async function GetFlotta(context, { riga, col_prima, col_ultima }) {
|
||||
console.log('GetFlotta')
|
||||
|
||||
const mydata = {
|
||||
@@ -1092,11 +1097,13 @@ namespace Actions {
|
||||
GlobalStore.state.calzoom = (res.data.calzoom) ? [...res.data.calzoom] : []
|
||||
GlobalStore.state.producers = (res.data.producers) ? [...res.data.producers] : []
|
||||
GlobalStore.state.storehouses = (res.data.storehouses) ? [...res.data.storehouses] : []
|
||||
GlobalStore.state.groups = (res.data.groups) ? [...res.data.groups] : []
|
||||
GlobalStore.state.departments = (res.data.departments) ? [...res.data.departments] : []
|
||||
// console.log('res.data.cart', res.data.cart)
|
||||
if (res.data.cart)
|
||||
Products.state.cart = (res.data.cart) ? {...res.data.cart} : {}
|
||||
Products.state.cart = (res.data.cart) ? { ...res.data.cart } : {}
|
||||
else
|
||||
Products.state.cart = { items: [], totalPrice: 0, totalQty: 0, userId: ''}
|
||||
Products.state.cart = { items: [], totalPrice: 0, totalQty: 0, userId: '' }
|
||||
|
||||
Products.state.orders = (res.data.orders) ? [...res.data.orders] : []
|
||||
|
||||
@@ -1134,8 +1141,14 @@ namespace Actions {
|
||||
|
||||
return true
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
}).then((res) => {
|
||||
|
||||
if (static_data.functionality.ENABLE_PROJECTS_LOADING)
|
||||
Projects.actions.dbLoad({ checkPending: false, onlyiffirsttime: true })
|
||||
|
||||
return res
|
||||
|
||||
}).catch((error) => {
|
||||
console.log('error dbLoad', error)
|
||||
// UserStore.mutations.setErrorCatch(error)
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
|
||||
@@ -1222,9 +1235,15 @@ namespace Actions {
|
||||
static_data.routes = static_data.routes.sort((a, b) => a.order - b.order)
|
||||
|
||||
if (tools.sito_online(false)) {
|
||||
router.addRoutes([...arrpagesroute, last])
|
||||
for (const r of arrpagesroute) {
|
||||
router.addRoute(r)
|
||||
}
|
||||
router.addRoute(last)
|
||||
// router.addRoutes([...arrpagesroute, last])
|
||||
} else {
|
||||
router.addRoutes([sito_offline, last])
|
||||
router.addRoute(sito_offline)
|
||||
router.addRoute(last)
|
||||
// router.addRoutes([sito_offline, last])
|
||||
this.$router.replace('/sito_offline')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ namespace Getters {
|
||||
|
||||
const getOrdersCart = b.read((stateparamf: IProductsState) => (tipoord: string): IOrderCart[] => {
|
||||
if (tipoord === 'incorso')
|
||||
return state.orders.filter((rec) => rec.status <= shared_consts.OrderStatus.CHECKOUT_CONFIRMED)
|
||||
return state.orders.filter((rec) => rec.status <= shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||
else
|
||||
return state.orders.filter((rec) => rec.status < shared_consts.OrderStatus.RECEIVED && rec.status > shared_consts.OrderStatus.CHECKOUT_CONFIRMED)
|
||||
return state.orders.filter((rec) => rec.status < shared_consts.OrderStatus.RECEIVED && rec.status > shared_consts.OrderStatus.CHECKOUT_SENT)
|
||||
}, 'getOrdersCart')
|
||||
|
||||
const existProductInCart = b.read((stateparamf: IProductsState) => (idproduct): boolean => {
|
||||
@@ -218,14 +218,14 @@ namespace Actions {
|
||||
return ris
|
||||
}
|
||||
|
||||
async function loadCart(context) {
|
||||
async function loadOrders(context) {
|
||||
|
||||
console.log('loadCart')
|
||||
console.log('loadOrders')
|
||||
|
||||
if (!static_data.functionality.ENABLE_ECOMMERCE)
|
||||
return null
|
||||
|
||||
console.log('loadCart', 'userid=', UserStore.state.my._id)
|
||||
console.log('loadOrders', 'userid=', UserStore.state.my._id)
|
||||
|
||||
// if (UserStore.state.my._id === '') {
|
||||
// return new Types.AxiosError(0, null, 0, '')
|
||||
@@ -244,7 +244,7 @@ namespace Actions {
|
||||
return res
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error loadCart', error)
|
||||
console.log('error loadOrders', error)
|
||||
UserStore.mutations.setErrorCatch(error)
|
||||
return new Types.AxiosError(serv_constants.RIS_CODE_ERR, null, tools.ERR_GENERICO, error)
|
||||
})
|
||||
@@ -349,7 +349,7 @@ namespace Actions {
|
||||
ris = await Api.SendReq('/cart/' + UserStore.state.my._id + '/cartstatus', 'POST', { cart_id, status })
|
||||
.then((res) => {
|
||||
|
||||
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_CONFIRMED) {
|
||||
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_SENT) {
|
||||
ProductsModule.state.cart = {}
|
||||
if (res.data.orders)
|
||||
Products.state.orders = res.data.orders
|
||||
@@ -366,13 +366,13 @@ namespace Actions {
|
||||
}
|
||||
|
||||
export const actions = {
|
||||
// loadCart: b.dispatch(loadCart),
|
||||
loadProduct: b.dispatch(loadProduct),
|
||||
loadProducts: b.dispatch(loadProducts),
|
||||
addToCart: b.dispatch(addToCart),
|
||||
addSubQtyToItem: b.dispatch(addSubQtyToItem),
|
||||
UpdateStatusCart: b.dispatch(UpdateStatusCart),
|
||||
removeFromCart: b.dispatch(removeFromCart),
|
||||
loadOrders: b.dispatch(loadOrders),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ const stateglob: IProjectsState = {
|
||||
visuLastCompleted: 10
|
||||
}
|
||||
|
||||
const listFieldsToChange: string [] = ['descr', 'longdescr', 'hoursplanned', 'hoursleft', 'hoursworked', 'id_parent', 'statusproj',
|
||||
'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progressCalc', 'live_url', 'test_url',
|
||||
const listFieldsToChange: string [] = ['descr', 'respUsername', 'viceRespUsername', 'longdescr', 'hoursplanned', 'hoursleft', 'hoursworked', 'id_parent', 'statusproj',
|
||||
'category', 'expiring_at', 'priority', 'pos', 'groupId', 'enableExpiring', 'progressCalc', 'live_url', 'test_url',
|
||||
'begin_development', 'begin_test', 'actualphase', 'totalphases', 'hoursweeky_plannedtowork', 'endwork_estimate',
|
||||
'privacyread', 'privacywrite', 'id_main_project', 'typeproj', 'favourite', 'themecolor', 'themebgcolor']
|
||||
|
||||
@@ -62,12 +62,14 @@ function getproj(projects, idproj, tipoproj: string) {
|
||||
let ris = null
|
||||
|
||||
if (tipoproj === RouteNames.myprojects)
|
||||
ris = projects.filter((proj) => (proj.id_parent === idproj) && (proj.userId === UserStore.state.my._id) && (proj.privacyread === Privacy.onlyme))
|
||||
ris = projects.filter((proj) => (proj.id_parent === idproj) && (proj.userId === UserStore.state.my._id))
|
||||
else if (tipoproj === RouteNames.projectsshared)
|
||||
ris = projects.filter((proj) => (proj.id_parent === idproj) && (proj.userId === UserStore.state.my._id) && (proj.privacyread !== Privacy.onlyme))
|
||||
else if (tipoproj === RouteNames.projectsall)
|
||||
ris = projects.filter((proj) => (proj.id_parent === idproj) && (proj.userId !== UserStore.state.my._id) )
|
||||
|
||||
if (ris)
|
||||
ris = ris.sort((a, b) => a.pos - b.pos)
|
||||
// console.log('idproj', idproj, 'projects', projects, 'getproj', tipoproj, 'ris=', ris)
|
||||
|
||||
return ris
|
||||
@@ -93,7 +95,6 @@ namespace Getters {
|
||||
category: '',
|
||||
// expiring_at: tomorrow,
|
||||
enableExpiring: false,
|
||||
id_prev: '',
|
||||
pos: 0,
|
||||
modified: false,
|
||||
live_url: '',
|
||||
@@ -111,7 +112,10 @@ namespace Getters {
|
||||
hoursweeky_plannedtowork: 0,
|
||||
endwork_estimate: tools.getDateNull(),
|
||||
themecolor: '',
|
||||
themebgcolor: ''
|
||||
themebgcolor: '',
|
||||
groupId: '',
|
||||
respUsername: '',
|
||||
viceRespUsername: ''
|
||||
}
|
||||
|
||||
return obj
|
||||
@@ -156,6 +160,8 @@ namespace Getters {
|
||||
}, 'getDescrById')
|
||||
|
||||
const getRecordById = b.read((state: IProjectsState) => (id: string): IProject => {
|
||||
// console.log('state.projects', state.projects)
|
||||
// console.log('find', state.projects.find((item) => item._id === id))
|
||||
if (state.projects) {
|
||||
return state.projects.find((item) => item._id === id)
|
||||
}
|
||||
@@ -293,6 +299,8 @@ namespace Actions {
|
||||
// return false // Login not made
|
||||
// }
|
||||
|
||||
console.log('UserStore.state.my', UserStore.state.my)
|
||||
|
||||
console.log('dbLoad', nametable, checkPending, 'userid=', UserStore.state.my._id)
|
||||
|
||||
const ris = await Api.SendReq('/projects/' + UserStore.state.my._id, 'GET', null)
|
||||
@@ -333,15 +341,19 @@ namespace Actions {
|
||||
console.log('myobjtrov', myobjtrov.descr)
|
||||
|
||||
if (!!myobjtrov) {
|
||||
/*
|
||||
const myobjnext = tools.getElemPrevById(myarr, myobjtrov._id)
|
||||
|
||||
if (!!myobjnext) {
|
||||
myobjnext.id_prev = myobjtrov.id_prev
|
||||
myobjnext.pos = myobjtrov.pos + 1
|
||||
myobjnext.modified = true
|
||||
await modify(context, { myitem: myobjnext, field: 'id_prev' })
|
||||
await modify(context, { myitem: myobjnext, field: 'pos' })
|
||||
}
|
||||
|
||||
ApiTables.table_DeleteRecord(nametable, myobjtrov, idobj)
|
||||
*/
|
||||
|
||||
// ApiTables.table_DeleteRecord(nametable, myobjtrov, idobj)
|
||||
ApiTables.table_HideRecord(nametable, myobjtrov, idobj)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,13 +377,13 @@ namespace Actions {
|
||||
if (atfirst) {
|
||||
console.log('INSERT AT THE TOP')
|
||||
elemtochange = tools.getFirstList(myarr)
|
||||
objproj.id_prev = ApiTables.LIST_START
|
||||
objproj.pos = 10
|
||||
} else {
|
||||
console.log('INSERT AT THE BOTTOM')
|
||||
// INSERT AT THE BOTTOM , so GET LAST ITEM
|
||||
const lastelem = tools.getLastListNotCompleted(nametable, objproj.id_parent, this.tipoProj)
|
||||
|
||||
objproj.id_prev = (!!lastelem) ? lastelem._id : ApiTables.LIST_START
|
||||
objproj.pos = (!!lastelem) ? lastelem.pos + 10 : 10
|
||||
}
|
||||
objproj.modified = false
|
||||
|
||||
@@ -382,9 +394,9 @@ namespace Actions {
|
||||
let field = ''
|
||||
if (atfirst) { // update also the last elem
|
||||
if (!!elemtochange) {
|
||||
elemtochange.id_prev = id
|
||||
elemtochange.pos = objproj.pos
|
||||
console.log('elemtochange', elemtochange)
|
||||
field = 'id_prev'
|
||||
field = 'pos'
|
||||
|
||||
// Modify the other record
|
||||
await modify(context, { myitem: elemtochange, field })
|
||||
@@ -429,7 +441,6 @@ namespace Actions {
|
||||
dest_obj.id_parent = dest._id
|
||||
dest_obj.id_main_project = dest.id_main_project
|
||||
dest_obj.modified = true
|
||||
dest_obj.id_prev = null
|
||||
|
||||
GlobalStore.state.lastaction.type = 0
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ const state: ITodosState = {
|
||||
visuLastCompleted: 10
|
||||
}
|
||||
|
||||
const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'id_prev', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at', 'themecolor', 'themebgcolor']
|
||||
const listFieldsToChange: string [] = ['descr', 'statustodo', 'category', 'expiring_at', 'priority', 'pos', 'enableExpiring', 'progress', 'phase', 'assigned_to_userId', 'hoursplanned', 'hoursworked', 'start_date', 'completed_at', 'themecolor', 'themebgcolor', 'assignedToUsers']
|
||||
|
||||
const b = storeBuilder.module<ITodosState>('Todos', state)
|
||||
const stateGetter = b.state()
|
||||
@@ -77,7 +77,6 @@ namespace Getters {
|
||||
category: '',
|
||||
expiring_at: tomorrow,
|
||||
enableExpiring: false,
|
||||
id_prev: '',
|
||||
pos: 0,
|
||||
modified: false,
|
||||
progress: 0,
|
||||
@@ -88,7 +87,8 @@ namespace Getters {
|
||||
hoursworked: 0,
|
||||
start_date: tools.getDateNull(),
|
||||
themecolor: 'blue',
|
||||
themebgcolor: 'white'
|
||||
themebgcolor: 'white',
|
||||
assignedToUsers: []
|
||||
}
|
||||
// return this.copy(objtodo)
|
||||
return objtodo
|
||||
@@ -104,6 +104,9 @@ namespace Getters {
|
||||
arrout = []
|
||||
}
|
||||
|
||||
if (arrout)
|
||||
arrout = arrout.sort((a, b) => a.pos - b.pos)
|
||||
|
||||
// return tools.mapSort(arrout)
|
||||
return arrout
|
||||
}, 'items_dacompletare')
|
||||
@@ -126,7 +129,10 @@ namespace Getters {
|
||||
arrout = []
|
||||
}
|
||||
|
||||
console.log('arrout', arrout)
|
||||
if (arrout)
|
||||
arrout = arrout.sort((a, b) => a.pos - b.pos)
|
||||
|
||||
// console.log('arrout', arrout)
|
||||
|
||||
return arrout
|
||||
// return tools.mapSort(arrout)
|
||||
@@ -309,15 +315,18 @@ namespace Actions {
|
||||
console.log('myobjtrov', myobjtrov.descr)
|
||||
|
||||
if (!!myobjtrov) {
|
||||
/*
|
||||
const myobjnext = tools.getElemPrevById(myarr, myobjtrov._id)
|
||||
|
||||
if (!!myobjnext) {
|
||||
myobjnext.id_prev = myobjtrov.id_prev
|
||||
myobjnext.pos = myobjtrov.pos + 1
|
||||
myobjnext.modified = true
|
||||
await modify(context, { myitem: myobjnext, field: 'id_prev' })
|
||||
await modify(context, { myitem: myobjnext, field: 'pos' })
|
||||
}
|
||||
|
||||
ApiTables.table_DeleteRecord(nametable, myobjtrov, idobj)
|
||||
*/
|
||||
|
||||
ApiTables.table_HideRecord(nametable, myobjtrov, idobj)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -336,13 +345,13 @@ namespace Actions {
|
||||
if (atfirst) {
|
||||
console.log('INSERT AT THE TOP')
|
||||
elemtochange = tools.getFirstList(myarr)
|
||||
objtodo.id_prev = ApiTables.LIST_START
|
||||
objtodo.pos = 10
|
||||
} else {
|
||||
console.log('INSERT AT THE BOTTOM')
|
||||
// INSERT AT THE BOTTOM , so GET LAST ITEM
|
||||
const lastelem = tools.getLastListNotCompleted(nametable, objtodo.category, this.tipoProj)
|
||||
|
||||
objtodo.id_prev = (!!lastelem) ? lastelem._id : ApiTables.LIST_START
|
||||
objtodo.pos = (!!lastelem) ? lastelem.pos + 10 : 10
|
||||
}
|
||||
objtodo.modified = false
|
||||
|
||||
@@ -353,9 +362,9 @@ namespace Actions {
|
||||
let field = ''
|
||||
if (atfirst) { // update also the last elem
|
||||
if (!!elemtochange) {
|
||||
elemtochange.id_prev = id
|
||||
elemtochange.pos = objtodo.pos
|
||||
console.log('elemtochange', elemtochange)
|
||||
field = 'id_prev'
|
||||
field = 'pos'
|
||||
|
||||
// Modify the other record
|
||||
await modify(context, { myitem: elemtochange, field })
|
||||
@@ -444,7 +453,7 @@ namespace Actions {
|
||||
if (!!dest_obj) {
|
||||
dest_obj.category = action._id
|
||||
dest_obj.modified = true
|
||||
dest_obj.id_prev = null
|
||||
dest_obj.pos = 1
|
||||
|
||||
GlobalStore.state.lastaction.type = 0
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ export const DefaultUser: IUserFields = {
|
||||
userId: '',
|
||||
items: [],
|
||||
totalPrice: 0,
|
||||
department: '',
|
||||
totalQty: 0,
|
||||
note: '',
|
||||
}
|
||||
@@ -103,6 +104,7 @@ const state: IUserState = {
|
||||
isLogged: false,
|
||||
isAdmin: false,
|
||||
isManager: false,
|
||||
isDepartment: false,
|
||||
isTutor: false,
|
||||
isZoomeri: false,
|
||||
isTraduttrici: false,
|
||||
@@ -341,6 +343,7 @@ namespace Mutations {
|
||||
mystate.isManager = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Manager.value)
|
||||
mystate.isTutor = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Tutor.value)
|
||||
mystate.isZoomeri = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Zoomeri.value)
|
||||
mystate.isDepartment = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Department.value)
|
||||
mystate.isTeacher = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Teacher.value)
|
||||
mystate.isTraduttrici = tools.isBitActive(mystate.my.perm, shared_consts.Permissions.Traduttrici.value)
|
||||
|
||||
@@ -897,6 +900,7 @@ namespace Actions {
|
||||
GlobalStore.mutations.setCategorySel(localStorage.getItem(tools.localStorage.categorySel))
|
||||
|
||||
GlobalStore.actions.checkUpdates()
|
||||
|
||||
}
|
||||
|
||||
const isok = await GlobalStore.actions.loadAfterLogin()
|
||||
|
||||
@@ -174,11 +174,36 @@ export const colTableProducer = [
|
||||
AddCol({ name: 'website', label_trans: 'producer.website' }),
|
||||
]
|
||||
|
||||
export const getcolorderscart = [
|
||||
AddCol({ name: 'numorder', label_trans: 'order.numorder' }),
|
||||
AddCol({ name: 'created_at', label_trans: 'order.created_at', fieldtype: tools.FieldType.date }),
|
||||
AddCol({ name: 'status', label_trans: 'order.status' }),
|
||||
AddCol({ name: 'items', label_trans: 'order.items' }),
|
||||
AddCol({ name: 'userId', label_trans: 'order.users', fieldtype: tools.FieldType.select, jointable: 'users' }),
|
||||
AddCol({ name: 'note', label_trans: 'order.note' }),
|
||||
]
|
||||
|
||||
export const colTableShareWithUs = [
|
||||
AddCol({ name: 'description', label_trans: 'share.description' }),
|
||||
AddCol({ name: 'numshared', label_trans: 'share.numshared', fieldtype: tools.FieldType.number }),
|
||||
AddCol({ name: 'rating', label_trans: 'share.rating', fieldtype: tools.FieldType.number }),
|
||||
]
|
||||
export const colTablegroups = [
|
||||
AddCol({ name: 'descr', label_trans: 'share.description' }),
|
||||
AddCol({ name: 'resp', label_trans: 'reg.resp' }),
|
||||
AddCol({ name: 'viceResp', label_trans: 'reg.viceResp' }),
|
||||
AddCol({
|
||||
name: 'assignedToUsers',
|
||||
label_trans: 'reg.userslist',
|
||||
fieldtype: tools.FieldType.multiselect,
|
||||
jointable: 'users'
|
||||
}),
|
||||
]
|
||||
|
||||
export const colTabledepartments = [
|
||||
AddCol({ name: 'name', label_trans: 'store.name' }),
|
||||
AddCol({ name: 'username', label_trans: 'store.username' })
|
||||
]
|
||||
|
||||
export const colTableStorehouse = [
|
||||
AddCol({ name: 'name', label_trans: 'store.name' }),
|
||||
@@ -197,7 +222,6 @@ export const colTableProducts = [
|
||||
AddCol({ name: 'description', label_trans: 'products.description' }),
|
||||
AddCol({ name: 'icon', label_trans: 'products.icon' }),
|
||||
AddCol({ name: 'img', label_trans: 'products.img' }),
|
||||
AddCol({ name: 'department', label_trans: 'products.department' }),
|
||||
// AddCol({ name: 'idProducer', label_trans: 'products.idProducer' }),
|
||||
AddCol({
|
||||
name: 'idProducer',
|
||||
@@ -211,6 +235,13 @@ export const colTableProducts = [
|
||||
fieldtype: tools.FieldType.multiselect,
|
||||
jointable: 'storehouses'
|
||||
}),
|
||||
AddCol({
|
||||
name: 'department',
|
||||
label_trans: 'products.department',
|
||||
fieldtype: tools.FieldType.select,
|
||||
jointable: 'departments'
|
||||
}),
|
||||
// AddCol({ name: 'department', label_trans: 'products.department' }),
|
||||
AddCol({ name: 'category', label_trans: 'products.category' }),
|
||||
AddCol({ name: 'price', label_trans: 'products.price', fieldtype: tools.FieldType.number }),
|
||||
AddCol({ name: 'color', label_trans: 'products.color' }),
|
||||
@@ -517,7 +548,7 @@ export const fieldsTable = {
|
||||
|
||||
getTableJoinByName(table) {
|
||||
if (table === 'permissions')
|
||||
return [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Tutor, shared_consts.Permissions.Traduttrici, shared_consts.Permissions.Zoomeri]
|
||||
return [shared_consts.Permissions.Admin, shared_consts.Permissions.Manager, shared_consts.Permissions.Teacher, shared_consts.Permissions.Tutor, shared_consts.Permissions.Traduttrici, shared_consts.Permissions.Zoomeri, shared_consts.Permissions.Department]
|
||||
else if (table === 'accepted')
|
||||
return [shared_consts.Accepted.CHECK_READ_GUIDELINES, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI]
|
||||
else if (table === 'fieldstype')
|
||||
@@ -932,6 +963,13 @@ export const fieldsTable = {
|
||||
colkey: '_id',
|
||||
collabel: 'name'
|
||||
},
|
||||
{
|
||||
value: 'departments',
|
||||
label: 'Uffici',
|
||||
columns: colTabledepartments,
|
||||
colkey: 'username',
|
||||
collabel: 'name'
|
||||
},
|
||||
{
|
||||
value: 'storehouses',
|
||||
label: 'Magazzini',
|
||||
|
||||
@@ -110,6 +110,7 @@ export const tools = {
|
||||
TABMAILINGLIST: 'mailinglist',
|
||||
TABMYPAGE: 'mypage',
|
||||
TABCALZOOM: 'calzoom',
|
||||
TABGROUPS: 'groups',
|
||||
TABTEMPLEMAIL: 'templemail',
|
||||
TABOPZEMAIL: 'opzemail',
|
||||
TABSHAREWITHUS: 'sharewithus',
|
||||
@@ -1072,11 +1073,9 @@ export const tools = {
|
||||
|
||||
if (priority === tools.Priority.PRIORITY_HIGH) {
|
||||
cl = 'high_priority'
|
||||
}
|
||||
else if (priority === tools.Priority.PRIORITY_NORMAL) {
|
||||
} else if (priority === tools.Priority.PRIORITY_NORMAL) {
|
||||
cl = 'medium_priority'
|
||||
}
|
||||
else if (priority === tools.Priority.PRIORITY_LOW) {
|
||||
} else if (priority === tools.Priority.PRIORITY_LOW) {
|
||||
cl = 'low_priority'
|
||||
}
|
||||
|
||||
@@ -1116,12 +1115,12 @@ export const tools = {
|
||||
,
|
||||
|
||||
logelem(mystr, elem) {
|
||||
console.log(mystr, 'elem [', elem._id, '] ', elem.descr, ' Pr(', tools.getPriorityByInd(elem.priority), ') [', elem.id_prev, '] modif=', elem.modified)
|
||||
console.log(mystr, 'elem [', elem._id, '] ', elem.descr, 'pos', elem.pos, ' Pr(', tools.getPriorityByInd(elem.priority), ') modif=', elem.modified)
|
||||
}
|
||||
,
|
||||
|
||||
getelemprojstr(elem) {
|
||||
return 'elem [id= ' + elem._id + '] ' + elem.descr + ' [id_prev= ' + elem.id_prev + '] '
|
||||
return elem.descr + ' [id= ' + elem._id + '] ' + 'pos: ' + elem.pos + ']\n'
|
||||
}
|
||||
,
|
||||
|
||||
@@ -1141,7 +1140,7 @@ export const tools = {
|
||||
,
|
||||
|
||||
getstrelem(elem) {
|
||||
return 'elem [' + elem._id + '] ' + elem.descr + ' Pr(' + tools.getPriorityByInd(elem.priority) + ') [ID_PREV=' + elem.id_prev + '] modif=' + elem.modified + ' '
|
||||
return 'elem [' + elem._id + '] ' + elem.descr + ' Pr(' + tools.getPriorityByInd(elem.priority) + ') modif=' + elem.modified + ' '
|
||||
}
|
||||
,
|
||||
|
||||
@@ -1151,7 +1150,7 @@ export const tools = {
|
||||
) {
|
||||
let mystr = '\n'
|
||||
myarr.forEach((item) => {
|
||||
mystr += '[' + item.pos + '] ' + item.descr + ' Pr(' + tools.getPriorityByInd(item.priority) + ') [' + item.id_prev + '] modif=' + item.modified + '\n'
|
||||
mystr += '[' + item.pos + '] ' + item.descr + ' Pr(' + tools.getPriorityByInd(item.priority) + ')' + ' modif=' + item.modified + '\n'
|
||||
// mystr += '[' + item.pos + '] ' + item.descr + '\n'
|
||||
})
|
||||
|
||||
@@ -1198,25 +1197,28 @@ export const tools = {
|
||||
}
|
||||
,
|
||||
|
||||
update_idprev(myarr, indelemchange, indelemId) {
|
||||
/* update_idprev(myarr, indelemchange, indelemId) {
|
||||
if (tools.isOkIndex(myarr, indelemchange)) {
|
||||
const id_prev = (indelemId >= 0) ? myarr[indelemId]._id : ApiTables.LIST_START
|
||||
console.log('update_idprev [', indelemchange, ']', '[id_prev=', id_prev, ']')
|
||||
if (myarr[indelemchange].id_prev !== id_prev) {
|
||||
// const id_prev = (indelemId >= 0) ? myarr[indelemId]._id : ApiTables.LIST_START
|
||||
const id_prevnew = myarr[indelemchange].id_prevnew
|
||||
console.log('update_idprev [', indelemchange, ']', myarr[indelemchange].descr, '[id_prev=', myarr[indelemchange].id_prev, ']', '[id_prevnew=', id_prevnew, ']')
|
||||
if (myarr[indelemchange].id_prev !== id_prevnew) {
|
||||
// tools.notifyarraychanged(myarr)
|
||||
// myarr[indelemchange].modified = true
|
||||
// console.log('update_idprev Index=', indelemchange, 'indtoget', indelemId, tools.getstrelem(myarr[indelemchange]))
|
||||
console.log(' MODIFICATO! ', myarr[indelemchange].descr, ' PRIMA:', myarr[indelemchange].id_prev, 'DOPO: ', id_prev)
|
||||
myarr[indelemchange].id_prev = id_prev
|
||||
console.log(' MODIFICATO! ', myarr[indelemchange].descr, ' PRIMA:', myarr[indelemchange].id_prev, 'DOPO: ', id_prevnew)
|
||||
myarr[indelemchange].id_prev = id_prevnew
|
||||
return myarr[indelemchange]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
,
|
||||
}, */
|
||||
|
||||
|
||||
async swapGeneralElem(nametable, myarr, itemdragend, listFieldsToChange) {
|
||||
|
||||
const arrprec = [...myarr]
|
||||
|
||||
if (itemdragend.field === 'priority') {
|
||||
// get last elem priority
|
||||
console.log('get last elem priority')
|
||||
@@ -1235,15 +1237,16 @@ export const tools = {
|
||||
if (tools.isOkIndex(myarr, itemdragend.newIndex) && tools.isOkIndex(myarr, itemdragend.oldIndex)) {
|
||||
|
||||
console.log('*** SPLICE!')
|
||||
// console.log(' PRIMA!', tools.logga_arrproj(myarr))
|
||||
console.log(' PRIMA!', tools.logga_arrproj(myarr))
|
||||
myarr.splice(itemdragend.newIndex, 0, myarr.splice(itemdragend.oldIndex, 1)[0])
|
||||
// console.log(' DOPO!', tools.logga_arrproj(myarr))
|
||||
console.log(' DOPO!', tools.logga_arrproj(myarr))
|
||||
|
||||
// Ora inverti gli indici
|
||||
const indold = itemdragend.oldIndex
|
||||
itemdragend.oldIndex = itemdragend.newIndex
|
||||
itemdragend.newIndex = indold
|
||||
|
||||
/*
|
||||
if (nametable === 'todos') {
|
||||
if (itemdragend.field !== 'priority') {
|
||||
const precind = itemdragend.newIndex - 1
|
||||
@@ -1273,22 +1276,72 @@ export const tools = {
|
||||
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
let status = 0
|
||||
|
||||
// const arr = lists.selectPriority[toolsext.getLocale()]
|
||||
// for (const priority of arr) {
|
||||
for (let i = 0; i < myarr.length; ++i) {
|
||||
if (nametable === 'todos') {
|
||||
status = myarr[i].statustodo
|
||||
} else if (nametable === 'projects') {
|
||||
status = myarr[i].statusproj
|
||||
}
|
||||
if (status !== tools.Status.COMPLETED) {
|
||||
myarr[i].pos = i
|
||||
|
||||
const findelem = arrprec.find((rec) => rec._id === myarr[i]._id)
|
||||
|
||||
if (findelem !== myarr[i].pos) {
|
||||
myarr[i].modified = true
|
||||
await ApiTables.table_ModifyRecord(nametable, myarr[i], listFieldsToChange, 'pos')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for (let i = 0; i < myarr.length; ++i) {
|
||||
if (nametable === 'todos') {
|
||||
status = myarr[i].statustodo
|
||||
} else if (nametable === 'projects') {
|
||||
status = myarr[i].statusproj
|
||||
}
|
||||
// (myarr[i].priority === priority.value)
|
||||
if ((status === tools.Status.COMPLETED)) {
|
||||
myarr[i].pos = 1000 + i
|
||||
|
||||
// Update the id_prev property
|
||||
const elem1 = tools.update_idprev(myarr, itemdragend.newIndex, itemdragend.newIndex - 1) // 0, -1
|
||||
const elem2 = tools.update_idprev(myarr, itemdragend.newIndex + 1, itemdragend.newIndex) // 1, 0
|
||||
const elem3 = tools.update_idprev(myarr, itemdragend.oldIndex, itemdragend.oldIndex - 1) // 1, 0
|
||||
const elem4 = tools.update_idprev(myarr, itemdragend.oldIndex + 1, itemdragend.oldIndex) // 2, 1
|
||||
const findelem = arrprec.find((rec) => rec._id === myarr[i]._id)
|
||||
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem1, listFieldsToChange, 'id_prev')
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem2, listFieldsToChange, 'id_prev')
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem3, listFieldsToChange, 'id_prev')
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem4, listFieldsToChange, 'id_prev')
|
||||
if (findelem !== myarr[i].pos) {
|
||||
myarr[i].modified = true
|
||||
await ApiTables.table_ModifyRecord(nametable, myarr[i], listFieldsToChange, 'pos')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
/*
|
||||
|
||||
console.table(myarr)
|
||||
|
||||
// Update the id_prev property
|
||||
const elem1 = tools.update_idprev(myarr, itemdragend.newIndex, itemdragend.newIndex - 1) // 0, -1
|
||||
const elem2 = tools.update_idprev(myarr, itemdragend.newIndex + 1, itemdragend.newIndex) // 1, 0
|
||||
const elem3 = tools.update_idprev(myarr, itemdragend.oldIndex, itemdragend.oldIndex - 1) // 1, 0
|
||||
const elem4 = tools.update_idprev(myarr, itemdragend.oldIndex + 1, itemdragend.oldIndex) // 2, 1
|
||||
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem1, listFieldsToChange, 'id_prev')
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem2, listFieldsToChange, 'id_prev')
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem3, listFieldsToChange, 'id_prev')
|
||||
await
|
||||
ApiTables.table_ModifyRecord(nametable, elem4, listFieldsToChange, 'id_prev')
|
||||
|
||||
|
||||
*/
|
||||
|
||||
tools.notifyarraychanged(myarr)
|
||||
|
||||
@@ -1318,8 +1371,8 @@ export const tools = {
|
||||
if (myarr === undefined)
|
||||
return null
|
||||
return myarr.find((elem) => elem.id_prev === id)
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
|
||||
getLastFirstElemPriority(myarr, priority: number, atfirst: boolean, escludiId: string) {
|
||||
if (myarr === null) {
|
||||
@@ -1350,8 +1403,7 @@ export const tools = {
|
||||
} else {
|
||||
if (priority === tools.Priority.PRIORITY_LOW) {
|
||||
return myarr.length - 1
|
||||
}
|
||||
else if (priority === tools.Priority.PRIORITY_HIGH) {
|
||||
} else if (priority === tools.Priority.PRIORITY_HIGH) {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
@@ -1380,8 +1432,7 @@ export const tools = {
|
||||
Projects.state.projects = tools.jsonCopy(myarr)
|
||||
return Projects.state.projects
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
getmyid(id) {
|
||||
return 'row' + id
|
||||
@@ -1406,8 +1457,7 @@ export const tools = {
|
||||
getElemByIndex(myarr, index) {
|
||||
if (index >= 0 && index < myarr.length) {
|
||||
return myarr[index]
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -1429,8 +1479,11 @@ export const tools = {
|
||||
|
||||
visumenu(elem) { // : IListRoutes
|
||||
let visu = ((elem.onlyAdmin && UserStore.state.isAdmin) || (elem.onlyManager && UserStore.state.isManager)
|
||||
|| (elem.onlySocioResidente && UserStore.state.my.profile.socioresidente)
|
||||
|| (elem.onlyTutor && UserStore.state.isTutor) || (elem.onlyTraduttrici && UserStore.state.isTraduttrici)
|
||||
|| ((!elem.onlyAdmin) && (!elem.onlyManager) && (!elem.onlyTutor) && (!elem.onlyTraduttrici))) && elem.active
|
||||
|| (elem.onlyDepartment && UserStore.state.isDepartment)
|
||||
|| ((!elem.onlyAdmin) && (!elem.onlyManager) && (!elem.onlyTutor) && (!elem.onlyTraduttrici) && (!elem.onlyDepartment)
|
||||
&& (!elem.onlySocioResidente))) && elem.active
|
||||
|
||||
if (!tools.isLoggedToSystem()) {
|
||||
if (elem.onlyif_logged)
|
||||
@@ -2091,6 +2144,14 @@ export const tools = {
|
||||
return UserStore.state.isManager
|
||||
},
|
||||
|
||||
isSocioResidente() {
|
||||
return UserStore.state.my.profile.socioresidente
|
||||
},
|
||||
|
||||
isDepartment() {
|
||||
return UserStore.state.isDepartment
|
||||
},
|
||||
|
||||
isAdmin() {
|
||||
return UserStore.state.isAdmin
|
||||
},
|
||||
@@ -2209,24 +2270,24 @@ export const tools = {
|
||||
if (tools.getstrDate(myevent.dateTimeStart) === tools.getstrDate(myevent.dateTimeEnd)) {
|
||||
if (withhtml) {
|
||||
mystr += `<span class="cal__where-content">${tools.getstrDate(myevent.dateTimeStart)}</span>
|
||||
<span class="cal__hours-content">${mythis.$t('cal.starttime')} ${ tools.getstrTime(myevent.dateTimeStart) }
|
||||
${ mythis.$t('cal.endtime')} ${ tools.getstrTime(myevent.dateTimeEnd) }`
|
||||
<span class="cal__hours-content">${mythis.$t('cal.starttime')} ${tools.getstrTime(myevent.dateTimeStart)}
|
||||
${mythis.$t('cal.endtime')} ${tools.getstrTime(myevent.dateTimeEnd)}`
|
||||
} else {
|
||||
mystr = `${tools.getstrDate(myevent.dateTimeStart)}
|
||||
${mythis.$t('cal.starttime')} ${ tools.getstrTime(myevent.dateTimeStart) }
|
||||
${ mythis.$t('cal.endtime')} ${ tools.getstrTime(myevent.dateTimeEnd) }`
|
||||
${mythis.$t('cal.starttime')} ${tools.getstrTime(myevent.dateTimeStart)}
|
||||
${mythis.$t('cal.endtime')} ${tools.getstrTime(myevent.dateTimeEnd)}`
|
||||
}
|
||||
} else {
|
||||
mystr = `<span class="cal__where-content">${tools.getstrDate(myevent.dateTimeStart)}</span>
|
||||
<span class="cal__hours-content">${mythis.$t('cal.starttime')} ${ tools.getstrTime(myevent.dateTimeStart) } </span>
|
||||
${ mythis.$t('cal.enddate')} ${tools.getstrDate(myevent.dateTimeEnd)}
|
||||
<span class="cal__hours-content">${ mythis.$t('cal.endtime')} ${ tools.getstrTime(myevent.dateTimeEnd) } </span>`
|
||||
<span class="cal__hours-content">${mythis.$t('cal.starttime')} ${tools.getstrTime(myevent.dateTimeStart)} </span>
|
||||
${mythis.$t('cal.enddate')} ${tools.getstrDate(myevent.dateTimeEnd)}
|
||||
<span class="cal__hours-content">${mythis.$t('cal.endtime')} ${tools.getstrTime(myevent.dateTimeEnd)} </span>`
|
||||
}
|
||||
|
||||
if (myevent.infoextra) {
|
||||
mystr += `<span class="cal__hours">
|
||||
<span class="cal__hours-title">${mythis.$t('cal.hours')}: </span>
|
||||
<span class="cal__hours-content">${ myevent.infoextra } </span>
|
||||
<span class="cal__hours-content">${myevent.infoextra} </span>
|
||||
</span>
|
||||
</span>`
|
||||
}
|
||||
@@ -2238,9 +2299,9 @@ export const tools = {
|
||||
// is same day?
|
||||
if (tools.getstrShortDate(myevent.dateTimeStart) === tools.getstrShortDate(myevent.dateTimeEnd)) {
|
||||
mystr = `${tools.getstrShortDate(myevent.dateTimeStart)}
|
||||
- ${ tools.getstrTime(myevent.dateTimeStart) }`
|
||||
- ${tools.getstrTime(myevent.dateTimeStart)}`
|
||||
} else {
|
||||
mystr = `${tools.getstrVeryVeryShortDate(myevent.dateTimeStart)} - ${ tools.getstrShortDate(myevent.dateTimeEnd) }`
|
||||
mystr = `${tools.getstrVeryVeryShortDate(myevent.dateTimeStart)} - ${tools.getstrShortDate(myevent.dateTimeEnd)}`
|
||||
|
||||
}
|
||||
|
||||
@@ -2252,9 +2313,9 @@ export const tools = {
|
||||
// is same day?
|
||||
if (tools.getstrShortDate(myevent.dateTimeStart) === tools.getstrShortDate(myevent.dateTimeEnd)) {
|
||||
mystr = `${tools.getstrVeryShortDate(myevent.dateTimeStart)}
|
||||
h. ${ tools.getstrTime(myevent.dateTimeStart) }`
|
||||
h. ${tools.getstrTime(myevent.dateTimeStart)}`
|
||||
} else {
|
||||
mystr = `${tools.getstrVeryShortDate(myevent.dateTimeStart)} - ${ tools.getstrVeryShortDate(myevent.dateTimeEnd) }`
|
||||
mystr = `${tools.getstrVeryShortDate(myevent.dateTimeStart)} - ${tools.getstrVeryShortDate(myevent.dateTimeEnd)}`
|
||||
|
||||
}
|
||||
|
||||
@@ -3076,8 +3137,7 @@ export const tools = {
|
||||
} finally {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
SignUpcheckErrors(mythis, riscode: number, msg: string) {
|
||||
console.log('SignUpcheckErrors', riscode)
|
||||
@@ -3114,19 +3174,16 @@ export const tools = {
|
||||
}
|
||||
|
||||
return endload
|
||||
}
|
||||
,
|
||||
},
|
||||
isCssColor(color) {
|
||||
return !!color && !!color.match(/^(#|(rgb|hsl)a?\()/)
|
||||
}
|
||||
,
|
||||
},
|
||||
displayClasses(eventparam) {
|
||||
return {
|
||||
// [`bg-${eventparam.bgcolor}`]: !tools.isCssColor(eventparam.bgcolor),
|
||||
'text-white': !tools.isCssColor(eventparam.bgcolor)
|
||||
}
|
||||
}
|
||||
,
|
||||
},
|
||||
displayStyles(eventparam) {
|
||||
const s = { color: '' }
|
||||
if (tools.isCssColor(eventparam.bgcolor)) {
|
||||
@@ -3134,8 +3191,7 @@ export const tools = {
|
||||
s.color = colors.luminosity(eventparam.bgcolor) > 0.5 ? 'black' : 'white'
|
||||
}
|
||||
return s
|
||||
}
|
||||
,
|
||||
},
|
||||
CancelBookingEvent(mythis, eventparam: IEvents, bookeventid: string, notify: boolean) {
|
||||
console.log('CancelBookingEvent ', eventparam)
|
||||
tools.askConfirm(mythis.$q, translate('cal.titlebooking'), translate('cal.cancelbooking') + ' ' + tools.gettextevent(mythis, eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.DELETE, 0, {
|
||||
@@ -3143,8 +3199,7 @@ export const tools = {
|
||||
param2: notify,
|
||||
param3: eventparam.title
|
||||
})
|
||||
}
|
||||
,
|
||||
},
|
||||
CancelEvent(mythis, eventparam: IEvents) {
|
||||
console.log('CancelEvent ', eventparam)
|
||||
tools.askConfirm(mythis.$q, translate('cal.event'), translate('cal.cancelevent') + ' ' + tools.gettextevent(mythis, eventparam) + '?', translate('dialog.yes'), translate('dialog.no'), mythis, '', lists.MenuAction.DELETE_EVENT, 0, {
|
||||
@@ -3166,8 +3221,7 @@ export const tools = {
|
||||
param1: id,
|
||||
param2: item
|
||||
})
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
async createNewRecord(mythis, table, data, withnotif = true) {
|
||||
|
||||
@@ -3687,6 +3741,14 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
getGroupById(myid) {
|
||||
const group = GlobalStore.state.groups.find((rec) => rec._id === myid)
|
||||
if (group) {
|
||||
return group.descr
|
||||
}
|
||||
return ''
|
||||
},
|
||||
|
||||
getLinkZoom() {
|
||||
let id = ''
|
||||
if (GlobalStore.state.calzoom.length > 0) {
|
||||
@@ -3944,6 +4006,30 @@ export const tools = {
|
||||
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
getGroupList() {
|
||||
|
||||
// console.log('GlobalStore.state.groups', GlobalStore.state.groups)
|
||||
const mylist = {
|
||||
it: [],
|
||||
es: [],
|
||||
enUs: []
|
||||
}
|
||||
|
||||
let myrec = {}
|
||||
|
||||
for (const mygroup of GlobalStore.state.groups) {
|
||||
myrec = {
|
||||
id: mygroup._id,
|
||||
label: mygroup.descr,
|
||||
value: mygroup._id
|
||||
}
|
||||
mylist.it.push(myrec)
|
||||
|
||||
}
|
||||
|
||||
return mylist
|
||||
}
|
||||
|
||||
// getLocale() {
|
||||
|
||||
Reference in New Issue
Block a user