diff --git a/static/js/diag.js b/static/js/diag.js index 3c4ee52..35a56e0 100644 --- a/static/js/diag.js +++ b/static/js/diag.js @@ -160,6 +160,7 @@ $("#Tarakan").click(function () { const otkaz = tempDetails[problem][1]; tempDetails = [] tempDetails[0] = ['Отказ. тараканы', otkaz] + prepareTable('excelTable', [tempModel,tempSerial,otkaz,'Отказ. тараканы'], 'yellow') }); @@ -171,16 +172,25 @@ $("#water").click(function () { tempDetails = [] tempDetails[0] = ['Отказ. попадание жидкости', otkaz] // console.log('my chnages are: ', tempDetails); + prepareTable('excelTable', [tempModel,tempSerial,otkaz,'Отказ. попадание жидкости'], 'yellow') + }); $("#removeFixes").click(function () { var problem = Object.keys(tempDetails)[0] checkModel(($("#serial").val()), models) $('#titleInput').val(tempModel + ' ' + tempSerial + ' ' + tempDetails[problem][1] + ' ' + "") + + const firstProblem = tempDetails[problem][1] const otkaz = tempDetails[problem][1]; tempDetails = [] tempDetails[0] = ['', otkaz] + makePlusList(tempDetails) + const pluslistMinus = makePlusList(tempDetails); + + prepareTable('excelTable', [tempModel,tempSerial,firstProblem,'']) + }); @@ -191,6 +201,8 @@ $("#cpu").click(function () { const otkaz = tempDetails[problem][1]; tempDetails = [] tempDetails[0] = ['Отказ. системная плата', otkaz] + + prepareTable('excelTable', [tempModel,tempSerial,otkaz,'Отказ. системная плата'], 'yellow') }); @@ -233,6 +245,10 @@ checkDetails = () => { tempModel = 'Error'; } $('#titleInput').val(tempModel + ' ' + tempSerial + ' ' + firstProblem + ' ' + makePlusList(tempDetails)) + const pluslist = makePlusList(tempDetails) + + prepareTable('excelTable', [tempModel,tempSerial,firstProblem,pluslist]) + } @@ -261,8 +277,23 @@ $('#copyText').click(function () { // showNotification('Поздравляю', '' , 'success') // } - $("#titleInput").select(); + // $("#titleInput").select(); + // document.execCommand('copy'); + var table = document.querySelector('#excelTable'); + + // Create a range for the table + var range = document.createRange(); + range.selectNode(table); + + // Select the table range + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + + // Copy to clipboard document.execCommand('copy'); + window.getSelection().removeAllRanges(); + + var problem = Object.keys(tempDetails)[0] checkModel(($("#serial").val()), models) @@ -487,6 +518,7 @@ const cleanAll = () => { }); tempDetails = []; $('#titleInput').val('Cleaned!') + prepareTable('excelTable', ['Модель','Сер.номер','Заявленная неисправность','Произведенная работа']) $('#tablePlace').text('') $('#tablePlace2').text('')