Message ui working

This commit is contained in:
benarc 2022-02-03 21:19:24 +00:00 committed by Tiago vasconcelos
parent a55dd18528
commit 80a5d26dce
2 changed files with 78 additions and 52 deletions

View file

@ -2,7 +2,24 @@
Vue.component(VueQrcode.name, VueQrcode) Vue.component(VueQrcode.name, VueQrcode)
const pica = window.pica() //const pica = window.pica()
var mapStalls = obj => {
obj._data = _.clone(obj)
return obj
}
var mapProducts = obj => {
obj._data = _.clone(obj)
return obj
}
var mapZone = obj => {
obj._data = _.clone(obj)
return obj
}
var mapOrders = obj => {
obj._data = _.clone(obj)
return obj
}
new Vue({ new Vue({
el: '#vue', el: '#vue',
@ -13,6 +30,9 @@ new Vue({
orders: [], orders: [],
stalls: [], stalls: [],
zones: [], zones: [],
customerKeys: [],
customerKey: '',
customerMessages: {},
shippedModel: false, shippedModel: false,
shippingZoneOptions: [ shippingZoneOptions: [
'Australia', 'Australia',
@ -64,7 +84,8 @@ new Vue({
'Groceries (Food and Drink)', 'Groceries (Food and Drink)',
'Technology (Phones and Computers)', 'Technology (Phones and Computers)',
'Home (furniture and accessories)', 'Home (furniture and accessories)',
'Gifts (flowers, cards, etc)' 'Gifts (flowers, cards, etc)',
'Adult'
], ],
relayOptions: [ relayOptions: [
'wss://nostr-relay.herokuapp.com/ws', 'wss://nostr-relay.herokuapp.com/ws',
@ -244,6 +265,17 @@ new Vue({
} }
}, },
methods: { methods: {
////////////////////////////////////////
///////////SUPPORT MESSAGES/////////////
////////////////////////////////////////
getMessages: function (customerKey) {
var self = this
console.log('fuck')
messages = []
messages.push(['in', 'blah blah'])
messages.push(['out', 'blah blah'])
self.customerMessages = messages
},
//////////////////////////////////////// ////////////////////////////////////////
////////////////STALLS////////////////// ////////////////STALLS//////////////////
//////////////////////////////////////// ////////////////////////////////////////
@ -256,10 +288,7 @@ new Vue({
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.stalls = response.data.map(function (obj) { self.stalls.push(mapStalls(response.data))
console.log(obj)
return mapDiagonAlley(obj)
})
}) })
}, },
openStallUpdateDialog: function (linkId) { openStallUpdateDialog: function (linkId) {
@ -302,7 +331,7 @@ new Vue({
self.stalls = _.reject(self.stalls, function (obj) { self.stalls = _.reject(self.stalls, function (obj) {
return obj.id == data.id return obj.id == data.id
}) })
self.stalls.push(mapDiagonAlley(response.data)) self.stalls.push(mapStalls(response.data))
self.stallDialog.show = false self.stallDialog.show = false
self.stallDialog.data = {} self.stallDialog.data = {}
data = {} data = {}
@ -323,7 +352,7 @@ new Vue({
data data
) )
.then(function (response) { .then(function (response) {
self.stalls.push(mapDiagonAlley(response.data)) self.stalls.push(mapStalls(response.data))
self.stallDialog.show = false self.stallDialog.show = false
self.stallDialog.data = {} self.stallDialog.data = {}
data = {} data = {}
@ -371,9 +400,7 @@ new Vue({
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.products = response.data.map(function (obj) { self.products.push(mapProducts(response.data))
return mapDiagonAlley(obj)
})
}) })
}, },
openProductUpdateDialog: function (linkId) { openProductUpdateDialog: function (linkId) {
@ -450,7 +477,7 @@ new Vue({
self.products = _.reject(self.products, function (obj) { self.products = _.reject(self.products, function (obj) {
return obj.id == data.id return obj.id == data.id
}) })
self.products.push(mapDiagonAlley(response.data)) self.products.push(mapProducts(response.data))
self.productDialog.show = false self.productDialog.show = false
self.productDialog.data = {} self.productDialog.data = {}
}) })
@ -470,7 +497,7 @@ new Vue({
data data
) )
.then(function (response) { .then(function (response) {
self.products.push(mapDiagonAlley(response.data)) self.products.push(mapProducts(response.data))
self.productDialog.show = false self.productDialog.show = false
self.productDialog.data = {} self.productDialog.data = {}
}) })
@ -517,9 +544,7 @@ new Vue({
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.zones = response.data.map(function (obj) { self.zones.push(mapZone(response.data))
return mapDiagonAlley(obj)
})
}) })
}, },
openZoneUpdateDialog: function (linkId) { openZoneUpdateDialog: function (linkId) {
@ -559,7 +584,7 @@ new Vue({
self.zones = _.reject(self.zones, function (obj) { self.zones = _.reject(self.zones, function (obj) {
return obj.id == data.id return obj.id == data.id
}) })
self.zones.push(mapDiagonAlley(response.data)) self.zones.push(mapZone(response.data))
self.zoneDialog.show = false self.zoneDialog.show = false
self.zoneDialog.data = {} self.zoneDialog.data = {}
data = {} data = {}
@ -580,7 +605,7 @@ new Vue({
data data
) )
.then(function (response) { .then(function (response) {
self.zones.push(mapDiagonAlley(response.data)) self.zones.push(mapZone(response.data))
self.zoneDialog.show = false self.zoneDialog.show = false
self.zoneDialog.data = {} self.zoneDialog.data = {}
data = {} data = {}
@ -628,9 +653,7 @@ new Vue({
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.shops = response.data.map(function (obj) { self.shops.push(mapShops(response.data))
return mapDiagonAlley(obj)
})
}) })
}, },
openShopUpdateDialog: function (linkId) { openShopUpdateDialog: function (linkId) {
@ -670,7 +693,7 @@ new Vue({
self.shops = _.reject(self.shops, function (obj) { self.shops = _.reject(self.shops, function (obj) {
return obj.id == data.id return obj.id == data.id
}) })
self.shops.push(mapDiagonAlley(response.data)) self.shops.push(mapShops(response.data))
self.shopDialog.show = false self.shopDialog.show = false
self.shopDialog.data = {} self.shopDialog.data = {}
data = {} data = {}
@ -692,7 +715,7 @@ new Vue({
data data
) )
.then(function (response) { .then(function (response) {
self.shops.push(mapDiagonAlley(response.data)) self.shops.push(mapShops(response.data))
self.shopDialog.show = false self.shopDialog.show = false
self.shopDialog.data = {} self.shopDialog.data = {}
data = {} data = {}
@ -740,9 +763,7 @@ new Vue({
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.orders = response.data.map(function (obj) { self.orders.push(mapOrders(response.data))
return mapDiagonAlley(obj)
})
}) })
}, },
createOrder: function () { createOrder: function () {
@ -763,7 +784,7 @@ new Vue({
data data
) )
.then(function (response) { .then(function (response) {
self.orders.push(mapDiagonAlley(response.data)) self.orders.push(mapOrders(response.data))
self.orderDialog.show = false self.orderDialog.show = false
self.orderDialog.data = {} self.orderDialog.data = {}
}) })
@ -804,9 +825,7 @@ new Vue({
this.g.user.wallets[0].inkey this.g.user.wallets[0].inkey
) )
.then(function (response) { .then(function (response) {
self.orders = response.data.map(function (obj) { self.orders.push(mapOrders(response.data))
return mapDiagonAlley(obj)
})
}) })
}, },
exportOrdersCSV: function () { exportOrdersCSV: function () {
@ -819,6 +838,10 @@ new Vue({
this.getProducts() this.getProducts()
this.getZones() this.getZones()
this.getOrders() this.getOrders()
this.customerKeys = [
'cb4c0164fe03fcdadcbfb4f76611c71620790944c24f21a1cd119395cdedfe1b',
'a9c17358a6dc4ceb3bb4d883eb87967a66b3453a0f3199f0b1c8eef8070c6a07'
]
} }
} }
}) })

View file

@ -594,34 +594,37 @@
</q-card> </q-card>
<q-card> <q-card>
<q-card-section> <q-card-section>
<h6 class="text-subtitle1 q-my-none">Messages (example)</h6> <h6 class="text-subtitle1 q-my-none">Messages</h6>
</q-card-section> </q-card-section>
<q-card-section class="q-pa-none" > <q-card-section class="q-pa-none" >
<q-separator></q-separator> <q-separator></q-separator>
<div class="row q-pa-md"> <div class="column q-ma-md q-pb-lg"
<div class="col-4"> style="height: 350px">
<q-btn outline color="primary" size="md" style="height: 90px; width:90%" <div class="col q-pb-md">
>OrderID:87h87h<br/>KJBIBYBUYBUF90898....</q-btn <q-select v-model="customerKey" style="width: 80%;"
> :options="customerKeys" label="Customers" @input="getMessages(customerKey)"></q-select>
<q-btn outline color="primary" size="md" style="height: 90px; width:90%"
>OrderID:NIUHB7<br/>79867KJGJHGVFYFV....</q-btn
>
</div> </div>
<div class="col-8"> <div class="col-8 q-px-md">
<div style="height: 350px"> <div v-for="message in customerMessages">
<q-chat-message <q-chat-message
:text="['I have not received my Welsh Cakes']" v-if="message[0] == 'out'"
sent :text="[message[1]]"
></q-chat-message> sent
<q-chat-message ></q-chat-message>
:text="['Yep, its Brexit. They are stuck in customs. We will have to wait it out. I can offer a full refund?']" <q-chat-message
></q-chat-message> v-else
:text="[message[1]]"
></q-chat-message>
</div>
</div>
<div class="col on-right " style="width: 90%">
<q-input >
<template v-slot:after>
<q-btn round dense flat icon="send" />
</template>
</q-input>
</div> </div>
<q-input ><template v-slot:after>
<q-btn round dense flat icon="send" />
</template></q-input>
</div> </div>
</q-card-section> </q-card-section>
</q-card> </q-card>