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

View File

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