<!--
TemplateName:Admin
-->
<!DOCTYPE html>
<html>
<head>
	<title>AutoTardy Kiosk Activity</title>
<!-- required scripts -->
	~[wc:commonscripts] 
<!-- Required style sheets: screen.css, and print.css --> 
	<link href="/images/css/screen.css" rel="stylesheet" media="screen">
	<link href="/images/css/print.css" rel="stylesheet" media="print">
    <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <style>
        @media print {
            .noPrint {
                display: none !important;
            }
        }

        .idm_kioskError {
            color: #A94442;
        }

        .idm_kioskNew {
            color: green;
        }

        .idm_editKioskDetails {
            color: rgb(68, 68, 68);
            white-space: nowrap;
        }

        .idm_editKioskDetails > div {
            display: flex;
            flex-direction: column;
        }

        .idm_editKioskDetails > div > div {
            display: flex;
            justify-content: space-between;
            margin-bottom: 2px;
        }

        .idm_editKioskDetails label {
            margin-right: 5px;
        }

        button.selected {
            background-color: orange;    
        }
    </style>
</head> 
<body> 
	~[wc:admin_header_css] 
    <!-- breadcrumb start --><a href="/admin/home.html" target="_top">~[text:psx.html.admin_attendance_functions.attendancestatus.start_page]</a> > <a href="/admin/attendance/functions/attendancestatus.html" target="_top">~[text:psx.html.admin_attendance_functions.attendancestatus.attendance1]</a> > <a href="/admin/attendance/functions/idm_scanAttendance.html" target="_top">AutoTardy Kiosk Activity</a> > AutoTardy Kiosk Activity<!-- breadcrumb end --> 
<!-- start of main menu and content --> 
	~[wc:admin_navigation_css] 
<!-- Start of Page --> 
    <p style="float:right; margin:25px 20px;"><a href="https://www.identimetrics.net" target="_blank"><img src="/images/img/identimetrics-wordmark.svg" style="height:2em;"></a></p>
    <h1>AutoTardy Kiosk Activity</h1>
    <!-- start of content area --> 
    <div data-require-path="components/identimetricsFOTM/index" data-module-name="identimetricsFOTM" data-ng-controller="fotm" data-ng-cloak>
        <p data-ng-if="!auth" class="feedback-error">This school is not authorized to use this plugin.</p>
        <div data-ng-show="auth">
            <table style="width:min-content;">
                <tr>
                    <td class="bold">From:</td>
                    <td style="white-space:nowrap;">
                        <input type="text" class="psDateWidget" data-ng-model="ctrlData.reportControls.dateStart">
                    </td>
                </tr>
                <tr>
                    <td class="bold">To:</td>
                    <td style="white-space:nowrap;">
                        <input type="text" class="psDateWidget" data-ng-model="ctrlData.reportControls.dateEnd">
                    </td>
                </tr>
            </table>

            <div>
                <div style="display:flex;justify-content:space-between;margin-left:20px;">
                    <div>
                        <span>
                            <strong>Time Now:</strong> {{ctrlData.ticker.toLocaleTimeString()}}<br>
                            <strong>Last Updated:</strong> {{ctrlData.kioskLastUpdated}} ({{ctrlData.kioskEntries.length}} Scans<span data-ng-show="ctrlData.kioskUpdateCount <= 1">)</span><span data-ng-show="ctrlData.kioskUpdateCount > 1">, {{ctrlData.kioskEntries.length - ctrlData.kioskEntriesPrevious.length}} New)</span>
                        </span>
                    </div>
                    <div id="refreshButtonContent" class="button-row">
                        <button style="line-height:1.5em;vertical-align:middle;" type="button" data-ng-click="exportKiosk(ctrlData.kioskEntries, 'All')">Export All</button>
                        <button style="line-height:1.5em;vertical-align:middle;" type="button" data-ng-click="kioskService.ctrlData.args.liveScanning=!ctrlData.args.liveScanning" data-ng-class="{'selected': !ctrlData.args.liveScanning, 'disabled': !ctrlData.args.allowLiveScanning}">
                            <i class="fa fa-pause" data-ng-show="ctrlData.args.liveScanning"></i>
                            <i class="fa fa-play" data-ng-show="!ctrlData.args.liveScanning"></i>
                        </button>
                        <div style="margin-left:0px;" class="prDropList ui-controlgroup ui-controlgroup-horizontal ui-helper-clearfix" role="toolbar" data-ng-class="{'disabled': !ctrlData.args.allowLiveScanning}">
                        <!-- white-space removed intentionally to remove spaces between inline buttons-->
                            <button style="margin-left:0px;" class="autoReloadPage" id="prReloadButton" type="button" data-ng-click="kioskService.kioskService.loadKiosk()">
                                <span>Refresh</span>
                                <em class="prClock" data-ng-show="!ctrlData.loadingKiosk && ctrlData.args.liveScanning">{{ctrlData.countdown}}</em>
                                <em class="prClock" data-ng-show="ctrlData.loadingKiosk"><i class="fa fa-spinner fa-spin"></i></em>
                                <em class="prClock" data-ng-show="!ctrlData.loadingKiosk && !ctrlData.args.liveScanning">-</em>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="box-round">
                <div
                    data-pss-grid-widget
                    data-data="ctrlData.kioskErrors"
                    data-filtered-data="ctrlData.filteredErrors"
                    data-pss-message-prefixes="psx.htmlc.idm"
                    data-client-side-pagination="true"
                    data-custom-pre-filter-function="kioskService.linkFilters"
                >
                    <h2 class="toggle aria-toggle lite expanded">
                        Entry Denied
                        <button style="bottom:8px;" type="button" data-ng-click="exportKiosk(ctrlData.filteredErrors, 'Denied');$event.stopPropagation()">Export Denied</button>
                    </h2>
                    <div class="idm_kioskError">
                        <label data-pss-filter-field="scanCode|multiselect-dropdown" data-filter-info="ctrlData.map.scanResults" data-default-filter="fixed">Initial Scan Result</label>
                        <label data-pss-filter-field="resolvedResultCode|multiselect-dropdown" data-filter-info="ctrlData.map.resolveResults" data-default-filter="fixed">Override Result</label>
                        <table class="grid">
                            <thead>
                                <tr>
                                    <th data-pss-sort-fields="lastfirst">Student</th>
                                    <th data-pss-sort-fields="scanIdentifier">Scanned ID</th>
                                    <th data-pss-sort-fields="scanSchool" data-ng-show="'~(curschoolid)' == '0'">Scanned School</th>
                                    <th data-pss-sort-fields="scanTime">Scan Time</th>
                                    <th data-pss-sort-fields="scanDateJS|date">Scan Date</th>
                                    <th data-pss-sort-fields="scanTerminal">Kiosk</th>
                                    <th>Result</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr data-ng-repeat="kioskEntry in ctrlData.filteredErrors">
                                    <td>{{kioskEntry.lastfirst}} <span data-ng-show="kioskEntry.loading"><i class="fa fa-spinner fa-spin"></i></span></td>
                                    <td>{{kioskEntry.scanIdentifier}}</td>
                                    <td data-ng-show="'~(curschoolid)' == '0'">{{kioskEntry.scanSchool}}</td>
                                    <td>{{kioskEntry.scanTime}}</td>
                                    <td>{{kioskEntry.scanDateJS.toLocaleDateString()}}</td>
                                    <td>{{kioskEntry.scanTerminal}}</td>
                                    <td>
                                        <span data-ng-show="kioskEntry.resolvedResult">
                                            {{kioskEntry.resolvedResult}}
                                        </span>
                                        <span data-ng-show="!kioskEntry.resolvedResult">
                                            {{kioskEntry.scanResult}}
                                        </span>
                                        <span data-ng-show="(kioskEntry.resolvedResultCode != '' && kioskEntry.resolvedResultCode != kioskEntry.scanCode) || kioskEntry.resolvedNote">
                                            (
                                        </span>
                                        
                                        <span data-ng-if="kioskEntry.resolvedResultCode != '' && kioskEntry.resolvedResultCode != kioskEntry.scanCode"> Original Result: {{kioskEntry.scanResult}}</span>
                                        <span data-ng-if="kioskEntry.resolvedNote"> Notes: {{kioskEntry.resolvedNote}}</span>

                                        <span data-ng-show="(kioskEntry.resolvedResultCode != '' && kioskEntry.resolvedResultCode != kioskEntry.scanCode) || kioskEntry.resolvedNote">
                                            )
                                        </span>
                                    </td>
                                    <td>
                                        <button type="button" data-ng-click="kioskService.resolveKiosk(kioskEntry, false)" data-ng-if="!kioskEntry.loading">Resolve</button>
                                        <button type="button" data-ng-click="kioskService.resolveKiosk(kioskEntry, true, '1')" data-ng-if="!kioskEntry.loading">
                                            <i class="fa fa-edit"></i>
                                        </button>
                                        <span data-ng-show="kioskEntry.loading && !kioskEntry.editDetails"><i class="fa fa-spinner fa-spin"></i></span>
                                        <span class="idm_editKioskDetails" data-ng-show="kioskEntry.editDetails">
                                            <div>
                                                <div>
                                                    <label for="idm_kioskEntryResolved{{$index}}">
                                                        Resolved
                                                    </label>
                                                    <select data-ng-model="kioskEntry.resolved" id="idm_kioskEntryResolved{{$index}}">
                                                        <option value="1">Yes</option>
                                                        <option value="0">No</option>
                                                    </select>
                                                </div>
                                                <div>
                                                    <label for="idm_kioskEntryStatus{{$index}}">
                                                        New Status
                                                    </label>
                                                    <select id="idm_kioskEntryStatus{{$index}}" data-ng-model="kioskEntry.resolvedResultCode" data-ng-options="result as ctrlData.map.scanResultsInverted[result] for result in ctrlData.map.scanResults" data-ng-change="updateKioskResult(kioskEntry, 'resolvedResult')"></select>
                                                </div>
                                                <div>
                                                    <label for="idm_kioskEntryNotes{{$index}}">
                                                        Notes
                                                    </label>
                                                    <textarea id="idm_kioskEntryNotes{{$index}}" data-ng-model="kioskEntry.resolvedNote"></textarea>
                                                </div>
                                                <div>
                                                    <button data-ng-click="kioskService.resetResolve(kioskEntry)">Cancel</button>
                                                    <button data-ng-click="kioskService.updateKioskResolved(kioskEntry, false)">Submit</button>
                                                </div>
                                            </div>
                                        </span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div
                    data-pss-grid-widget
                    data-data="ctrlData.kioskAllowed"
                    data-filtered-data="ctrlData.filteredAllowed"
                    data-pss-message-prefixes="psx.htmlc.idm"
                    data-client-side-pagination="true"
                    data-filter-constraint="no-filters"
                >
                    <h2 class="toggle aria-toggle lite expanded">
                        Entry Allowed/Resolved
                        <button style="bottom:8px;" type="button" data-ng-click="exportKiosk(ctrlData.filteredAllowed, 'Allowed/Resolved');$event.stopPropagation()">Export Allowed/Resolved</button>
                    </h2>
                    <div class="idm_kioskAllowed">
                        <table class="grid">
                            <thead>
                                <tr>
                                    <th data-pss-sort-fields="lastfirst">Student</th>
                                    <th data-pss-sort-fields="scanIdentifier">Scanned ID</th>
                                    <th data-pss-sort-fields="scanSchool" data-ng-show="'~(curschoolid)' == '0'">Scanned School</th>
                                    <th data-pss-sort-fields="scanTime">Scan Time</th>
                                    <th data-pss-sort-fields="scanDateJS|date">Scan Date</th>
                                    <th data-pss-sort-fields="scanTerminal">Kiosk</th>
                                    <th data-pss-sort-fields="scanCode,resolvedResultCode">Result</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr data-ng-repeat="kioskEntry in ctrlData.filteredAllowed" data-ng-class="{
                                        'idm_kioskError': kioskEntry.scanCode != '1' && kioskEntry.resolved == '0',
                                        'idm_kioskNew': ctrlData.kioskUpdateCount > 1 && kioskEntry.scanCode == '1' && !kioskEntriesPrevious.includes(kioskEntry.kioskid)
                                    }"
                                >
                                    <td>{{kioskEntry.lastfirst}} <span data-ng-show="kioskEntry.loading"><i class="fa fa-spinner fa-spin"></i></span></td>
                                    <td>{{kioskEntry.scanIdentifier}}</td>
                                    <td data-ng-show="'~(curschoolid)' == '0'">{{kioskEntry.scanSchool}}</td>
                                    <td>{{kioskEntry.scanTime}}</td>
                                    <td>{{kioskEntry.scanDateJS.toLocaleDateString()}}</td>
                                    <td>{{kioskEntry.scanTerminal}}</td>
                                    <td>
                                        <span data-ng-show="kioskEntry.resolvedResult">
                                            {{kioskEntry.resolvedResult}}
                                        </span>
                                        <span data-ng-show="!kioskEntry.resolvedResult">
                                            {{kioskEntry.scanResult}}
                                        </span>
                                        <span data-ng-show="kioskEntry.resolved == '1' || (kioskEntry.resolvedResultCode != '' && kioskEntry.resolvedResultCode != kioskEntry.scanCode) || kioskEntry.resolvedNote || kioskEntry.resolvedBy">
                                            (
                                        </span>
                                        
                                        <span data-ng-show="kioskEntry.resolvedBy">{{kioskEntry.resolvedBy}} @ {{kioskEntry.resolvedTime}}.</span>
                                        <span data-ng-if="kioskEntry.resolvedResultCode != '' && kioskEntry.resolvedResultCode != kioskEntry.scanCode"> Original Result: {{kioskEntry.scanResult}}</span>
                                        <span data-ng-if="kioskEntry.resolvedNote"> Notes: {{kioskEntry.resolvedNote}}</span>

                                        <span data-ng-show="kioskEntry.resolved == '1' || (kioskEntry.resolvedResultCode != '' && kioskEntry.resolvedResultCode != kioskEntry.scanCode) || kioskEntry.resolvedNote">
                                            )
                                        </span>
                                    </td>
                                    <td style="white-space:nowrap;">
                                        <span data-ng-show="kioskEntry.loading && !kioskEntry.editDetails"><i class="fa fa-spinner fa-spin"></i></span>
                                        <button type="button" data-ng-click="kioskService.resolveKiosk(kioskEntry, true, '1')" data-ng-if="!kioskEntry.loading">
                                            <i class="fa fa-edit"></i>
                                        </button>
                                        <span class="idm_editKioskDetails" data-ng-show="kioskEntry.editDetails">
                                            <div>
                                                <div>
                                                    <label for="idm_kioskEntryResolved{{$index}}">
                                                        Resolved
                                                    </label>
                                                    <select data-ng-model="kioskEntry.resolved" id="idm_kioskEntryResolved{{$index}}">
                                                        <option value="1">Yes</option>
                                                        <option value="0">No</option>
                                                    </select>
                                                </div>
                                                <div>
                                                    <label for="idm_kioskEntryStatus{{$index}}">
                                                        New Status
                                                    </label>
                                                    <select id="idm_kioskEntryStatus{{$index}}" data-ng-model="kioskEntry.resolvedResultCode" data-ng-options="result as ctrlData.map.scanResultsInverted[result] for result in ctrlData.map.scanResults" data-ng-change="updateKioskResult(kioskEntry, 'resolvedResult')"></select>
                                                </div>
                                                <div>
                                                    <label for="idm_kioskEntryNotes{{$index}}">
                                                        Notes
                                                    </label>
                                                    <textarea id="idm_kioskEntryNotes{{$index}}" data-ng-model="kioskEntry.resolvedNote"></textarea>
                                                </div>
                                                <div>
                                                    <button data-ng-click="kioskService.resetResolve(kioskEntry)">Cancel</button>
                                                    <button data-ng-click="kioskService.updateKioskResolved(kioskEntry, false)">Submit</button>
                                                </div>
                                            </div>
                                        </span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
	</div> 
    ~[wc:idM_FOTM_args]
    <script>
        idmFOTMArgs.fotmOnly = 1
        idmFOTMArgs.printAll = 1
        idmFOTMArgs.dateStart = idmFOTMArgs.isoDate
        idmFOTMArgs.dateEnd = idmFOTMArgs.isoDate
        idmFOTMArgs.liveScanning = true
    </script>
<!-- end of content area --> 
	~[wc:admin_footer_css] 
    ~[wc:idM_AutoTardy_auth]
</body> 
</html>