Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
6ccec8fcbf
4 changed files with 142 additions and 68 deletions
|
|
@ -4,6 +4,7 @@
|
|||
* Copyright (C) 2020-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 William Mead <william@m34d.com>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -365,7 +366,7 @@ class Holidays extends DolibarrApi
|
|||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->holiday->setValidate(DolibarrApiAccess::$user, $notrigger);
|
||||
$result = $this->holiday->validate(DolibarrApiAccess::$user, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||
}
|
||||
|
|
@ -410,7 +411,7 @@ class Holidays extends DolibarrApi
|
|||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->holiday->setApproved(DolibarrApiAccess::$user, $notrigger);
|
||||
$result = $this->holiday->approve(DolibarrApiAccess::$user, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(304, 'Error nothing done. May be object is already approved');
|
||||
}
|
||||
|
|
|
|||
61
htdocs/public/webportal/css/card.css
Normal file
61
htdocs/public/webportal/css/card.css
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
.header-card-block {
|
||||
|
||||
--photo-size : 128px;
|
||||
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* If a photo is present */
|
||||
.header-card-block:has(.header-card-photo) {
|
||||
grid-template-columns: var(--photo-size) 1fr auto;
|
||||
}
|
||||
|
||||
/* Photo */
|
||||
.header-card-photo {
|
||||
grid-column: 1;
|
||||
width: var(--photo-size);
|
||||
}
|
||||
|
||||
/* main information */
|
||||
.header-card-main-information {
|
||||
grid-column: 2;
|
||||
}
|
||||
|
||||
/* Status */
|
||||
.header-card-status {
|
||||
grid-column: 3;
|
||||
justify-self: end;
|
||||
align-self: start; /* Align the content to the top */
|
||||
}
|
||||
|
||||
/* Responsive for smartphone */
|
||||
@media (max-width: 600px) {
|
||||
.header-card-block{
|
||||
--photo-size : 64px;
|
||||
}
|
||||
|
||||
.header-card-block:has(.header-card-photo) {
|
||||
grid-template-columns: var(--photo-size) 1fr;
|
||||
grid-template-rows: auto auto; /* 2 rows: status first, then main info */
|
||||
}
|
||||
|
||||
.header-card-photo {
|
||||
grid-column: 1;
|
||||
grid-row: 1 / span 2; /* photo spans 2 rows */
|
||||
}
|
||||
|
||||
.header-card-status {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
justify-self: start;
|
||||
align-self: start; /* Align the content to the top */
|
||||
}
|
||||
|
||||
.header-card-main-information {
|
||||
grid-column: 2;
|
||||
grid-row: 2;
|
||||
}
|
||||
}
|
||||
|
|
@ -99,6 +99,7 @@ if (empty($dolibarr_nocache)) {
|
|||
@import "badges.css";
|
||||
@import "title-buttons.css";
|
||||
@import "nav.css";
|
||||
@import "card.css";
|
||||
@import "dialog.css";
|
||||
@import "btn.css";
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,82 +17,93 @@ if (empty($context) || !is_object($context)) {
|
|||
* @var Context $context
|
||||
* @var AbstractCardController $this
|
||||
* @var FormCardWebPortal $formCard
|
||||
* @var mixed $vars TPL vars
|
||||
*/
|
||||
$formCard = $this->formCard;
|
||||
|
||||
?>
|
||||
|
||||
<header>
|
||||
<div class="header-card-left-block inline-block" style="width: 75%;">
|
||||
<div>
|
||||
<div class="inline-block floatleft valignmiddle">
|
||||
<div class="floatleft inline-block valignmiddle divphotoref">
|
||||
<?php
|
||||
if ($formCard->object->element == 'member') {
|
||||
print $formCard->form->showphoto('memberphoto', $formCard->object, 0, 0, 0, 'photowithmargin photoref', 'small', 1, 0);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<header class="object-card-view" data-element="<?php print dolPrintHTMLForAttribute($formCard->object->element); ?>" >
|
||||
<div class="header-card-block">
|
||||
|
||||
<div class="header-card-main-information inline-block valignmiddle">
|
||||
<div><strong><?php print $langs->trans("Ref") . ' : ' . dol_escape_htmltag($formCard->object->ref) ?></strong></div>
|
||||
<?php
|
||||
// TODO: CODE QUALITY: Avoid defining object-specific logic directly inside the template.
|
||||
// If object-specific handling is required, create a dedicated template file or pass the necessary variables in $vars so the template remains generic.
|
||||
// also you can create a getBannerAddressForWebPortal method into object (who extend Dolibarr object) but its not a good way
|
||||
if ($formCard->object->element == 'member') {
|
||||
print '<div class="header-card-photo">';
|
||||
print $formCard->form->showphoto('memberphoto', $formCard->object, 0, 0, 0, 'photowithmargin photoref', 'small', 1, 0);
|
||||
print '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($formCard->object->element == 'member') {
|
||||
$object = $formCard->object;
|
||||
'@phan-var-force Adherent $object';
|
||||
/**
|
||||
* @var Adherent $object
|
||||
*/
|
||||
$addgendertxt = '';
|
||||
//if (property_exists($object, 'gender') && !empty($object->gender)) {
|
||||
// switch ($object->gender) {
|
||||
// case 'man':
|
||||
// $addgendertxt .= '<i class="fas fa-mars"></i>';
|
||||
// break;
|
||||
// case 'woman':
|
||||
// $addgendertxt .= '<i class="fas fa-venus"></i>';
|
||||
// break;
|
||||
// case 'other':
|
||||
// $addgendertxt .= '<i class="fas fa-transgender"></i>';
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
$fullname = '';
|
||||
if (method_exists($object, 'getFullName')) {
|
||||
$fullname = $object->getFullName($langs);
|
||||
}
|
||||
if ($object->morphy == 'mor' && !empty($object->company)) {
|
||||
$out = dol_htmlentities($object->company);
|
||||
$out .= (!empty($fullname) && $object->company != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '';
|
||||
} else {
|
||||
$out = dol_htmlentities($fullname) . $addgendertxt;
|
||||
if (empty($object->socid)) {
|
||||
$out .= (!empty($object->company) && $object->company != $fullname) ? ' (' . dol_htmlentities($object->company) . ')' : '';
|
||||
}
|
||||
} ?>
|
||||
<div><strong><?php print $out ?></strong></div>
|
||||
<?php } ?>
|
||||
<div class="header-card-main-information">
|
||||
<?php if (!empty($formCard->object->ref)) : ?>
|
||||
<div class="header-card-ref"><?php print $langs->trans("Ref") . ' : ' . dol_escape_htmltag($formCard->object->ref) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
if (method_exists($formCard->object, 'getBannerAddressForWebPortal')) {
|
||||
$moreaddress = $formCard->object->getBannerAddressForWebPortal('refaddress');
|
||||
if ($moreaddress) { ?>
|
||||
<div class="refidno refaddress"><?php print $moreaddress ?></div>
|
||||
<?php }
|
||||
<?php
|
||||
// TODO: CODE QUALITY: Avoid defining object-specific logic directly inside the template.
|
||||
// If object-specific handling is required, create a dedicated template file or pass the necessary variables so the template remains generic.
|
||||
// also you can create a getBannerAddressForWebPortal method into webportal object (who extend Dolibarr object) but its not a good way
|
||||
|
||||
if ($formCard->object->element == 'member') {
|
||||
$object = $formCard->object;
|
||||
'@phan-var-force Adherent $object';
|
||||
/**
|
||||
* @var Adherent $object
|
||||
*/
|
||||
$addgendertxt = '';
|
||||
//if (property_exists($object, 'gender') && !empty($object->gender)) {
|
||||
// switch ($object->gender) {
|
||||
// case 'man':
|
||||
// $addgendertxt .= '<i class="fas fa-mars"></i>';
|
||||
// break;
|
||||
// case 'woman':
|
||||
// $addgendertxt .= '<i class="fas fa-venus"></i>';
|
||||
// break;
|
||||
// case 'other':
|
||||
// $addgendertxt .= '<i class="fas fa-transgender"></i>';
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
$fullname = '';
|
||||
if (method_exists($object, 'getFullName')) {
|
||||
$fullname = $object->getFullName($langs);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
if ($object->morphy == 'mor' && !empty($object->company)) {
|
||||
$out = dol_htmlentities($object->company);
|
||||
$out .= (!empty($fullname) && $object->company != $fullname) ? ' (' . dol_htmlentities($fullname) . $addgendertxt . ')' : '';
|
||||
} else {
|
||||
$out = dol_htmlentities($fullname) . $addgendertxt;
|
||||
if (empty($object->socid)) {
|
||||
$out .= (!empty($object->company) && $object->company != $fullname) ? ' (' . dol_htmlentities($object->company) . ')' : '';
|
||||
}
|
||||
} ?>
|
||||
<div class="header-card-company" ><?php print $out ?></div>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
// TODO : use TPL $vars not the object, there is a controller so use it instead to pass $vars.
|
||||
if (method_exists($formCard->object, 'getBannerAddressForWebPortal')) {
|
||||
$moreaddress = $formCard->object->getBannerAddressForWebPortal('refaddress');
|
||||
if ($moreaddress) { ?>
|
||||
<div class="header-card-address"><?php print $moreaddress ?></div>
|
||||
<?php }
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="header-card-status" >
|
||||
<?php
|
||||
$htmlStatus = $formCard->object->getLibStatut(6);
|
||||
if (empty($htmlStatus) || $htmlStatus == $formCard->object->getLibStatut(3)) {
|
||||
$htmlStatus = $formCard->object->getLibStatut(5);
|
||||
}
|
||||
print $htmlStatus;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-card-right-block inline-block" style="width: 24%;">
|
||||
<?php
|
||||
$htmlStatus = $formCard->object->getLibStatut(6);
|
||||
if (empty($htmlStatus) || $htmlStatus == $formCard->object->getLibStatut(3)) {
|
||||
$htmlStatus = $formCard->object->getLibStatut(5);
|
||||
}
|
||||
print $htmlStatus;
|
||||
?>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
|
|
|||
Loading…
Reference in a new issue