Added option to change UPI ID for cashier

This commit is contained in:
sairaj mote 2022-03-11 16:44:12 +05:30
parent afebd5672c
commit 3b538ac947
2 changed files with 22 additions and 2 deletions

View File

@ -20,7 +20,7 @@
//Required for blockchain API operators //Required for blockchain API operators
apiURL: { apiURL: {
FLO: ['https://livenet.flocha.in/', 'https://flosight.duckdns.org/'], FLO: ['https://flosight.duckdns.org/', 'https://livenet.flocha.in/'],
FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/'] FLO_TEST: ['https://testnet-flosight.duckdns.org/', 'https://testnet.flocha.in/']
}, },
adminID: "FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf", adminID: "FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf",
@ -203,7 +203,7 @@
</section> </section>
</tab-panels> </tab-panels>
</section> </section>
<section id="settings" class="page hide gap-1-5"> <section id="settings" class="page hide gap-2">
<h4>Settings</h4> <h4>Settings</h4>
<section class="grid gap-1"> <section class="grid gap-1">
<div class="grid"> <div class="grid">
@ -212,6 +212,17 @@
</div> </div>
<sm-button class="danger justify-self-start" onclick="signOut()">Sign out</sm-button> <sm-button class="danger justify-self-start" onclick="signOut()">Sign out</sm-button>
</section> </section>
<section class="admin-element grid gap-1">
<h4>Change UPI ID</h4>
<sm-form style="width: min(100%,24rem);">
<sm-input id="upi_id" placeholder="UPI ID" pattern="[a-zA-Z0-9_]{3,}@[a-zA-Z]{3,}"
error-text="Invalid UPI ID" animate required></sm-input>
<button class="button button--primary cta justify-self-start" type="submit"
onclick="changeUpi()">
Change
</button>
</sm-form>
</section>
</section> </section>
</section> </section>
<nav id="main_navbar"> <nav id="main_navbar">

View File

@ -285,6 +285,15 @@ function executeUserAction() {
} }
} }
function changeUpi() {
const upiID = getRef('upi_id').value.trim()
Cashier.updateUPI(upiID).then(() => {
notify('UPI ID updated successfully', 'success')
}).catch(err => {
notify(err, 'error')
})
}
function signOut() { function signOut() {
getConfirmation('Sign out?', 'You are about to sign out of the app, continue?', 'Stay', 'Leave') getConfirmation('Sign out?', 'You are about to sign out of the app, continue?', 'Stay', 'Leave')
.then(async (res) => { .then(async (res) => {