<?php

use src\Home;
use src\Computer;
use src\Customer;
use src\Tariff;
use src\utilities;
$computers = new computer();
$customers_info = new Customer();
$tariff_info = new Tariff();
if (isset($_GET['pcid']) && $_GET['pcid'] > 0) {
    ?>
	<script type="text/javascript" src="webcam/webcam.js"></script>
	<script>
		webcam.set_api_url( 'webcam/upload.php' );
		webcam.set_quality( 90 ); // JPEG quality (1 - 100)
		webcam.set_shutter_sound( true ); // play shutter click sound
		
		webcam.set_hook( 'onComplete', 'my_completion_handler' );
		
		function take_snapshot() {
			// take snapshot and upload to server
			document.getElementById('upload_results').innerHTML = '<img src="webcam/uploading.gif">';
			webcam.snap();
		}
		
		function my_completion_handler(msg) {
			// extract URL out of PHP output
			if (msg.match(/(http\:\/\/\S+)/)) {
				var image_url = RegExp.$1;
				// show JPEG image in page
<?php

use src\Tariff;
use src\Utilities;
$tariffs = new Tariff();
if (isset($_POST['amount_per_hour']) && $_POST['amount_per_hour'] != 0 && isset($_POST['pulse_in_munite']) && $_POST['pulse_in_munite'] != 0 && isset($_POST['pulse_amount']) && $_POST['pulse_amount'] != 0) {
    echo $tariffs->update($_POST['amount_per_hour'], $_POST['pulse_in_munite'], $_POST['pulse_amount']);
}
$tariff = $tariffs->getTariff();
$amount_per_hour = $tariff[0]['amount_per_hour'];
$pulse_in_munite = $tariff[0]['pulse_in_munite'];
$pulse_amount = $tariff[0]['pulse_amount'];
?>
<div class="container">
	<div class="row">
		<div class="col-md-10" id="home-second-half" style="overflow-x:hidden; overflow-y: auto; height:400px;">
			<form action="?view=tariff_setup" method="post" class="form-horizontal">
				<input type='hidden' value='1' name='tariff_id'>
				<div class="form-group">
					<label for="amount_per_hour" class="col-sm-2 control-label">Amount Per Hour</label>
					<div class="col-sm-4">
						<input type="text" maxlength="9" class="form-control" id="amount_per_hour" name="amount_per_hour" value="<?php 
echo $amount_per_hour;
?>
" placeholder="Amount Per Hour" required>
					</div>
				</div>
				<div class="form-group">
					<label for="pulse_in_munite" class="col-sm-2 control-label">Pulse In Munite</label>
					<div class="col-sm-4">
						<input type="text" maxlength="6" class="form-control" id="pulse_in_munite" name="pulse_in_munite" value="<?php