Add article livesearch lookup
This commit is contained in:
Vendored
+24
@@ -345,6 +345,30 @@ class AgrarmonitorConnector {
|
||||
};
|
||||
});
|
||||
}
|
||||
async getArtikel(artikelGruppe, suchstring = '') {
|
||||
const response = await this.http.get('/module/artikel/livesearch.php', {
|
||||
params: {
|
||||
suchstring,
|
||||
artikel_aktiv: 0,
|
||||
warengruppe: artikelGruppe,
|
||||
lagerplatz: 0,
|
||||
bestand: 0,
|
||||
itemsperpage: 100000,
|
||||
seite: 1,
|
||||
},
|
||||
});
|
||||
await this.saveSession();
|
||||
const document = this.parseHtmlDocument(response.data);
|
||||
const rows = Array.from(document.querySelectorAll('table#artikel_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() ?? '',
|
||||
bezeichnung: cells[1]?.textContent?.trim() ?? '',
|
||||
};
|
||||
});
|
||||
}
|
||||
createHttpClient() {
|
||||
const client = (0, axios_cookiejar_support_1.wrapper)(axios_1.default.create({
|
||||
baseURL: this.baseUrl,
|
||||
|
||||
Reference in New Issue
Block a user