Exemplo n.º 1
0
            echo "We are sorry.  There are no spaces available to rent for that time period.  Please select another time and try again.";
        }
    }
} else {
    if (isset($_POST['submitted2'])) {
        // note validation SHOULD occur here (user input should never be trusted), but this is outside the scope of this project
        $serviceId = trim($_POST['service']);
        $dayOffset = trim($_POST['day']);
        $startTime = trim($_POST['time']);
        $help = trim($_POST['helpRequired']);
        $roomRequest = trim($_POST['roomRequest']);
        echo "<h2>Create an appointment - Complete</h2>";
        $appointment = new Appointment();
        $appointment->setByOffset($user, $serviceId, $dayOffset, $startTime, $help);
        $appointment->reserveAppointment();
        $appointment->reserveResource($roomRequest);
        $workSpace = $appointment->getAttachedResources('S');
        echo "<p>Congratulations! Your appointment has been reserved!</p>";
        echo "<p><strong><u>Appointment Details:</u></strong></p><div class='indented'>";
        echo "<strong>Service name:</strong> " . $appointment->service->name . "<br /><strong>Service cost:</strong> \$" . $appointment->service->cost;
        echo "<br /><strong>Start time:</strong> " . $appointment->startDateDisplay . "<br /><strong>End time:</strong> " . $appointment->endDateDisplay . "<br /><strong>Workspace:</strong> " . $workSpace->name . "<br /><strong>Workspace cost:</strong> \$" . $workSpace->price;
        echo "<br /><strong>Help:</strong> ";
        if ($help == null) {
            echo "No help requested<br /><br /></div>";
        } else {
            echo "Help requested<br /><br /></div>";
        }
        $total = $appointment->service->cost + $workSpace->price;
        echo "<br /><strong><u>Total Amount Owed:</u></strong> \$" . $total . "<br /><br />";
        if ($help != null) {
            echo "<p><strong><u>Please Note:</u></strong><br /> You have requested help for this service.  Mechanics will now be able to place bids on this service.  You can log back in at a later \n\t\tdate to select which mechanic you desire to perform this service.  If you do not select a mechanic, one will be chosen for you when you come in.</p> <p>Amount owed must be payed prior to appointment.</p>";