Add machine livesearch lookup

This commit is contained in:
2026-06-07 13:54:54 +02:00
parent 24c6c9e017
commit 020d36a0a1
9 changed files with 75 additions and 4 deletions
+23
View File
@@ -278,6 +278,29 @@ class AgrarmonitorConnector {
};
});
}
async getMaschinen(gruppenId, suchstring = '') {
const response = await this.http.get('/module/maschinen/livesearch.php', {
params: {
suchstring,
maschinen_aktiv: 1,
maschinengruppe: gruppenId,
seite: 1,
},
});
await this.saveSession();
const document = this.parseHtmlDocument(response.data);
const rows = Array.from(document.querySelectorAll('table.maschinen_table tbody tr'));
return rows.map(row => {
const cells = Array.from(row.querySelectorAll('td'));
return {
id: this.parseNumber(row.getAttribute('data-id') ?? row.id),
nummer: cells[0]?.textContent?.trim() ?? '',
name: cells[1]?.textContent?.trim() ?? '',
kennzeichen: cells[2]?.textContent?.trim() ?? '',
aktiv: Boolean(cells[4]?.querySelector('.fa-check, .text-green')),
};
});
}
createHttpClient() {
const client = (0, axios_cookiejar_support_1.wrapper)(axios_1.default.create({
baseURL: this.baseUrl,