OTA PART 2 Setting Page
This commit is contained in:
		@@ -3,7 +3,7 @@ class UserManager
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	public function getUsers () {
 | 
						public function getUsers () {
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			$allUsers = Db::loadAll ("SELECT user_id, username, at_home FROM users");
 | 
								$allUsers = Db::loadAll ("SELECT user_id, username, at_home, ota FROM users");
 | 
				
			||||||
			return $allUsers;
 | 
								return $allUsers;
 | 
				
			||||||
		} catch(PDOException $error) {
 | 
							} catch(PDOException $error) {
 | 
				
			||||||
			echo $error->getMessage();
 | 
								echo $error->getMessage();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,3 +38,21 @@ function sendTestNotification(){
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$( "button[name='deactivateOta']" ).click(function(){
 | 
				
			||||||
 | 
					    console.log("Didabling ota");
 | 
				
			||||||
 | 
					    $.ajax({
 | 
				
			||||||
 | 
					        url: 'ajax',
 | 
				
			||||||
 | 
					        type: 'POST',
 | 
				
			||||||
 | 
					        data: {
 | 
				
			||||||
 | 
					            "ota" : 'X',
 | 
				
			||||||
 | 
					            "action": 'disable'
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        success: function(data){
 | 
				
			||||||
 | 
					            console.log(data);
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        error: function (request, status, error) {
 | 
				
			||||||
 | 
					            console.log("ERROR ", request, error);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,11 +77,12 @@
 | 
				
			|||||||
				</form>
 | 
									</form>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
								<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
				
			||||||
				<h4 class="mb-4"><?php ?></h4>
 | 
									<h4 class="mb-4"><?php $LANGMNG->echo('t_ota') ?></h4>
 | 
				
			||||||
				<img src="<?php echo $QRURL;?>" />
 | 
									<?php if (!empty($QRURL)) {?>
 | 
				
			||||||
				<form method="post">
 | 
										<img src="<?php echo $QRURL;?>" />
 | 
				
			||||||
 | 
									<?php } else {?>
 | 
				
			||||||
				</form>
 | 
										<button name="deactivateOta" type="button" class="button is-danger fa"><?php $LANGMNG->echo('b_disable');?> <?php $LANGMNG->echo('b_ota'); ?></button>
 | 
				
			||||||
 | 
									<?php }?>
 | 
				
			||||||
			</div>
 | 
								</div>
 | 
				
			||||||
			<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
								<div class="col-12 col-sm-9 mx-auto mt-4">
 | 
				
			||||||
				<h4 class="mb-4"><?php $LANGMNG->echo('t_createuser') ?></h4>
 | 
									<h4 class="mb-4"><?php $LANGMNG->echo('t_createuser') ?></h4>
 | 
				
			||||||
@@ -89,6 +90,7 @@
 | 
				
			|||||||
					<thead>
 | 
										<thead>
 | 
				
			||||||
						<tr>
 | 
											<tr>
 | 
				
			||||||
							<th><?php $LANGMNG->echo('t_userName');?></th>
 | 
												<th><?php $LANGMNG->echo('t_userName');?></th>
 | 
				
			||||||
 | 
												<th><?php $LANGMNG->echo('t_ota');?></th>
 | 
				
			||||||
							<th><?php $LANGMNG->echo('t_action');?></th>
 | 
												<th><?php $LANGMNG->echo('t_action');?></th>
 | 
				
			||||||
						</tr>
 | 
											</tr>
 | 
				
			||||||
					</thead>
 | 
										</thead>
 | 
				
			||||||
@@ -96,6 +98,7 @@
 | 
				
			|||||||
						<?php foreach ($USERS as $key => $user) { ?>
 | 
											<?php foreach ($USERS as $key => $user) { ?>
 | 
				
			||||||
							<tr>
 | 
												<tr>
 | 
				
			||||||
								<td><?php echo $user['username']; ?></td>
 | 
													<td><?php echo $user['username']; ?></td>
 | 
				
			||||||
 | 
													<td><?php echo ($user['ota'] ? '<span class="fa"></span>' : ''); ?></td>
 | 
				
			||||||
								<td><button name="deleteUser" type="button" class="button is-danger fa"></button></td>
 | 
													<td><button name="deleteUser" type="button" class="button is-danger fa"></button></td>
 | 
				
			||||||
							</tr>
 | 
												</tr>
 | 
				
			||||||
						<?php } ?>
 | 
											<?php } ?>
 | 
				
			||||||
@@ -119,11 +122,11 @@
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
	<script src="./app/templates/js/setting.js"></script>
 | 
					 | 
				
			||||||
	<?php
 | 
						<?php
 | 
				
			||||||
	$partial = new Partial('footer');
 | 
						$partial = new Partial('footer');
 | 
				
			||||||
	$partial->render();
 | 
						$partial->render();
 | 
				
			||||||
	?>
 | 
						?>
 | 
				
			||||||
 | 
						<script src="./app/templates/js/setting.js"></script>
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
</body>
 | 
					</body>
 | 
				
			||||||
</html>
 | 
					</html>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user