Hi Team,
I am trying to develop a Client Dashboard for my site where it will show all orders (there are multiple order for each user). I need a button to be enabled if payment status for that particular order is True. While i am trying add the condition in onReady function but it is showing either Enabled or Disabled for all the orders of that user. Please check the code below and help me to sove this. Thanks in advance.
import wixUsers from 'wix-users';
import wixData from 'wix-data';
$w.onReady(async function () {
let userEmail = await wixUsers.currentUser.getEmail()
$w("#dataset1").onReady(() => {
let items = $w("#dataset1").getItems()
$w("#dataset1").setFilter(wixData.filter()
.eq("clientEmail", userEmail)
)
console.log('status'+items["downloadStatus"])
if (items["downloadStatus"]) {
console.log("in true block")
$w('#button4').enable()
}
else{
console.log("in else block")
$w('#button4').disable()
}
});
}
);
I understand what you´re trying to do. One question before we can offer a solution: how do you display it? Inside a repeater, with a button per row? Something else? Could you give us an idea plus a screen shot of what it is supposed to look like?
Thank you Giri…
Yes I am using a repeater with button per row. With my previously posted logic it is enabling all the button if one status is true for that user. I wan it to be specific to each order.
Hi Giri,
Please let me know if you need any further details.
Thank you.
Hi, sorry about a late reply, but I had to check with other Masters what our position on this is. The thing is, the way you approach the solution is highly insecure: you are doing financial stuff from the front end, which is open to abuse. We agreed that we do not help people writing insecure code, but help them getting towards a secure solution. This will take some effort from my part, but also from you. This means that I will guide you, give you hints, give you some ideas and example code, but it will take you to study some articles and other documentation. So my question is: are you willing to spend some time into learning how to CODE securely (because we are going to code, we are going to leave all the datasets and front end data-binding behind us)?