- add categories: skills and subskills.

This commit is contained in:
paoloar77
2022-02-10 19:43:42 +01:00
parent e2875e2400
commit 5f767400b7
8 changed files with 224 additions and 117 deletions

View File

@@ -111,6 +111,8 @@ export const shared_consts = {
PROVINCE: 1,
COMUNI: 2,
CITIES_SERVER: 3,
CAT_TXT: 4,
CAT_NO_SPAZI: 5,
},
BotType: [

View File

@@ -12,6 +12,7 @@ import { colmySkills } from '@store/Modules/fieldsTable'
import { CGridTableRec } from '@/components/CGridTableRec'
import { IMySkill, ISearchList, ISkill } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
import { useI18n } from '@/boot/i18n'
export default defineComponent({
name: 'CFinder',
@@ -26,6 +27,7 @@ export default defineComponent({
},
setup(props, { attrs, slots, emit }) {
const mytable = 'users'
const { t } = useI18n();
const globalStore = useGlobalStore()
const userStore = useUserStore()
@@ -33,6 +35,8 @@ export default defineComponent({
const filtercustom: any = ref([])
const searchList = ref(<ISearchList[]>[])
const search = ref('')
const idSector = computed(() => {
let myval: any = null
myval = searchList.value.find((rec) => (rec.table === 'sectors'))
@@ -114,9 +118,9 @@ export default defineComponent({
label: 'Specializzazione',
table: 'subskills',
key: 'idSubSkill',
value: 0,
type: costanti.FieldType.multiselect,
arrvalue: [costanti.FILTER_TUTTI],
value: tools.getCookie(tools.COOK_SEARCH + 'subskills' + '_' + tools.getCookie(tools.COOK_SEARCH + 'skills', costanti.FILTER_TUTTI), costanti.FILTER_TUTTI),
type: costanti.FieldType.select,
arrvalue: [],
addall: true,
filter: getFilterSubSkills,
showcount: true,
@@ -302,9 +306,14 @@ export default defineComponent({
}
}
function doSearch() {
//
}
onMounted(mounted)
return {
t,
tools,
costanti,
colmySkills,
@@ -314,6 +323,8 @@ export default defineComponent({
filtercustom,
searchList,
idSector,
search,
doSearch,
}
},
})

View File

@@ -1,6 +1,17 @@
<template>
<div class="bi-border-all">
<div class="q-ma-xs q-gutter-xs q-pa-xs">
<div v-if="true" class="q-mr-sm">
<q-input
v-model="search" filled dense type="search" debounce="500" :hint="t('finder.search_skill')"
v-on:keyup.enter="doSearch">
<template v-slot:after>
<q-btn dense label="" color="primary" @click="doSearch" icon="search"></q-btn>
</template>
</q-input>
</div>
<CGridTableRec
v-if="searchList.length > 0"
prop_mytable="myskills"

View File

@@ -1,112 +0,0 @@
<template>
<q-layout view="lHh Lpr lFf">
<q-header elevated>
<q-toolbar>
<q-btn
flat
dense
round
icon="menu"
aria-label="Menu"
@click="toggleLeftDrawer"
/>
<q-toolbar-title>
Quasar App
</q-toolbar-title>
<div>Quasar v{{ $q.version }}</div>
</q-toolbar>
</q-header>
<q-drawer
v-model="leftDrawerOpen"
show-if-above
bordered
class="bg-grey-1"
>
<q-list>
<q-item-label
header
class="text-grey-8"
>
Essential Links
</q-item-label>
<EssentialLink
v-for="link in essentialLinks"
:key="link.title"
v-bind="link"
/>
</q-list>
</q-drawer>
<q-page-container>
<router-view />
</q-page-container>
</q-layout>
</template>
<script lang="ts">
import EssentialLink from 'components/EssentialLink.vue'
const linksList = [
{
title: 'Docs',
caption: 'quasar.dev',
icon: 'school',
link: 'https://quasar.dev',
},
{
title: 'Github',
caption: 'github.com/quasarframework',
icon: 'code',
link: 'https://github.com/quasarframework',
},
{
title: 'Discord Chat Channel',
caption: 'chat.quasar.dev',
icon: 'chat',
link: 'https://chat.quasar.dev',
},
{
title: 'Forum',
caption: 'forum.quasar.dev',
icon: 'record_voice_over',
link: 'https://forum.quasar.dev',
},
{
title: 'Twitter',
caption: '@quasarframework',
icon: 'rss_feed',
link: 'https://twitter.quasar.dev',
},
{
title: 'Facebook',
caption: '@QuasarFramework',
icon: 'public',
link: 'https://facebook.quasar.dev',
},
{
title: 'Quasar Awesome',
caption: 'Community Quasar projects',
icon: 'favorite',
link: 'https://awesome.quasar.dev',
},
]
import { Vue, Options } from 'vue-class-component'
@Options({
components: { EssentialLink },
})
export default class MainLayout extends Vue {
leftDrawerOpen = false;
essentialLinks = linksList;
toggleLeftDrawer() {
this.leftDrawerOpen = !this.leftDrawerOpen
}
}
</script>

View File

@@ -1,8 +1,13 @@
<template>
<div>
Mia Pagina 404
<q-banner rounded class="bg-negative text-white">
<div class="text-h6 text-center">
Pagina non Trovata
</div>
</q-banner>
</div>
</template>
<script lang="ts" src="./My404page.ts">
</script>
im

View File

@@ -8,6 +8,7 @@ import { useI18n } from '@src/boot/i18n'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { useQuasar } from 'quasar'
import { IParamsQuery } from 'model'
export default defineComponent({
name: 'Sendpushnotif',
@@ -18,6 +19,9 @@ export default defineComponent({
const userStore = useUserStore()
const globalStore = useGlobalStore()
const arrSector = ref(<any[]>[])
const arrSkill = ref(<any[]>[])
const incaricamento = ref(false)
@@ -40,11 +44,186 @@ export default defineComponent({
label: 'Tabella Cities',
value: shared_consts.Cmd.CITIES_SERVER
},
{
label: 'Importa Categorie da TXT',
value: shared_consts.Cmd.CAT_TXT
},
{
label: 'converti da TXT seperato senza spazi',
value: shared_consts.Cmd.CAT_NO_SPAZI
},
]
)
function created() {
inputfile.value = ''
const sortBy = 'descr'
const descending = 1
const myobj: any = {}
if (descending)
myobj[sortBy] = -1
else
myobj[sortBy] = 1
const params: IParamsQuery = {
table: 'sectors',
startRow: 0,
endRow: 10000,
filter: '',
filterand: '',
filtersearch: '',
filtersearch2: '',
filtercustom: '',
sortBy: myobj,
descending,
userId: ''
}
globalStore.loadTable(params).then((data) => {
arrSector.value = data.rows
})
params.table = 'skills'
globalStore.loadTable(params).then((data) => {
arrSkill.value = data.rows
})
}
function createSector(cat: string) {
const myid = arrSector.value.length + 1
arrSector.value.push({_id: myid, descr: cat})
return myid
}
function findidSector(cat: string) {
const rec = arrSector.value.find((rec) => rec.descr === cat)
if (rec) {
return rec._id
}
return 0;
}
function findidSkill(cat: string) {
const rec = arrSkill.value.find((rec) => rec.descr === cat)
if (rec) {
return rec._id
}
return 0;
}
function createSkill(cat: string) {
const myid = arrSkill.value.length + 1
arrSkill.value.push({_id: myid, descr: cat})
return myid
}
function importCmdTxt(cmd: number, testo: string) {
const delim = '\n';
const righe = 1;
let indrec = 0;
let myarr = tools.CSVToArray(testo, delim)
let sector = ''
let skill = ''
let sotto_cat = ''
let idSector = 0
let idSkill = 0
let strskills = '';
let strsubskills = '';
let strsectors = '';
let indrecsub = 1;
myarr = myarr[0]
let arrstr = []
// debugger;
for (let i = 0; i < myarr.length; i = i + righe) {
arrstr = myarr[i].split(',')
sector = arrstr[0]
skill = arrstr[1]
sotto_cat = arrstr[2]
// sotto_cat = myarr[i].replace('\'', '\\\'')
// sector = myarr[i+2]
if (skill)
skill = skill.replace('\'', '\\\'')
if (sector)
sector = sector.replace('\'', '\\\'')
idSector = findidSector(sector)
if (!idSector) {
idSector = createSector(sector)
// sectors
strsectors += '{ \n'
strsectors += ' _id:' + idSector + ','
strsectors += ' descr:\'' + sector + '\','
strsectors += '}, \n'
}
idSkill = findidSkill(skill)
if (!idSkill) {
idSkill = createSkill(skill)
// skills
strskills += '{ \n'
strsectors += ' _id:' + idSkill + ','
strskills += ' idSector: [' + idSector + '],'
strskills += ' descr:\'' + skill + '\','
strskills += '}, \n'
}
// subskills
strsubskills += '{ \n'
strsubskills += ' idSkill: ' + idSkill + ','
strsubskills += ' descr:\'' + sotto_cat + '\','
strsubskills += '}, \n'
indrecsub++
}
let ris = 'module.exports = {\n' +
' list: [' + strsectors + ']'
ris += '<br><br><br><br>'
ris += 'module.exports = {\n' +
' list: [' + strskills + ']'
ris += '<br><br><br><br>'
ris += 'module.exports = {\n' +
' list: [' + strsubskills + ']'
return ris
}
function importNoSpazi(cmd: number, testo: string) {
const delim = '\n';
const righe = 3;
let indrec = 0;
let myarr = tools.CSVToArray(testo, delim)
let sector = ''
let sotto_cat = ''
myarr = myarr[0]
let txt = ''
// debugger;
for (let i = 0; i < myarr.length; i = i + righe) {
sotto_cat = myarr[i].replace('\'', '\\\'')
sector = myarr[i+2]
txt += sotto_cat + ',' + sector + '<br>'
}
return txt
}
function importCmd(cmd: number, testo: string) {
@@ -56,6 +235,10 @@ export default defineComponent({
delim = ','
} else if ((cmd === shared_consts.Cmd.COMUNI) || (cmd === shared_consts.Cmd.CITIES_SERVER)) {
delim = ';'
} else if (cmd === shared_consts.Cmd.CAT_TXT) {
return importCmdTxt(cmd, testo);
} else if (cmd === shared_consts.Cmd.CAT_NO_SPAZI) {
return importNoSpazi(cmd, testo);
}
const myarr = tools.CSVToArray(testo, delim)

View File

@@ -17,6 +17,10 @@
label="Esegui"
@click="eseguiCmd"></q-btn>
{{risultato}}
<br><br><br><br><br>
VERSIONE HTML:
<div v-html="risultato"></div>
<br>
<br>
</div>

View File

@@ -906,7 +906,10 @@ const msg_it = {
cancel_ask_group_short: 'Annulla richiesta',
refuse_ask_group_short: 'Rifiuta la richiesta',
pwd: 'Password per accedere',
}
},
finder: {
search_skill: 'Cerca una specializzazione'
},
},
};