This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go to a folder where you want to create your project | |
// Then enter the following command: | |
monaca create projectname | |
// Choose JavaScript from the list and press Enter | |
// After that, choose the Framework7 Core Tab View from the list and press Enter again | |
// If the installation process is finished, your project is ready to go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#panel-header { | |
text-align: left !important; | |
width: 100%; | |
} | |
.card-bg { | |
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add new items to the Shop List | |
function addNewShopToFirebase(jsonObject) { | |
db.collection('shops').add({ | |
'name': jsonObject.name, | |
'telephone': jsonObject.telephone, | |
'address': jsonObject.address, | |
'location': jsonObject.location | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gives back the current location & adds a marker to the map | |
// onSuccess callback accepts a Position object, which contains the current coordinates | |
// onError callback receives a PositionError object | |
function currentLocation(map) { | |
navigator.geolocation.getCurrentPosition(function (position) { | |
onSuccess(map, position); | |
document.getElementById("shop-location").value = position.coords.latitude + " " + position.coords.longitude; | |
}, onError); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Set options for camera | |
function setOptions(srcType) { | |
const options = { | |
quality: 50, | |
destinationType: Camera.DestinationType.DATA_URL, | |
sourceType: srcType, | |
encodingType: Camera.EncodingType.JPEG, | |
mediaType: Camera.MediaType.PICTURE, | |
allowEdit: false, | |
correctOrientation: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scanBarcode() { | |
cordova.plugins.barcodeScanner.scan( | |
function (result) { | |
document.getElementById("product-code").value = result.text; | |
getProductInfoWithYahoo(result.text); | |
}, | |
function (error) { | |
alert("Scanning failed: " + error); | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let onSuccess = function (map, p) { | |
L.marker([p.coords.latitude, p.coords.longitude]) | |
.addTo(map) | |
.bindPopup("Your current location.") | |
.openPopup(); | |
map.setView([p.coords.latitude, p.coords.longitude], 14); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let map = null; | |
//For the edit-shop page, the map needs a different name | |
if (!map) map = L.map('newShopMap', {doubleClickZoom: false}).locate({setView: true, maxZoom: 12}); | |
map.setView([35.40, 139.50], 12); | |
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | |
}).addTo(map); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Move on the map and add marker to a chosen position | |
function moveOnTheMap(map, chosenPositionMarker) { | |
map.on("click", function (e) { | |
lat = e.latlng.lat; | |
lon = e.latlng.lng; | |
document.getElementById("shop-location").value = lat + " " + lon; | |
let redIcon = new L.Icon({ | |
iconUrl: "https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png", | |
shadowUrl: "https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.7/images/marker-shadow.png", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Uploading picture | |
function uploadImageToFirebaseStorage(elementName, fileName, img, edit) { | |
// // Create a reference for the storage, the folder and the filename | |
const storageRef = firebase.storage().ref('products/' + fileName); | |
// Upload the file and metadata | |
const uploadTask = storageRef.putString(img, 'base64'); | |
// Register three observers: | |
// 1. 'state_changed' observer, called any time the state changes | |
// 2. Error observer, called on failure |
OlderNewer