diff --git a/htdocs/holiday/class/api_holidays.class.php b/htdocs/holiday/class/api_holidays.class.php index 7333c658b23..3356af74979 100644 --- a/htdocs/holiday/class/api_holidays.class.php +++ b/htdocs/holiday/class/api_holidays.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2020-2025 Frédéric France * Copyright (C) 2025 MDW * Copyright (C) 2025 William Mead + * Copyright (C) 2025 Charlene Benke * * 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'); } diff --git a/htdocs/public/webportal/css/card.css b/htdocs/public/webportal/css/card.css new file mode 100644 index 00000000000..9bce48fbe03 --- /dev/null +++ b/htdocs/public/webportal/css/card.css @@ -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; + } +} diff --git a/htdocs/public/webportal/css/style.css.php b/htdocs/public/webportal/css/style.css.php index 1e034f2ae97..edeb7e85c01 100644 --- a/htdocs/public/webportal/css/style.css.php +++ b/htdocs/public/webportal/css/style.css.php @@ -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"; /** diff --git a/htdocs/public/webportal/tpl/card-view-header.tpl.php b/htdocs/public/webportal/tpl/card-view-header.tpl.php index 7a7ac5233fe..162c879c357 100644 --- a/htdocs/public/webportal/tpl/card-view-header.tpl.php +++ b/htdocs/public/webportal/tpl/card-view-header.tpl.php @@ -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; ?> -
-
-
-
-
- object->element == 'member') { - print $formCard->form->showphoto('memberphoto', $formCard->object, 0, 0, 0, 'photowithmargin photoref', 'small', 1, 0); - } - ?> -
-
+
+
-
-
trans("Ref") . ' : ' . dol_escape_htmltag($formCard->object->ref) ?>
+ object->element == 'member') { + print '
'; + print $formCard->form->showphoto('memberphoto', $formCard->object, 0, 0, 0, 'photowithmargin photoref', 'small', 1, 0); + print '
'; + } + ?> - 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 .= ''; - // break; - // case 'woman': - // $addgendertxt .= ''; - // break; - // case 'other': - // $addgendertxt .= ''; - // 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) . ')' : ''; - } - } ?> -
- +
+ object->ref)) : ?> +
trans("Ref") . ' : ' . dol_escape_htmltag($formCard->object->ref) ?>
+ - object, 'getBannerAddressForWebPortal')) { - $moreaddress = $formCard->object->getBannerAddressForWebPortal('refaddress'); - if ($moreaddress) { ?> -
- 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 .= ''; + // break; + // case 'woman': + // $addgendertxt .= ''; + // break; + // case 'other': + // $addgendertxt .= ''; + // 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) . ')' : ''; + } + } ?> +
+ + + object, 'getBannerAddressForWebPortal')) { + $moreaddress = $formCard->object->getBannerAddressForWebPortal('refaddress'); + if ($moreaddress) { ?> +
+ +
+ +
+ object->getLibStatut(6); + if (empty($htmlStatus) || $htmlStatus == $formCard->object->getLibStatut(3)) { + $htmlStatus = $formCard->object->getLibStatut(5); + } + print $htmlStatus; + ?>
-
- object->getLibStatut(6); - if (empty($htmlStatus) || $htmlStatus == $formCard->object->getLibStatut(3)) { - $htmlStatus = $formCard->object->getLibStatut(5); - } - print $htmlStatus; - ?> -
+