Add company settings lookup

This commit is contained in:
2026-06-07 14:23:04 +02:00
parent 2b5481f7e2
commit 8ac9b1e58a
9 changed files with 49 additions and 4 deletions
+19
View File
@@ -14,6 +14,7 @@ import type {
AgrarmonitorKunde2,
AgrarmonitorRegistrierungStatus,
EingangsrechnungLivesearchResult,
Firma,
Logger,
Maschine,
MaschinenKategorie,
@@ -416,6 +417,24 @@ export class AgrarmonitorConnector implements AgrarmonitorConnectorResult {
});
}
async getFirmen(): Promise<Firma[]> {
const response = await this.http.get('/einstellungen');
await this.saveSession();
const document = this.parseHtmlDocument(response.data);
const rows = Array.from(document.querySelectorAll<HTMLTableRowElement>('table#firmen_table tbody tr'));
return rows.map(row => {
const cells = Array.from(row.querySelectorAll<HTMLTableCellElement>('td'));
return {
id: this.parseNumber(row.getAttribute('data-firma_id') ?? row.id),
bezeichnung: cells[0]?.textContent?.trim() ?? '',
};
});
}
private createHttpClient(): AxiosInstance {
const client = wrapper(
axios.create({
+6
View File
@@ -56,6 +56,7 @@ export interface AgrarmonitorConnectorResult {
getCustomerById(id: number): Promise<AgrarmonitorApiCustomer>;
getMaschinenKategorien(): Promise<MaschinenKategorie[]>;
getMaschinen(gruppenId: number, suchstring?: string): Promise<Maschine[]>;
getFirmen(): Promise<Firma[]>;
}
export interface AgrarmonitorFreischaltungStatus {
@@ -164,3 +165,8 @@ export interface Maschine {
kennzeichen: string;
aktiv: boolean;
}
export interface Firma {
id: number;
bezeichnung: string;
}