{"id":19,"date":"2024-11-20T02:31:00","date_gmt":"2024-11-20T02:31:00","guid":{"rendered":"https:\/\/citytaxideventer.nl\/?page_id=19"},"modified":"2025-01-16T21:28:06","modified_gmt":"2025-01-16T21:28:06","slug":"rit-reserveren","status":"publish","type":"page","link":"https:\/\/citytaxideventer.nl\/?page_id=19","title":{"rendered":"Rit reserveren"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"nl\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Taxi ritprijs berekenen<\/title>\n    <script src=\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=AIzaSyCS7jP0shIguxWJ0AlyROeJVKPbQlggPkM&#038;libraries=places\"><\/script>\n    <style>\n        body {\n            font-family: Arial, sans-serif;\n            margin: 20px;\n        }\n        .form-group {\n            margin-bottom: 15px;\n        }\n        label {\n            display: block;\n            margin-bottom: 5px;\n        }\n        input, select, button, textarea {\n            width: 100%;\n            padding: 10px;\n            margin-bottom: 10px;\n        }\n        textarea {\n            resize: vertical;\n            min-height: 80px;\n        }\n        .stop-group {\n            margin-bottom: 10px;\n        }\n        #result {\n            margin-top: 20px;\n            font-weight: bold;\n        }\n        .whatsapp-button {\n            margin-top: 20px;\n            display: inline-block;\n            background-color: #25D366; \/* WhatsApp groen *\/\n            color: white;\n            padding: 10px 20px;\n            text-align: center;\n            border-radius: 5px;\n            text-decoration: none;\n            font-size: 16px;\n            width: 100%; \/* Zorgt ervoor dat de knop net zo breed is als de 'Bereken prijs' knop *\/\n            cursor: pointer;\n            font-family: Arial, sans-serif; \/* Zelfde lettertype als 'Bereken prijs' knop *\/\n            text-transform: uppercase; \/* Optioneel: maakt de tekst hoofdletters *\/\n        }\n        .whatsapp-button:hover {\n            background-color: #128C7E; \/* WhatsApp groene hoverkleur *\/\n        }\n        button {\n            background-color: #007BFF; \/* Zelfde kleur als 'Bereken prijs' knop *\/\n            color: white;\n            padding: 10px 20px;\n            border-radius: 5px;\n            border: none;\n            font-size: 16px;\n            cursor: pointer;\n            width: 100%; \/* Zorgt ervoor dat de knop volledig de breedte vult *\/\n            font-family: Arial, sans-serif; \/* Zelfde lettertype als 'Vraag uw rit aan via WhatsApp' knop *\/\n        }\n        button:hover {\n            background-color: #0056b3;\n        }\n    <\/style>\n<\/head>\n<body>\n    <h1>Taxi Reserveren<\/h1>\n    <form id=\"taxiForm\">\n        <div class=\"form-group\">\n            <label for=\"start\">Ophaallocatie:<\/label>\n            <input type=\"text\" id=\"start\" placeholder=\"Voer ophaallocatie in\" required>\n        <\/div>\n        <div id=\"stopsContainer\" class=\"form-group\">\n            <label for=\"stops\">Tussenstops:<\/label>\n            <button type=\"button\" onclick=\"addStop()\">+ Voeg tussenstop toe<\/button>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"end\">Afleverlocatie:<\/label>\n            <input type=\"text\" id=\"end\" placeholder=\"Voer afleverlocatie in\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"return\">Terugrit gewenst?<\/label>\n            <select id=\"return\">\n                <option value=\"no\">Nee<\/option>\n                <option value=\"yes\">Ja<\/option>\n            <\/select>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"vehicle\">Voertuig:<\/label>\n            <select id=\"vehicle\" required>\n                <option value=\"car\">Personenauto (tot 4 personen)<\/option>\n                <option value=\"bus\">Bus (tot 7 personen)<\/option>\n            <\/select>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"date\">Ophaaldatum:<\/label>\n            <input type=\"date\" id=\"date\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"time\">Ophaaltijdstip:<\/label>\n            <input type=\"time\" id=\"time\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"name\">Naam:<\/label>\n            <input type=\"text\" id=\"name\" placeholder=\"Voer je naam in\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"phone\">Telefoonnummer:<\/label>\n            <input type=\"tel\" id=\"phone\" placeholder=\"Voer je telefoonnummer in\" required>\n        <\/div>\n        <div class=\"form-group\">\n            <label for=\"remarks\">Eventuele wensen of toelichting:<\/label>\n            <textarea id=\"remarks\" placeholder=\"Bijvoorbeeld: kinderzitje nodig, hulp met bagage, etc.\"><\/textarea>\n        <\/div>\n        <button type=\"button\" onclick=\"calculatePrice()\">Bereken Prijs<\/button>\n    <\/form>\n    <div id=\"result\"><\/div>\n    <a id=\"whatsappButton\" class=\"whatsapp-button\" href=\"#\" target=\"_blank\" style=\"display:none;\">Vraag uw rit aan via WhatsApp<\/a>\n\n    <script>\n        let stopCount = 0;\n\n        function addStop() {\n            stopCount++;\n            const stopContainer = document.getElementById('stopsContainer');\n            const stopGroup = document.createElement('div');\n            stopGroup.classList.add('stop-group');\n            stopGroup.id = `stop-${stopCount}`;\n            stopGroup.innerHTML = `\n                <input type=\"text\" id=\"stop-${stopCount}-input\" placeholder=\"Voer tussenstop ${stopCount} in\">\n                <button type=\"button\" onclick=\"removeStop('${stopGroup.id}')\">Verwijder<\/button>\n            `;\n            stopContainer.appendChild(stopGroup);\n        }\n\n        function removeStop(id) {\n            const stopElement = document.getElementById(id);\n            stopElement.remove();\n        }\n\n        function calculatePrice() {\n            const start = document.getElementById('start').value;\n            const end = document.getElementById('end').value;\n            const vehicle = document.getElementById('vehicle').value;\n            const returnTrip = document.getElementById('return').value === 'yes';\n            const remarks = document.getElementById('remarks').value || 'Geen aanvullende informatie.';\n\n            if (!start || !end || !vehicle) {\n                alert('Vul alle verplichte velden in.');\n                return;\n            }\n\n            const stops = Array.from(document.querySelectorAll('.stop-group input'))\n                .map(input => input.value)\n                .filter(value => value.trim() !== '');\n\n            const allLocations = [start, ...stops, end];\n            const reversedLocations = [end, ...stops.reverse(), start];\n\n            const service = new google.maps.DistanceMatrixService();\n            service.getDistanceMatrix(\n                {\n                    origins: allLocations.slice(0, -1),\n                    destinations: allLocations.slice(1),\n                    travelMode: 'DRIVING',\n                },\n                (response, status) => {\n                    if (status === 'OK') {\n                        const { totalDistance, totalDuration, totalPrice } = calculateTotals(response, vehicle);\n\n                        let returnPrice = 0;\n                        if (returnTrip) {\n                            service.getDistanceMatrix(\n                                {\n                                    origins: reversedLocations.slice(0, -1),\n                                    destinations: reversedLocations.slice(1),\n                                    travelMode: 'DRIVING',\n                                },\n                                (returnResponse, returnStatus) => {\n                                    if (returnStatus === 'OK') {\n                                        const returnTotals = calculateTotals(returnResponse, vehicle);\n                                        returnPrice = returnTotals.totalPrice;\n\n                                        displayResults(totalDistance, totalDuration, totalPrice, returnPrice, remarks);\n                                    } else {\n                                        alert('Fout bij berekening van terugrit.');\n                                    }\n                                }\n                            );\n                        } else {\n                            displayResults(totalDistance, totalDuration, totalPrice, 0, remarks);\n                        }\n                    } else {\n                        alert('Er is een fout opgetreden bij het ophalen van gegevens.');\n                    }\n                }\n            );\n        }\n\n        function calculateTotals(response, vehicle) {\n            let totalDistance = 0;\n            let totalDuration = 0;\n\n            response.rows.forEach((row, index) => {\n                const element = row.elements[index];\n                totalDistance += element.distance.value;\n                totalDuration += element.duration.value;\n            });\n\n            totalDistance \/= 1000; \/\/ in kilometers\n            totalDuration \/= 60; \/\/ in minuten\n\n            const startPrice = vehicle === 'car' ? 4.15 : 8.44;\n            const pricePerKm = vehicle === 'car' ? 3.05 : 3.85;\n            const pricePerMin = vehicle === 'car' ? 0.50 : 0.57;\n            const totalPrice = startPrice + (pricePerKm * totalDistance) + (pricePerMin * totalDuration);\n\n            return { totalDistance, totalDuration, totalPrice };\n        }\n\n        function displayResults(heenAfstand, heenTijd, heenPrijs, terugPrijs, remarks) {\n            const total = heenPrijs + terugPrijs;\n            const resultDiv = document.getElementById('result');\n            resultDiv.innerHTML = `\n                Heenreis: Afstand: ${heenAfstand.toFixed(2)} km, Tijd: ${heenTijd.toFixed(2)} minuten, Prijs: \u20ac${heenPrijs.toFixed(2)}<br>\n                Terugreis: Prijs: \u20ac${terugPrijs.toFixed(2)}<br>\n                Totaalprijs: \u20ac${total.toFixed(2)}<br><br>\n                Eventuele wensen of toelichting: ${remarks}\n            `;\n\n            const message = encodeURIComponent(`\n                Taxi reservering:\n                Heenreis - Afstand: ${heenAfstand.toFixed(2)} km, Tijd: ${heenTijd.toFixed(2)} minuten, Prijs: \u20ac${heenPrijs.toFixed(2)}\n                Terugreis - Prijs: \u20ac${terugPrijs.toFixed(2)}\n                Totaalprijs: \u20ac${total.toFixed(2)}\n                Wensen\/Toelichting: ${remarks}\n            `);\n\n            const whatsappLink = `https:\/\/wa.me\/?text=${message}`;\n            const whatsappButton = document.getElementById('whatsappButton');\n            whatsappButton.href = whatsappLink;\n            whatsappButton.style.display = 'inline-block';\n        }\n    <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Taxi ritprijs berekenen Taxi Reserveren Ophaallocatie: Tussenstops: + Voeg tussenstop toe Afleverlocatie: Terugrit gewenst? NeeJa Voertuig: Personenauto (tot 4 personen)Bus (tot 7 personen) Ophaaldatum: Ophaaltijdstip: Naam: Telefoonnummer: Eventuele wensen of toelichting: Bereken Prijs Vraag uw rit aan via WhatsApp<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"class_list":["post-19","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=\/wp\/v2\/pages\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":18,"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=\/wp\/v2\/pages\/19\/revisions"}],"predecessor-version":[{"id":636,"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=\/wp\/v2\/pages\/19\/revisions\/636"}],"wp:attachment":[{"href":"https:\/\/citytaxideventer.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}