"0": ['b', 's', 'b', 'S', 'B', 's', 'B', 's', 'b'],
"J": ['b', 's', 'b', 's', 'B', 'S', 'B', 's', 'b'],
"T": ['b', 's', 'b', 's', 'B', 's', 'B', 'S', 'b'],
- "*": ['b', 'S', 'b', 's', 'B', 's', 'B', 's', 'b']
+ "*": ['b', 'S', 'b', 's', 'B', 's', 'B', 's', 'b'],
};
let colors = [
'#E27B99',
'#67A945',
'#F6B855',
- '#705A81'
+ '#705A81',
];
let lto_label_width = 70;
let lto_label_height = 17;
function foreach_label(page_layout, callback) {
-
let count = 0;
let row = 0;
let height = page_layout.margin_top;
while ((height + page_layout.label_height) <= page_layout.page_height) {
-
let column = 0;
let width = page_layout.margin_left;
while ((width + page_layout.label_width) <= page_layout.page_width) {
-
callback(column, row, count, width, height);
count += 1;
height += page_layout.label_height;
height += page_layout.row_spacing;
}
-
}
function compute_max_labels(page_layout) {
-
let max_labels = 0;
foreach_label(page_layout, function() { max_labels += 1; });
return max_labels;
}
for (let c of code) {
-
if (c === 's') {
xpos += small;
continue;
/* no page margins */
html += "@page{margin-left: 0px;margin-right: 0px;margin-top: 0px;margin-bottom: 0px;}";
/* to hide things on printed page */
- html += "@media print { .unprintable { visibility: hidden; } }";
+ html += "@media print { .unprintable { visibility: hidden; } }";
html += "</style>";
}
function generate_barcode_page(target_id, page_layout, label_list, calibration) {
-
let svg = svg_page_header(page_layout.page_width, page_layout.page_height);
let c = calibration;
svg += '>';
foreach_label(page_layout, function(column, row, count, xpos, ypos) {
-
if (count >= label_list.length) { return; }
let item = label_list[count];
}
function generate_calibration_page(target_id, page_layout, calibration) {
-
let frame = document.getElementById(target_id);
setupPrintFrame(frame, page_layout.page_width, page_layout.page_height);
- let svg = svg_page_header( page_layout.page_width, page_layout.page_height);
+ let svg = svg_page_header(page_layout.page_width, page_layout.page_height);
svg += "<defs>";
svg += "<marker id='endarrow' markerWidth='10' markerHeight='7' ";
plugins: {
ptype: 'cellediting',
- clicksToEdit: 1
+ clicksToEdit: 1,
},
selModel: 'cellmodel',
xtype: 'prefixfield',
allowBlank: false,
},
- renderer: function (value, metaData, record) {
+ renderer: function(value, metaData, record) {
console.log(record);
if (record.data.mode === 'placeholder') {
return "-";
xtype: 'ltoTapeType',
allowBlank: false,
},
- renderer: function (value, metaData, record) {
+ renderer: function(value, metaData, record) {
console.log(record);
if (record.data.mode === 'placeholder') {
return "-";
handler: function(grid, rowIndex) {
grid.getStore().removeAt(rowIndex);
},
- }
+ },
],
},
],
}
function draw_labels(target_id, label_list, page_layout, calibration) {
-
let max_labels = compute_max_labels(page_layout);
let count_fixed = 0;
count = fill_size;
}
rest -= count;
+ } else if (item.end <= item.start) {
+ count = 1;
} else {
- if (item.end <= item.start) {
- count = 1;
- } else {
- count = (item.end - item.start) + 1;
- }
+ count = (item.end - item.start) + 1;
}
for (j = 0; j < count; j++) {
-
let id = item.start + j;
if (item.prefix.length == 6) {
-
list.push({
label: item.prefix,
tape_type: item.tape_type,
});
rest += count - j - 1;
break;
-
} else {
-
let pad_len = 6-item.prefix.length;
let label = item.prefix + id.toString().padStart(pad_len, 0);
label_list.push(record.data);
});
- let page_layout_view = view.down("pageLayoutPanel");
+ let page_layout_view = view.down("pageLayoutPanel");
let page_layout = page_layout_view.getValues();
- let calibration_view = view.down("pageCalibration");
+ let calibration_view = view.down("pageCalibration");
let page_calibration = calibration_view.getValues();
draw_labels("print_frame", label_list, page_layout, page_calibration);
update_calibration_preview: function() {
let me = this;
let view = me.getView();
- let page_layout_view = view.down("pageLayoutPanel");
+ let page_layout_view = view.down("pageLayoutPanel");
let page_layout = page_layout_view.getValues();
- let calibration_view = view.down("pageCalibration");
+ let calibration_view = view.down("pageCalibration");
let page_calibration = calibration_view.getValues();
console.log(page_calibration);
generate_calibration_page('print_frame', page_layout, page_calibration);
border: false,
flex: 1,
scrollable: true,
- tools:[{
+ tools: [{
type: 'print',
tooltip: 'Open Print Dialog',
handler: function(event, toolEl, panelHeader) {
printBarcodePage();
- }
+ },
}],
},
],
});
Ext.onReady(function() {
-
Ext.create('MainView', {
renderTo: Ext.getBody(),
});