Compare commits

...

10 Commits

Author SHA1 Message Date
Ahmedvolga ee559b57cb add Evotor 5i and 7.3 on auto detect sn 2025-09-15 13:21:51 +03:00
Ahmedvolga 4afd1f7ede style last record and history 2025-03-19 19:25:59 +03:00
Ahmedvolga 938a0097a2 history filter fixed by date 2025-03-19 19:25:42 +03:00
Ahmedvolga 8077bc484a jquery UI 2024-10-17 16:22:10 +03:00
Ahmedvolga cdd7c1a887 jquery UI images icons 2024-10-16 16:44:25 +03:00
Ahmedvolga 9f07897ab7 add option to banks 2024-10-16 11:59:56 +03:00
Ahmedvolga 1196ae5432 Update Check Serials page 2024-10-10 15:11:09 +03:00
Ahmedvolga cb7641ee53 tables places fix 2024-10-08 18:20:40 +03:00
Ahmedvolga 34335ae2a3 place to 3rd table 2024-10-03 17:40:41 +03:00
Ahmedvolga b3931c7ed4 add search in Priom db 2024-10-03 13:12:35 +03:00
7 changed files with 424 additions and 159 deletions

View File

@ -19,8 +19,8 @@
<link rel="stylesheet" href="/css/notification.css">
<link rel="stylesheet" href="/css/navbar.css">
<link rel="stylesheet" href="/css/options.css">
<link rel="stylesheet" href="/css/fa-icons.css">
<script src="https://kit.fontawesome.com/e8e55b4ad4.js" crossorigin="anonymous"></script>
<script src="js/jquery-3.5.1.min.js"></script>
<script src="js/jquery.maphilight.min.js"></script>
<script src="js/axios.min.js"></script>
@ -29,13 +29,13 @@
</head>
<body>
<body style="max-width: 90%;">
<nav class="navbar">
<div class="navbar-brand" href="/" onclick="window.location.href='/';">
<img src="/images/sv-org-logo.png" alt="Site Logo">
<span>СЕРВИС-ВОЛГА</span> <!-- Title as a span for styling -->
<span>СЕРВИС-ВОЛГА - Поиск повторяющихся аппаратов</span> <!-- Title as a span for styling -->
</div>
@ -73,37 +73,56 @@
</div>
<div class="pageTitle">
<h3>Поиск повторяющихся аппаратов</h3>
<span class="counter"> </span>
</div>
</div>
<div class="searchResult">
<textarea name="" id="textcopied" class="inputHolder22" cols="15" rows="40"></textarea>
<div id="tablePlace" class="repeated2">
<div class="container">
<div class="left-panel">
<div class="title-section">
Input List
</div>
<textarea id="textcopied" class="inputHoldercheck" rows="15"></textarea>
</div>
<div class="results-panel">
<div id="tablePlaceSection" class="result-item">
<div class="title-section">
Search Main Database
</div>
<table id="tablePlace" class="result-item" border="1"></table>
<div class="title-section">
Search Live Database
</div>
<div class="test"></div>
<table id="tablePlace2" class="result-item" border="1"></table>
</div>
</div>
</div>
<pre id="json-data"></pre>
<div class="total-results">
<p class="total-results-title">Total Results</p>
<div class="title-section">
Results Main Database (from uploaded files XLSX)
</div>
<div class="copy-text">
<textarea id="copytablePlace" rows="15" placeholder="Summary of results here..."></textarea>
<textarea name="" id="copyPlace" cols="130" rows="50"></textarea>
<div class="title-section">
Results Live Database
</div>
<textarea id="copytablePlace2" rows="15" placeholder="Summary of results here..."></textarea>
</div>
<br>
<br>
<br>
<br>
<footer>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -191,18 +191,12 @@ body {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
color: rgb(51, 51, 51);
/* color: rgb(51, 51, 51); */
font-size: small;
color: rgb(209, 209, 209);
}
/* table,
th,
td {
border: 1px solid black;
border-collapse: collapse;
background-color: aliceblue;
padding: 4px;
} */
.visible {
display: block;
@ -255,7 +249,19 @@ footer {
text-decoration: none !important;
}
.searchResult {}
/* .searchResult {
display: flex;
gap: 10px;
justify-content: center;
align-items: center;
}
.left-panel{
width: 20%;
}
.right-panel{
width: 80%;
} */
.check-butons {
margin-left: 10px;
@ -297,6 +303,9 @@ footer {
color: red;
}
.redTable td {
padding: 1px 3px;
}
.bold {
font-weight: bold;
@ -310,6 +319,24 @@ footer {
#history {
display: flex;
justify-content: center;
place-items: center;
}
.custom-table {
width: 100%;
border-collapse: collapse;
background-color: white;
}
.custom-th, .custom-td {
border: 1px solid black;
padding: 2px;
text-align: left;
width: 60px;
font-size: 12px;
}
.custom-th {
cursor: pointer;
background-color: #f2f2f2;
}
.copy-text {
@ -427,7 +454,7 @@ footer {
}
#excelTable {
.tableplace {
font-family: Calibri, sans-serif;
font-size: 15px;
text-align: center;
@ -440,7 +467,7 @@ min-width: 680px;
background-color: yellow; /* Change background color for the second column */
/* } */
#excelTable tr td {
.tableplace tr td {
text-align: center;
padding: 0px 6px;
background-color: white;
@ -451,7 +478,7 @@ background-color: white;
border-color: red;
border-style: solid !important;
}
#excelTableContainer {
.tableplaceContainer {
margin: auto;
text-align: -webkit-center;
text-align: center;
@ -467,7 +494,107 @@ background-color: white;
border-radius: 10px;
}
.repeatedx {
.tableplacedown{
color: aliceblue;
margin: auto;
text-align: -webkit-center;
/* background-color: white; */
display: flex;
gap: 5px;
justify-content: center;
}
.search2table{
color: blue;
}
.searchlivetable{
color: red;
}
.searchpriomtable{
color: green;
}
.container {
display: grid;
grid-template-columns: 1fr 9fr; /* Left panel is 1 part, results panel is 3 parts */
/* height: calc(100vh - 150px); Adjust height for footer space */
height: calc(87vh - 150px);
padding: 10px;
gap: 10px; /* Space between columns */
}
.left-panel {
background-color: #ffffff;
padding: 5px;
border: 1px solid #ccc;
border-radius: 15px;
}
.inputHoldercheck {
width: 100%;
height: 96%;
resize: vertical; /* Allow vertical resizing */
}
.results-panel {
background-color: #ffffff;
padding: 20px;
border: 1px solid #ccc;
border-radius: 15px;
overflow-y: auto; /* Allows scrolling if content exceeds */
}
.result-item {
font-family: Calibri, sans-serif;
font-size: 13px;
text-align: center;
border-style: none;
border-collapse: collapse;
min-width: 680px;
margin-bottom: 20px;
}
.test {
max-width: 14ch; /* Limit width to 14 characters */
overflow: hidden; /* Prevent overflow */
white-space: nowrap; /* No line breaks */
text-overflow: ellipsis; /* Add ellipsis for overflow */
}
.total-results {
background-color: #e9ecef;
padding: 5px;
padding-bottom: 54px;
border-top: 2px solid #ccc;
/* position: sticky; */
bottom: 0;
width: 100%;
box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}
.total-results textarea {
width: 100%;
resize: none; /* Disable resizing */
}
.total-results-title{
padding: 0;
margin: 0;
font-weight: bold;
}
.title-section{
padding: 3px;
margin: 0;
}

View File

@ -6,12 +6,13 @@ document.getElementById("buttonGet").onclick = function () {
const serialsList = data.value.split("\n")
console.log(serialsList);
$('#tablePlace').append('<tr><th>Модель</th><th>Сер.номер</th><th>Заявленная неисправность</th><th>Произведенная работа</th><th>Файл</th><th>Сервер</th></tr>')
// $('#tablePlace').append('<tr><th>Модель</th><th>Сер.номер</th><th>Заявленная неисправность</th><th>Произведенная работа</th><th>Файл</th><th>Сервер</th></tr>')
serialsList.forEach(element => {
if (element) {
// console.log(element);
check(element)
check(element);
check(element, 'searchLive', 'tablePlace2');
}
});
@ -33,91 +34,139 @@ $('#buttonRest').on('click', () => {
});
function check(serialUnchecked) {
const serial = keyboardLayoutSwitch(serialUnchecked)
if (serial == "") {
function check(serialUnchecked, searchLink = 'search2', tablePlace = 'tablePlace') {
const serial = keyboardLayoutSwitch(serialUnchecked);
// alert("Ensure you input a value in both fields!");
$('#searchText').text('Empty!')
} else {
$('#searchText').text(' Sending ... wait')
$('#buttonGet').css('background-color', 'yellow')
axios.get('http://'+serverEnv.ip+'/search2?sn=' + serial)
.then(response => {
console.log(response);
counter = counter + response.data.length
if(response.statusText == 'OK'){
$('#searchText').text('Search')
$('#buttonGet').css('background-color', 'chartreuse')
}
const data = response.data
let bold = false
if (response.data.length > 1) {
bold = true
if (serial === "") {
displayMessage('Empty!', 'red');
return;
}
console.log(data);
if( data.length == 0){
console.log('empty');
appendata(false, serial, response.statusText );
}
for (var key in data) {
displayMessage('Sending ... wait', 'yellow');
$('#buttonGet').css('background-color', 'yellow');
console.dir(data[key]);
// console.log(data.length);
// $('.repeated').append(buildHtmlTable([data[key]]))
appendata(data[key], serial, response.statusText, bold ); // The response body
}
$('.counter').text('найден : ' + counter)
fetchData(serial, searchLink)
.then(data => {
updateUIOnSuccess(data, serial, tablePlace);
})
.catch(error => {
$('#tablePlace').append('<tr class="redTable"><td>error !</td> <td colspan="4"> No answer from server , try again or ask Ahmed !</td> <td>'+error.code+'</td> </tr>')
$('#searchText').text(error.message)
$('#buttonGet').css('background-color', 'orangered')
console.error(error);
handleError(error, tablePlace);
});
} //end if else
}
function fetchData(serial, searchLink) {
return axios.get(`http://${serverEnv.ip}/${searchLink}?sn=${serial}`)
.then(response => {
if (response.statusText !== 'OK') {
throw new Error('Server responded with an error');
}
// counter = counter + response.data.length
return response.data;
});
}
function updateUIOnSuccess(data, serial, tablePlace) {
let bold = data.length > 1;
console.log(data);
if (data.length === 0) {
appendData(false, serial, 'No results found', bold, tablePlace);
} else {
data.forEach(item => {
appendData(item, serial, 'Search successful', bold, tablePlace);
});
}
counter = counter + data.length;
$('.counter').text(`найден : ${counter}`);
$('#searchText').text('Search');
$('#buttonGet').css('background-color', 'chartreuse');
}
function handleError(error, tablePlace) {
$('#' + tablePlace).append('<tr class="redTable"><td>error !</td> <td colspan="4"> No answer from server , try again or ask Ahmed !</td> <td>' + error.code + '</td></tr>');
$('#searchText').text(error.message);
$('#buttonGet').css('background-color', 'orangered');
console.error(error);
}
function displayMessage(message, color) {
$('#searchText').text(message);
$('#buttonGet').css('background-color', color);
}
const list = document.getElementById("json-data");
function appendata(data,sn,statusText, bold) {
function appendData(data, sn, statusText, bold, tablePlace) {
console.log(data);
// Check if the table exists; if not, create it
let table = document.getElementById(tablePlace);
if (!table) {
table = document.createElement('table');
table.id = tablePlace;
document.body.appendChild(table); // or append to a specific parent element
}
if (data) {
// $('#tablePlace').append(buildHtmlTable([data]))
let addClass = ''
if(bold){addClass = 'bold'}
// Create a new row and cells
const row = document.createElement('tr');
row.className = 'redTable' + (bold ? ' bold' : '');
$('#tablePlace').append('<tr class="redTable '+ addClass +'"><td>'+data.Model+'</td><td>'+data.SerialNumber+'</td> <td>'+data.Problem+'</td> <td>'+ data.Details +'</td> <td>'+data.filename+'</td><td>'+statusText+'</td> </tr>')
// Create cells for each piece of data
const modelCell = createCell(data.Model);
const serialNumberCell = createCell(data.SerialNumber);
const problemCell = createCell(data.Problem);
const detailsCell = createCell(data.Details);
const filenameCell = createCell(data.filename);
const statusCell = createCell(statusText);
const xlsxFormat = data.Model + ' ' + data.SerialNumber + ' ' + data.Problem + ' ' + data.Details + ' ' + data.filename + '\n'
console.log('thsi data texarea is: ', xlsxFormat);
$('#copyPlace').append(xlsxFormat).attr('rows', '5') // Set the number of
// Append cells to the row
row.appendChild(modelCell);
row.appendChild(serialNumberCell);
row.appendChild(problemCell);
row.appendChild(detailsCell);
row.appendChild(filenameCell);
row.appendChild(statusCell);
// Append the row to the table
table.appendChild(row);
// Prepare xlsx format string
const xlsxFormat = `${data.Model}\t${data.SerialNumber}\t${data.Problem}\t${data.Details}\t${data.filename}\n`;
console.log('This data textarea is: ', xlsxFormat);
const copyTextarea = document.getElementById(`copy${tablePlace}`);
copyTextarea.value += xlsxFormat; // Append to the textarea
copyTextarea.setAttribute('rows', '15'); // Set the number of rows
} else {
// Create a new row for the "not found" state
const row = document.createElement('tr');
row.className = 'greenTable';
const okCell = createCell('ОК');
const serialNotFoundCell = createCell(sn);
const messageCell = createCell('Серийный номер не найден в БД', { colSpan: 3 });
const statusNotFoundCell = createCell(statusText);
// Append cells to the row
row.appendChild(okCell);
row.appendChild(serialNotFoundCell);
row.appendChild(messageCell);
row.appendChild(statusNotFoundCell);
// Append the row to the table
table.appendChild(row);
}
else{
$('#tablePlace').append(' <tr class="greenTable"><td>ОК</td> <td>'+sn+'</td><td colspan="3">Серийный номер не найден в БД</td> <td>'+statusText+'</td></tr> ')
}
// Helper function to create a cell
function createCell(content, options) {
const cell = document.createElement('td');
cell.textContent = content;
if (options && options.colSpan) {
cell.colSpan = options.colSpan;
}
return cell;
}

View File

@ -57,7 +57,9 @@ const models = {
"V520": ["331-4", "331-9", "262-", "285-", 11],
"VX675": ["331-0", "331-3", "331-0", "333-", "332-", 11],
"VX820": ["903-","327-" , 11],
"D230": ["233", 10]
"D230": ["233", 10],
"EVOTOR_5I": ["15", "05", 12],
"EVOTOR_73": ["003", 14],
}
manualSelectModel = false; // manual select model
@ -520,38 +522,84 @@ const cleanAll = () => {
tempDetails = [];
$('#titleInput').val('Cleaned!')
prepareTable('excelTable', ['Модель','Сер.номер','Заявленная неисправность','Произведенная работа'])
$('#tablePlace').text('')
$('#tablePlace2').text('')
$('#RepeatedTablePlace').text('')
$('#SearchLiveTablePlace').text('')
$('#SearchPriomTablePlace').text('')
const dancers = document.querySelector('.bg-tarakan');
dancers.classList.remove("show-tarakan");
}
$('#showStorage').on('click', () => {
var textarea = $('<textarea>'); // Create a new textarea element
$('#history').html(textarea); // Append the textarea to the div
// Extract the data from localStorage
const dataEntries = Object.entries(localStorage).map(([key, value]) => ({ key, value: JSON.parse(value) }));
// Sort the data entries by date in descending order
dataEntries.sort((a, b) => new Date(b.value.date) - new Date(a.value.date));
// Assuming you want to use the parsed 'value' part for table data
const tableData = dataEntries.map(entry => entry.value); // Extract values from the entries
// Populate the table with the sorted data
dataEntries.forEach(entry => {
const table = createHistoryTable(tableData); // Create the table with data from localStorage
$('#history').append(table); // Append the table to the div
if (entry.value.date) {
const xlsxFormat = entry.value.model + ' ' + entry.value.serialNumber + ' ' + entry.value.problemList + ' ' + entry.value.fixList + '\n'
textarea.append(xlsxFormat).attr('rows', '5') // Set the number of rows to 5
.attr('cols', '100'); // Set the number of columns to 50
});
// Function to create the table with records
function createHistoryTable(data) {
const table = document.createElement('table');
table.classList.add('custom-table'); // Add custom class for the table
const headerRow = document.createElement('tr');
// Create the table headers
const headers = ['Model', 'Serial Number', 'Problem List', 'Fix List', 'Date'];
headers.forEach((headerText, index) => {
const th = document.createElement('th');
th.classList.add('custom-th'); // Add custom class for header
th.textContent = headerText;
th.dataset.index = index; // Add a data attribute for sorting by column index
th.addEventListener('click', () => sortTable(table, index)); // Add click listener for sorting
headerRow.appendChild(th);
});
table.appendChild(headerRow);
// Create the table rows
data.forEach(item => {
const row = document.createElement('tr');
row.innerHTML = `
<td class="custom-td">${item.model}</td>
<td class="custom-td">${item.serialNumber}</td>
<td class="custom-td">${item.problemList}</td>
<td class="custom-td">${item.fixList}</td>
<td class="custom-td">${new Date(item.date).toLocaleString()}</td>
`;
table.appendChild(row);
});
return table;
}
console.log('sorted', entry.value);
});
// Function to sort the table by a specific column index
function sortTable(table, columnIndex) {
const rows = Array.from(table.rows).slice(1); // Get all rows except the header
const sortedRows = rows.sort((rowA, rowB) => {
const cellA = rowA.cells[columnIndex].textContent;
const cellB = rowB.cells[columnIndex].textContent;
// Sort by date (if the column is 'Date')
if (columnIndex === 4) { // Date column index
return new Date(cellA) - new Date(cellB);
}
// Sort by text (for other columns)
return cellA.localeCompare(cellB);
});
// Remove existing rows and append sorted rows
sortedRows.forEach(row => table.appendChild(row));
}
@ -562,7 +610,9 @@ const modelImages = {
'D230': './images/devices/d230.png',
'SP580': './images/devices/SP580-PC-5.png',
'ES600': './images/devices/ES600.png',
'VX820': './images/devices/VX820.png'
'VX820': './images/devices/VX820.png',
// 'EVOTOR_5I': './images/devices/evotor_5i.png',
// 'EVOTOR_73': './images/devices/evotor_73.png'
// Add more models as needed
};
@ -656,7 +706,8 @@ SerialNumber.addEventListener("submit", (e) => {
for (var key in data) {
if (data.hasOwnProperty(key)) {
console.dir(data[key]);
$('.repeated').append(buildHtmlTable([data[key]]))
$('#RepeatedTablePlace').text('Повтор:')
$('#RepeatedTablePlace').append(buildHtmlTable([data[key]],'search2'))
}
}
})
@ -671,7 +722,24 @@ SerialNumber.addEventListener("submit", (e) => {
for (var key in data) {
if (data.hasOwnProperty(key)) {
console.dir(data[key]);
$('.repeatedx').append(buildHtmlTable([data[key]]))
$('#SearchLiveTablePlace').text('Повтор Live:')
$('#SearchLiveTablePlace').append(buildHtmlTable([data[key]],'searchlive'))
}
}
})
.catch(error => {
console.error(error);
$('#searchText').text(error.message)
$('.form-btn').css('background-color', 'orangered')
});
fetchData(keyboardLayoutSwitch(serial.value), 'searchpriom').then(data => {
console.log(data); // The response body
for (var key in data) {
if (data.hasOwnProperty(key)) {
console.dir(data[key]);
$('#SearchPriomTablePlace').text('АКТ Прием:')
$('#SearchPriomTablePlace').append(buildHtmlTable([data[key]],'searchpriom'))
}
}
})
@ -699,14 +767,14 @@ async function fetchData(serial, location) {
console.error('Fetch Error:', error);
$('#searchText').text(error.message)
$('.form-btn').css('background-color', 'orangered')
throw error; // Re-throw the error to be caught in the main function
}
}
function buildHtmlTable(arr) {
function buildHtmlTable(arr,search) {
const table = document.createElement('table');
table.setAttribute('id', 'excelTable');
table.setAttribute('class', 'redtable');
table.setAttribute('id', search);
table.setAttribute('class', `${search}table tableplace`);
table.setAttribute('border', '2');
// const columns = addAllColumnHeaders(arr, table);
const columns = addRowWithoutHeaders(arr, table);
@ -757,12 +825,9 @@ $("#selectmodel").change(function () {
manualSelectModel = true;
$("#selectmodel").removeClass("blinking");
tempModel = document.getElementById("selectmodel").value;
// checkModel(tempSerial, tempModel);
cleanCoords();
imageFromModel(tempModel)
checkDetails()
// console.log(tempSerial, tempModel);
});
const checkModel = (serial, models) => {
@ -772,7 +837,6 @@ const checkModel = (serial, models) => {
tempModel = document.getElementById("selectmodel").value;
// updateCoords(tempModel);
return;
}

View File

@ -67,6 +67,7 @@
<div class="select-city">
<select name="banks" id="banksList" class="bank-list" placeholder="Banks" onchange="getCityDetails()">
<option value="Сбербанк" selected="selected">Сбербанк</option>
<option value="Частник">Частник</option>
<option value="Алфабанк">Открытие</option>
<option value="Алфабанк">Альфа-Банк</option>
<option value="Стандарт">Национальный-стандарт</option>
@ -74,7 +75,7 @@
<div class="city-selection">
<div id="autocompleteText" class="auto-complete-text"></div>
<input type="text" id="cityInput" placeholder="Type a city..."
onkeyup="filterCities()"" autocomplete=" off">
onkeyup="filterCities()" autocomplete=" off">
<div id="cityList"></div>
</div>
<input type="text" id="datepicker" autocomplete="off" onchange="getCityDetails()">
@ -109,8 +110,8 @@
<div class="display-info">
<!-- <textarea id="titleInput" class="inputHolder" placeholder="" rows="" cols="" name="" form=""> </textarea> -->
<div id="excelTableContainer">
<table id="excelTable" border="1">
<div id="excelTableContainer" class="tableplaceContainer">
<table id="excelTable" class="tableplace" border="1">
<tr>
<td>Модель
</td>
@ -139,6 +140,8 @@
<select name="model" id="selectmodel" class="serialform modelselect" placeholder="Model">
<option class="pax" value="S90">S90</option>
<option class="pax" value="D230">D230</option>
<option class="evotor" value="EVOTOR_5I">Evotor 5i</option>
<option class="evotor" value="EVOTOR_73">Evotor 73</option>
<option class="Alited" value="SP580">Alited SP580</option>
<option class="Alited" value="ES600">Alited ES600</option>
@ -184,11 +187,11 @@
</div>
</div>
<div id="tablePlace" class="repeated"> </div>
<div id="RepeatedTablePlace" class="tableplacedown"></div>
<div id="tablePlace2" class="repeatedx">
<div id="SearchLiveTablePlace" class="tableplacedown"></div>
</div>
<div id="SearchPriomTablePlace" class="tableplacedown"></div>
<div class="additionalButtonsContainer">
<div id="top2ButtonsContainer"></div>
@ -414,6 +417,9 @@
<area shape="poly" gid="sensor" id="sensor" coords=" "
data-maphilight='{"strokeColor":"0000ff","strokeWidth":3,"fillColor":"ff0000","fillOpacity":0.6}'
href="#">
<area shape="poly" gid="connector" id="connector" coords=" "
data-maphilight='{"strokeColor":"0000ff","strokeWidth":3,"fillColor":"ff0000","fillOpacity":0.6}'
href="#">
</map>