add new table excelTable instead on inputText

This commit is contained in:
Ahmed 2024-09-12 15:05:48 +03:00
parent 6e147aede5
commit 365d3b4921
1 changed files with 33 additions and 1 deletions

View File

@ -160,6 +160,7 @@ $("#Tarakan").click(function () {
const otkaz = tempDetails[problem][1]; const otkaz = tempDetails[problem][1];
tempDetails = [] tempDetails = []
tempDetails[0] = ['Отказ. тараканы', otkaz] tempDetails[0] = ['Отказ. тараканы', otkaz]
prepareTable('excelTable', [tempModel,tempSerial,otkaz,'Отказ. тараканы'], 'yellow')
}); });
@ -171,16 +172,25 @@ $("#water").click(function () {
tempDetails = [] tempDetails = []
tempDetails[0] = ['Отказ. попадание жидкости', otkaz] tempDetails[0] = ['Отказ. попадание жидкости', otkaz]
// console.log('my chnages are: ', tempDetails); // console.log('my chnages are: ', tempDetails);
prepareTable('excelTable', [tempModel,tempSerial,otkaz,'Отказ. попадание жидкости'], 'yellow')
}); });
$("#removeFixes").click(function () { $("#removeFixes").click(function () {
var problem = Object.keys(tempDetails)[0] var problem = Object.keys(tempDetails)[0]
checkModel(($("#serial").val()), models) checkModel(($("#serial").val()), models)
$('#titleInput').val(tempModel + ' ' + tempSerial + ' ' + tempDetails[problem][1] + ' ' + "") $('#titleInput').val(tempModel + ' ' + tempSerial + ' ' + tempDetails[problem][1] + ' ' + "")
const firstProblem = tempDetails[problem][1]
const otkaz = tempDetails[problem][1]; const otkaz = tempDetails[problem][1];
tempDetails = [] tempDetails = []
tempDetails[0] = ['', otkaz] 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]; const otkaz = tempDetails[problem][1];
tempDetails = [] tempDetails = []
tempDetails[0] = ['Отказ. системная плата', otkaz] tempDetails[0] = ['Отказ. системная плата', otkaz]
prepareTable('excelTable', [tempModel,tempSerial,otkaz,'Отказ. системная плата'], 'yellow')
}); });
@ -233,6 +245,10 @@ checkDetails = () => {
tempModel = 'Error'; tempModel = 'Error';
} }
$('#titleInput').val(tempModel + ' ' + tempSerial + ' ' + firstProblem + ' ' + makePlusList(tempDetails)) $('#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('Поздравляю', '<i class="fa-solid fa-thumbs-up"></i>' , 'success') // showNotification('Поздравляю', '<i class="fa-solid fa-thumbs-up"></i>' , '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'); document.execCommand('copy');
window.getSelection().removeAllRanges();
var problem = Object.keys(tempDetails)[0] var problem = Object.keys(tempDetails)[0]
checkModel(($("#serial").val()), models) checkModel(($("#serial").val()), models)
@ -487,6 +518,7 @@ const cleanAll = () => {
}); });
tempDetails = []; tempDetails = [];
$('#titleInput').val('Cleaned!') $('#titleInput').val('Cleaned!')
prepareTable('excelTable', ['Модель','Сер.номер','Заявленная неисправность','Произведенная работа'])
$('#tablePlace').text('') $('#tablePlace').text('')
$('#tablePlace2').text('') $('#tablePlace2').text('')