Skip to content

Commit

Permalink
Evarisk#3682 [LegalDisplay] add: half of the widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-charles committed Feb 16, 2024
1 parent 122b517 commit 257fae7
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 13 deletions.
81 changes: 81 additions & 0 deletions class/digiriskdolibarrdocuments/legaldisplay.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,88 @@ public function getIDCCByCode($code) {
*/
public function load_dashboard(): array
{
global $db, $langs;

$document = new LegalDisplay($db);

$getLegalDisplayInfos = $this->getLegalDisplayInfos();
$document = json_decode($document->LegalDisplayFillJSON(), false, 512, JSON_UNESCAPED_UNICODE)->LegalDisplay;

$dashboardData['widgets'] = [
'labour_doctor' => [
'label' => [
$langs->transnoentities('Name') ?? '',
$langs->transnoentities('Address') ?? '',
$langs->transnoentities('Town') ?? '',
$langs->transnoentities('Phone') ?? '',
$langs->transnoentities('Schedules') ?? '',
],
'content' => [
$document->occupational_health_service->name,
$document->occupational_health_service->address,
$document->occupational_health_service->town,
$document->occupational_health_service->phone,
$document->occupational_health_service->openinghours,
],
'picto' => 'fas fa-user-md',
'widgetName' => $langs->transnoentities('Society')
],
'labour_inspector' => [
'label' => [
$langs->transnoentities('Name') ?? '',
$langs->transnoentities('Address') ?? '',
$langs->transnoentities('Town') ?? '',
$langs->transnoentities('Phone') ?? '',
$langs->transnoentities('Schedules') ?? '',
],
'content' => [
$document->detective_work->name,
$document->detective_work->address,
$document->detective_work->town,
$document->detective_work->phone,
$document->detective_work->openinghours,
],
'picto' => 'fas fa-briefcase',
'widgetName' => $langs->transnoentities('Society')
],
'emergency_calls' => [
'label' => [
$langs->transnoentities('SAMU') ?? '',
$langs->transnoentities('Pompiers') ?? '',
$langs->transnoentities('Police') ?? '',
$langs->transnoentities('AllEmergencies') ?? '',
$langs->transnoentities('RightsDefender') ?? '',
$langs->transnoentities('PoisonControlCenter') ?? '',
$langs->transnoentities('ResponsibleToNotify') ?? ''
],
'content' => [
$document->emergency_service->samu,
$document->emergency_service->pompier,
$document->emergency_service->police,
$document->emergency_service->emergency,
$document->emergency_service->right_defender,
$document->emergency_service->poison_control_center,
$document->emergency_service->safety_rule
],
'picto' => 'fas fa-ambulance',
'widgetName' => $langs->transnoentities('Emergency')
],
'working_time' => [
'label' => [
$langs->transnoentities('Monday') ?? '',
$langs->transnoentities('Tuesday') ?? '',
$langs->transnoentities('Wednesday') ?? '',
$langs->transnoentities('Thursday') ?? '',
$langs->transnoentities('Friday') ?? '',
$langs->transnoentities('Saturday') ?? '',
$langs->transnoentities('Sunday') ?? ''
],
'content' => [
],
'picto' => 'fas fa-clock',
'widgetName' => $langs->transnoentities('Emergency')
],
];

$dashboardData['graphs'] = [$getLegalDisplayInfos];

Expand Down
14 changes: 1 addition & 13 deletions view/digiriskstandard/digiriskstandard_legaldisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,11 @@
saturne_banner_tab($object,'ref','none', 0, 'ref', 'ref', $moreHtmlRef, true);
$moduleNameLowerCase = 'digiriskdolibarr';

print '<div class="valignmiddle"> <a href="../../admin/securityconf.php" target="_blank">' . $langs->trans('ConfigureSecurityAndSocialData') . ' <i class="fas fa-external-link-alt"></i></a></div>';
print '<hr>';
//print '<div class="valignmiddle"> <a href="../../admin/securityconf.php" target="_blank">' . $langs->trans('ConfigureSecurityAndSocialData') . ' <i class="fas fa-external-link-alt"></i></a></div>';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<table class="border centpercent tableforfield">';

//JSON Decode and show fields
require_once __DIR__ . '/../../core/tpl/digiriskdocuments/digiriskdolibarr_legaldisplayfields_view.tpl.php';

print '</table>';
print '</div>';
print '<div class="fichehalfright">';

$moreParams = ['loadLegalDisplay' => 1];
$dashboard->show_dashboard($moreParams);
print '</div>';
print '</div>';

print dol_get_fiche_end();

Expand Down

0 comments on commit 257fae7

Please sign in to comment.