119 lines
4.9 KiB
PHP
119 lines
4.9 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$db = db();
|
|
$stmt = $db->prepare("SELECT id, document_name FROM required_documents WHERE applies_to = 'restaurant'");
|
|
$stmt->execute();
|
|
$required_documents = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
include 'header.php';
|
|
?>
|
|
|
|
<main>
|
|
<div class="auth-container">
|
|
<h1>Create a Restaurant Account</h1>
|
|
<p>Sign up to list your restaurant on our platform.</p>
|
|
<form action="restaurant_signup_process.php" method="POST" enctype="multipart/form-data">
|
|
<div class="form-group">
|
|
<label for="name">Your Name</label>
|
|
<input type="text" id="name" name="name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" required>
|
|
</div>
|
|
<hr>
|
|
<h3>Restaurant Details</h3>
|
|
<div class="form-group">
|
|
<label for="restaurant_name">Restaurant Name</label>
|
|
<input type="text" id="restaurant_name" name="restaurant_name" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="restaurant_address">Restaurant Address</label>
|
|
<input type="text" id="restaurant_address" name="restaurant_address" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="restaurant_phone">Restaurant Phone</label>
|
|
<input type="text" id="restaurant_phone" name="restaurant_phone" required>
|
|
</div>
|
|
|
|
<hr>
|
|
<h4>Required Documents</h4>
|
|
<?php foreach ($required_documents as $doc): ?>
|
|
<div class="form-group">
|
|
<label for="doc_<?php echo htmlspecialchars($doc['id']); ?>"><?php echo htmlspecialchars($doc['document_name']); ?></label>
|
|
<input type="file" id="doc_<?php echo htmlspecialchars($doc['id']); ?>" name="documents[<?php echo htmlspecialchars($doc['id']); ?>]" class="form-control" required>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
|
|
<hr>
|
|
<h4>Set Your Restaurant's Location</h4>
|
|
<p><small>Pin your location on the map to help drivers find you.</small></p>
|
|
|
|
<div class="form-group">
|
|
<label for="location_label">Location Label</label>
|
|
<input type="text" class="form-control" id="location_label" name="location_label" placeholder="e.g., 'Across from the post office'">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="location_notes">Location Notes</label>
|
|
<textarea class="form-control" id="location_notes" name="location_notes" rows="2" placeholder="e.g., 'Entrance is on the side street'"></textarea>
|
|
</div>
|
|
|
|
<div id='map' style='width: 100%; height: 300px; margin-bottom: 15px;'></div>
|
|
<input type="hidden" id="lat" name="lat">
|
|
<input type="hidden" id="lng" name="lng">
|
|
|
|
<button type="submit" class="btn-submit">Sign Up</button>
|
|
</form>
|
|
<script src='https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.js'></script>
|
|
<link href='https://api.mapbox.com/mapbox-gl-js/v2.9.1/mapbox-gl.css' rel='stylesheet' />
|
|
<script>
|
|
mapboxgl.accessToken = '<?php require_once 'includes/api_keys.php'; echo MAPBOX_API_KEY; ?>';
|
|
const lat_input = document.getElementById('lat');
|
|
const lng_input = document.getElementById('lng');
|
|
|
|
const map = new mapboxgl.Map({
|
|
container: 'map',
|
|
style: 'mapbox://styles/mapbox/streets-v11',
|
|
center: [171.380, 7.135], // Default to Majuro
|
|
zoom: 12
|
|
});
|
|
|
|
let marker = new mapboxgl.Marker({
|
|
draggable: true
|
|
})
|
|
.setLngLat([171.380, 7.135])
|
|
.addTo(map);
|
|
|
|
function onDragEnd() {
|
|
const lngLat = marker.getLngLat();
|
|
lat_input.value = lngLat.lat;
|
|
lng_input.value = lngLat.lng;
|
|
}
|
|
|
|
marker.on('dragend', onDragEnd);
|
|
|
|
map.on('click', (e) => {
|
|
const coordinates = e.lngLat;
|
|
lat_input.value = coordinates.lat;
|
|
lng_input.value = coordinates.lng;
|
|
marker.setLngLat(coordinates).addTo(map);
|
|
});
|
|
|
|
// Set initial values
|
|
lat_input.value = 7.135;
|
|
lng_input.value = 171.380;
|
|
</script>
|
|
<div class="form-footer">
|
|
<p>Already have an account? <a href="restaurant_login.php">Log in</a></p>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<?php include 'footer.php'; ?>
|