[UPDT]Biometric : Updated biometric app by changing Request class attributes

This commit is contained in:
Horilla
2024-08-09 11:20:46 +05:30
parent 765f94bf17
commit c3e8fb04fd
15 changed files with 897 additions and 1262 deletions

View File

@@ -1,133 +1,111 @@
{% load static %} {% load i18n %} {% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
{% load static %} {% load i18n %}
{% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
{% endfor %}
<script>
setTimeout(function () {
$(".oh-modal__close").click();
}, 1000);
</script>
</div>
</div>
{% endfor %}
<script>
setTimeout(function () {
$(".oh-modal__close").click();
}, 1000);
</script>
</div>
{% endif %}
<div class="oh-modal__dialog-header pb-0">
<h2 class="oh-modal__dialog-title" id="biometricDeviceLavel">
{% trans "Add Biometric Device" %}
</h2>
<button
type="button"
class="oh-modal__close"
data-dismiss="oh-modal"
aria-label="Close"
{% if messages %}
hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page=1&view=card"
{% endif %}
>
<ion-icon name="close-outline"></ion-icon>
</button>
<h2 class="oh-modal__dialog-title" id="biometricDeviceLavel">
{% trans "Add Biometric Device" %}
</h2>
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close" {% if messages %}
hx-target="#biometricDeviceList" hx-get="{% url 'search-devices' %}?{{pd}}&page=1&view=card" {% endif %}>
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body" id="biometricDeviceModalBody">
<form
hx-post="{%url 'biometric-device-add' %}?{{pd}}"
hx-target="#BiometricDeviceFormTarget"
class="oh-profile-section"
>
{% csrf_token %}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.name.id_for_label}}">{% trans "Name" %}</label>
{{biometric_form.name}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.machine_type.id_for_label}}">{% trans "Device Type" %}</label>
{{biometric_form.machine_type}}
</div>
<div class="oh-input-group" id="machinIpInput" style="display: none">
{{biometric_form.machine_ip.errors}}
<label class="oh-label" for="{{biometric_form.machine_ip.id_for_label}}">{% trans "Machine IP" %}</label>
{{biometric_form.machine_ip}}
</div>
<div class="oh-input-group" id="machinPortInput" style="display: none">
{{biometric_form.port.errors}}
<label class="oh-label" for="{{biometric_form.port.id_for_label}}">{% trans "Port No" %}</label>
{{biometric_form.port}}
</div>
<div class="oh-input-group" id="machinUserName" style="display: none">
{{biometric_form.cosec_username.errors}}
<label class="oh-label" for="{{biometric_form.cosec_username.id_for_label}}">{% trans "Username" %}</label>
{{biometric_form.cosec_username}}
</div>
<div class="oh-input-group" id="machinPassword" style="display: none">
{{biometric_form.cosec_password.errors}}
<label class="oh-label" for="{{biometric_form.cosec_password.id_for_label}}">{% trans "Password" %}</label>
{{biometric_form.cosec_password}}
<button
type="button"
class="oh-btn oh-btn--transparent oh-password-input--toggle"
style="padding-top: 55px"
>
<ion-icon
class="oh-passowrd-input__show-icon"
title="Show Password"
name="eye-outline"
></ion-icon>
<ion-icon
class="oh-passowrd-input__hide-icon d-none"
title="Hide Password"
name="eye-off-outline"
></ion-icon>
</button>
</div>
<div class="oh-input-group" id="apiRequestIDInput" style="display: none">
{{biometric_form.anviz_request_id.errors}}
<label class="oh-label" for="{{biometric_form.anviz_request_id.id_for_label}}">{% trans "Request ID" %}</label>
{{biometric_form.anviz_request_id}}
</div>
<div class="oh-input-group" id="apiUrlInput" style="display: none">
{{biometric_form.api_url.errors}}
<label class="oh-label" for="{{biometric_form.api_url.id_for_label}}">{% trans "API Url" %}</label>
{{biometric_form.api_url}}
</div>
<div class="oh-input-group" id="apiKeyInput" style="display: none">
{{biometric_form.api_key.errors}}
<label class="oh-label" for="{{biometric_form.api_key.id_for_label}}">{% trans "API Key" %}</label>
{{biometric_form.api_key}}
</div>
<div class="oh-input-group" id="apiSecretInput" style="display: none">
{{biometric_form.api_secret.errors}}
<label class="oh-label" for="{{biometric_form.api_secret.id_for_label}}">{% trans "API Secret" %}</label>
{{biometric_form.api_secret}}
</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>
<form hx-post="{%url 'biometric-device-add' %}?{{pd}}" hx-target="#BiometricDeviceFormTarget"
class="oh-profile-section">
{% csrf_token %}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.name.id_for_label}}">{% trans "Name" %}</label>
{{biometric_form.name}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.machine_type.id_for_label}}">{% trans "Device Type" %}</label>
{{biometric_form.machine_type}}
</div>
<div class="oh-input-group" id="machinIpInput" style="display: none">
{{biometric_form.machine_ip.errors}}
<label class="oh-label" for="{{biometric_form.machine_ip.id_for_label}}">{% trans "Machine IP" %}</label>
{{biometric_form.machine_ip}}
</div>
<div class="oh-input-group" id="machinPortInput" style="display: none">
{{biometric_form.port.errors}}
<label class="oh-label" for="{{biometric_form.port.id_for_label}}">{% trans "Port No" %}</label>
{{biometric_form.port}}
</div>
<div class="oh-input-group" id="machinUserName" style="display: none">
{{biometric_form.cosec_username.errors}}
<label class="oh-label" for="{{biometric_form.cosec_username.id_for_label}}">{% trans "Username" %}</label>
{{biometric_form.cosec_username}}
</div>
<div class="oh-input-group" id="machinPassword" style="display: none">
{{biometric_form.cosec_password.errors}}
<label class="oh-label" for="{{biometric_form.cosec_password.id_for_label}}">{% trans "Password" %}</label>
{{biometric_form.cosec_password}}
<button type="button" class="oh-btn oh-btn--transparent oh-password-input--toggle" style="padding-top: 55px">
<ion-icon class="oh-passowrd-input__show-icon" title="Show Password" name="eye-outline"></ion-icon>
<ion-icon class="oh-passowrd-input__hide-icon d-none" title="Hide Password" name="eye-off-outline"></ion-icon>
</button>
</div>
<div class="oh-input-group" id="apiRequestIDInput" style="display: none">
{{biometric_form.anviz_request_id.errors}}
<label class="oh-label" for="{{biometric_form.anviz_request_id.id_for_label}}">{% trans "Request ID" %}</label>
{{biometric_form.anviz_request_id}}
</div>
<div class="oh-input-group" id="apiUrlInput" style="display: none">
{{biometric_form.api_url.errors}}
<label class="oh-label" for="{{biometric_form.api_url.id_for_label}}">{% trans "API Url" %}</label>
{{biometric_form.api_url}}
</div>
<div class="oh-input-group" id="apiKeyInput" style="display: none">
{{biometric_form.api_key.errors}}
<label class="oh-label" for="{{biometric_form.api_key.id_for_label}}">{% trans "API Key" %}</label>
{{biometric_form.api_key}}
</div>
<div class="oh-input-group" id="apiSecretInput" style="display: none">
{{biometric_form.api_secret.errors}}
<label class="oh-label" for="{{biometric_form.api_secret.id_for_label}}">{% trans "API Secret" %}</label>
{{biometric_form.api_secret}}
</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>
</div>
<script>
$(document).ready(function (e) {
$('select[name="machine_type"]').change();
$(".oh-password-input--toggle").click(function () {
var passwordInput = $(this).prev('input[name="cosec_password"]');
var showIcon = $(this).find(".oh-passowrd-input__show-icon");
var hideIcon = $(this).find(".oh-passowrd-input__hide-icon");
if (passwordInput.attr("type") === "password") {
passwordInput.attr("type", "text");
showIcon.addClass("d-none");
hideIcon.removeClass("d-none");
} else {
passwordInput.attr("type", "password");
showIcon.removeClass("d-none");
hideIcon.addClass("d-none");
}
$(document).ready(function (e) {
$('select[name="machine_type"]').change();
$(".oh-password-input--toggle").click(function () {
var passwordInput = $(this).prev('input[name="cosec_password"]');
var showIcon = $(this).find(".oh-passowrd-input__show-icon");
var hideIcon = $(this).find(".oh-passowrd-input__hide-icon");
if (passwordInput.attr("type") === "password") {
passwordInput.attr("type", "text");
showIcon.addClass("d-none");
hideIcon.removeClass("d-none");
} else {
passwordInput.attr("type", "password");
showIcon.removeClass("d-none");
hideIcon.addClass("d-none");
}
});
});
});
</script>

View File

@@ -1,36 +1,32 @@
{% load i18n %}
<div class="oh-modal__dialog-header pb-0">
<span class="oh-modal__dialog-title" id="biometricEmployeesLavel">
{% trans "Add Employee" %}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
<span class="oh-modal__dialog-title" id="biometricEmployeesLavel">
{% trans "Add Employee" %}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body" id="biometricEmployeesModalBody">
<form
hx-post="{%url 'add-biometric-user' device_id%}"
id="biometricEmployeesForm"
class="oh-profile-section pt-0"
>
{% csrf_token %}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{form.employee_ids.id_for_label}}">{% trans "Employees" %}</label>
{{form.employee_ids}}
</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Add" %}
</button>
</div>
</form>
<form hx-post="{%url 'add-biometric-user' device_id%}" id="biometricEmployeesForm" class="oh-profile-section pt-0">
{% csrf_token %}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{form.employee_ids.id_for_label}}">{% trans "Employees" %}</label>
{{form.employee_ids}}
</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Add" %}
</button>
</div>
</form>
</div>
<script>
$(document).ready(function () {
$("#biometricEmployeesForm").submit(function (event) {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
$(document).ready(function () {
$("#biometricEmployeesForm").submit(function (event) {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
});
});
});
</script>

View File

@@ -6,21 +6,21 @@
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for = "{{f.form.machine_type.id_for_label}}">{% trans "Device Type" %}</label>
<label class="oh-label" for="{{f.form.machine_type.id_for_label}}">{% trans "Device Type" %}</label>
{{f.form.machine_type}}
</div>
<div class="oh-input-group">
<label class="oh-label" for = "{{f.form.is_scheduler.id_for_label}}">{% trans "Is Scheduled" %}</label>
<label class="oh-label" for="{{f.form.is_scheduler.id_for_label}}">{% trans "Is Scheduled" %}</label>
{{f.form.is_scheduler}}
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-6">
<div class="oh-input-group">
<label class="oh-label" for = "{{f.form.is_active.id_for_label}}">{% trans "Is Active" %}</label>
<label class="oh-label" for="{{f.form.is_active.id_for_label}}">{% trans "Is Active" %}</label>
{{f.form.is_active}}
</div>
<div class="oh-input-group">
<label class="oh-label" for = "{{f.form.is_live.id_for_label}}">{% trans "Is Live" %}</label>
<label class="oh-label" for="{{f.form.is_live.id_for_label}}">{% trans "Is Live" %}</label>
{{f.form.is_live}}
</div>
</div>

View File

@@ -1,277 +1,199 @@
{% load static %} {% load i18n %} {% load basefilters %} {% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
{% endfor %}
</div>
{% endif %} {% include 'filter_tags.html' %}
{% if devices %}
<div class="oh-layout--grid-3">
{% for device in devices %}
<div
class="oh-kanban-card oh-kanban-card--biometric {% if device.is_live %} oh-kanban-card--orange {% elif device.is_scheduler %} oh-kanban-card--blue {% else %} oh-kanban-card--red {% endif %}"
>
<div class="oh-kanban-card__details">
<span class="oh-kanban-card__title">{{device.name}}</span>
<span class="oh-kanban-card__subtitle d-block"
>{{device.get_machine_type_display}}</span
>
{% if device.machine_type == "zk" or device.machine_type == "cosec" %}
<span class="oh-kanban-card__subtitle d-block"
>{{device.machine_ip}}</span
>
{% if device.machine_type == "zk" %}
<span class="oh-kanban-card__subtitle d-block">{{device.port}}</span>
{% endif %} {% else %}
<span class="oh-kanban-card__subtitle d-block">{{device.api_url}}</span>
{% endif %}
<table>
<tr>
{% if device.machine_type == "zk" %}
<td>
<span class="oh-kanban-card__subtitle d-block"
>{% trans "Activate live capture mode" %}</span
>
</td>
<td>
<div class="oh-switch">
<input
type="checkbox"
class="style-widget oh-switch__checkbox is-live-activate"
{% if device.is_live %}
checked
title="{% trans 'Deactivate' %}"
{% else %}
title="{% trans 'Activate' %}"
{% endif %}
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceTestModal"
name="is_live"
hx-trigger="change"
hx-get="{% url 'biometric-device-live-capture' %}?deviceId={{device.id}}&{{pd}}&page={{devices.number}}&view=card"
hx-target="#BiometricDeviceTestFormTarget"
/>
</div>
</td>
{% endif %}
</tr>
</table>
</div>
<div class="oh-kanban-card__dots">
<div class="oh-dropdown" x-data="{show: false}">
<button
class="oh-btn oh-btn--transparent text-muted p-3"
@click="show = !show"
>
<ion-icon name="ellipsis-vertical-sharp"></ion-icon>
</button>
<div
class="oh-dropdown__menu oh-dropdown__menu--dark-border oh-dropdown__menu--right"
x-show="show"
@click.outside="show = false"
>
<ul class="oh-dropdown__items">
<li class="oh-dropdown__item">
<a
hx-get="{% url 'biometric-device-edit' device.id %}"
class="oh-dropdown__link"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal"
hx-target="#BiometricDeviceFormTarget"
>{% trans "Edit" %}</a
>
</li>
{% if perms.biometric.change_biometricdevices %}
{% if device.is_active %}
<li class="oh-dropdown__item">
<a
hx-confirm="{% trans 'Do you want to archive this device?' %}"
hx-post="{% url 'biometric-device-archive' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList"
class="oh-dropdown__link"
>{% trans "Archive" %}</a
>
</li>
{% else %}
<li class="oh-dropdown__item">
<a
hx-confirm="{% trans 'Do you want to un-archive this device?' %}"
hx-post="{% url 'biometric-device-archive' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList"
class="oh-dropdown__link"
>{% trans "Un-Archive" %}</a
>
</li>
{% endif %}
{% endif %}
{% if perms.biometric.delete_biometricdevices %}
<li class="oh-dropdown__item">
<form
hx-confirm="{% trans 'Do you want to delete this device?' %}"
hx-post="{% url 'biometric-device-delete' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList"
>
{% csrf_token %}
<button class="oh-dropdown__link oh-dropdown__link--danger">
{% trans "Delete" %}
</button>
</form>
</li>
{% endif %}
</ul>
</div>
{% load static %}
{% load i18n %}
{% load basefilters %}
{% include 'filter_tags.html' %}
{% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
</div>
<div class="d-block oh-kanban-card__biometric-actions""
{% if device.machine_type == "anviz" or device.machine_type == "cosec" %}
style='margin-top:53px;'
{% endif %}">
<a
href="#"
hx-get="{% url 'biometric-device-test' device.id %}"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceTestModal"
hx-target="#BiometricDeviceTestFormTarget"
class="oh-checkpoint-badge text-success"
>{% trans "Test" %}
</a>
{% if device.is_scheduler %}
<a
hx-confirm="{% trans 'Do you want to unschedule the device attendance fetching?' %}"
hx-post="{% url 'biometric-device-unschedule' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList"
class="oh-checkpoint-badge text-info"
>{% trans "Unschedule" %}
</a>
{% else %}
<a
href="#"
class="oh-checkpoint-badge text-info"
hx-get="{% url 'biometric-device-schedule' device.id %}"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal"
hx-target="#BiometricDeviceFormTarget"
>{% trans "Schedule" %}</a
>
{% endif %}
{% if device.machine_type == "zk" or device.machine_type == "cosec" %}
<a
href="{% url 'biometric-device-employees' device.id %}"
class="oh-checkpoint-badge text-secondary bio-user-list"
>{% trans "Employee" %}</a
>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if devices %}
<div class="oh-layout--grid-3">
{% for device in devices %}
<div class="oh-kanban-card oh-kanban-card--biometric
{% if device.is_live %}
oh-kanban-card--orange
{% elif device.is_scheduler %}
oh-kanban-card--blue
{% else %}
oh-kanban-card--red
{% endif %}"
>
<div class="oh-kanban-card__details">
<span class="oh-kanban-card__title">{{device.name}}</span>
<span class="oh-kanban-card__subtitle d-block">{{device.get_machine_type_display}}</span>
{% if device.machine_type == "zk" or device.machine_type == "cosec" %}
<span class="oh-kanban-card__subtitle d-block">{{device.machine_ip}}</span>
{% endif %}
{% if device.machine_type == "zk" %}
<span class="oh-kanban-card__subtitle d-block">{{device.port}}</span>
{% else %}
<span class="oh-kanban-card__subtitle d-block">{{device.api_url}}</span>
{% endif %}
<table>
<tr>
{% if device.machine_type == "zk" %}
<td>
<span class="oh-kanban-card__subtitle d-block">{% trans "Activate live capture mode" %}</span>
</td>
<td>
<div class="oh-switch">
<input type="checkbox"
class="style-widget oh-switch__checkbox is-live-activate"
{% if device.is_live %} checked title="{% trans 'Deactivate' %}" {% else %} title="{% trans 'Activate' %}" {% endif %}
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceTestModal" name="is_live" hx-trigger="change"
hx-get="{% url 'biometric-device-live-capture' %}?deviceId={{device.id}}&{{pd}}&page={{devices.number}}&view=card"
hx-target="#BiometricDeviceTestFormTarget" />
</div>
</td>
{% endif %}
</tr>
</table>
</div>
<div class="oh-kanban-card__dots">
<div class="oh-dropdown" x-data="{show: false}">
<button class="oh-btn oh-btn--transparent text-muted p-3" @click="show = !show">
<ion-icon name="ellipsis-vertical-sharp"></ion-icon>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--dark-border oh-dropdown__menu--right" x-show="show"
@click.outside="show = false">
<ul class="oh-dropdown__items">
<li class="oh-dropdown__item">
<a hx-get="{% url 'biometric-device-edit' device.id %}" class="oh-dropdown__link"
data-toggle="oh-modal-toggle" data-target="#BiometricDeviceModal"
hx-target="#BiometricDeviceFormTarget">{% trans "Edit" %}</a>
</li>
{% if perms.biometric.change_biometricdevices %}
{% if device.is_active %}
<li class="oh-dropdown__item">
<a hx-confirm="{% trans 'Do you want to archive this device?' %}"
hx-post="{% url 'biometric-device-archive' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList" class="oh-dropdown__link">{% trans "Archive" %}</a>
</li>
{% else %}
<li class="oh-dropdown__item">
<a hx-confirm="{% trans 'Do you want to un-archive this device?' %}"
hx-post="{% url 'biometric-device-archive' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList" class="oh-dropdown__link">{% trans "Un-Archive" %}</a>
</li>
{% endif %}
{% endif %}
{% if perms.biometric.delete_biometricdevices %}
<li class="oh-dropdown__item">
<form hx-confirm="{% trans 'Do you want to delete this device?' %}"
hx-post="{% url 'biometric-device-delete' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList">
{% csrf_token %}
<button class="oh-dropdown__link oh-dropdown__link--danger">
{% trans "Delete" %}
</button>
</form>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
<div class="d-block oh-kanban-card__biometric-actions" {% if device.machine_type == "anviz" or device.machine_type == "cosec" %} style='margin-top:53px;' {% endif %}>
<a href="#" hx-get="{% url 'biometric-device-test' device.id %}" data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceTestModal" hx-target="#BiometricDeviceTestFormTarget"
class="oh-checkpoint-badge text-success">{% trans "Test" %}
</a>
{% if device.is_scheduler %}
<a hx-confirm="{% trans 'Do you want to unschedule the device attendance fetching?' %}"
hx-post="{% url 'biometric-device-unschedule' device.id %}?{{pd}}&page={{devices.number}}&view=card"
hx-target="#biometricDeviceList" class="oh-checkpoint-badge text-info">{% trans "Unschedule" %}
</a>
{% else %}
<a href="#" class="oh-checkpoint-badge text-info" hx-get="{% url 'biometric-device-schedule' device.id %}"
data-toggle="oh-modal-toggle" data-target="#BiometricDeviceModal"
hx-target="#BiometricDeviceFormTarget">{% trans "Schedule" %}</a>
{% endif %}
{% if device.machine_type == "zk" or device.machine_type == "cosec" %}
<a href="{% url 'biometric-device-employees' device.id %}"
class="oh-checkpoint-badge text-secondary bio-user-list">{% trans "Employee" %}</a>
{% endif %}
</div>
</div>
{% endfor %}
</div>
<div class="oh-pagination" data-pd="{{pd}}">
<span class="oh-pagination__page" data-toggle="modal">
{% trans "Page" %} {{ devices.number }} {% trans "of" %} {{ devices.paginator.num_pages }}.
</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
<input type="number" name="page" class="oh-pagination__input" value="{{devices.number}}"
hx-get="{% url 'search-devices' %}?{{pd}}&view=card" hx-target="#biometricDeviceList" min="1" />
<span class="oh-pagination__label">{% trans "of" %} {{devices.paginator.num_pages}}</span>
</div>
<ul class="oh-pagination__items">
{% if devices.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#biometricDeviceList" hx-get="{% url 'search-devices' %}?{{pd}}&page=1&view=card"
class="oh-pagination__link">{% trans "First" %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page={{ devices.previous_page_number }}&view=card"
class="oh-pagination__link">{% trans "Previous" %}</a>
</li>
{% endif %} {% if devices.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page={{ devices.next_page_number }}&view=card"
class="oh-pagination__link">{% trans "Next" %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page={{ devices.paginator.num_pages }}&view=card"
class="oh-pagination__link">{% trans "Last" %}</a>
</li>
{% endif %}
</ul>
</nav>
</div>
<script>
$(document).ready(function () {
var pd = $(".oh-pagination").attr("data-pd");
var hxVals = JSON.stringify(pd);
$("#addBiometricDevice").attr("hx-vals", `{"pd":${hxVals}}`);
$(".bio-user-list").click(function () {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
});
});
</script>
<div class="oh-modal" id="BiometricDeviceTestModal" role="dialog" aria-labelledby="BiometricDeviceTestModal"
aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px" id="BiometricDeviceTestFormTarget">
{% include "animation.html" %}
</div>
</div>
{% else %}
<div class="oh-wrapper-main">
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img style="width: 150px; height: 150px" src="{% static 'images/ui/devices.png' %}"
class="oh-404__image mb-4" alt="Page not found. 404." />
<h3 class="oh-404__subtitle">
{% trans "No biometric devices found." %}
</h3>
</div>
</div>
</main>
</div>
</div>
{% endfor %}
</div>
<div class="oh-pagination" data-pd="{{pd}}">
<span class="oh-pagination__page" data-toggle="modal">
{% trans "Page" %} {{ devices.number }} {% trans "of" %} {{ devices.paginator.num_pages }}.
</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
<input
type="number"
name="page"
class="oh-pagination__input"
value="{{devices.number}}"
hx-get="{% url 'search-devices' %}?{{pd}}&view=card"
hx-target="#biometricDeviceList"
min="1"
/>
<span class="oh-pagination__label"
>{% trans "of" %} {{devices.paginator.num_pages}}</span
>
</div>
<ul class="oh-pagination__items">
{% if devices.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page=1&view=card"
class="oh-pagination__link"
>{% trans "First" %}</a
>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page={{ devices.previous_page_number }}&view=card"
class="oh-pagination__link"
>{% trans "Previous" %}</a
>
</li>
{% endif %} {% if devices.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page={{ devices.next_page_number }}&view=card"
class="oh-pagination__link"
>{% trans "Next" %}</a
>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?{{pd}}&page={{ devices.paginator.num_pages }}&view=card"
class="oh-pagination__link"
>{% trans "Last" %}</a
>
</li>
{% endif %}
</ul>
</nav>
</div>
<script>
$(document).ready(function () {
var pd = $(".oh-pagination").attr("data-pd");
var hxVals = JSON.stringify(pd);
$("#addBiometricDevice").attr("hx-vals", `{"pd":${hxVals}}`);
$(".bio-user-list").click(function () {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
});
});
</script>
<div
class="oh-modal"
id="BiometricDeviceTestModal"
role="dialog"
aria-labelledby="BiometricDeviceTestModal"
aria-hidden="true"
>
<div
class="oh-modal__dialog"
style="max-width: 550px"
id="BiometricDeviceTestFormTarget"
>
{% include "animation.html" %}
</div>
</div>
{% else %}
<div class="oh-wrapper-main">
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img
style="width: 150px; height: 150px"
src="{% static 'images/ui/devices.png' %}"
class="oh-404__image mb-4"
alt="Page not found. 404."
/>
<h3 class="oh-404__subtitle">
{% trans "No biometric devices found." %}
</h3>
</div>
</div>
</main>
</div>
{% endif %}

View File

@@ -1,133 +1,112 @@
{% load i18n %} {% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
{% load i18n %}
{% if messages %}
<div class="oh-wrapper">
{% for message in messages %}
<div class="oh-alert-container">
<div class="oh-alert oh-alert--animated {{message.tags}}">
{{ message }}
</div>
</div>
{% endfor %}
<script>
setTimeout(function () {
$(".oh-modal__close").click();
}, 1000);
</script>
</div>
</div>
{% endfor %}
<script>
setTimeout(function () {
$(".oh-modal__close").click();
}, 1000);
</script>
</div>
{% endif %}
<div class="oh-modal__dialog-header pb-0">
<h2 class="oh-modal__dialog-title" id="biometricDeviceEditLavel">
{% trans "Edit Biometric Devices" %}
</h2>
<button
type="button"
class="oh-modal__close"
data-dismiss="oh-modal"
aria-label="Close"
{% if messages %}
hx-target="#biometricDeviceList"
hx-get="{% url 'search-devices' %}?page=1&view=card"
{% endif %}
>
<ion-icon name="close-outline"></ion-icon>
</button>
<h2 class="oh-modal__dialog-title" id="biometricDeviceEditLavel">
{% trans "Edit Biometric Devices" %}
</h2>
<button type="button" class="oh-modal__close" data-dismiss="oh-modal" aria-label="Close" {% if messages %}
hx-target="#biometricDeviceList" hx-get="{% url 'search-devices' %}?page=1&view=card" {% endif %}>
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body" id="biometricDeviceEditModalBody">
<form
hx-post="{% url 'biometric-device-edit' device_id %}"
hx-target="#BiometricDeviceFormTarget"
id="biometricDeviceEditForm"
class="oh-profile-section pt-0"
>
{% csrf_token %} {{form.errors}} {{biometric_form.non_field_errors}}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.name.id_for_label}}">{% trans "Name" %}</label>
{{biometric_form.name}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.machine_type.id_for_label}}">{% trans "Device Type" %}</label>
{{biometric_form.machine_type}}
</div>
<div class="oh-input-group" id="machinIpInput" style="display: none">
{{biometric_form.machine_ip.errors}}
<label class="oh-label" for="{{biometric_form.machine_ip.id_for_label}}">{% trans "Machine IP" %}</label>
{{biometric_form.machine_ip}}
</div>
<div class="oh-input-group" id="machinPortInput" style="display: none">
{{biometric_form.port.errors}}
<label class="oh-label" for="{{biometric_form.port.id_for_label}}">{% trans "Port No" %}</label>
{{biometric_form.port}}
</div>
<div class="oh-input-group" id="machinUserName" style="display: none">
{{biometric_form.cosec_username.errors}}
<label class="oh-label" for="{{biometric_form.cosec_username.id_for_label}}">{% trans "Username" %}</label>
{{biometric_form.cosec_username}}
</div>
<div class="oh-input-group" id="machinPassword" style="display: none">
{{biometric_form.cosec_password.errors}}
<label class="oh-label" for="{{biometric_form.cosec_password.id_for_label}}">{% trans "Password" %}</label>
{{biometric_form.cosec_password}}
<button
type="button"
class="oh-btn oh-btn--transparent oh-password-input--toggle"
style="padding-top: 55px"
>
<ion-icon
class="oh-passowrd-input__show-icon"
title="Show Password"
name="eye-outline"
></ion-icon>
<ion-icon
class="oh-passowrd-input__hide-icon d-none"
title="Hide Password"
name="eye-off-outline"
></ion-icon>
</button>
</div>
<div class="oh-input-group" id="apiRequestIDInput" style="display: none">
{{biometric_form.anviz_request_id.errors}}
<label class="oh-label" for="{{biometric_form.anviz_request_id.id_for_label}}">{% trans "Request ID" %}</label>
{{biometric_form.anviz_request_id}}
</div>
<div class="oh-input-group" id="apiUrlInput" style="display: none">
{{biometric_form.api_url.errors}}
<label class="oh-label" for="{{biometric_form.api_url.id_for_label}}">{% trans "API Url" %}</label>
{{biometric_form.api_url}}
</div>
<div class="oh-input-group" id="apiKeyInput" style="display: none">
{{biometric_form.api_key.errors}}
<label class="oh-label" for="{{biometric_form.api_key.id_for_label}}">{% trans "API Key" %}</label>
{{biometric_form.api_key}}
</div>
<div class="oh-input-group" id="apiSecretInput" style="display: none">
{{biometric_form.api_secret.errors}}
<label class="oh-label" for="{{biometric_form.api_secret.id_for_label}}">{% trans "API Secret" %}</label>
{{biometric_form.api_secret}}
</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>
<form hx-post="{% url 'biometric-device-edit' device_id %}" hx-target="#BiometricDeviceFormTarget"
id="biometricDeviceEditForm" class="oh-profile-section pt-0">
{% csrf_token %} {{form.errors}} {{biometric_form.non_field_errors}}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.name.id_for_label}}">{% trans "Name" %}</label>
{{biometric_form.name}}
</div>
<div class="oh-input-group">
<label class="oh-label" for="{{biometric_form.machine_type.id_for_label}}">{% trans "Device Type" %}</label>
{{biometric_form.machine_type}}
</div>
<div class="oh-input-group" id="machinIpInput" style="display: none">
{{biometric_form.machine_ip.errors}}
<label class="oh-label" for="{{biometric_form.machine_ip.id_for_label}}">{% trans "Machine IP" %}</label>
{{biometric_form.machine_ip}}
</div>
<div class="oh-input-group" id="machinPortInput" style="display: none">
{{biometric_form.port.errors}}
<label class="oh-label" for="{{biometric_form.port.id_for_label}}">{% trans "Port No" %}</label>
{{biometric_form.port}}
</div>
<div class="oh-input-group" id="machinUserName" style="display: none">
{{biometric_form.cosec_username.errors}}
<label class="oh-label" for="{{biometric_form.cosec_username.id_for_label}}">{% trans "Username" %}</label>
{{biometric_form.cosec_username}}
</div>
<div class="oh-input-group" id="machinPassword" style="display: none">
{{biometric_form.cosec_password.errors}}
<label class="oh-label" for="{{biometric_form.cosec_password.id_for_label}}">{% trans "Password" %}</label>
{{biometric_form.cosec_password}}
<button type="button" class="oh-btn oh-btn--transparent oh-password-input--toggle"
style="padding-top: 55px">
<ion-icon class="oh-passowrd-input__show-icon" title="Show Password" name="eye-outline"></ion-icon>
<ion-icon class="oh-passowrd-input__hide-icon d-none" title="Hide Password"
name="eye-off-outline"></ion-icon>
</button>
</div>
<div class="oh-input-group" id="apiRequestIDInput" style="display: none">
{{biometric_form.anviz_request_id.errors}}
<label class="oh-label" for="{{biometric_form.anviz_request_id.id_for_label}}">{% trans "Request ID" %}</label>
{{biometric_form.anviz_request_id}}
</div>
<div class="oh-input-group" id="apiUrlInput" style="display: none">
{{biometric_form.api_url.errors}}
<label class="oh-label" for="{{biometric_form.api_url.id_for_label}}">{% trans "API Url" %}</label>
{{biometric_form.api_url}}
</div>
<div class="oh-input-group" id="apiKeyInput" style="display: none">
{{biometric_form.api_key.errors}}
<label class="oh-label" for="{{biometric_form.api_key.id_for_label}}">{% trans "API Key" %}</label>
{{biometric_form.api_key}}
</div>
<div class="oh-input-group" id="apiSecretInput" style="display: none">
{{biometric_form.api_secret.errors}}
<label class="oh-label" for="{{biometric_form.api_secret.id_for_label}}">{% trans "API Secret" %}</label>
{{biometric_form.api_secret}}
</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Save" %}
</button>
</div>
</form>
</div>
<script>
$(document).ready(function (e) {
$('select[name="machine_type"]').change();
$(".oh-password-input--toggle").click(function () {
var passwordInput = $(this).prev('input[name="cosec_password"]');
var showIcon = $(this).find(".oh-passowrd-input__show-icon");
var hideIcon = $(this).find(".oh-passowrd-input__hide-icon");
if (passwordInput.attr("type") === "password") {
passwordInput.attr("type", "text");
showIcon.addClass("d-none");
hideIcon.removeClass("d-none");
} else {
passwordInput.attr("type", "password");
showIcon.removeClass("d-none");
hideIcon.addClass("d-none");
}
$(document).ready(function (e) {
$('select[name="machine_type"]').change();
$(".oh-password-input--toggle").click(function () {
var passwordInput = $(this).prev('input[name="cosec_password"]');
var showIcon = $(this).find(".oh-passowrd-input__show-icon");
var hideIcon = $(this).find(".oh-passowrd-input__hide-icon");
if (passwordInput.attr("type") === "password") {
passwordInput.attr("type", "text");
showIcon.addClass("d-none");
hideIcon.removeClass("d-none");
} else {
passwordInput.attr("type", "password");
showIcon.removeClass("d-none");
hideIcon.addClass("d-none");
}
});
});
});
</script>

View File

@@ -1,75 +1,62 @@
{% load i18n %}
<div class="oh-modal__dialog-header">
<span class="oh-modal__dialog-title" id="biometricEmployeesLavel">
{% trans "Edit COSEC User" %}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body" id="biometricEmployeesModalBody">
<form
hx-post="{%url 'edit-cosec-user' user_id=user_id device_id=device_id%}"
hx-target="#objectUpdateModalTarget"
id="biometricEmployeesForm"
class="oh-profile-section pt-2"
>
{% csrf_token %} {% if form.errors %}
<!-- form errors -->
{% for error in form.non_field_errors %}
<ul class="errorlist nonfield">
<li>{{ error }}</li>
</ul>
{% endfor %}
{% endif %}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="row">
<div class="col-sm-6">
<div class="oh-input-group">
<label class="oh-label" for="{{form.name.id_for_label}}">{% trans "Name" %}</label>
{{form.name}}
</div>
</div>
<div class="col-sm-6">
<label class="oh-label" for="{{form.user_active.id_for_label}}">{% trans "User Active" %}</label>
<div class="oh-switch">{{form.user_active}}</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<label class="oh-label" for="{{form.by_pass_finger.id_for_label}}">{% trans "By-Pass-Biometric" %}</label>
<div class="oh-switch">{{form.by_pass_finger}}</div>
</div>
<div class="col-sm-6">
<label class="oh-label" for="{{form.vip.id_for_label}}">{% trans "VIP" %}</label>
<div class="oh-switch">{{form.vip}}</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<label class="oh-label" for="{{form.validity_enable.id_for_label}}">{% trans "Validity Enable" %}</label>
<div class="oh-switch">{{form.validity_enable}}</div>
</div>
<div class="col-sm-6">
<label class="oh-label" for="{{form.validity_end_date.id_for_label}}">{% trans "Validity End Date" %}</label>
<div class="oh-input-group">{{form.validity_end_date}}</div>
</div>
</div>
</div>
<div class="d-flex flex-row-reverse pt-4">
<button class="oh-btn oh-btn--secondary oh-btn--small bio-user-add">
{% trans "Save" %}
</button>
</div>
</form>
<span class="oh-modal__dialog-title" id="biometricEmployeesLavel">
{% trans "Edit COSEC User" %}
</span>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
{% comment %}
<script>
$(document).ready(function () {
$("#biometricEmployeesForm").submit(function (event) {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
});
});
</script>
{% endcomment %}
<div class="oh-modal__dialog-body" id="biometricEmployeesModalBody">
<form hx-post="{%url 'edit-cosec-user' user_id=user_id device_id=device_id%}" hx-target="#objectUpdateModalTarget"
id="biometricEmployeesForm" class="oh-profile-section pt-2">
{% csrf_token %}
{% if form.errors %}
{% for error in form.non_field_errors %}
<ul class="errorlist nonfield">
<li>{{ error }}</li>
</ul>
{% endfor %}
{% endif %}
<div class="col-sm-12 col-md-12 col-lg-12">
<div class="row">
<div class="col-sm-6">
<div class="oh-input-group">
<label class="oh-label" for="{{form.name.id_for_label}}">{% trans "Name" %}</label>
{{form.name}}
</div>
</div>
<div class="col-sm-6">
<label class="oh-label" for="{{form.user_active.id_for_label}}">{% trans "User Active" %}</label>
<div class="oh-switch">{{form.user_active}}</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<label class="oh-label" for="{{form.by_pass_finger.id_for_label}}">{% trans "By-Pass-Biometric" %}</label>
<div class="oh-switch">{{form.by_pass_finger}}</div>
</div>
<div class="col-sm-6">
<label class="oh-label" for="{{form.vip.id_for_label}}">{% trans "VIP" %}</label>
<div class="oh-switch">{{form.vip}}</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<label class="oh-label" for="{{form.validity_enable.id_for_label}}">{% trans "Validity Enable" %}</label>
<div class="oh-switch">{{form.validity_enable}}</div>
</div>
<div class="col-sm-6">
<label class="oh-label" for="{{form.validity_end_date.id_for_label}}">{% trans "Validity End Date" %}</label>
<div class="oh-input-group">{{form.validity_end_date}}</div>
</div>
</div>
</div>
<div class="d-flex flex-row-reverse pt-4">
<button class="oh-btn oh-btn--secondary oh-btn--small bio-user-add">
{% trans "Save" %}
</button>
</div>
</form>
</div>

View File

@@ -1,14 +1,12 @@
{% load static %}{% load i18n %}
<div
class="oh-wrapper-main"
>
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img style=" width: 150px;height: 150px;" src="{% static 'images/ui/devices.png' %}" class="oh-404__image mb-4" alt="Page not found. 404."/>
<h3 class="oh-404__subtitle">{% trans "No biometric devices for attendance have been added yet." %}</h3>
</div>
</div>
</main>
<div class="oh-wrapper-main">
<main :class="sidebarOpen ? 'oh-main__sidebar-visible' : ''">
<div class="oh-wrapper">
<div class="oh-404">
<img style=" width: 150px;height: 150px;" src="{% static 'images/ui/devices.png' %}"
class="oh-404__image mb-4" alt="Page not found. 404." />
<h3 class="oh-404__subtitle">{% trans "No biometric devices for attendance have been added yet." %}</h3>
</div>
</div>
</main>
</div>

View File

@@ -1,33 +1,37 @@
{% extends 'settings.html' %} {% load i18n %} {% block settings %}
{% extends 'settings.html' %}
{% load i18n %}
{% block settings %}
<div class="oh-inner-sidebar-content mb-4">
<div class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center">
<div class="oh-inner-sidebar-content__header d-flex justify-content-between align-items-center">
<h2 class="oh-inner-sidebar-content__title">{% trans "Biometric Attendance" %}</h2>
</div>
<div class="oh-switch ms-3">{% trans "Activate Biometric Attendance" %}&nbsp;&nbsp;&nbsp;&nbsp;: &nbsp;&nbsp;&nbsp;&nbsp;
<div class="oh-switch ms-3">{% trans "Activate Biometric Attendance" %}&nbsp;&nbsp;&nbsp;&nbsp;:
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="is_installed" data-widget="style-widget" class="style-widget oh-switch__checkbox"
{% if biometric.is_installed %} checked title="{% trans 'Activated' %}" {% else %} title="{% trans 'Activate' %}" {% endif %}
id="is_installed">
{% if biometric.is_installed %} checked title="{% trans 'Activated' %}" {% else %}
title="{% trans 'Activate' %}" {% endif %} id="is_installed">
</div>
</div>
<script>
$(document).ready(function(){
$('#is_installed').on('change',function(){
var boolean = $(this).is(":checked")
$.ajax({
type: "GET",
url: "/settings/activate-biometric-attendance",
data: {
is_installed: boolean,
},
success: function (response, textStatus, jqXHR) {
if (jqXHR.status === 200) {
location.reload();
} else {
}
},
});
$(document).ready(function () {
$('#is_installed').on('change', function () {
var boolean = $(this).is(":checked")
$.ajax({
type: "GET",
url: "/settings/activate-biometric-attendance",
data: {
is_installed: boolean,
},
success: function (response, textStatus, jqXHR) {
if (jqXHR.status === 200) {
location.reload();
} else {
}
},
});
});
});
});
</script>
{% endblock settings %}

View File

@@ -1,185 +1,155 @@
{% load i18n %}
<div class="oh-sticky-table">
<div class="oh-sticky-table__table oh-table--sortable">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th" style="width: 10px">
<div class="centered-div">
<input
type="checkbox"
class="oh-input oh-input__checkbox all-bio-device"
title="Select All"
id="allBioEmployee"
/>
</div>
</div>
<div class="oh-sticky-table__th">{% trans "Device" %}</div>
<div class="oh-sticky-table__th">{% trans "Machine IP" %}</div>
<div class="oh-sticky-table__th">{% trans "Port No." %}</div>
<div class="oh-sticky-table__th oh-sticky-table__right">
{% trans "Actions" %}
</div>
</div>
</div>
{% for device in devices %}
<div class="oh-sticky-table__tbody ui-sortable">
<div class="oh-sticky-table__tr ui-sortable-handle">
<div class="oh-sticky-table__sd">
<div class="centered-div">
<input
type="checkbox"
id="{{device.id}}"
class="form-check-input all-bio-device-row"
/>
</div>
</div>
<div class="oh-sticky-table__td">{{device.name}}</div>
<div class="oh-sticky-table__td">{{device.machine_ip}}</div>
<div class="oh-sticky-table__td">{{device.port}}</div>
<div class="oh-sticky-table__td oh-sticky-table__right">
{% comment %} <div class="oh-btn-group"> {% endcomment %}
{% comment %} <div class="oh-kanban-card__dots"> {% endcomment %}
<div class="oh-dropdown" x-data="{show: false}">
<button class="oh-btn oh-btn--transparent text-muted p-3" @click="show = !show" title={% trans "Actions" %}>
<ion-icon name="ellipsis-vertical-sharp" title="{% trans 'Options' %}" role="img" class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--dark-border oh-dropdown__menu--right" x-show="show" @click.outside="show = false" style="display: none;">
<ul class="oh-dropdown__items">
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a
hx-get="{% url 'biometric-device-test' device.id %}"
class="oh-dropdown__link"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceTestModal"
hx-target="#BiometricDeviceTestFormTarget"
>
{% trans "Test" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a
href="{% url 'biometric-device-employees' device.id %}"
class="oh-dropdown__link"
>
{% trans "Employees" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a
class="oh-dropdown__link"
data-toggle="oh-modal-toggle"
hx-target="#ScheduleDevice"
>
{% trans "Schedule" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a
hx-get="{% url 'biometric-device-edit' device.id %}"
class="oh-dropdown__link"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal"
hx-target="#BiometricDeviceFormTarget"
>
{% trans "Edit" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
{% if device.is_active %}
<li class="oh-dropdown__item">
<a href="{% url 'biometric-device-archive' device.id %}" onclick="return confirm('{% trans "Do you want to archive this device?" %}')" class="oh-dropdown__link">{% trans "Archive" %}</a>
</li>
{% else %}
<li class="oh-dropdown__item">
<a href="{% url 'biometric-device-archive' device.id %}" onclick="return confirm('{% trans "Do you want to un-archive this device?" %}')" class="oh-dropdown__link">{% trans "Un-Archive" %}</a>
</li>
{% endif %}
{% endif %}
{% if perms.biometric.delete_biometricdevices %}
<li class="oh-dropdown__item">
<form action="{% url 'biometric-device-delete' device.id %}" onsubmit="return confirm('{% trans "Do you want to delete this device?" %}')" method="post">
{% csrf_token %}
<button class="oh-dropdown__link oh-dropdown__link--danger ">{% trans "Delete" %}</button>
</form>
</li>
{% endif %}
</ul>
<div class="oh-sticky-table__table oh-table--sortable">
<div class="oh-sticky-table__thead">
<div class="oh-sticky-table__tr">
<div class="oh-sticky-table__th" style="width: 10px">
<div class="centered-div">
<input type="checkbox" class="oh-input oh-input__checkbox all-bio-device" title="{% trans 'Select All' %}" id="allBioEmployee" />
</div>
</div>
</div>
{% comment %} </div> {% endcomment %}
{% comment %} </div> {% endcomment %}
<div class="oh-sticky-table__th">{% trans "Device" %}</div>
<div class="oh-sticky-table__th">{% trans "Machine IP" %}</div>
<div class="oh-sticky-table__th">{% trans "Port No." %}</div>
<div class="oh-sticky-table__th oh-sticky-table__right">
{% trans "Actions" %}
</div>
</div>
</div>
</div>
{% for device in devices %}
<div class="oh-sticky-table__tbody ui-sortable">
<div class="oh-sticky-table__tr ui-sortable-handle">
<div class="oh-sticky-table__sd">
<div class="centered-div">
<input type="checkbox" id="{{device.id}}" class="form-check-input all-bio-device-row" />
</div>
</div>
<div class="oh-sticky-table__td">{{device.name}}</div>
<div class="oh-sticky-table__td">{{device.machine_ip}}</div>
<div class="oh-sticky-table__td">{{device.port}}</div>
<div class="oh-sticky-table__td oh-sticky-table__right">
{% comment %} <div class="oh-btn-group"> {% endcomment %}
{% comment %} <div class="oh-kanban-card__dots"> {% endcomment %}
<div class="oh-dropdown" x-data="{show: false}">
<button class="oh-btn oh-btn--transparent text-muted p-3" @click="show = !show" title={%
trans "Actions" %}>
<ion-icon name="ellipsis-vertical-sharp" title="{% trans 'Options' %}" role="img"
class="md hydrated" aria-label="ellipsis vertical sharp"></ion-icon>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--dark-border oh-dropdown__menu--right"
x-show="show" @click.outside="show = false" style="display: none;">
<ul class="oh-dropdown__items">
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a hx-get="{% url 'biometric-device-test' device.id %}"
class="oh-dropdown__link" data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceTestModal"
hx-target="#BiometricDeviceTestFormTarget">
{% trans "Test" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a href="{% url 'biometric-device-employees' device.id %}"
class="oh-dropdown__link">
{% trans "Employees" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a class="oh-dropdown__link" data-toggle="oh-modal-toggle"
hx-target="#ScheduleDevice">
{% trans "Schedule" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
<li class="oh-dropdown__item">
<a hx-get="{% url 'biometric-device-edit' device.id %}"
class="oh-dropdown__link" data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal"
hx-target="#BiometricDeviceFormTarget">
{% trans "Edit" %}
</a>
</li>
{% endif %}
{% if perms.biometric.change_biometricdevices %}
{% if device.is_active %}
<li class="oh-dropdown__item">
<a href="{% url 'biometric-device-archive' device.id %}"
onclick="return confirm('{% trans " Do you want to archive this device?"
%}')" class="oh-dropdown__link">{% trans "Archive" %}</a>
</li>
{% else %}
<li class="oh-dropdown__item">
<a href="{% url 'biometric-device-archive' device.id %}"
onclick="return confirm('{% trans " Do you want to un-archive this
device?" %}')" class="oh-dropdown__link">{% trans "Un-Archive" %}</a>
</li>
{% endif %}
{% endif %}
{% if perms.biometric.delete_biometricdevices %}
<li class="oh-dropdown__item">
<form action="{% url 'biometric-device-delete' device.id %}"
onsubmit="return confirm('{% trans " Do you want to delete this device?"
%}')" method="post">
{% csrf_token %}
<button class="oh-dropdown__link oh-dropdown__link--danger ">{% trans
"Delete" %}</button>
</form>
</li>
{% endif %}
</ul>
</div>
</div>
{% comment %}
</div> {% endcomment %}
{% comment %} </div> {% endcomment %}
</div>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% comment %}
<div class="oh-pagination">
<span class="oh-pagination__page">
{% trans "Page" %} {{ employees.number }} {% trans "of" %} {{
employees.paginator.num_pages }}.
</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
<input
type="number"
name="page"
class="oh-pagination__input"
value="{{employees.number}}"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&device={{device_id}}"
hx-target="#section"
min="1"
/>
<span class="oh-pagination__label"
>{% trans "of" %} {{employees.paginator.num_pages}}</span
>
</div>
<ul class="oh-pagination__items">
{% if employees.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page=1&device={{device_id}}"
class="oh-pagination__link"
>{% trans "First" %}</a
>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page={{ employees.previous_page_number }}&device={{device_id}}"
class="oh-pagination__link"
>{% trans "Previous" %}</a
>
</li>
{% endif %} {% if employees.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page={{ employees.next_page_number }}&device={{device_id}}"
class="oh-pagination__link"
>{% trans "Next" %}</a
>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a
hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page={{ employees.paginator.num_pages }}&device={{device_id}}"
class="oh-pagination__link"
>{% trans "Last" %}</a
>
</li>
{% endif %}
</ul>
</nav>
</div> {% endcomment %}
<span class="oh-pagination__page">
{% trans "Page" %} {{ employees.number }} {% trans "of" %} {{ employees.paginator.num_pages }}.
</span>
<nav class="oh-pagination__nav">
<div class="oh-pagination__input-container me-3">
<span class="oh-pagination__label me-1">{% trans "Page" %}</span>
<input type="number" name="page" class="oh-pagination__input" value="{{employees.number}}"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&device={{device_id}}" hx-target="#section"
min="1" />
<span class="oh-pagination__label">{% trans "of" %} {{employees.paginator.num_pages}}</span>
</div>
<ul class="oh-pagination__items">
{% if employees.has_previous %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page=1&device={{device_id}}"
class="oh-pagination__link">{% trans "First" %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page={{ employees.previous_page_number }}&device={{device_id}}"
class="oh-pagination__link">{% trans "Previous" %}</a>
</li>
{% endif %} {% if employees.has_next %}
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page={{ employees.next_page_number }}&device={{device_id}}"
class="oh-pagination__link">{% trans "Next" %}</a>
</li>
<li class="oh-pagination__item oh-pagination__item--wide">
<a hx-target="#section"
hx-get="{% url 'search-device-in-device' %}?{{pd}}&view=list&page={{ employees.paginator.num_pages }}&device={{device_id}}"
class="oh-pagination__link">{% trans "Last" %}</a>
</li>
{% endif %}
</ul>
</nav>
</div>

View File

@@ -1,168 +1,56 @@
{% load i18n %}{% load static %}
<section class="oh-main__topbar" x-data="{searchShow: false}">
<div class="oh-main__titlebar oh-main__titlebar--left">
<div class="oh-main__titlebar-title fw-bold mb-0 text-dark">
{% trans "Biometric Devices" %}
<div class="oh-main__titlebar oh-main__titlebar--left">
<div class="oh-main__titlebar-title fw-bold mb-0 text-dark">
{% trans "Biometric Devices" %}
</div>
<div style="display: ruby">
<a class="oh-main__titlebar-search-toggle" role="button" aria-label="Toggle Search"
@click="searchShow = !searchShow">
<ion-icon name="search-outline" class="oh-main__titlebar-serach-icon"></ion-icon>
</a>
<a class="oh-main__titlebar-search-toggle oh-btn oh-btn--secondary" role="button"
data-toggle="oh-modal-toggle" data-target="#BiometricDeviceModal"
hx-get="{% url 'biometric-device-add' %}" hx-target="#BiometricDeviceFormTarget">
<ion-icon name="add-outline" class="oh-main__titlebar-serach-icon m-0"></ion-icon>
</a>
</div>
</div>
<div style="display: ruby">
<a
class="oh-main__titlebar-search-toggle"
role="button"
aria-label="Toggle Search"
@click="searchShow = !searchShow"
>
<ion-icon
name="search-outline"
class="oh-main__titlebar-serach-icon"
></ion-icon>
</a>
<a
class="oh-main__titlebar-search-toggle oh-btn oh-btn--secondary"
role="button"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal"
hx-get="{% url 'biometric-device-add' %}"
hx-target="#BiometricDeviceFormTarget"
>
<ion-icon
name="add-outline"
class="oh-main__titlebar-serach-icon m-0"
></ion-icon>
</a>
</div>
</div>
<form
hx-get='{% url "search-devices" %}'
hx-swap="innerHTML"
hx-target="#biometricDeviceList"
id="filterForm"
class="d-flex"
>
<div class="oh-main__titlebar oh-main__titlebar--right">
<div
class="oh-input-group oh-input__search-group"
:class="searchShow ? 'oh-input__search-group--show' : ''"
>
<ion-icon
name="search-outline"
class="oh-input-group__icon oh-input-group__icon--left"
></ion-icon>
<input
type="text"
class="oh-input oh-input__icon"
aria-label="Search Input"
id="devices-search"
name="search"
placeholder="{% trans 'Search' %}"
onkeyup="$('.filterButton')[0].click()"
/>
</div>
{% comment %}
<ul class="oh-view-types ml-2" style="margin-bottom: 0" id="view-type">
<li class="oh-view-type devices-view-type" data-view="list">
<a id = 'list' hx-get="{% url 'search-devices' %}?view=list"
hx-target='#section' title = {% trans "List" %} class="oh-btn
oh-btn--view {% if request.GET.view == 'list' %} oh-btn--view-active
{% endif %}" >
<ion-icon name="list-outline"></ion-icon>
</a>
</li>
<li class="oh-view-type devices-view-type" data-view="card">
<a id="card" hx-get="{% url 'search-devices' %}?view=card"
hx-target='#section' class="oh-btn oh-btn--view {% if request.GET.view
!= 'list' %} oh-btn--view-active {% endif %}" title = {% trans "Card"
%} >
<ion-icon name="grid-outline"></ion-icon>
</a>
</li>
</ul>
{% endcomment %}
<div class="oh-main__titlebar-button-container">
<div class="oh-dropdown" x-data="{open: false}">
<button
class="oh-btn"
@click="open = !open"
onclick="event.preventDefault()"
>
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}
<div id="filterCount"></div>
</button>
<div
class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4"
x-show="open"
@click.outside="open = false"
id="biometricDeviceFilter"
style="display: none; width: 550px"
>
{% include 'biometric/biometric_device_filter.html' %}
</div>
</div>
{% comment %}
<div class="oh-btn-group ml-2">
<div class="oh-dropdown" x-data="{open: false}">
<button
class="oh-btn oh-btn--dropdown oh-btn oh-btn--shadow"
@click="open = !open"
@click.outside="open = false"
>
{% trans "Actions" %}
</button>
<div
class="oh-dropdown__menu oh-dropdown__menu--right"
x-show="open"
style="display: none"
>
<ul class="oh-dropdown__items">
{% if perms.delete_candidates %}
<li class="oh-dropdown__item">
<a href="#" class="oh-dropdown__link" id="archiveDevices"
>{% trans "Archive" %}</a
>
</li>
{% endif %} {% if perms.delete_candidates %}
<li class="oh-dropdown__item">
<a href="#" class="oh-dropdown__link" id="unArchiveDevices"
>{% trans "Un-Archive" %}</a
>
</li>
{% endif %} {% if perms.delete_candidates %}
<li class="oh-dropdown__item">
<a
href="#"
class="oh-dropdown__link oh-dropdown__link--danger"
id="deleteDevices"
>{% trans "Delete" %}</a
>
</li>
{% endif %}
</ul>
<form hx-get='{% url "search-devices" %}' hx-swap="innerHTML" hx-target="#biometricDeviceList" id="filterForm" class="d-flex">
<div class="oh-main__titlebar oh-main__titlebar--right">
<div class="oh-input-group oh-input__search-group"
:class="searchShow ? 'oh-input__search-group--show' : ''">
<ion-icon name="search-outline" class="oh-input-group__icon oh-input-group__icon--left"></ion-icon>
<input type="text" class="oh-input oh-input__icon" aria-label="Search Input" id="devices-search"
name="search" placeholder="{% trans 'Search' %}" onkeyup="$('.filterButton')[0].click()" />
</div>
<div class="oh-main__titlebar-button-container">
<div class="oh-dropdown" x-data="{open: false}">
<button class="oh-btn" @click="open = !open" onclick="event.preventDefault()">
<ion-icon name="filter" class="mr-1"></ion-icon>{% trans "Filter" %}
<div id="filterCount"></div>
</button>
<div class="oh-dropdown__menu oh-dropdown__menu--right oh-dropdown__filter p-4" x-show="open"
@click.outside="open = false" id="biometricDeviceFilter" style="display: none; width: 550px">
{% include 'biometric/biometric_device_filter.html' %}
</div>
</div>
<div class="oh-btn-group ml-2">
<div class="oh-dropdown">
{% if perms.recruitment.add_candidate %}
<button class="oh-btn oh-btn--secondary" id="addBiometricDevice" data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal" hx-get="{% url 'biometric-device-add' %}"
hx-target="#BiometricDeviceFormTarget">
<ion-icon name="add-sharp" class="mr-1"></ion-icon>
{% trans "Add" %}
</button>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endcomment %}
<div class="oh-btn-group ml-2">
<div class="oh-dropdown">
{% if perms.recruitment.add_candidate %}
<button
class="oh-btn oh-btn--secondary"
id="addBiometricDevice"
data-toggle="oh-modal-toggle"
data-target="#BiometricDeviceModal"
hx-get="{% url 'biometric-device-add' %}"
hx-target="#BiometricDeviceFormTarget"
>
<ion-icon name="add-sharp" class="mr-1"></ion-icon>
{% trans "Add" %}
</button>
{% endif %}
</div>
</div>
</div>
</div>
</form>
</form>
</section>
<div
id="filterTagContainerSectionNav"
class="oh-titlebar-container__filters mb-2 mt-0 oh-wrapper"
></div>
<div id="filterTagContainerSectionNav" class="oh-titlebar-container__filters mb-2 mt-0 oh-wrapper"></div>

View File

@@ -1,36 +1,32 @@
{% load i18n %}
<div class="oh-modal__dialog-header pb-0">
<h2 class="oh-modal__dialog-title" id="scheduleDeviceLavel">
{% trans "Schedule Biometric Device" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
<h2 class="oh-modal__dialog-title" id="scheduleDeviceLavel">
{% trans "Schedule Biometric Device" %}
</h2>
<button class="oh-modal__close" aria-label="Close">
<ion-icon name="close-outline"></ion-icon>
</button>
</div>
<div class="oh-modal__dialog-body" id="scheduleDeviceModalBody">
<form
id="biometricDeviceScheduleForm"
hx-post="{% url 'biometric-device-schedule' device_id %}"
hx-target="#BiometricDeviceFormTarget"
class="oh-profile-section class p-3 pt-0"
>
{% csrf_token %}
<div class="col-sm-12 col-md-12 col-lg-12">
{{scheduler_form.scheduler_duration.errors}}
<label class="oh-label" for="{{scheduler_form.scheduler_duration.id_for_label}}">{% trans "Interval duration" %}</label>
<div class="oh-input-group">{{scheduler_form.scheduler_duration}}</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Schedule" %}
</button>
</div>
</form>
<form id="biometricDeviceScheduleForm" hx-post="{% url 'biometric-device-schedule' device_id %}"
hx-target="#BiometricDeviceFormTarget" class="oh-profile-section class p-3 pt-0">
{% csrf_token %}
<div class="col-sm-12 col-md-12 col-lg-12">
{{scheduler_form.scheduler_duration.errors}}
<label class="oh-label" for="{{scheduler_form.scheduler_duration.id_for_label}}">{% trans "Interval duration" %}</label>
<div class="oh-input-group">{{scheduler_form.scheduler_duration}}</div>
</div>
<div class="oh-modal__dialog-footer p-0 pt-3">
<button type="submit" class="oh-btn oh-btn--secondary oh-btn--shadow">
{% trans "Schedule" %}
</button>
</div>
</form>
</div>
<script>
$("#biometricDeviceScheduleForm").submit(function (event) {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
$("#BiometricDeviceModal").removeClass("oh-modal--show");
});
$("#biometricDeviceScheduleForm").submit(function (event) {
$("#BiometricDeviceTestModal").toggleClass("oh-modal--show");
$("#BiometricDeviceModal").removeClass("oh-modal--show");
});
</script>

View File

@@ -1,116 +1,83 @@
{% extends 'index.html' %} {% block content %} {% load static %} {% load i18n %}
<div class="oh-wrapper">
{% include 'biometric/nav_biometric_devices.html' %}
<div
class="oh-checkpoint-badge mb-2"
id="selectedDevices"
data-ids="[]"
data-clicked=""
style="display: none"
></div>
{% include 'biometric/nav_biometric_devices.html' %}
<div class="oh-checkpoint-badge mb-2" id="selectedDevices" data-ids="[]" data-clicked="" style="display: none">
</div>
<div class="d-flex flex-row-reverse">
<span
class="m-3"
onclick="$('[name=hired]').val('false'); $('[name=hired]').first().change(); $('.filterButton').click()"
style="cursor: pointer"
>
<span
class="oh-dot oh-dot--small me-1"
style="background-color: red"
></span>
{% trans "Not-Connected" %}
</span>
<span
class="m-3"
onclick="$('[name=is_scheduler]').val('true');$('[name=is_scheduler]').first().change(); $('.filterButton').click()"
style="cursor: pointer"
>
<span
class="oh-dot oh-dot--small me-1"
style="background-color: rgb(103, 171, 238)"
></span>
{% trans "Scheduled" %}
</span>
<span
class="m-3"
onclick="$('[name=is_live]').val('true');$('[name=is_live]').first().change(); $('.filterButton').click()"
style="cursor: pointer"
>
<span
class="oh-dot oh-dot--small me-1"
style="background-color: orange"
></span>
{% trans "Live Capture" %}
</span>
</div>
<div id="biometricDeviceList">
{% if devices %}
{% comment %} {% if view_type == 'list' %}
{% include 'attendance/biometric/list_biometric_devices.html' %}
{% else %} {% endcomment %}
{% include 'biometric/card_biometric_devices.html' %}
{% comment %} {% endif %} {% endcomment %}
{% else %}
{% include 'biometric/empty_view_biometric.html' %}
{% endif %}
</div>
<div
class="oh-modal"
id="BiometricDeviceModal"
role="dialog"
aria-labelledby="BiometricDeviceModal"
aria-hidden="true"
>
<div
class="oh-modal__dialog"
style="max-width: 550px"
id="BiometricDeviceFormTarget"
></div>
</div>
<div class="d-flex flex-row-reverse">
<span class="m-3"
onclick="$('[name=hired]').val('false'); $('[name=hired]').first().change(); $('.filterButton').click()"
style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color: red"></span>
{% trans "Not-Connected" %}
</span>
<span class="m-3"
onclick="$('[name=is_scheduler]').val('true');$('[name=is_scheduler]').first().change(); $('.filterButton').click()"
style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color: rgb(103, 171, 238)"></span>
{% trans "Scheduled" %}
</span>
<span class="m-3"
onclick="$('[name=is_live]').val('true');$('[name=is_live]').first().change(); $('.filterButton').click()"
style="cursor: pointer">
<span class="oh-dot oh-dot--small me-1" style="background-color: orange"></span>
{% trans "Live Capture" %}
</span>
</div>
<div id="biometricDeviceList">
{% if devices %}
{% include 'biometric/card_biometric_devices.html' %}
{% else %}
{% include 'biometric/empty_view_biometric.html' %}
{% endif %}
</div>
<div class="oh-modal" id="BiometricDeviceModal" role="dialog" aria-labelledby="BiometricDeviceModal"
aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px" id="BiometricDeviceFormTarget"></div>
</div>
</div>
<script>
function machineTypeChange(selectElement) {
var machineType = selectElement.val();
if (machineType === "anviz") {
$("#machinIpInput").hide();
$("#machinPortInput").hide();
$("#machinUserName").hide();
$("#machinPassword").hide();
$("#apiRequestIDInput").show();
$("#apiUrlInput").show();
$("#apiKeyInput").show();
$("#apiSecretInput").show();
} else if (machineType === "zk") {
$("#machinIpInput").show();
$("#machinPortInput").show();
$("#machinUserName").hide();
$("#machinPassword").hide();
$("#apiRequestIDInput").hide();
$("#apiUrlInput").hide();
$("#apiKeyInput").hide();
$("#apiSecretInput").hide();
function machineTypeChange(selectElement) {
var machineType = selectElement.val();
if (machineType === "anviz") {
$("#machinIpInput").hide();
$("#machinPortInput").hide();
$("#machinUserName").hide();
$("#machinPassword").hide();
$("#apiRequestIDInput").show();
$("#apiUrlInput").show();
$("#apiKeyInput").show();
$("#apiSecretInput").show();
} else if (machineType === "zk") {
$("#machinIpInput").show();
$("#machinPortInput").show();
$("#machinUserName").hide();
$("#machinPassword").hide();
$("#apiRequestIDInput").hide();
$("#apiUrlInput").hide();
$("#apiKeyInput").hide();
$("#apiSecretInput").hide();
}
else if (machineType === "cosec") {
console.log()
$("#machinIpInput").show();
$("#machinPortInput").show();
$("#machinUserName").show();
$("#machinPassword").show();
$("#apiRequestIDInput").hide();
$("#apiUrlInput").hide();
$("#apiKeyInput").hide();
$("#apiSecretInput").hide();
}
else {
$("#machinIpInput").hide();
$("#machinPortInput").hide();
$("#machinUserName").hide();
$("#machinPassword").hide();
$("#apiUrlInput").hide();
$("#apiKeyInput").hide();
$("#apiSecretInput").hide();
}
}
else if(machineType === "cosec"){
console.log()
$("#machinIpInput").show();
$("#machinPortInput").show();
$("#machinUserName").show();
$("#machinPassword").show();
$("#apiRequestIDInput").hide();
$("#apiUrlInput").hide();
$("#apiKeyInput").hide();
$("#apiSecretInput").hide();
}
else{
$("#machinIpInput").hide();
$("#machinPortInput").hide();
$("#machinUserName").hide();
$("#machinPassword").hide();
$("#apiUrlInput").hide();
$("#apiKeyInput").hide();
$("#apiSecretInput").hide();
}
}
</script>
{% endblock %}

View File

@@ -1,27 +1,23 @@
{% extends 'index.html' %} {% block content %} {% load static %} {% load i18n %}
{% extends 'index.html' %}
{% block content %}
{% load static %}
{% load i18n %}
<div class="oh-wrapper">
{% include 'biometric/nav_employees_cosec_biometric.html' %}
<div id="section">
{% include 'biometric/list_employees_cosec_biometric.html' %}
</div>
<div class="oh-modal" id="BiometricDeviceModal" role="dialog" aria-labelledby="BiometricDeviceModal" aria-hidden="true">
<div class="oh-modal__dialog " style="max-width: 550px;" id="BiometricDeviceFormTarget"></div>
</div>
<div
class="oh-modal"
id="BiometricDeviceTestModal"
role="dialog"
aria-labelledby="BiometricDeviceTestModal"
aria-hidden="true"
>
<div
class="oh-modal__dialog"
style="max-width: 550px"
id="BiometricDeviceTestFormTarget"
>
{% include "animation.html" %}
{% include 'biometric/nav_employees_cosec_biometric.html' %}
<div id="section">
{% include 'biometric/list_employees_cosec_biometric.html' %}
</div>
<div class="oh-modal" id="BiometricDeviceModal" role="dialog" aria-labelledby="BiometricDeviceModal"
aria-hidden="true">
<div class="oh-modal__dialog " style="max-width: 550px;" id="BiometricDeviceFormTarget"></div>
</div>
<div class="oh-modal" id="BiometricDeviceTestModal" role="dialog" aria-labelledby="BiometricDeviceTestModal"
aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px" id="BiometricDeviceTestFormTarget">
{% include "animation.html" %}
</div>
</div>
</div>
</div>
<script src="{% static 'actions.js' %}"></script>
{% endblock %}

View File

@@ -1,27 +1,22 @@
{% extends 'index.html' %} {% block content %} {% load static %} {% load i18n %}
{% extends 'index.html' %}
{% block content %}
{% load static %}
{% load i18n %}
<div class="oh-wrapper">
{% include 'biometric/nav_employees_biometric.html' %}
<div id="section">
{% include 'biometric/list_employees_biometric.html' %}
</div>
<div class="oh-modal" id="BiometricDeviceModal" role="dialog" aria-labelledby="BiometricDeviceModal" aria-hidden="true">
<div class="oh-modal__dialog " style="max-width: 550px;" id="BiometricDeviceFormTarget"></div>
</div>
<div
class="oh-modal"
id="BiometricDeviceTestModal"
role="dialog"
aria-labelledby="BiometricDeviceTestModal"
aria-hidden="true"
>
<div
class="oh-modal__dialog"
style="max-width: 550px"
id="BiometricDeviceTestFormTarget"
>
{% include "animation.html" %}
{% include 'biometric/nav_employees_biometric.html' %}
<div id="section">
{% include 'biometric/list_employees_biometric.html' %}
</div>
<div class="oh-modal" id="BiometricDeviceModal" role="dialog" aria-labelledby="BiometricDeviceModal"
aria-hidden="true">
<div class="oh-modal__dialog " style="max-width: 550px;" id="BiometricDeviceFormTarget"></div>
</div>
<div class="oh-modal" id="BiometricDeviceTestModal" role="dialog" aria-labelledby="BiometricDeviceTestModal"
aria-hidden="true">
<div class="oh-modal__dialog" style="max-width: 550px" id="BiometricDeviceTestFormTarget">
{% include "animation.html" %}
</div>
</div>
</div>
</div>
<script src="{% static 'actions.js' %}"></script>
{% endblock %}

View File

@@ -17,10 +17,12 @@ from apscheduler.schedulers.background import BackgroundScheduler
from django.contrib import messages
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect, render
from django.utils import timezone as django_timezone
from django.utils.translation import gettext as __
from django.utils.translation import gettext_lazy as _
from zk import ZK
from attendance.methods.utils import Request
from attendance.views.clock_in_out import clock_in, clock_out
from base.methods import get_key_instances, get_pagination
from employee.models import Employee, EmployeeWorkInformation
@@ -104,50 +106,6 @@ def biometric_set_time(conn):
conn.set_time(new_time)
class META:
"""
Provides access to HTTP metadata keys.
"""
@classmethod
def keys(cls):
"""
Retrieve the list of available HTTP metadata keys.
Returns:
list: A list of HTTP metadata keys.
"""
return ["HTTP_HX_REQUEST"]
class Request:
"""
Represents a request for clock-in or clock-out.
Attributes:
- user: The user associated with the request.
- date: The date of the request.
- time: The time of the request.
- path: The path associated with the request (default: "/").
- session: The session data associated with the request (default: {"title": None}).
"""
def __init__(
self,
user,
date,
time,
datetime,
) -> None:
self.user = user
self.path = "/"
self.session = {"title": None}
self.date = date
self.time = time
self.datetime = datetime
self.META = META()
class ZKBioAttendance(Thread):
"""
Represents a thread for capturing live attendance data from a ZKTeco biometric device.
@@ -193,7 +151,10 @@ class ZKBioAttendance(Thread):
if attendance:
user_id = attendance.user_id
punch_code = attendance.punch
date_time = attendance.timestamp
date_time = django_timezone.make_aware(
attendance.timestamp
)
# date_time = attendance.timestamp
date = date_time.date()
time = date_time.time()
device.last_fetch_date = date
@@ -1043,42 +1004,40 @@ def biometric_device_employees(request, device_id, **kwargs):
previous_data = request.GET.urlencode()
device = BiometricDevices.find(device_id)
if device:
try:
if device.machine_type == "zk":
employee_add_form = EmployeeBiometricAddForm()
employees = zk_employees_fetch(device)
employees = paginator_qry(employees, request.GET.get("page"))
context = {
"employees": employees,
"device_id": device_id,
"form": employee_add_form,
"pd": previous_data,
}
return render(
request, "biometric/view_employees_biometric.html", context
)
if device.machine_type == "cosec":
employee_add_form = CosecUserAddForm()
employees = cosec_employee_fetch(device_id)
employees = biometric_paginator_qry(
employees, int(request.GET.get("page", 1))
)
context = {
"employees": employees,
"device_id": device.id,
"form": employee_add_form,
"pd": previous_data,
}
return render(request, "biometric/view_cosec_employees.html", context)
except Exception as error:
print(f"An error occurred: {error}")
messages.info(
request,
_(
"Failed to establish a connection. Please verify the accuracy of the IP\
Address and Port No. of the device."
),
# try:
if device.machine_type == "zk":
employee_add_form = EmployeeBiometricAddForm()
employees = zk_employees_fetch(device)
employees = paginator_qry(employees, request.GET.get("page"))
context = {
"employees": employees,
"device_id": device_id,
"form": employee_add_form,
"pd": previous_data,
}
return render(request, "biometric/view_employees_biometric.html", context)
if device.machine_type == "cosec":
employee_add_form = CosecUserAddForm()
employees = cosec_employee_fetch(device_id)
employees = biometric_paginator_qry(
employees, int(request.GET.get("page", 1))
)
context = {
"employees": employees,
"device_id": device.id,
"form": employee_add_form,
"pd": previous_data,
}
return render(request, "biometric/view_cosec_employees.html", context)
# except Exception as error:
# print(f"An error occurred: {error}")
# messages.info(
# request,
# _(
# "Failed to establish a connection. Please verify the accuracy of the IP\
# Address and Port No. of the device."
# ),
# )
else:
messages.error(request, _("Biometric device not found"))
return redirect(biometric_devices_view)
@@ -1732,7 +1691,7 @@ def zk_biometric_device_attendance(device_id):
for attendance in filtered_attendances:
user_id = attendance.user_id
punch_code = attendance.punch
date_time = attendance.timestamp
date_time = django_timezone.make_aware(attendance.timestamp)
date = date_time.date()
time = date_time.time()
bio_id = BiometricEmployees.objects.filter(user_id=user_id).first()
@@ -1776,7 +1735,7 @@ def anviz_biometric_device_attendance(device_id):
date_time_obj = datetime.strptime(
attendance["checktime"], "%Y-%m-%dT%H:%M:%S%z"
)
target_timezone = pytz.timezone(settings.TIME_ZONE)
target_timezone = pytz.django_timezone(settings.TIME_ZONE)
date_time_obj = date_time_obj.astimezone(target_timezone)
employee = Employee.objects.filter(badge_id=badge_id).first()
if employee:
@@ -1784,7 +1743,7 @@ def anviz_biometric_device_attendance(device_id):
user=employee.employee_user_id,
date=date_time_obj.date(),
time=date_time_obj.time(),
datetime=date_time_obj,
datetime=django_timezone.make_aware(date_time_obj),
)
if punch_code in {0, 128}:
try:
@@ -1853,7 +1812,7 @@ def cosec_biometric_device_attendance(device_id):
user=employee.employee_id.employee_user_id,
date=attendance_date,
time=attendance_time,
datetime=attendance_datetime,
datetime=django_timezone.make_aware(attendance_datetime),
)
try: