diff --git a/server/list.php b/server/list.php index 2862861..a5ac1f4 100644 --- a/server/list.php +++ b/server/list.php @@ -1,5 +1,10 @@ t("Availability List", false), 'token_list' => $_SESSION['token_list']]); +if($JSless){ + $query_results = $db->select("SELECT * FROM `".DB_PREFIX."_profiles` ORDER BY available DESC, chief DESC, services ASC, availability_minutes ASC, name ASC"); +} else { + $query_results = null; +} +loadtemplate('list.html', ['title' => t("Availability List", false), 'token_list' => $_SESSION['token_list'], 'query_results' => $query_results]); bdump($_SESSION); diff --git a/server/log.php b/server/log.php index 44c0ed8..9bde2c6 100644 --- a/server/log.php +++ b/server/log.php @@ -1,3 +1,8 @@ t('Logs', false)]); +if($JSless){ + $query_results = $db->select("SELECT * FROM `".DB_PREFIX."_log` ORDER BY `timestamp` DESC"); +} else { + $query_results = null; +} +loadtemplate('log.html', ['title' => t('Logs', false), 'query_results' => $query_results]); diff --git a/server/resources/src/main.css b/server/resources/src/main.css index f0ad2ae..c3ed671 100644 --- a/server/resources/src/main.css +++ b/server/resources/src/main.css @@ -1,3 +1,7 @@ +#jsDisabledNotice { + display: none; +} + body:not(table) { max-width: 100%; overflow-x: hidden; diff --git a/server/resources/src/main.js b/server/resources/src/main.js index 8aa8fc9..9866c68 100644 --- a/server/resources/src/main.js +++ b/server/resources/src/main.js @@ -152,6 +152,9 @@ var fillTableLoaded = undefined; window.addEventListener("securitypolicyviolation", console.error.bind(console)); $(function() { + $("#topNavBar").show(); + $("#content").show(); + $("#footer").show(); $("#menuButton").on("click", function() { const topNavBar = document.getElementById("topNavBar"); if (topNavBar.className === "topnav") { diff --git a/server/services.php b/server/services.php index 6b2bb63..49adf41 100644 --- a/server/services.php +++ b/server/services.php @@ -1,4 +1,9 @@ t('Services', false)]); +if($JSless){ + $query_results = $db->select("SELECT * FROM `".DB_PREFIX."_services` ORDER BY date DESC, beginning DESC"); +} else { + $query_results = null; +} +loadtemplate('services.html', ['title' => t('Services', false), 'query_results' => $query_results]); ?> diff --git a/server/templates/JSless/base.html b/server/templates/JSless/base.html new file mode 100644 index 0000000..efed26c --- /dev/null +++ b/server/templates/JSless/base.html @@ -0,0 +1,106 @@ +{% apply minimize %} + + + + {% block head %} + {{ title }} - ALLERTA sistema gestionale {{ owner }} + + + + + {% endblock %} + + +{% if show_menu %} + {% block menu %} + {# Menu #} + +
+ {{ 'Availability List'|t }} + {{ 'Services'|t }} + {{ 'Trainings'|t }} + {{ 'Logs'|t }} + {{ 'Hi, %s.'|t|format(user.name) }} {{ 'Logout'|t }} +
+ {# /Menu #} + {% endblock %} +{% endif %} + + {# Content #} +
+{% block pjax_content %} +{% if message %} + +{% endif %} +{% block content %}{% endblock %} +{% endblock %} +
+ {# /Content #} +{% if show_footer %} + {% block footer %} + {# Footer #} + + + {# /Footer #} + {% endblock %} +{% endif %} + + +{% endapply %} \ No newline at end of file diff --git a/server/templates/JSless/edit_service.html b/server/templates/JSless/edit_service.html new file mode 100644 index 0000000..5ff9d97 --- /dev/null +++ b/server/templates/JSless/edit_service.html @@ -0,0 +1,212 @@ +{% extends "base.html" %} + +{% block menu %} +{% endblock %} + +{% block content %} +TODO + {% if service.modalità == "edit" or service.modalità == "add" %} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ {% for user in service.crew %} + {% if user.chief == 1 and not user.hidden %} +
+ + +
+ {% endif %} + {% endfor %} +
+ +
+ +
+ {% for user in service.crew %} + {% if user.driver == 1 and not user.hidden %} +
+ + +
+ {% endif %} + {% endfor %} +
+
+ +
+ {% for user in service.crew %} + {% if not user.hidden %} +
+ + +
+ {% endif %} + {% endfor %} +
+ {% if option('use_location_picker') %} + +
+ + + {{ script('maps.js', 'allertaJS.maps.loadMap();') }} + {% else %} +
+ + +
+
+ {% endif %} +
+
+ +
+
+
+ +
+ +
+
+ + + + +
+
+ + {% endif %} + {% if service.modalità == "delete" %} +
+

{{ 'Are you sure you want to delete the service?'|t }}

+
+ + + + +
+ +
+ {% endif %} + +{% block footer %} +{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/edit_training.html b/server/templates/JSless/edit_training.html new file mode 100644 index 0000000..44a72b3 --- /dev/null +++ b/server/templates/JSless/edit_training.html @@ -0,0 +1,136 @@ +{% extends "base.html" %} + +{% block menu %} +{% endblock %} + +{% block content %} +TODO + {% if training.modalità == "edit" or training.modalità == "add" %} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ {% for user in training.crew %} + {% if not user.hidden %} +
+ + +
+ {% endif %} + {% endfor %} +
+ +
+ +
+ {% for user in training.crew %} + {% if not user.hidden %} +
+ + +
+ {% endif %} + {% endfor %} +
+ {% if option('use_location_picker') %} + +
+ + + {{ script('maps.js', 'allertaJS.maps.loadMap();') }} + {% else %} +
+ + +
+
+ {% endif %} +
+
+ +
+
+ + + + +
+
+ + {% endif %} + {% if training.modalità == "delete" %} +
+

{{ 'Are you sure you want to delete the training?'|t }}

+
+ + + + +
+ +
+ {% endif %} + +{% block footer %} +{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/edit_user.html b/server/templates/JSless/edit_user.html new file mode 100644 index 0000000..ad03706 --- /dev/null +++ b/server/templates/JSless/edit_user.html @@ -0,0 +1,84 @@ +{% extends "base.html" %} + +{% block menu %} +{% endblock %} + +{% block content %} +TODO + {% if modalità == "edit" or modalità == "add" %} +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+ + + +
+
+ {% endif %} + {% if modalità == "delete" %} +
+

{{ 'Are you sure you want to delete the user?'|t }}

+
+ + + + +
+ +
+ {% endif %} + +{% block footer %} +{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/index.html b/server/templates/JSless/index.html new file mode 100644 index 0000000..c42185e --- /dev/null +++ b/server/templates/JSless/index.html @@ -0,0 +1,41 @@ +{% extends "base.html" %} + +{% block menu %} +{% endblock %} + +{% block content %} +
+
+ VVF

+
+ +
+
+ +
+ {% if option('force_remember_cookie') %} + + {% else %} +
+
+ + +
+
+ {% endif %} + +
+ {% if error %} + + {% endif %} +
+

+ +{% block footer %} +{% endblock %} + +{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/list.html b/server/templates/JSless/list.html new file mode 100644 index 0000000..27f884b --- /dev/null +++ b/server/templates/JSless/list.html @@ -0,0 +1,59 @@ +{% extends "base.html" %} + +{% block content %} +
+
+

{{ 'Are you available in case of alert?'|t }}

+ + +
+
+
+VVF +
+
+ + + + + {% if user.full_viewer %} + + + + + + {# TODO: fix "Other" page #} + {% endif %} + +{% for row in query_results %} + + + + {% if user.full_viewer %} + + {% if row.phone_number %} + + {% else %} + + {% endif %} + {% if row.phone_number %} + + {% else %} + + {% endif %} + + + {# TODO: fix "Other" page #} + {% endif %} + +{% endfor %} +
{{ 'Name'|t }}{{ 'Available'|t }}{{ 'Driver'|t }}{{ 'Call'|t }}{{ 'Write'|t }}{{ 'Services'|t }}{{ 'Availability Minutes'|t }}{{ 'Other'|t }}
{{ username(row.id) }}{{ yesOrNo(row.available) }}{{ yesOrNo(row.driver) }}ChiamaManda un messaggio{{ row.services }}{{ row.availability_minutes }}{{ 'Other'|t }}
+ +

+

+ +

+
+
+{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/log.html b/server/templates/JSless/log.html new file mode 100644 index 0000000..72f4e94 --- /dev/null +++ b/server/templates/JSless/log.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} + +{% block content %} +
+VVF +
+ + + + + + + +{% for row in query_results %} + + + + + + +{% endfor %} +
{{ 'Action'|t }}{{ 'Interested'|t }}{{ 'Made by'|t }}{{ 'Datetime'|t }}
{{ row.action }}{{ username(row.changed) }}{{ username(row.editor) }}{{ row.timestamp }}
+
+
+ {% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/offline.html b/server/templates/JSless/offline.html new file mode 100644 index 0000000..bb2d2d8 --- /dev/null +++ b/server/templates/JSless/offline.html @@ -0,0 +1 @@ +{% extends "list.html" %} \ No newline at end of file diff --git a/server/templates/JSless/services.html b/server/templates/JSless/services.html new file mode 100644 index 0000000..d8692de --- /dev/null +++ b/server/templates/JSless/services.html @@ -0,0 +1,66 @@ +{% extends "base.html" %} + +{% block content %} +
+VVF +
+

+ +

+
+ + + + + + + + + + + + + {% if option('service_edit') %} + + {% endif %} + {% if option('service_remove') %} + + {% endif %} + +{% for row in query_results %} + + + + + + + + + + + + {% if option('service_edit') %} + + {% endif %} + {% if option('service_remove') %} + + {% endif %} + +{% endfor %} +
{{ 'Date'|t }}{{ 'code'|t|capitalize }}{{ 'Start time'|t }}{{ 'End time'|t }}{{ 'Chief'|t }}{{ 'Drivers'|t }}{{ 'Crew'|t }}{{ 'Place'|t }}{{ 'Notes'|t }}{{ 'Type'|t }}{{ 'Edit'|t }}{{ 'Remove'|t }}
{{ row.date }}{{ row.code }}{{ row.beginning }}{{ row.end }}{{ username(row.chief) }}{{ username_list(row.drivers) }}{{ username_list(row.crew) }} + {% if "#" in row.place %} + {% set mapImageID = row.place|split('#')[1] %} + {% set place = row.place|split('#')[0] %} + {% set place_lat = place|split(';')[0] %} + {% set place_lng = place|split(';')[1] %} +
+ {% endif %} + Apri la mappa in Google Maps
+ Apri la mappa in OpenStreetMap
+ Lat: {{ place_lat }}
+ Lng: {{ place_lng }}
+
{{ row.notes }}{{ row.type }}ModificaRimuovi
+
+
+{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/trainings.html b/server/templates/JSless/trainings.html new file mode 100644 index 0000000..366a235 --- /dev/null +++ b/server/templates/JSless/trainings.html @@ -0,0 +1,62 @@ +{% extends "base.html" %} + +{% block content %} +
+VVF +
+

+ {{ 'Add training'|t }} +

+
+ + + + + + + + + + + {% if option('training_edit') %} + + {% endif %} + {% if option('training_remove') %} + + {% endif %} + +{% for row in query_results %} + + + + + + + + + + {% if option('training_edit') %} + + {% endif %} + {% if option('training_remove') %} + + {% endif %} + +{% endfor %} +
{{ 'Date'|t }}{{ 'Name'|t }}{{ 'Start time'|t }}{{ 'End time'|t }}{{ 'Chief'|t }}{{ 'Crew'|t }}{{ 'Place'|t }}{{ 'Notes'|t }}{{ 'Edit'|t }}{{ 'Remove'|t }}
{{ row.date }}{{ row.name }}{{ row.beginning }}{{ row.end }}{{ username(row.chief) }}{{ username_list(row.crew) }} + {% if "#" in row.place %} + {% set mapImageID = row.place|split('#')[1] %} + {% set place = row.place|split('#')[0] %} + {% set place_lat = place|split(';')[0] %} + {% set place_lng = place|split(';')[1] %} +
+ {% endif %} + Apri la mappa in Google Maps
+ Apri la mappa in OpenStreetMap
+ Lat: {{ place_lat }}
+ Lng: {{ place_lng }}
+
{{ row.notes }}ModificaRimuovi
+
+
+{% endblock %} \ No newline at end of file diff --git a/server/templates/JSless/user_details.html b/server/templates/JSless/user_details.html new file mode 100644 index 0000000..a6f261b --- /dev/null +++ b/server/templates/JSless/user_details.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block content %} +
+
+ TEST - TODO
+ {{ user.id }} +
+{% endblock %} \ No newline at end of file diff --git a/server/templates/base.html b/server/templates/base.html index 0f6e2ea..0ab5445 100644 --- a/server/templates/base.html +++ b/server/templates/base.html @@ -56,7 +56,7 @@ {% if show_menu %} {% block menu %} {# Menu #} -
+