Hi,
I would like to to know how can I make a visitor check-in and can be checkout using contact number. Kindly help me in a simple way.
Thanks
Hi,
I would like to to know how can I make a visitor check-in and can be checkout using contact number. Kindly help me in a simple way.
Thanks
For your “Corona-Check-in” you normaly do not need any coding.
Just connect your database with the help of a dataset with your Check-In-form and button.
Set your dataset to read&write. You will find the right options in the wix-editors property-panel.
For your check-out you probably will need some code-lines.
Hi Anyone can help me to code this “Corona Check In/Out”. I would like the visitor to check-in first and after within the day they can checkout using there contact number.
Here you can see a check-in without coding…
https://www.media-junkie.com/check-in-out
All you have now to do is to code the check-out.
How should the check-out work ?
You will need something like this… (this is just a part of what you will need)
import wixData from 'wix-data';
$w.onReady(function(){
$w('#CheckoutButtonIdHere').onClick(()=>{
let contactNumber = $w('#CheckOutContactInputFieldID').value
wixData.query("DATABASE-ID-HERE")
.eq("DATAFIELD-HERE", contactNumber)
.find()
.then( (results) => {
if(results.items.length>0){let firstItem = results.items[0];
console.log(results);}
else { }
}).catch( (err) => {let errorMsg = err;});
});
});
Hi Sir Velo-Ninja
I have follow the code that you give but it created a new line only. I wish it could update the previous record and update the check out date & time.
or create a new line but get the last record details and update with check out value.
import wixData from ‘wix-data’ ;
$w . onReady ( function (){
$w ( ‘#button1’ ). onClick (()=>{
let contactNumber = $w ( ‘#input1’ ). value //contactNumber is fieldKey
wixData . query ( “Contactless” ) //Name of Collection //dataset1
. eq ( “Contact Number” , contactNumber ) // Contact Number is Field Name
. find ()
. then ( ( results ) => {
if ( results . items . length > 0 ){ let firstItem = results . items [ 0 ];
console . log ( results );}
else { }
}). catch ( ( err ) => { let errorMsg = err ;});
});
})
If you want to have a good working solution, than you will have to code both → check-in & check-out function. Then it will work like you want.
You have two options…
Everything you need, can be found in the Velo-API…
especialy here…for dataset…
https://www.wix.com/velo/reference/wix-dataset
…and here for wix-data…
https://www.wix.com/velo/reference/wix-data
Follow the given examples and try to modify them to your own needs.
Do everything step by step.
If you still feel that you are not able to get it to work, you can contact me on my profile.