50 lines
1.5 KiB
HTML
50 lines
1.5 KiB
HTML
{% extends 'base.html' %}
|
|
{% from "macros.html" import render_field, render_included_field %}
|
|
|
|
{% block title %}Create or Edit Tenant{% endblock %}
|
|
|
|
{% block content_title %}Create or Edit Tenant{% endblock %}
|
|
{% block content_description %}Create or Edit Tenant{% endblock %}
|
|
|
|
{% block content %}
|
|
<form method="post">
|
|
{{ form.hidden_tag() }}
|
|
{% set disabled_fields = [] %}
|
|
{% set exclude_fields = [] %}
|
|
{% for field in form %}
|
|
{{ render_field(field, disabled_fields, exclude_fields) }}
|
|
{% endfor %}
|
|
|
|
<button type="submit" class="btn btn-primary">Save Tenant</button>
|
|
</form>
|
|
{% endblock %}
|
|
|
|
|
|
{% block content_footer %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
// JavaScript to detect user's timezone
|
|
document.addEventListener('DOMContentLoaded', (event) => {
|
|
// Detect timezone
|
|
const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
|
|
// Send timezone to the server via a POST request
|
|
fetch('/set_user_timezone', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ timezone: userTimezone })
|
|
}).then(response => {
|
|
if (response.ok) {
|
|
console.log('Timezone sent to server successfully');
|
|
} else {
|
|
console.error('Failed to send timezone to server');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %} |