Update inits fields on main and report. Fix site/user mgt to hide default rows. Fix scaling on main approvals page. Etc

This commit is contained in:
Josh North 2021-04-21 20:05:47 -04:00
parent e74e446453
commit 87af236592
4 changed files with 44 additions and 25 deletions

View File

@ -158,10 +158,10 @@
</div>
</div>
<?php echo '<ul class="pagination pagination-sm"><li class="page-item disabled"><a class="page-link" href="#" tabindex="-1">' . $transLang['PAGE'] . '</a></li>'; for ($i = 1; $i <= $page_count; $i++): echo '<li class="page-item'; if ($i === $page_num): echo ' active'; else: echo ' '; endif; echo '"><a class="page-link" href="' . $_SERVER['PHP_SELF'] . '?pnum=' . $i . '">' . $i . '</a></li>'; endfor; echo '</ul>'; ?>
<table class="table table-sm table-responsive-sm">
<table class="table table-sm table-responsive-sm text-nowrap">
<thead class="thead-dark">
<tr>
<th><?php echo $transLang['TIMEREASON']; ?></th><th><?php echo $transLang['NAME']; ?></th><th><?php echo $transLang['ESCORT']; ?></th><th><?php echo $transLang['VALIDATIONS']; ?></th><th><?php echo $transLang['BADGEINITIALS']; ?></th><?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?><th><?php echo $transLang['CARNUM'] . " / " . $transLang['SSANUM']; ?></th><?php }; ?><th><?php echo $transLang['ACTIONS']; ?></th><th>&nbsp</th>
<th class="small"><?php echo $transLang['TIMEREASON']; ?></th><th class="small"><?php echo $transLang['NAME']; ?></th><th class="small"><?php echo $transLang['ESCORT']; ?></th><th class="small"><?php echo $transLang['VALIDATIONS']; ?></th><th class="small"><?php echo $transLang['BADGEINITIALS']; ?></th><?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?><th class="small"><?php echo $transLang['CARNUM'] . " / " . $transLang['SSANUM']; ?></th><?php }; ?><th class="small"><?php echo $transLang['ACTIONS']; ?></th><th class="small">&nbsp</th>
</tr>
</thead>
<tbody>
@ -178,13 +178,13 @@
<?php } else { ?>
<tr class="alert alert-warning">
<?php }; ?>
<form class="form-approve" method="post">
<td><?php echo $timein_disp; ?><br><?php echo $transLang[$VisitTypeInfo->getVisitTypeInfo($row['visits_reason'])[0]["visittypes_name"]]; ?></td>
<td><?php echo $row['visits_lastname'] . ", " . $row['visits_firstname']; ?><br><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50"></img></td>
<td><?php if (!empty($row['visits_escort'])) {echo $row['visits_escort'] . '<br /><img src="' . $row['visits_escort_signature'] . '" width="200" height="50"></img>'; } ?></td>
<td>
<form class="form form-approve" method="post">
<td class="small"><?php echo $timein_disp; ?><br><?php echo $transLang[$VisitTypeInfo->getVisitTypeInfo($row['visits_reason'])[0]["visittypes_name"]]; ?></td>
<td class="small"><?php echo $row['visits_lastname'] . ", " . $row['visits_firstname']; ?><br><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50"></img></td>
<td class="small"><?php if (!empty($row['visits_escort'])) {echo $row['visits_escort'] . '<br /><img src="' . $row['visits_escort_signature'] . '" width="200" height="50"></img>'; } ?></td>
<td class="small">
<?php if($row['visits_approved']==2) { ?>
<input class="form-control" type="text" id="id_type" name="id_type" disabled value="<?php echo $transLang[$IDTypeInfo->getIDTypeInfo($row['visits_id_type'])[0]["idtypes_name"]]; ?>">
<input class="form-control form-control-sm" type="text" id="id_type" name="id_type" disabled value="<?php echo $transLang[$IDTypeInfo->getIDTypeInfo($row['visits_id_type'])[0]["idtypes_name"]]; ?>">
<?php if($row['visits_id_checked']==1) { ?>
<div class="form-check form-group-sm">
<input class="form-check-input" type="checkbox" value="1" id="id_checked" name="id_checked" checked disabled>
@ -205,16 +205,16 @@
</div>
<?php }; ?>
</td>
<td><input type="text" id="badge" name="badge" class="form-control" autofocus disabled value="<?php echo $row['visits_badge']; ?>"> <input type="text" id="initials" name="initials" class="form-control" autofocus disabled value="<?php echo $Users->getUserInitials($row['visits_initials'])[0]["users_firstname"] . " " . $Users->getUserInitials($row['visits_initials'])[0]["users_lastname"]; ?>"></td>
<td class="small"><input type="text" id="badge" name="badge" class="form-control form-control-sm" autofocus disabled value="<?php echo $row['visits_badge']; ?>"><br><?php echo $Users->getUserInitials($row['visits_initials'])[0]["users_firstname"] . " " . $Users->getUserInitials($row['visits_initials'])[0]["users_lastname"]; ?></td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<td class="small"><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<?php }; ?>
<td> </td>
<td><button type="submit" name="endvisit" value="<?php echo $row['visits_id']; ?>" class="btn btn-warning btn-block"><i class="fas fa-sign-out-alt"></i>&nbsp<?php echo $transLang['SIGNOUT']; ?></button><br>
<td class="small"> </td>
<td class="small"><button type="submit" name="endvisit" value="<?php echo $row['visits_id']; ?>" class="btn btn-warning btn-block"><i class="fas fa-sign-out-alt"></i>&nbsp<?php echo $transLang['SIGNOUT']; ?></button><br>
<div>
<div class="row">
<div class="col-lg">
<input placeholder="<?php echo $transLang['OPTIONAL']; ?>" name="outtime" type="text" class="form-control datetimepicker-input datetimepicker-<?php echo $row['visits_id']; ?>" id="datetimepicker-<?php echo $row['visits_id']; ?>" data-toggle="datetimepicker" data-target=".datetimepicker-<?php echo $row['visits_id']; ?>"/>
<div class="col">
<input placeholder=" / / : : " name="outtime" type="text" class="form-control form-control-sm datetimepicker-input datetimepicker-<?php echo $row['visits_id']; ?>" id="datetimepicker-<?php echo $row['visits_id']; ?>" data-toggle="datetimepicker" data-target=".datetimepicker-<?php echo $row['visits_id']; ?>"/>
</div>
<script type="text/javascript">
$(function () {
@ -225,7 +225,7 @@
</div>
</td>
<?php } else { ?>
<select class="custom-select<?php if( isset($id_type_error) && $id_type_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" id="id_type" aria-label="ID Type" name="id_type">
<select class="form-control form-control-sm custom-select<?php if( isset($id_type_error) && $id_type_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" id="id_type" aria-label="ID Type" name="id_type">
<option value="" selected><?php echo $transLang['SELECTID']; ?></option><?php foreach($IDTypeInfo->getIDTypeInfo("%") as $row): ?>
<option value="<?php echo $row['idtypes_id']; ?>"><?php echo $transLang[$row['idtypes_name']]; ?></option><?php endforeach; ?>
</select>
@ -240,25 +240,25 @@
<label class="form-check-label" for="citizen"><?php echo $transLang['CITIZEN']; ?></label>
</div>
<?php }; ?>
<td>
<input type="text" id="badge" name="badge" class="form-control<?php if( isset($badge_error) && $badge_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $transLang['BADGE']; ?>" autofocus maxlength="15">
<td class="small">
<input type="text" id="badge" name="badge" class="form-control form-control-sm<?php if( isset($badge_error) && $badge_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $transLang['BADGE']; ?>" autofocus maxlength="15">
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
<input type="hidden" id="initials" name="initials" class="form-control<?php if( isset($initials_error) && $initials_error == "1" && $_POST['approvevisit'] == $visitid ) { echo " is-invalid"; } ?>" placeholder="<?php echo $uid; ?>" value="<?php echo $uid; ?>" autofocus maxlength="5">
<div class="invalid-feedback"><?php echo $transLang['REQUIRED']; ?></div>
</td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<td class="small"><?php echo $carnum; ?> / <?php echo $ssanum; ?></td>
<?php }; ?>
<td>
<button type="submit" name="approvevisit" value="<?php echo $visitid; ?>" class="btn btn-success btn-block"><i class="fas fa-thumbs-up"></i>&nbsp;<?php echo $transLang['APPROVE']; ?></button><br /><button type="submit" name="voidvisit" value="<?php echo $visitid; ?>" class="btn btn-danger btn-block" onsubmit="return confirm('<?php echo $transLang['VOID_WARNING']; ?>')"><i class="fas fa-thumbs-down"></i>&nbsp;<?php echo $transLang['VOID']; ?></button>
<td class="small">
<button type="submit" name="approvevisit" value="<?php echo $visitid; ?>" class="btn btn-success btn-block btn-sm"><i class="fas fa-thumbs-up"></i>&nbsp;<?php echo $transLang['APPROVE']; ?></button><br /><button type="submit" name="voidvisit" value="<?php echo $visitid; ?>" class="btn btn-danger btn-block btn-sm" onsubmit="return confirm('<?php echo $transLang['VOID_WARNING']; ?>')"><i class="fas fa-thumbs-down"></i>&nbsp;<?php echo $transLang['VOID']; ?></button>
</td>
<td>
<button type="submit" name="endvisit" value="<?php echo $visitid; ?>" class="btn btn-warning btn-block"><i class="fas fa-sign-out-alt"></i>&nbsp;<?php echo $transLang['SIGNOUT']; ?></button>
<td class="small">
<button type="submit" name="endvisit" value="<?php echo $visitid; ?>" class="btn btn-warning btn-block btn-sm"><i class="fas fa-sign-out-alt"></i>&nbsp;<?php echo $transLang['SIGNOUT']; ?></button>
<br>
<div>
<div class="row">
<div class="col-lg">
<input name="outtime" type="text" class="form-control datetimepicker-input datetimepicker-<?php echo $visitid; ?>" id="datetimepicker-<?php echo $visitid; ?>" data-toggle="datetimepicker" data-target=".datetimepicker-<?php echo $visitid; ?>" />
<div class="col">
<input placeholder=" / / : : " name="outtime" type="text" class="form-control form-control-sm datetimepicker-input datetimepicker-<?php echo $visitid; ?>" id="datetimepicker-<?php echo $visitid; ?>" data-toggle="datetimepicker" data-target=".datetimepicker-<?php echo $visitid; ?>" />
</div>
<script type="text/javascript">
$(function () {

View File

@ -157,7 +157,7 @@
<td><?php echo $row['visits_lastname'] . ", " . $row['visits_firstname']; ?><br /><img src="<?php echo $row['visits_signature']; ?>" width="200" height="50" alt="Signature" /></td>
<td><?php if (!empty($row['visits_escort'])) {echo $row['visits_escort'] . '<br /><img src="' . $row['visits_escort_signature'] . '" width="200" height="50" alt="Escort Signature" />'; } ?></td>
<td><?php echo $row['visits_badge']; ?></td>
<td><?php echo $row['visits_initials']; ?></td>
<td><?php echo $Users->getUserInitials($row['visits_initials'])[0]["users_firstname"] . " " . $Users->getUserInitials($row['visits_initials'])[0]["users_lastname"]; ?></td>
<?php if($SiteInfo->getSite($siteid, $uid, "0", "0")[0]["sites_region"] == "EMEA") { ?>
<td><?php echo $carnum; ?></td>
<td><?php echo $ssanum; ?></td>

View File

@ -129,6 +129,16 @@ class SiteInfo {
return $count;
}
public function getSiteByID ($sitename) {
$query = "
SELECT *
FROM " . Registry::DB_PRFX . "sites WHERE " . Registry::DB_PRFX . "sites.name LIKE \"$sitename\"
";
$database = new \App\LobbySIO\Database\Connect();
$rows = $database->getQuery($query);
return $rows;
}
public function addSite ($sitename, $timezone, $region) {
$query = "
INSERT INTO " . Registry::DB_PRFX . "sites (" . Registry::DB_PRFX . "sites.name, " . Registry::DB_PRFX . "sites.timezone, " . Registry::DB_PRFX . "sites.region)

View File

@ -143,6 +143,9 @@
if (!empty($_POST['newsite'])): // NEW SITE
$SiteInfo->addSite($_POST['sitename'], $_POST['timezone'], $_POST['region']);
$newsiteid = $SiteInfo->getSiteByID($_POST['sitename']);
$SiteInfo->setSitePerms($newsiteid["0"]["id"], "1");
$SiteInfo->setSitePerms($newsiteid["0"]["id"], "2");
header('Location: ' . $_SERVER['PHP_SELF']);
endif;
@ -246,6 +249,8 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
</thead>
<tbody>
<?php foreach($Users->getUserInfo("%", $StaticFunctions->getPageRows(), $offset) as $row): ?>
<?php if ($row['users_id'] == "1"): echo " "; else: ?>
<?php if ($row['users_id'] == "2"): echo " "; else: ?>
<tr>
<td><?php echo $row['users_lastname'] . ", " . $row['users_firstname']; ?></td>
<td><?php echo $row['users_username']; ?></td>
@ -265,6 +270,8 @@ if (0 === $row_count): else: $page_count = (int)ceil($row_count / $StaticFunctio
</form>
</td>
</tr>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>
@ -383,9 +390,11 @@ if (0 === $row_count1): else: $page_count1 = (int)ceil($row_count1 / $StaticFunc
</thead>
<tbody>
<?php foreach($SiteInfo->listSite($StaticFunctions->getPageRows(), $offset1) as $row1): ?>
<?php if ($row1['sites_name'] === "NOSITE"): echo " "; else: ?>
<tr>
<td><?php echo $row1['sites_name']; ?></td><td><?php echo $row1['sites_timezone']; ?></td><td><?php echo $row1['sites_region']; ?></td><td><form method="post" onsubmit="return confirm('<?php echo $transLang['DELETE_WARNING']; ?>')"><input type="hidden" id="_METHOD" name="_METHOD" value="DELETE" /><input type="hidden" id="deleteid" name="deleteid" value="<?php echo $row1['sites_id']; ?>" /><button class="btn btn-danger btn-sm" id="deluser" name="delsite" value="delsite" type="submit"><i class="fa fa-trash"></i> </button></form></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</tbody>
</table>