Add machine livesearch lookup
This commit is contained in:
Vendored
+23
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user