Corretto le richieste di amicizie, aggiunto Accettazione sul BOT

This commit is contained in:
paoloar77
2022-03-11 12:38:17 +01:00
parent 64579ccabf
commit a353e85ccf
14 changed files with 117 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.3.10" APP_VERSION="0.3.11"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.3.10" APP_VERSION="0.3.11"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.3.10" APP_VERSION="0.3.11"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="12" APP_ID="12"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.3.10" APP_VERSION="0.3.11"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.3.10" APP_VERSION="0.3.11"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -495,9 +495,13 @@ export default defineComponent({
if (item.table === 'regions') { if (item.table === 'regions') {
obj['mycities.reg'] = item.value let myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'mycities.reg')
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) { obj[myfield] = item.value
filtersearch3and.push(obj) if (myfield) {
obj['mycities.reg'] = item.value
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) {
filtersearch3and.push(obj)
}
} }
if (item.value && recProvince && idRegion !== costanti.FILTER_TUTTI) { if (item.value && recProvince && idRegion !== costanti.FILTER_TUTTI) {
@@ -506,9 +510,12 @@ export default defineComponent({
} else if (item.table === 'provinces') { } else if (item.table === 'provinces') {
obj['mycities.prov'] = item.value let myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'mycities.prov')
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) { obj[myfield] = item.value
filtersearch3and.push(obj) if (myfield) {
if (item.value !== '' && item.value !== costanti.FILTER_TUTTI) {
filtersearch3and.push(obj)
}
} }
if (item.value && recCities && idProvince !== costanti.FILTER_TUTTI) { if (item.value && recCities && idProvince !== costanti.FILTER_TUTTI) {
@@ -518,9 +525,12 @@ export default defineComponent({
} else if (item.table === 'cities') { } else if (item.table === 'cities') {
if (item.value && item.value.hasOwnProperty('_id')) { if (item.value && item.value.hasOwnProperty('_id')) {
obj['idCity'] = item.value._id let myfield = tools.getFieldSearchByTable(mytable.value, item.table, 'idCity')
if (item.value && item.value !== '' && item.value._id !== costanti.FILTER_TUTTI) { if (myfield) {
filtersearch3and.push(obj) obj[myfield] = item.value._id
if (item.value && item.value !== '' && item.value._id !== costanti.FILTER_TUTTI) {
filtersearch3and.push(obj)
}
} }
} }
} else if (shared_consts.TABLES_WITH_FILTER_FIELD.includes(item.table)) { } else if (shared_consts.TABLES_WITH_FILTER_FIELD.includes(item.table)) {

View File

@@ -145,7 +145,7 @@
</div>--> </div>-->
<CMySelect <CMySelect
:col="fieldsTable.getColByTable(mytable, item.key)" :col="fieldsTable.getColByColumns(mycolumns, item.key)"
v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)" v-if="(item.type === costanti.FieldType.select) || (item.type === costanti.FieldType.select_by_server)"
:label="labelcombo(item)" :label="labelcombo(item)"
v-model:value="item.value" v-model:value="item.value"
@@ -172,7 +172,7 @@
<CMySelect <CMySelect
v-if="item.type === costanti.FieldType.multiselect_by_server" v-if="item.type === costanti.FieldType.multiselect_by_server"
:col="fieldsTable.getColByTable(mytable, item.key)" :col="fieldsTable.getColByColumns(mycolumns, item.key)"
:multiselect_by_server="true" :multiselect_by_server="true"
:label="labelcombo(item)" :label="labelcombo(item)"
v-model:arrvalue="item.arrvalue" v-model:arrvalue="item.arrvalue"

View File

@@ -88,11 +88,11 @@ export default defineComponent({
$router.push(path) $router.push(path)
} }
function setCmd($q: any, cmd: number, myusername: string, value: any, groupname: string) { function setCmd($q: any, cmd: number, myusername: string, value: any, dest: string) {
if (props.notsetcmd) { if (props.notsetcmd) {
tools.setCmd($q, cmd, myusername, value, groupname) tools.setCmd($q, cmd, myusername, value, dest)
}else { }else {
emit('setCmd', $q, cmd, myusername, value, groupname) emit('setCmd', $q, cmd, myusername, value, dest)
} }
} }

View File

@@ -22,12 +22,12 @@
<q-menu> <q-menu>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup <q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd($q, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, contact.username, '', '')"> @click="setCmd($q, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, userStore.my.username, '', contact.username)">
<q-item-section>{{ $t('friends.remove_from_myfriends') }}</q-item-section> <q-item-section>{{ $t('friends.remove_from_myfriends') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
<q-item clickable icon="fas fa-ban" v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.BLOCK_USER, contact.username, '', '')"> <q-item clickable icon="fas fa-ban" v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.BLOCK_USER, userStore.my.username, '', contact.username)">
<q-item-section>{{ $t('friends.block_user') }}</q-item-section> <q-item-section>{{ $t('friends.block_user') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -40,13 +40,13 @@
<q-btn rounded icon="fas fa-ellipsis-h"> <q-btn rounded icon="fas fa-ellipsis-h">
<q-menu> <q-menu>
<q-list v-if="true" style="min-width: 150px"> <q-list v-if="true" style="min-width: 150px">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.SETFRIEND, contact.username, '', '')"> <q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.SETFRIEND, userStore.my.username, '', contact.username)">
<q-item-section>{{ $t('friends.accept_friend') }}</q-item-section> <q-item-section>{{ $t('friends.accept_friend') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup <q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, contact.username, false, '')"> @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, userStore.my.username, false, contact.username, false)">
<q-item-section>{{ $t('friends.reject_ask_friend') }}</q-item-section> <q-item-section>{{ $t('friends.reject_ask_friend') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -104,7 +104,7 @@
<q-menu> <q-menu>
<q-list style="min-width: 150px"> <q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup <q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd($q, shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND, contact.username, '', '')"> @click="setCmd($q, shared_consts.FRIENDSCMD.CANCEL_REQ_FRIEND, userStore.my.username, '', contact.username, '')">
<q-item-section>{{ $t('friends.cancel_ask_friend') }}</q-item-section> <q-item-section>{{ $t('friends.cancel_ask_friend') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -114,10 +114,10 @@
</q-item-section> </q-item-section>
<q-item-section side v-else-if="visu === costanti.ASK_TRUST"> <q-item-section side v-else-if="visu === costanti.ASK_TRUST">
<q-item-label> <q-item-label>
<q-btn color="positive" :label="$t('friends.accept_trust')" @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, contact.username, true, '')"/> <q-btn color="positive" :label="$t('friends.accept_trust')" @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, userStore.my.username, true, contact.username)"/>
</q-item-label> </q-item-label>
<q-item-label> <q-item-label>
<q-btn color="negative" :label="$t('friends.refuse_trust')" @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, contact.username, false, '')"/> <q-btn color="negative" :label="$t('friends.refuse_trust')" @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, userStore.my.username, false, contact.username)"/>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section side v-else-if="visu === costanti.TRUSTED"> <q-item-section side v-else-if="visu === costanti.TRUSTED">
@@ -125,12 +125,12 @@
<q-btn rounded icon="fas fa-ellipsis-h"> <q-btn rounded icon="fas fa-ellipsis-h">
<q-menu> <q-menu>
<q-list v-if="!userStore.IsMyFriendByUsername(contact.username)" style="min-width: 200px"> <q-list v-if="!userStore.IsMyFriendByUsername(contact.username)" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, contact.username, true, '')"> <q-item clickable icon="fas fa-user-plus" v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, userStore.my.username, true, contact.username)">
<q-item-section>{{ $t('friends.ask_friend') }}</q-item-section> <q-item-section>{{ $t('friends.ask_friend') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<q-list style="min-width: 200px"> <q-list style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, contact.username, false, '')"> <q-item clickable icon="fas fa-user-minus" v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, userStore.my.username, false, contact.username)">
<q-item-section>{{ $t('friends.reject_trust') }}</q-item-section> <q-item-section>{{ $t('friends.reject_trust') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -140,20 +140,31 @@
</q-item-section> </q-item-section>
<q-item-section side v-else-if="visu === costanti.FIND_PEOPLE"> <q-item-section side v-else-if="visu === costanti.FIND_PEOPLE">
<q-item-label> <q-item-label>
<q-btn v-if="contact.username !== userStore.my.username" rounded :icon="userStore.IsMyFriendByUsername(contact.username) ? `fas fa-ellipsis-h` : `fas fa-user`"> <q-btn v-if="contact.username !== userStore.my.username" rounded :icon="userStore.IsMyFriendByUsername(contact.username) ? `fas fa-ellipsis-h` : `fas fa-user`">
<q-menu> <q-menu>
<q-list v-if="(!userStore.IsMyFriendByUsername(contact.username) && !userStore.IsAskedFriendByUsername(contact.username))" style="min-width: 200px"> <q-list v-if="(!userStore.IsMyFriendByUsername(contact.username) && !userStore.IsAskedFriendByUsername(contact.username))" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, contact.username, true, '')"> <q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, userStore.my.username, true, contact.username)">
<q-item-section avatar>
<q-icon color="positive" name="fas fa-user-plus" />
</q-item-section>
<q-item-section>{{ $t('friends.ask_friend') }}</q-item-section> <q-item-section>{{ $t('friends.ask_friend') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<q-list v-else-if="(!userStore.IsMyFriendByUsername(contact.username) && userStore.IsAskedFriendByUsername(contact.username))" style="min-width: 200px"> <q-list v-else-if="(!userStore.IsMyFriendByUsername(contact.username) && userStore.IsAskedFriendByUsername(contact.username))" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, contact.username, false, '')">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REQFRIEND, userStore.my.username, false, contact.username)">
<q-item-section avatar>
<q-icon color="negative" name="fas fa-user-minus" />
</q-item-section>
<q-item-section>{{ $t('friends.cancel_ask_friend') }}</q-item-section> <q-item-section>{{ $t('friends.cancel_ask_friend') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
<q-list v-else-if="userStore.IsMyFriendByUsername(contact.username)" style="min-width: 200px"> <q-list v-else-if="userStore.IsMyFriendByUsername(contact.username)" style="min-width: 200px">
<q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, contact.username, '', '')"> <q-item clickable v-close-popup @click="setCmd($q, shared_consts.FRIENDSCMD.REMOVE_FROM_MYFRIENDS, userStore.my.username, '', contact.username)">
<q-item-section avatar>
<q-icon color="negative" name="fas fa-user-minus" />
</q-item-section>
<q-item-section>{{ $t('friends.remove_from_myfriends') }}</q-item-section> <q-item-section>{{ $t('friends.remove_from_myfriends') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>
@@ -167,7 +178,7 @@
<q-menu> <q-menu>
<q-list style="min-width: 200px"> <q-list style="min-width: 200px">
<q-item clickable icon="fas fa-user-minus" v-close-popup <q-item clickable icon="fas fa-user-minus" v-close-popup
@click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, contact.username, true, '')"> @click="setCmd($q, shared_consts.FRIENDSCMD.SETTRUST, userStore.my.username, true, contact.username)">
<q-item-section>{{ $t('friends.accept_trust') }}</q-item-section> <q-item-section>{{ $t('friends.accept_trust') }}</q-item-section>
</q-item> </q-item>
</q-list> </q-list>

View File

@@ -278,7 +278,7 @@ export default defineComponent({
} else if (tools.isTest()) { } else if (tools.isTest()) {
strv = 'TEST ' strv = 'TEST '
} }
return `[${strv} ver. ${process.env.APP_VERSION}]` return `${strv}v. ${process.env.APP_VERSION}`
} }
function getLangAtt() { function getLangAtt() {

View File

@@ -523,6 +523,15 @@ export const colmyUserPeople = [
name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false, name: 'profile.img', field: 'profile', subfield: 'img', label_trans: 'reg.img', sortable: false,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InEdit,
}), }),
AddCol({
name: 'profile.born_city_id', label_trans: 'reg.born_city', fieldtype: costanti.FieldType.select_by_server,
jointable: 'cities',
tablesel: 'cities',
remote_table: 'mycities',
remote_key: '_id',
remote_field: 'comune',
noshowlabel: true,
}),
// AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: costanti.FieldType.boolean }), // AddCol({ name: 'sospeso', label_trans: 'reg.sospeso', fieldtype: costanti.FieldType.boolean }),
// AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }), // AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }),
] ]
@@ -2174,6 +2183,15 @@ export const fieldsTable = {
} else } else
return null return null
}, },
getColByColumns(mycolumns: any, namecol: string) {
if (mycolumns) {
// console.log('tablerec', tablerec.columns)
const mycol = mycolumns.find((col: any) => col.name === namecol)
// console.log('mycol = ', mycol)
return mycol
} else
return null
},
getArrColsByTable(mytable: string) { getArrColsByTable(mytable: string) {
const tablerec: any = this.tablesList.find((rec) => rec.value === mytable) const tablerec: any = this.tablesList.find((rec) => rec.value === mytable)
if (tablerec) { if (tablerec) {

View File

@@ -5316,6 +5316,24 @@ export const tools = {
}, },
getFieldSearchByTable: function (mytable: string, tablejoin: string, field: string) {
let ris = field
if (mytable === 'users') {
if (tablejoin === 'cities') {
ris = 'profile.born_city_id'
}
if (tablejoin === 'provinces') {
ris = 'profile.born_province'
}
if (tablejoin === 'regions') {
ris = ''
}
}
return ris
},
// getLocale() { // getLocale() {
// if (navigator.languages && navigator.languages.length > 0) { // if (navigator.languages && navigator.languages.length > 0) {

View File

@@ -28,6 +28,7 @@ export default defineComponent({
const filter = ref(costanti.FIND_PEOPLE) const filter = ref(costanti.FIND_PEOPLE)
function mounted() { function mounted() {
console.log('mounted')
searchList.value = [ searchList.value = [
{ {
label: 'Regione', label: 'Regione',
@@ -57,7 +58,7 @@ export default defineComponent({
{ {
label: 'Comune', label: 'Comune',
table: 'cities', table: 'cities',
key: 'idCity', key: 'profile.born_city_id',
type: costanti.FieldType.select_by_server, type: costanti.FieldType.select_by_server,
value: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI), value: tools.getCookie(tools.COOK_SEARCH + 'cities', costanti.FILTER_TUTTI),
addall: true, addall: true,
@@ -113,9 +114,31 @@ export default defineComponent({
username: 1, username: 1,
name: 1, name: 1,
'profile.img': 1, 'profile.img': 1,
'profile.born_city_id': 1,
'profile.qualifica': 1, 'profile.qualifica': 1,
} }
} },
lookup2: {
lk_tab: 'cities',
lk_LF: 'profile.born_city_id',
lk_FF: '_id',
lk_as: 'comune',
af_objId_tab: '',
lk_proj: {
idCity: 1,
numLevel: 1,
comune: 1,
userId: 1,
username: 1,
name: 1,
surname: 1,
mycities: 1,
'profile.img': 1,
'profile.qualifica': 1,
'profile.born_city_id': 1,
}
},
} }
} }

View File

@@ -13,6 +13,7 @@
</q-banner> </q-banner>
<CMyFriends <CMyFriends
v-if="searchList.length > 0"
v-model="filter" v-model="filter"
:finder="true" :finder="true"
> >
@@ -34,7 +35,6 @@
noresultLabel="Username non trovato" noresultLabel="Username non trovato"
:arrfilters="arrfilterand" :arrfilters="arrfilterand"
:filtercustom="filtercustom" :filtercustom="filtercustom"
:prop_searchList="searchList"
:showType="costanti.SHOW_USERINFO" :showType="costanti.SHOW_USERINFO"
:showCol="false" :showCol="false"
:extraparams="extraparams()"> :extraparams="extraparams()">
@@ -43,6 +43,7 @@
</CMyFriends> </CMyFriends>
</div> </div>
</template> </template>
<!--:prop_searchList="searchList"-->
<script lang="ts" src="./myfriends.ts"> <script lang="ts" src="./myfriends.ts">
</script> </script>