neuer printer
This commit is contained in:
parent
a1e9027648
commit
c917371845
33 changed files with 476 additions and 665 deletions
65
resources/[inventory]/omi-printers/html/app.js
Normal file
65
resources/[inventory]/omi-printers/html/app.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
PrinterBox = {}
|
||||
|
||||
$(document).ready(function() {
|
||||
window.addEventListener('message', function(event) {
|
||||
var action = event.data.action;
|
||||
|
||||
switch (action) {
|
||||
case "openprinternui":
|
||||
PrinterBox.Open(event.data);
|
||||
break;
|
||||
case "startprinternui":
|
||||
PrinterBox.Start(event.data);
|
||||
break;
|
||||
case "close":
|
||||
PrinterBox.Close(event.data);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.printerbox-accept').click(function() {
|
||||
PrinterBox.Save();
|
||||
PrinterBox.Close();
|
||||
});
|
||||
$('.printerbox-decline').click(function() {
|
||||
PrinterBox.Close();
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('keydown', function() {
|
||||
switch (event.keyCode) {
|
||||
case 27: // ESC
|
||||
PrinterBox.Close();
|
||||
break;
|
||||
case 9: // ESC
|
||||
PrinterBox.Close();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
PrinterBox.Open = function(data) {
|
||||
if (data.url) {
|
||||
$(".paper-container").fadeIn(150);
|
||||
$(".document-image").attr('src', data.url);
|
||||
} else {
|
||||
console.log('No document is linked to it!!!!!')
|
||||
}
|
||||
}
|
||||
|
||||
PrinterBox.Start = function(data) {
|
||||
$(".printerbox-container").fadeIn(150);
|
||||
}
|
||||
|
||||
PrinterBox.Save = function(data) {
|
||||
$.post('https://moon-printers/SaveDocument', JSON.stringify({
|
||||
url: $('.printerboxurl-input').val()
|
||||
}));
|
||||
}
|
||||
|
||||
PrinterBox.Close = function(data) {
|
||||
$(".printerbox-container").fadeOut(150);
|
||||
$(".paper-container").fadeOut(150);
|
||||
$.post('https://moon-printers/CloseDocument');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue