Fixed models

This commit is contained in:
ben 2022-10-26 13:15:50 +01:00
parent 1bfa28da19
commit 937654e4f7
3 changed files with 124 additions and 48 deletions

View File

@ -36,7 +36,7 @@ async def create_lnurldevice(
pin3, pin3,
profit4, profit4,
amount4, amount4,
pin4, pin4
) )
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", """,

View File

@ -19,18 +19,18 @@ class createLnurldevice(BaseModel):
profit: float profit: float
amount: int amount: int
pin: int pin: int
profit1: float profit1: float = 0
amount1: int amount1: int = 0
pin1: int pin1: int = 0
profit2: float profit2: float = 0
amount2: int amount2: int = 0
pin2: int pin2: int = 0
profit3: float profit3: float = 0
amount3: int amount3: int = 0
pin3: int pin3: int = 0
profit4: float profit4: float = 0
amount4: int amount4: int = 0
pin4: int pin4: int = 0
class lnurldevices(BaseModel): class lnurldevices(BaseModel):

View File

@ -105,7 +105,7 @@
@click="openQrCodeDialog(props.row.id)" @click="openQrCodeDialog(props.row.id)"
><q-tooltip v-if="protocol == 'http:'"> ><q-tooltip v-if="protocol == 'http:'">
LNURLs only work over HTTPS </q-tooltip LNURLs only work over HTTPS </q-tooltip
><q-tooltip v-else> view LNURL </q-tooltip></q-btn ><q-tooltip v-else> view LNURLS </q-tooltip></q-btn
> >
</q-td> </q-td>
<q-td <q-td
@ -148,6 +148,42 @@
style="width: 700px; max-width: 80vw" style="width: 700px; max-width: 80vw"
class="q-pa-lg q-pt-xl lnbits__dialog-card" class="q-pa-lg q-pt-xl lnbits__dialog-card"
> >
<q-tabs
v-model="tab"
dense
class="text-grey"
active-color="primary"
indicator-color="primary"
align="justify"
narrow-indicator
>
<q-tab name="mails" label="Mails" />
<q-tab name="alarms" label="Alarms" />
<q-tab name="movies" label="Movies" />
</q-tabs>
<q-separator />
<q-tab-panels v-model="tab" animated>
<q-tab-panel name="mails">
<div class="text-h6">Mails</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
</q-tab-panel>
<q-tab-panel name="alarms">
<div class="text-h6">Alarms</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
</q-tab-panel>
<q-tab-panel name="movies">
<div class="text-h6">Movies</div>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
</q-tab-panel>
</q-tab-panels>
<div class="text-h6">LNURLDevice device string</div> <div class="text-h6">LNURLDevice device string</div>
<center> <center>
<q-btn <q-btn
@ -230,19 +266,15 @@
label="Profit margin (% added to invoices/deducted from faucets)" label="Profit margin (% added to invoices/deducted from faucets)"
></q-input> ></q-input>
<div v-else> <div v-else>
<p>Switches</p>
<q-toggle v-model="switch1" color="primary" label="1"></q-toggle>
<q-toggle v-model="switch2" color="primary" label="2"></q-toggle> <q-btn unelevated class="q-mb-lg" round size="sm" icon="add" @click="addSwitch" v-model="switches" color="primary"></q-btn>
<q-btn unelevated class="q-mb-lg" round size="sm" icon="remove" @click="removeSwitch" v-model="switches" color="primary"></q-btn>
<q-toggle v-model="switch3" color="primary" label="3"></q-toggle>
<q-toggle v-model="switch4" color="primary" label="4"></q-toggle> <div v-if="switches >= 0">
<div class="row">
<q-toggle v-model="switch5" color="primary" label="5"></q-toggle> <div class="col" >
<q-input
<div v-if="switch1">
<q-input
ref="setAmount" ref="setAmount"
filled filled
dense dense
@ -255,7 +287,9 @@
:step="'0.01'" :step="'0.01'"
value="0.00" value="0.00"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.amount" v-model.trim="formDialoglnurldevice.data.amount"
@ -263,16 +297,22 @@
value="1000" value="1000"
label="milesecs to turn Switch on for (1sec = 1000ms)" label="milesecs to turn Switch on for (1sec = 1000ms)"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.pin" v-model.trim="formDialoglnurldevice.data.pin"
type="number" type="number"
label="GPIO to turn on" label="GPIO to turn on"
></q-input> ></q-input>
</div>
</div>
</div> </div>
<div v-if="switch2"> <div v-if="switches >= 1">
<q-input <div class="row">
<div class="col" >
<q-input
ref="setAmount" ref="setAmount"
filled filled
dense dense
@ -285,7 +325,9 @@
:step="'0.01'" :step="'0.01'"
value="0.00" value="0.00"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.amount1" v-model.trim="formDialoglnurldevice.data.amount1"
@ -293,16 +335,23 @@
value="1000" value="1000"
label="milesecs to turn Switch on for (1sec = 1000ms)" label="milesecs to turn Switch on for (1sec = 1000ms)"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.pin1" v-model.trim="formDialoglnurldevice.data.pin1"
type="number" type="number"
label="GPIO to turn on" label="GPIO to turn on"
></q-input> ></q-input>
</div>
</div>
</div> </div>
<div v-if="switch3">
<q-input <div v-if="switches >= 2">
<div class="row">
<div class="col" >
<q-input
ref="setAmount" ref="setAmount"
filled filled
dense dense
@ -315,7 +364,9 @@
:step="'0.01'" :step="'0.01'"
value="0.00" value="0.00"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.amount2" v-model.trim="formDialoglnurldevice.data.amount2"
@ -323,16 +374,23 @@
value="1000" value="1000"
label="milesecs to turn Switch on for (1sec = 1000ms)" label="milesecs to turn Switch on for (1sec = 1000ms)"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.pin2" v-model.trim="formDialoglnurldevice.data.pin2"
type="number" type="number"
label="GPIO to turn on" label="GPIO to turn on"
></q-input> ></q-input>
</div>
</div>
</div> </div>
<div v-if="switch4">
<q-input <div v-if="switches >= 3">
<div class="row">
<div class="col" >
<q-input
ref="setAmount" ref="setAmount"
filled filled
dense dense
@ -345,7 +403,9 @@
:step="'0.01'" :step="'0.01'"
value="0.00" value="0.00"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.amount3" v-model.trim="formDialoglnurldevice.data.amount3"
@ -353,16 +413,23 @@
value="1000" value="1000"
label="milesecs to turn Switch on for (1sec = 1000ms)" label="milesecs to turn Switch on for (1sec = 1000ms)"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.pin3" v-model.trim="formDialoglnurldevice.data.pin3"
type="number" type="number"
label="GPIO to turn on" label="GPIO to turn on"
></q-input> ></q-input>
</div>
</div>
</div> </div>
<div v-if="switch4">
<q-input <div v-if="switches >= 4">
<div class="row">
<div class="col" >
<q-input
ref="setAmount" ref="setAmount"
filled filled
dense dense
@ -375,7 +442,9 @@
:step="'0.01'" :step="'0.01'"
value="0.00" value="0.00"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.amount4" v-model.trim="formDialoglnurldevice.data.amount4"
@ -383,16 +452,19 @@
value="1000" value="1000"
label="milesecs to turn Switch on for (1sec = 1000ms)" label="milesecs to turn Switch on for (1sec = 1000ms)"
></q-input> ></q-input>
<q-input </div>
<div class="col q-ml-md">
<q-input
filled filled
dense dense
v-model.trim="formDialoglnurldevice.data.pin4" v-model.trim="formDialoglnurldevice.data.pin4"
type="number" type="number"
label="GPIO to turn on" label="GPIO to turn on"
></q-input> ></q-input>
</div>
</div>
</div> </div>
</div> </div>
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<q-btn <q-btn
v-if="formDialoglnurldevice.data.id" v-if="formDialoglnurldevice.data.id"
@ -478,11 +550,7 @@
wslocation: window.location.hostname, wslocation: window.location.hostname,
filter: '', filter: '',
currency: 'USD', currency: 'USD',
switch1: false, switches: 0,
switch2: false,
switch3: false,
switch4: false,
switch5: false,
lnurldeviceLinks: [], lnurldeviceLinks: [],
lnurldeviceLinksObj: [], lnurldeviceLinksObj: [],
devices: [ devices: [
@ -587,6 +655,14 @@
window.location.protocol + '//' + window.location.host window.location.protocol + '//' + window.location.host
this.qrCodeDialog.show = true this.qrCodeDialog.show = true
}, },
addSwitch: function () {
var self = this
self.switches = self.switches + 1
},
removeSwitch: function () {
var self = this
self.switches = self.switches - 1
},
cancellnurldevice: function (data) { cancellnurldevice: function (data) {
var self = this var self = this
self.formDialoglnurldevice.show = false self.formDialoglnurldevice.show = false