From f59691985af7b7eb6d921a6b2d75840a6beb02ab Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Mon, 12 Sep 2022 18:36:54 +0200 Subject: [PATCH] Send Coins --- .../CCurrencyValue/CCurrencyValue.scss | 0 .../CCurrencyValue/CCurrencyValue.ts | 64 +++++++++ .../CCurrencyValue/CCurrencyValue.vue | 51 +++++++ src/components/CCurrencyValue/index.ts | 1 + src/components/CGridTableRec/CGridTableRec.ts | 8 +- src/components/CMyPopupEdit/CMyPopupEdit.scss | 5 + src/components/CMyPopupEdit/CMyPopupEdit.ts | 4 +- src/components/CMyPopupEdit/CMyPopupEdit.vue | 27 +++- .../CMyRecCircuitCard/CMyRecCircuitCard.ts | 3 +- .../CMyRecCircuitCard/CMyRecCircuitCard.vue | 11 ++ src/components/CSendCoins/CSendCoins.ts | 44 +++++- src/components/CSendCoins/CSendCoins.vue | 41 +++++- src/components/MyFooter/MyFooter.scss | 5 + src/components/MyFooter/MyFooter.vue | 13 +- src/components/index.ts | 1 + src/css/app.scss | 46 +++++++ .../toolbar/notifPopover/notifPopover.ts | 1 + .../toolbar/notifPopover/notifPopover.vue | 2 +- src/model/GlobalStore.ts | 12 +- src/statics/lang/it.js | 26 ++-- src/store/Modules/costanti.ts | 1 + src/store/Modules/fieldsTable.ts | 39 ++++-- src/store/Modules/serv_constants.ts | 1 + src/store/Modules/tools.ts | 55 ++++++-- src/store/globalStore.ts | 2 +- src/views/user/mycircuit/mycircuit.ts | 5 +- src/views/user/mycircuit/mycircuit.vue | 126 ++++++++++++------ src/views/user/myprofile/myprofile.vue | 8 +- 28 files changed, 507 insertions(+), 95 deletions(-) create mode 100755 src/components/CCurrencyValue/CCurrencyValue.scss create mode 100755 src/components/CCurrencyValue/CCurrencyValue.ts create mode 100755 src/components/CCurrencyValue/CCurrencyValue.vue create mode 100755 src/components/CCurrencyValue/index.ts diff --git a/src/components/CCurrencyValue/CCurrencyValue.scss b/src/components/CCurrencyValue/CCurrencyValue.scss new file mode 100755 index 00000000..e69de29b diff --git a/src/components/CCurrencyValue/CCurrencyValue.ts b/src/components/CCurrencyValue/CCurrencyValue.ts new file mode 100755 index 00000000..eed77c48 --- /dev/null +++ b/src/components/CCurrencyValue/CCurrencyValue.ts @@ -0,0 +1,64 @@ +import { defineComponent, onMounted, PropType, ref, watch } from 'vue' +import { tools } from '@src/store/Modules/tools' + +import { date, useQuasar } from 'quasar' +import { useI18n } from '@/boot/i18n' + +export default defineComponent({ + name: 'CCurrencyValue', + props: { + label: { + type: String, + required: false, + default: '', + }, + tips: { + type: String, + required: false, + default: '', + }, + readonly: { + type: Boolean, + required: false, + default: false, + }, + symbol: { + type: String, + required: true, + }, + color: { + type: String, + required: false, + default: '', + }, + icon: { + type: String, + required: false, + default: '', + }, + value: { + type: Number, + required: true, + }, + }, + components: {}, + setup(props, { emit }) { + const $q = useQuasar() + const { t } = useI18n() + + const showingtooltip = ref(false) + + function created() { + // created + } + + + onMounted(created) + + return { + showingtooltip, + t, + $q, + } + }, +}) diff --git a/src/components/CCurrencyValue/CCurrencyValue.vue b/src/components/CCurrencyValue/CCurrencyValue.vue new file mode 100755 index 00000000..124bd272 --- /dev/null +++ b/src/components/CCurrencyValue/CCurrencyValue.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/components/CCurrencyValue/index.ts b/src/components/CCurrencyValue/index.ts new file mode 100755 index 00000000..ad2d7ddf --- /dev/null +++ b/src/components/CCurrencyValue/index.ts @@ -0,0 +1 @@ +export {default as CCurrencyValue} from './CCurrencyValue.vue' diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 3a9b1f03..5f46d8f2 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -881,7 +881,13 @@ export default defineComponent({ try { numRecLoaded.value = numRecLoaded.value + (returnedData.value ? returnedData.value.length : 0) // console.log(' ...numRecLoaded.value', numRecLoaded.value) - serverData.value = [...serverData.value, ...returnedData.value] + let toadd = [] + for (const elem of returnedData.value) { + if (serverData.value.findIndex((rec: any) => rec._id === elem._id) < 0) { + toadd.push(elem) + } + } + serverData.value = [...serverData.value, ...toadd] } catch (e) { serverData.value = [] } diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.scss b/src/components/CMyPopupEdit/CMyPopupEdit.scss index f10835dd..7d504fd4 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.scss +++ b/src/components/CMyPopupEdit/CMyPopupEdit.scss @@ -9,3 +9,8 @@ .clpopupVisuCard{ /*border-radius: $generic-border-radius */ } +.extrafield{ + color: black; + font-size: 1rem; + padding: 4px; +} diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.ts b/src/components/CMyPopupEdit/CMyPopupEdit.ts index d7215eb8..2549c031 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.ts +++ b/src/components/CMyPopupEdit/CMyPopupEdit.ts @@ -10,6 +10,7 @@ import { CDateTime } from '../CDateTime' import { CLabel } from '../CLabel' import { CMyToggleList } from '../CMyToggleList' import { CMySelect } from '../CMySelect' +import { CCurrencyValue } from '../CCurrencyValue' import { CMyEditor } from '../CMyEditor' import { CGallery } from '../CGallery' import { CAccomodation } from '../CAccomodation' @@ -185,7 +186,8 @@ export default defineComponent({ default: false, }, }, - components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery, CLabel, CAccomodation }, + components: { CMyChipList, CDateTime, CDate, CMyToggleList, CMySelect, CMyEditor, CGallery, + CCurrencyValue, CLabel, CAccomodation }, setup(props, { emit }) { const $q = useQuasar() const { t } = useI18n() diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index 11572a53..d3e75927 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -10,13 +10,14 @@
@@ -53,6 +54,9 @@
+ + {{t(col.extrafield)}} +
-
+
+
+ + + +
@@ -640,6 +653,16 @@
+
+ + + + +
{{ myrec.longdescr }}
+ + diff --git a/src/components/CSendCoins/CSendCoins.ts b/src/components/CSendCoins/CSendCoins.ts index 41b16b03..2e39690b 100755 --- a/src/components/CSendCoins/CSendCoins.ts +++ b/src/components/CSendCoins/CSendCoins.ts @@ -1,10 +1,12 @@ import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue' -import { ICircuit, IOperators, ISendCoin, ISpecialField, IUserFields } from '../../model' +import { IAccount, ICircuit, IOperators, ISendCoin, ISpecialField, IUserFields } from '../../model' import { tools } from '@store/Modules/tools' +import { CCurrencyValue } from '@/components/CCurrencyValue' import { useUserStore } from '@store/UserStore' import { useCircuitStore } from '@store/CircuitStore' import { useQuasar } from 'quasar' +import { useI18n } from '@/boot/i18n' export default defineComponent({ name: 'CSendCoins', @@ -19,9 +21,11 @@ export default defineComponent({ required: true, }, }, + components: { CCurrencyValue }, setup(props, { emit }) { const $q = useQuasar() + const { t } = useI18n() const show = ref(false) const userStore = useUserStore() const circuitStore = useCircuitStore() @@ -33,8 +37,16 @@ export default defineComponent({ const causal = ref('') const bothcircuits = ref([]) - const circuitloaded = ref(undefined) + const circuitloaded = ref(undefined) + const circuitdest = ref(undefined) + const accountloaded = ref(undefined) + const accountdest = ref(undefined) + const remainingCoins = ref(0) + const priceLabel = computed(() => circuitloaded.value ? `${qty.value} ` + circuitloaded.value.symbol : '') + const arrayMarkerLabel = ref([]) + + const qtyRef = ref(null) watch(() => circuitsel.value, (newval, oldval) => { aggiorna() @@ -47,7 +59,28 @@ export default defineComponent({ function aggiorna() { circuitloaded.value = circuitStore.listcircuits.find((rec: ICircuit) => rec.name === circuitsel.value) + if (circuitloaded.value) { + accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id) + // accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id) + if (accountloaded.value) { + remainingCoins.value = tools.getRemainingCoinsToSend(accountloaded.value) + const quanti = [ ...Array(100).keys() ].map( i => i+1) + for (const ind of quanti) { + let value = ind * 10 + if (value > remainingCoins.value) { + break + } else { + const label = value.toString() + arrayMarkerLabel.value.push({value, label}) + } + } + } + + } + + console.log('circuitStore.listcircuits', circuitStore.listcircuits, 'aggiorna', circuitloaded.value) + console.log('userStore.my.profile.mycircuits', userStore.my.profile.mycircuits) } function mounted() { @@ -95,16 +128,23 @@ export default defineComponent({ onMounted(mounted) return { + t, tools, show, bothcircuits, from_username, circuitsel, circuitloaded, + accountloaded, + accountdest, qty, hide, sendCoin, causal, + priceLabel, + arrayMarkerLabel, + remainingCoins, + qtyRef, } }, }) diff --git a/src/components/CSendCoins/CSendCoins.vue b/src/components/CSendCoins/CSendCoins.vue index f6ff9b71..10c1f6c0 100755 --- a/src/components/CSendCoins/CSendCoins.vue +++ b/src/components/CSendCoins/CSendCoins.vue @@ -13,6 +13,15 @@ + + + + @@ -21,21 +30,39 @@ - + + + diff --git a/src/components/MyFooter/MyFooter.scss b/src/components/MyFooter/MyFooter.scss index cf620a6c..4cbb6682 100755 --- a/src/components/MyFooter/MyFooter.scss +++ b/src/components/MyFooter/MyFooter.scss @@ -1,3 +1,8 @@ .q-tab__label { font-size: 0.7rem !important; } + +.q-tab { + padding-left: 2px; + padding-right: 2px; +} diff --git a/src/components/MyFooter/MyFooter.vue b/src/components/MyFooter/MyFooter.vue index b417a3bf..bcf87899 100755 --- a/src/components/MyFooter/MyFooter.vue +++ b/src/components/MyFooter/MyFooter.vue @@ -6,7 +6,9 @@ > + - diff --git a/src/components/index.ts b/src/components/index.ts index 812c0517..919cc01d 100755 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -61,3 +61,4 @@ export * from './CKeyAndValue' export * from './CNotifSettings' // export * from './CPreloadImages' export * from './CSendCoins' +export * from './CCurrencyValue' diff --git a/src/css/app.scss b/src/css/app.scss index 403e0408..63324690 100755 --- a/src/css/app.scss +++ b/src/css/app.scss @@ -671,6 +671,13 @@ $heightBtn: 100%; } } +.text-h7-dense { + font-size: 1rem; + font-weight: 400; + line-height: 1.25rem; + letter-spacing: normal; +} + .clBorderSmall { border: #dfe3f6 solid 1px; border-radius: 16px; @@ -749,6 +756,27 @@ $heightBtn: 100%; border: solid 3px #49b502; } +.bordo_stondato_stretto{ + margin: 4px; + border-radius: 3rem; + padding-left: 14px; + padding-right: 14px; + padding-top: 0px; + padding-bottom: 0px; + border: solid 3px #49b502; +} + +.bordo_quadrato{ + margin: 1px; + border-radius: 0.5rem; + padding-left: 2px; + padding-right: 2px; + padding-top: 4px; + padding-bottom: 4px; + border: solid 2px #2d3e88; +} + + .bordo_stondato_blu2 { border: solid 3px #0f01b5; } @@ -1065,3 +1093,21 @@ $heightBtn: 100%; padding: 8px !important; } } +.align_elem_right { + margin-left: auto; +} + +.text-section{ + font-size: 1.15rem; + font-weight: bold; +} + +.sezioni{ + vertical-align: center; + padding: 4px; +} + +.mysmalltabs { + padding-left: 1px !important; + padding-right: 1px !important; +} diff --git a/src/layouts/toolbar/notifPopover/notifPopover.ts b/src/layouts/toolbar/notifPopover/notifPopover.ts index 502ea770..bf15ed37 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.ts +++ b/src/layouts/toolbar/notifPopover/notifPopover.ts @@ -222,6 +222,7 @@ export default defineComponent({ t, username, userStore, + $q, } }, }) diff --git a/src/layouts/toolbar/notifPopover/notifPopover.vue b/src/layouts/toolbar/notifPopover/notifPopover.vue index 8bd776e3..004810c4 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.vue +++ b/src/layouts/toolbar/notifPopover/notifPopover.vue @@ -11,7 +11,7 @@ {{ $t('notifs.notifs') }} diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts index e15f8764..ba36cedb 100755 --- a/src/model/GlobalStore.ts +++ b/src/model/GlobalStore.ts @@ -602,6 +602,7 @@ export interface IColGridTable { subfield_extra1?: string allowNewValue?: boolean showpicprofile_ifnotset?: boolean + extrafield?: string } export interface ITableRec { @@ -922,6 +923,7 @@ export interface ICircuit { totTransato?: number nome_valuta: string symbol: string + color: string abbrev: string compara_valuta?: number compara_euro?: number @@ -960,6 +962,8 @@ export interface IMovVisu { transactionDate: Date userfrom: IUserFields userto: IUserFields + circuitfrom: ICircuit + circuitto: ICircuit amount: number causal: string residual: number @@ -971,9 +975,9 @@ export interface IAccount { circuitId: number circuit: ICircuit[] name: string - deperibile?: boolean - fidoConcesso?: number - qta_maxConcessa?: number + deperibile: boolean + fidoConcesso: number + qta_maxConcessa: number importo_iniziale?: number - saldo?: number + saldo: number } diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index 25afe192..d03fb068 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -577,6 +577,7 @@ const msg_it = { user_aportador_not_valid: 'Il link di registrazione non sembra risultare valido.', rec_already_exist_name: 'Esiste già con questo Nome', rec_already_exist_code: 'Esiste già con questo Link Pagina', + rec_already_exist_symbol: 'Esiste già con questo Simbolo', duplicate_username: 'L\'Username è stato già utilizzato', username_not_valid: 'L\'Username non é valido', aportador_not_exist: 'L\'Username di chi ti ha invitato non è presente. Contattaci.', @@ -1105,12 +1106,15 @@ const msg_it = { totTransato: 'Totale Transato', nome_valuta: 'Nome Valuta', symbol: 'Simbolo', + color: 'Colore', abbrev: 'Abbreviaz.', compara_valuta: 'Compara Valuta', compara_euro: 'Compara Euro', valuta_per_euro: 'Valuta per Euro', - fido_scoperto_default: 'Capacità di finanziamento concessa', - qta_max_default: 'Quantità massima concessa', + fido_scoperto_default: 'Fiducia concessa', + fido_scoperto_default_tips: 'Rappresenta quanta moneta puoi creare autonomamente', + qta_max_default: 'Massimo accumulo', + qta_max_default_tips: 'Rappresenta quanta moneta ti è concesso accumulare temporaneamente. Incentiviamo di utilizzarla...', data_costituz: 'Data Costituzione', deperimento: 'Deperimento', freq_deper: 'Frequenza Deperimento', @@ -1122,8 +1126,8 @@ const msg_it = { durata_deper: 'Durata Dep.', img_logo: 'NomeFile Logo', regulation: 'Regolamento', - - domanda_ask: 'Chiedere l\'invito al Circuito {circuitname}?', + acceptregulation: 'Accetta il Regolamento', + domanda_ask: 'Chiedere l\'invito al Circuito {circuitname} accettando il suo Regolamento?', domanda_revoke: 'Revocare la richiesta al Circuito {circuitname}?', askedto: 'Chiesto l\'invito al Circuito {circuitname}', revoketo: 'Revocato la richiesta d\'invito al Circuito {circuitname}', @@ -1143,7 +1147,7 @@ const msg_it = { cancel_req: 'Annullata la richiesta al Circuito {circuitname}', remove_from_mylist: 'Rimuovi dal Circuito', reject_ask: 'Rifiuta l\'ingresso dal Circuito', - domanda_exit_fromcircuit: 'Uscire dal CIrcuito {groupname} ?', + domanda_exit_fromcircuit: 'Uscire dal CIrcuito {circuitname} ?', domanda_addadminofcircuit: 'Aggiungere {username} come Amministratore del CIrcuito {circuitname} ?', domanda_removeadminofcircuit: 'Rimuovere {username} dall\' incarico di Amministratore del CIrcuito {circuitname} ?', domanda_refuse_circuit: 'Rifiutare la richiesta di {username} per entrare nel Circuito {circuitname}?', @@ -1158,6 +1162,8 @@ const msg_it = { accept_coins: 'Accetta Monete', refuse_coins: 'Rifiuta Monete', movements: 'Movimenti', + qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}', + qta_max_to_send: 'Quantità massima inviabile {maxqta} {symbol}', }, account: { @@ -1166,6 +1172,7 @@ const msg_it = { qta_maxConcessa: 'Capacità massima accumulabile', importo_iniziale: 'Importo Iniziale', saldo: 'Saldo', + saldo_tips: 'Rappresenta quanta moneta ho accumulato. Ma posso andare anche sotto ', user: 'Utente', }, @@ -1173,14 +1180,16 @@ const msg_it = { transactionDate: 'Data Transazione', accountFromId: 'Dal Conto', accountToId: 'Al Conto', - amount: 'Quantità', + amount: 'Quantità da inviare', causal: 'Note', causal_table: 'Tabella Causale', causal_IdRec: 'Id Record Causale', residual: 'Residuo', expiringDate: 'Data Scadenza', - movin: 'In Entrata', - movout: 'In Uscita', + movin: 'Monete Ricevute', + movout: 'Monete Inviate', + from: 'Inviate da:', + to: 'A favore di:', }, editor: { showtool: 'Mostra strumenti per formattare il testo', @@ -1193,6 +1202,7 @@ const msg_it = { friends: 'Amici', bookings: 'Prenotaz.', profile: 'Profilo', + circuits: 'Circuiti', } }, diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index b44a68c0..d9f435da 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -275,6 +275,7 @@ export const costanti = { link: 12500, listobj: 13000, label: 14000, + currency: 15000, }, diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index 420bb331..9d0217bc 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -65,6 +65,7 @@ function AddCol(params: IColGridTable) { subfield_extra1: (params.subfield_extra1 === undefined) ? '' : params.subfield_extra1, allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue, showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset, + extrafield: (params.extrafield === undefined) ? '' : params.extrafield, visible: (params.visible === undefined) ? true : params.visible, icon: (params.icon === undefined) ? '' : params.icon, action: (params.action === undefined) ? '' : params.action, @@ -531,6 +532,7 @@ export const colmyMovement = [ fieldtype: costanti.FieldType.username_chip, link: '/my/userfrom.username', noshowlabel: true, + extrafield: 'movement.from', }), AddCol({ name: 'userto.username', @@ -541,11 +543,12 @@ export const colmyMovement = [ tipovisu: costanti.TipoVisu.LINK, fieldtype: costanti.FieldType.username_chip, link: '/my/userto.username', + extrafield: 'movement.to', noshowlabel: true, }), AddCol({ name: 'amount', label_trans: 'movement.amount', - fieldtype: costanti.FieldType.string, required: true, tipovisu: costanti.TipoVisu.TESTO_BORDATO }), + fieldtype: costanti.FieldType.currency, required: true, tipovisu: costanti.TipoVisu.TESTO_BORDATO }), AddCol({ name: 'causal', label_trans: 'movement.causal', tipovisu: costanti.TipoVisu.TESTO_BORDATO }), ] @@ -2415,11 +2418,13 @@ export const colTableSubCashCategory = [ export const colTableCircuitComplete = [ AddCol({ name: 'Num', label_trans: 'circuit.num', fieldtype: costanti.FieldType.number }), - AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi + // AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi AddCol({ name: 'name', label_trans: 'circuit.name', maxlength: 40, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage }), - AddCol({ name: 'path', label_trans: 'circuit.path' }), + AddCol({ name: 'path', label_trans: 'circuit.path', + allowchar: costanti.ALLOWCHAR_CODE, + }), AddCol({ name: 'subname', label_trans: 'circuit.subname' }), AddCol({ name: 'longdescr', label_trans: 'circuit.descr', fieldtype: costanti.FieldType.html }), AddCol({ name: 'regulation', label_trans: 'circuit.regulation', fieldtype: costanti.FieldType.html }), @@ -2428,14 +2433,15 @@ export const colTableCircuitComplete = [ AddCol({ name: 'createdBy', label_trans: 'circuit.founder', fieldtype: costanti.FieldType.select, jointable: 'users', }), AddCol({ name: 'totCircolante', label_trans: 'circuit.totCircolante', fieldtype: costanti.FieldType.number }), AddCol({ name: 'totTransato', label_trans: 'circuit.totTransato', fieldtype: costanti.FieldType.number }), - AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta' }), + // AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta' }), AddCol({ name: 'symbol', label_trans: 'circuit.symbol' }), + AddCol({ name: 'color', label_trans: 'circuit.color' }), AddCol({ name: 'abbrev', label_trans: 'circuit.abbrev' }), AddCol({ name: 'compara_valuta', label_trans: 'circuit.compara_valuta', fieldtype: costanti.FieldType.number }), AddCol({ name: 'compara_euro', label_trans: 'circuit.compara_euro', fieldtype: costanti.FieldType.number }), AddCol({ name: 'valuta_per_euro', label_trans: 'circuit.valuta_per_euro', fieldtype: costanti.FieldType.number }), - AddCol({ name: 'fido_scoperto_default', label_trans: 'circuit.fido_scoperto_default', fieldtype: costanti.FieldType.number }), - AddCol({ name: 'qta_max_default', label_trans: 'circuit.qta_max_default', fieldtype: costanti.FieldType.number }), + AddCol({ name: 'fido_scoperto_default', label_trans: 'circuit.fido_scoperto_default', fieldtype: costanti.FieldType.currency }), + AddCol({ name: 'qta_max_default', label_trans: 'circuit.qta_max_default', fieldtype: costanti.FieldType.currency }), AddCol({ name: 'data_costituz', label_trans: 'circuit.data_costituz', fieldtype: costanti.FieldType.date }), AddCol({ name: 'deperimento', label_trans: 'circuit.deperimento', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'freq_deper', label_trans: 'circuit.freq_deper' }), @@ -2480,12 +2486,16 @@ export const colTableCircuitComplete = [ ] export const colTableCircuit = [ - AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi + // AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi AddCol({ name: 'name', label_trans: 'circuit.name', required: true, - maxlength: 40, + maxlength: 30, showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InView }), - AddCol({ name: 'path', label_trans: 'circuit.path', required: true }), + AddCol({ name: 'path', label_trans: 'circuit.path', required: true, + maxlength: 30, + showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InView, + allowchar: costanti.ALLOWCHAR_CODE, + }), AddCol({ name: 'subname', label_trans: 'circuit.subname' }), AddCol({ name: 'longdescr', label_trans: 'circuit.descr', fieldtype: costanti.FieldType.html }), AddCol({ name: 'systemUserId', label_trans: 'circuit.systemUserId', fieldtype: costanti.FieldType.select, jointable: 'users', }), @@ -2504,12 +2514,15 @@ export const colTableCircuit = [ sortable: true, showWhen: 0 }), - AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta', required: true }), + // AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta', required: true }), AddCol({ name: 'symbol', label_trans: 'circuit.symbol' }), + AddCol({ name: 'color', label_trans: 'circuit.color' }), AddCol({ name: 'fido_scoperto_default', label_trans: 'circuit.fido_scoperto_default', - fieldtype: costanti.FieldType.number, required: true, visulabel: true }), + fieldtype: costanti.FieldType.currency, required: true, visulabel: true }), AddCol({ name: 'qta_max_default', label_trans: 'circuit.qta_max_default', - fieldtype: costanti.FieldType.number, required: true, visulabel: true }), + fieldtype: costanti.FieldType.currency, required: true, visulabel: true }), + AddCol({ name: 'regulation', label_trans: 'circuit.regulation', fieldtype: costanti.FieldType.html }), + AddCol({ name: 'deperimento', label_trans: 'circuit.deperimento', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'data_costituz', label_trans: 'circuit.data_costituz', fieldtype: costanti.FieldType.date }), AddCol({ name: 'photos', @@ -2531,7 +2544,7 @@ export const colmyUserCircuit = [ AddCol({ name: 'fidoConcesso', label_trans: 'account.fidoConcesso', fieldtype: costanti.FieldType.number }), AddCol({ name: 'qta_maxConcessa', label_trans: 'account.qta_maxConcessa', fieldtype: costanti.FieldType.number }), AddCol({ name: 'importo_iniziale', label_trans: 'account.importo_iniziale', fieldtype: costanti.FieldType.number }), - AddCol({ name: 'saldo', label_trans: 'account.saldo', fieldtype: costanti.FieldType.number }), + AddCol({ name: 'saldo', label_trans: 'account.saldo', fieldtype: costanti.FieldType.currency }), AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }), AddCol(DeleteRec), AddCol(DuplicateRec), diff --git a/src/store/Modules/serv_constants.ts b/src/store/Modules/serv_constants.ts index 1323ad3e..f4453c08 100755 --- a/src/store/Modules/serv_constants.ts +++ b/src/store/Modules/serv_constants.ts @@ -6,6 +6,7 @@ export const serv_constants = { RIS_CODE_EMAIL_ALREADY_VERIFIED: -5, RIS_CODE_EMAIL_VERIFIED: 1, + RIS_CODE_REC_ALREADY_EXIST_SYMBOL: -102, RIS_CODE_REC_ALREADY_EXIST_CODE: -101, RIS_CODE_REC_ALREADY_EXIST_NAME: -100, RIS_CODE_USER_APORTADOR_NOT_VALID: -75, diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 0fbff9bc..4263e4cb 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -3154,6 +3154,8 @@ export const tools = { this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_name') + ' ' + msg) } else if (riscode === serv_constants.RIS_CODE_REC_ALREADY_EXIST_CODE) { this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_code') + ' ' + msg) + } else if (riscode === serv_constants.RIS_CODE_REC_ALREADY_EXIST_SYMBOL) { + this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_symbol') + ' ' + msg) } }, @@ -4791,7 +4793,11 @@ export const tools = { userStore.setCircuitCmd($q, t, username, recsendcoin.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT, 0, recsendcoin) .then((res: any) => { if (res) { - tools.showPositiveNotif($q, t('circuit.coins_accepted')) + if (res.cansend) { + tools.showPositiveNotif($q, t('circuit.coins_accepted')) + } else { + tools.showNegativeNotif($q, res.errormsg) + } } }) }, @@ -5282,13 +5288,15 @@ export const tools = { return userStore.setCircuitCmd($q, t, username, sendcoinrec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REQ, true, sendcoinrec) .then((res: any) => { - if (res) { + if (res.cansend) { tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent')) } else { - tools.showNegativeNotif($q, t('circuit.coins_sendrequest_failed')) + tools.showNegativeNotif($q, res.errormsg) } }) }) + + return null }, cancelReqCircuit($q: any, username: string, circuitname: string) { @@ -6264,12 +6272,14 @@ export const tools = { }, isTypeByRecMov(rec: IMovVisu) { - const userStore = useUserStore() let type = costanti.TypeMov.Nessuno - if (userStore.my.username === rec.userfrom.username) { - type = rec.amount > 0 ? costanti.TypeMov.Uscita : (rec.amount < 0 ? costanti.TypeMov.Entrata : costanti.TypeMov.Nessuno) - } else if (userStore.my.username === rec.userto.username) { - type = rec.amount > 0 ? costanti.TypeMov.Entrata : (rec.amount < 0 ? costanti.TypeMov.Uscita : costanti.TypeMov.Nessuno) + if (rec && rec.userfrom) { + const userStore = useUserStore() + if (userStore.my.username === rec.userfrom.username) { + type = rec.amount > 0 ? costanti.TypeMov.Uscita : (rec.amount < 0 ? costanti.TypeMov.Entrata : costanti.TypeMov.Nessuno) + } else if (userStore.my.username === rec.userto.username) { + type = rec.amount > 0 ? costanti.TypeMov.Entrata : (rec.amount < 0 ? costanti.TypeMov.Uscita : costanti.TypeMov.Nessuno) + } } return type @@ -6278,6 +6288,35 @@ export const tools = { return this.isTypeByRecMov(rec) === costanti.TypeMov.Entrata }, + + getSymbolByCircuit(circuit: any) { + try { + if (circuit.symbol) { + return circuit.symbol + } else { + if (circuit.circuitfrom.symbol) { + return circuit.circuitfrom.symbol + } else { + return '' + } + } + }catch (e) { + return '' + } + }, + getColorByCircuit(circuit: any) { + if (circuit.color) { + return circuit.color + } else { + return '' + } + }, + getRemainingCoinsToSend(account: IAccount) { + return account.saldo + account.fidoConcesso; + }, + getMaxCoinsToSend(account: IAccount) { + return account.qta_maxConcessa - account.saldo; + }, // getLocale() { // if (navigator.languages && navigator.languages.length > 0) { // return navigator.languages[0] diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 80a399b6..0bd63e46 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -1676,7 +1676,7 @@ export const useGlobalStore = defineStore('GlobalStore', { myserv = window.location.host if (process.env.DEBUGGING) { - myserv = 'http://localhost:3000'; // 'http://192.168.1.54:3000' + myserv = 'http://192.168.1.103:3000'; // 'http://192.168.1.54:3000' } if (!myserv) { diff --git a/src/views/user/mycircuit/mycircuit.ts b/src/views/user/mycircuit/mycircuit.ts index 1927c7ef..1f29db42 100755 --- a/src/views/user/mycircuit/mycircuit.ts +++ b/src/views/user/mycircuit/mycircuit.ts @@ -5,6 +5,7 @@ import { CTitleBanner } from '@/components/CTitleBanner' import { CProfile } from '@/components/CProfile' import { CCheckIfIsLogged } from '@/components/CCheckIfIsLogged' import { CMyFieldRec } from '@/components/CMyFieldRec' +import { CCurrencyValue } from '@/components/CCurrencyValue' import { CSkill } from '@/components/CSkill' import { CDateTime } from '@/components/CDateTime' import { tools } from '@store/Modules/tools' @@ -25,7 +26,7 @@ import { useNotifStore } from '@store/NotifStore' export default defineComponent({ name: 'mycircuit', components: { CProfile, CTitleBanner, CMyFieldRec, CSkill, CDateTime, CMyFriends, - CGridTableRec, CMyUser, CCheckIfIsLogged }, + CGridTableRec, CMyUser, CCheckIfIsLogged, CCurrencyValue }, props: {}, setup() { const userStore = useUserStore() @@ -48,6 +49,7 @@ export default defineComponent({ const users_in_circuit = ref([]) const loading = ref(false) + const requestToEnterCircuit = ref(false) const tabgrp = ref('info') const tabmembers = ref('all') @@ -222,6 +224,7 @@ export default defineComponent({ mystatus, cities, path, + requestToEnterCircuit, } } }) diff --git a/src/views/user/mycircuit/mycircuit.vue b/src/views/user/mycircuit/mycircuit.vue index 06c89661..95db9235 100755 --- a/src/views/user/mycircuit/mycircuit.vue +++ b/src/views/user/mycircuit/mycircuit.vue @@ -39,43 +39,21 @@ {{ $t('db.youarerefusedcircuit') }}
-
- - - - + - - - -
+
+ @click="tools.removeFromMyCircuits($q, userStore.my.username, circuit.name, $t('circuit.domanda_exit_fromcircuit', {circuitname: circuit.name }))"> @@ -117,7 +95,7 @@ - + @@ -201,18 +179,48 @@ >
-
- - {{ circuit.fido_scoperto_default }} {{ t('circuit.fido_scoperto_default') }} +
+ + {{ t('circuit.symbol') }}: + + {{ tools.getSymbolByCircuit(circuit) }} +
-
+
+ + +
+
+ + +
+
- {{ circuit.qta_max_default }} {{ t('circuit.qta_max_default') }} + {{ t('circuit.deperimento') }}: {{ circuit.deperimento ? t('dialog.yes') : t('dialog.no') }} {{ }}
-
- - {{ t('circuit.deperimento') }}{{ circuit.deperimento ? t('dialog.yes') : t('dialog.no') }} {{ }} + +
+ + {{ t('circuit.regulation') }}:
+
+ + @@ -387,6 +395,44 @@ + + + + + + + + {{ circuit.name }} + + + + + + Regolamento:
+
+
+
+
+ + + + + + +
+
diff --git a/src/views/user/myprofile/myprofile.vue b/src/views/user/myprofile/myprofile.vue index 7dd553f5..c098949b 100755 --- a/src/views/user/myprofile/myprofile.vue +++ b/src/views/user/myprofile/myprofile.vue @@ -152,10 +152,12 @@
+ userStore.IsMyCircuitByUser(myuser): {{ userStore.IsMyCircuitByUser(myuser) }}