feature/basic functionality added
This commit is contained in:
1 parent
4f73959cfb
commit
8166245ab1
3 files changed
+21
-2
No files matched your search
@@ -5,6 +5,7 @@ function getLocation() {
|
||||
}
|
||||
|
||||
function update(data) {
|
||||
if (data.data.message != "error") {
|
||||
document.getElementById("loading").style = "display: none";
|
||||
document.getElementById("currencyExchange").style = "display: flex";
|
||||
|
||||
@@ -37,6 +38,14 @@ function update(data) {
|
||||
|
||||
dropdown.appendChild(listItem);
|
||||
});
|
||||
} else {
|
||||
document.getElementById("loading").style = "display: none";
|
||||
document.getElementById("exFrom").style = "display: none";
|
||||
document.getElementById("dropdown-country-button").style = "display: none";
|
||||
document.getElementById("currencyExchange").style = "display: flex";
|
||||
document.getElementById("exchange").innerHTML = "Country not supported";
|
||||
document.getElementById("exchange").className = "block rounded-lg text-center p-2.5 w-50 z-20 text-sm border bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:border-blue-500";
|
||||
}
|
||||
}
|
||||
|
||||
function switchButton(clickedButton) {
|
||||
|
||||
@@ -544,6 +544,12 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
|
||||
country = data.results[0].formatted_address;
|
||||
let results = await getRates(country);
|
||||
|
||||
if (!results.exRates) {
|
||||
req.session.geoData = {
|
||||
message: "error"
|
||||
}
|
||||
} else {
|
||||
req.session.geoData = {
|
||||
country: results.abbreviation,
|
||||
toCurrencyRates: results.exRates,
|
||||
@@ -551,6 +557,8 @@ module.exports = (middleware, users, plans, assets) => {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return res.status(status.Ok).send({ data: req.session.geoData });
|
||||
})
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
</div>
|
||||
|
||||
<div style="display: none;" class="flex items-center" id="currencyExchange">
|
||||
<div class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
||||
<div id="exFrom" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
||||
<img src="" id="yourFlag" class="h-4 w-4 me-2" alt="">
|
||||
<p id="flagTag"></p>
|
||||
</div>
|
||||
<div class="relative w-full">
|
||||
<p id="exchange" class="block text-center p-2.5 w-40 z-20 text-sm text-gray-900 bg-gray-50 border-s-0 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500">
|
||||
<p id="exchange" class="block text-center p-2.5 w-40 z-20 text-sm border bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:border-blue-500">
|
||||
</p>
|
||||
</div>
|
||||
<button id="dropdown-country-button" value="" data-dropdown-toggle="dropdown-country" class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-e-lg hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600" type="button">
|
||||
@@ -38,6 +38,8 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% } else if(geoData.message == "error") { %>
|
||||
<p>error</p>
|
||||
<% } else { %>
|
||||
<div class="flex items-center">
|
||||
<div class="shrink-0 z-10 inline-flex items-center py-2.5 px-4 text-sm font-medium text-center text-gray-900 bg-gray-100 border border-gray-300 rounded-s-lg focus:ring-4 focus:outline-none focus:ring-gray-100 dark:bg-gray-700 dark:focus:ring-gray-700 dark:text-white dark:border-gray-600">
|
||||
|
||||
Reference in new issue
Block a user