feat: Aufmaß-Tab lädt Projekte aus ElektroPlan-Backend [deploy]
All checks were successful
Deploy Eplan / deploy (push) Successful in 1s
All checks were successful
Deploy Eplan / deploy (push) Successful in 1s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b2393b0385
commit
8860a97b75
1 changed files with 35 additions and 6 deletions
|
|
@ -82,12 +82,41 @@ print '<tr class="liste_titre">';
|
|||
print '<td>Grundriss</td><td>Etage</td><td>Räume</td><td>Fläche</td><td>Erstellt</td><td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// TODO: Hier Aufmaß-Daten aus dem ElektroPlan-Backend laden
|
||||
// GET /api/projekte?dolibarr_auftrag_id={$object->id}
|
||||
|
||||
// Aufmaß-Daten aus dem ElektroPlan-Backend laden
|
||||
$api_url = getDolGlobalString('EPLAN_PWA_URL');
|
||||
$raeume = array();
|
||||
if (!empty($api_url)) {
|
||||
$ch = curl_init($api_url.'/api/projekte/');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
$response = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
if ($response) {
|
||||
$projekte = json_decode($response, true);
|
||||
if (is_array($projekte)) {
|
||||
// TODO: Filter nach dolibarr_auftrag_id wenn Backend das unterstützt
|
||||
foreach ($projekte as $p) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.dol_escape_htmltag($p['name'] ?? '-').'</td>';
|
||||
print '<td>-</td>';
|
||||
print '<td>-</td>';
|
||||
print '<td>-</td>';
|
||||
print '<td>'.dol_print_date(strtotime($p['erstellt'] ?? ''), 'day').'</td>';
|
||||
print '<td class="right">';
|
||||
if (!empty($pwa_url)) {
|
||||
print '<a href="'.dol_escape_htmltag($pwa_url.'/?projekt='.$p['id']).'" target="_blank" class="butAction butActionSmall">Öffnen</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empty($raeume) && empty($projekte)) {
|
||||
print '<tr class="oddeven"><td colspan="6" class="opacitymedium" style="text-align: center; padding: 20px;">';
|
||||
print 'Noch keine Aufmaße verknüpft. Starte ein neues Aufmaß über den Button oben.';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue