add sid in template

This commit is contained in:
Cayo Puigdefabregas 2022-06-08 11:59:47 +02:00
parent dd68c5c410
commit a65e93b470
2 changed files with 24 additions and 2 deletions

View file

@ -24,6 +24,7 @@ function save_settings() {
var sizePreset = $("#printerType").val();
var data = {"height": height, "width": width, "sizePreset": sizePreset};
data['dhid'] = $("#dhidCheck").prop('checked');
data['sid'] = $("#sidCheck").prop('checked');
data['qr'] = $("#qrCheck").prop('checked');
data['serial_number'] = $("#serialNumberCheck").prop('checked');
data['manufacturer'] = $("#manufacturerCheck").prop('checked');
@ -39,6 +40,7 @@ function load_settings() {
$("#printerType").val(data.sizePreset);
$("#qrCheck").prop('checked', data.qr);
$("#dhidCheck").prop('checked', data.dhid);
$("#sidCheck").prop('checked', data.sid);
$("#serialNumberCheck").prop('checked', data.serial_number);
$("#manufacturerCheck").prop('checked', data.manufacturer);
$("#modelCheck").prop('checked', data.model);
@ -50,6 +52,7 @@ function reset_settings() {
$("#printerType").val('brotherSmall');
$("#qrCheck").prop('checked', true);
$("#dhidCheck").prop('checked', true);
$("#sidCheck").prop('checked', true);
$("#serialNumberCheck").prop('checked', false);
$("#manufacturerCheck").prop('checked', false);
$("#modelCheck").prop('checked', false);
@ -74,6 +77,11 @@ function change_check() {
} else {
$(".dhid").hide();
}
if ($("#sidCheck").prop('checked')) {
$(".sid").show();
} else {
$(".sid").hide();
}
if ($("#serialNumberCheck").prop('checked')) {
$(".serial_number").show();
} else {
@ -109,6 +117,9 @@ function printpdf() {
min_tag_side = (Math.min(height, width)/2) + border;
var last_tag_code = '';
if ($("#sidCheck").prop('checked')) {
height += line;
};
if ($("#serialNumberCheck").prop('checked')) {
height += line;
};
@ -145,6 +156,12 @@ function printpdf() {
space += line;
}
};
if ($("#sidCheck").prop('checked')) {
var sn = $(y).data('sid');
pdf.setFontSize(15);
pdf.text(sn, border, space);
space += line;
};
if ($("#serialNumberCheck").prop('checked')) {
var sn = $(y).data('serial-number');
pdf.setFontSize(12);

View file

@ -39,6 +39,11 @@
data-sid="{{ dev.sid or '' }}">{{ dev.devicehub_id }}</b>
</div>
</div>
<div class="col sid" style="display: none">
<div>
<b>{{ dev.sid or '' }}</b>
</div>
</div>
</div>
<div class="row serial_number" style="display: none">
<div class="col">
@ -105,8 +110,8 @@
<label class="form-check-label" for="dhidCheck">Dhid</label>
</div>
<div class="form-switch">
<input class="form-check-input" name="sid" type="checkbox" id="dhidCheck">
<label class="form-check-label" for="dhidCheck">Sid</label>
<input class="form-check-input" name="sid" type="checkbox" id="sidCheck">
<label class="form-check-label" for="sidCheck">Sid</label>
</div>
<div class="form-switch">
<input class="form-check-input" name="serial_number" type="checkbox" id="serialNumberCheck">