QUAL : Ergo btn and fix (#30947)

* Clean sql

* Doc

* Fix ergo feedback and accessibility button

* Add hsl color var to allow css use user color with variants

* Add hsl color var to allow css use user color with variants

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
John BOTELLA 2024-09-13 17:30:41 +02:00 committed by GitHub
parent 3ff6015b40
commit 308178d5bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 145 additions and 8 deletions

View file

@ -12639,7 +12639,7 @@ function getFieldErrorIcon($fieldValidationErrorMsg)
* @param string $url the url for link
* @param string $id attribute id of button
* @param int<-2,2> $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use param $helpText as tooltip help
* @param array<string,mixed> $params various params for future : recommended rather than adding more function arguments
* @param array<string,mixed> $params various parameters for future : recommended rather than adding more function arguments
* @return string html button
*/
function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array())

View file

@ -997,9 +997,13 @@ if ($id > 0 || !empty($ref)) {
}
// Qty to dispatch
print '<td class="right">';
print '<a href="#" id="reset'.$suffix.'" class="resetline">'.img_picto($langs->trans("Reset"), 'eraser', 'class="pictofixedwidth opacitymedium"').'</a>';
print '<input id="qty'.$suffix.'" name="qty'.$suffix.'" type="text" class="width50 right qtydispatchinput" value="'.(GETPOSTISSET('qty'.$suffix) ? GETPOSTINT('qty'.$suffix) : (!getDolGlobalString('SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO') ? $remaintodispatch : 0)).'">';
print '<td class="right nowrap">';
if ($remaintodispatch>0) {
$btnLabel = $langs->trans("Fill").' : '.$remaintodispatch;
print '<button class="auto-fill-qty btn-low-emphasis --btn-icon" data-rowname="qty'.$suffix.'" data-value="'.$remaintodispatch.'" title="'.dol_escape_htmltag($btnLabel).'" aria-label="'.dol_escape_htmltag($btnLabel).'" >'.img_picto($btnLabel, 'fa-arrow-right', 'aria-hidden="true"', 0, 0, 1).'</button>';
}
print '<input id="qty'.$suffix.'" name="qty'.$suffix.'" type="number" step="any" class="width50 right qtydispatchinput" value="'.(GETPOSTISSET('qty'.$suffix) ? GETPOSTINT('qty'.$suffix) : (!getDolGlobalString('SUPPLIER_ORDER_DISPATCH_FORCE_QTY_INPUT_TO_ZERO') ? $remaintodispatch : 0)).'">';
print '<button class="resetline btn-low-emphasis --btn-icon" id="reset'.$suffix.'" title="'.dol_escape_htmltag($langs->trans("Reset")).'" >'.img_picto($langs->trans("Reset"), 'eraser', 'aria-hidden="true"', 0, 0, 1).'</button>';
print '</td>';
print '<td>';
@ -1136,6 +1140,11 @@ if ($id > 0 || !empty($ref)) {
$("select[name^=entrepot_]").val(fk_default_warehouse).change();
});
$(".auto-fill-qty").on("click touchstart", function(e){
e.preventDefault();
$("input[name="+$(this).data("rowname")+"]").val($(this).data("value")).trigger("change");
});
$("#autoreset").click(function() {
$(".qtydispatchinput").each(function(){
id = $(this).attr("id");
@ -1154,7 +1163,8 @@ if ($id > 0 || !empty($ref)) {
});
});
$(".resetline").click(function(){
$(".resetline").click(function(e){
e.preventDefault();
id = $(this).attr("id");
id = id.split("reset_");
console.log("Reset trigger for id = qty_"+id[1]);

View file

@ -2419,7 +2419,7 @@ class Societe extends CommonObject
// Writes trace in discount history
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise";
$sql .= " (entity, datec, fk_soc, remise_client, note, fk_user_author)";
$sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',";
$sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',";
$sql .= " '".$this->db->escape($note)."',";
$sql .= " ".((int) $user->id);
$sql .= ")";
@ -2480,7 +2480,7 @@ class Societe extends CommonObject
// Writes trace in discount history
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier";
$sql .= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)";
$sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',";
$sql .= " VALUES (".((int) $conf->entity).", '".$this->db->idate($now)."', ".((int) $this->id).", '".$this->db->escape($remise)."',";
$sql .= " '".$this->db->escape($note)."',";
$sql .= " ".((int) $user->id);
$sql .= ")";

View file

@ -344,7 +344,7 @@ div.pagination li:first-child a.btnTitle, div.pagination li.paginationafterarrow
/*
* BTN LINK
* BTN LINK (used with <a/> tag in general but not with <button/>)
*/
.btn-link{
@ -360,3 +360,60 @@ div.pagination li:first-child a.btnTitle, div.pagination li.paginationafterarrow
background-color: #ddd;
border: 1px solid #ddd;
}
/*
* BUTTON With Low emphasis
*/
button.btn-low-emphasis{
text-align: center;
display: inline-block;
border: none;
outline: none;
cursor: pointer;
margin: 0;
padding: 0;
width: auto;
min-width: 1.5em;
min-height: 1.5em;
line-height: 1.5em;
overflow: visible;
background: transparent;
background-position: center; /* used for hover ripple effect */
background-size: 0%;
color: var(--colortextlink, inherit);
font: inherit;
line-height: normal;
/* Corrects font smoothing for webkit */
-webkit-font-smoothing: inherit;
-moz-osx-font-smoothing: inherit;
/* Corrects inability to style clickable input types in iOS */
-webkit-appearance: none;
transition: background 0.8s;/* used for hover ripple effect */
background: transparent radial-gradient(circle, transparent 1%, hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1) 1%, transparent 10%) center/15000%;
}
button.btn-low-emphasis.--btn-icon{
border-radius: 100%;
}
button.btn-low-emphasis :is(.fa, .fas){
color: var(--colortextlink, inherit);
opacity: 0.4;
}
button.btn-low-emphasis:is(:focus,:hover) :is(.fa, .fas){
opacity: 0.8;
}
button.btn-low-emphasis.--btn-icon:active {
background-color: hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1);
background-size: 100%;
transition: background 0s;/* used for hover ripple effect */
}

View file

@ -109,6 +109,10 @@ $leftmenuwidth = 240;
--colortexttitlelink: rgba(<?php print $colortexttitlelink; ?>, 0.9);
--colortext: rgb(<?php print $colortext; ?>);
--colortextlink: rgb(<?php print $colortextlink; ?>);
--colortextlink-h: <?php print $colortextlinkHsla['h']; ?>;
--colortextlink-l: <?php print $colortextlinkHsla['l']; ?>%;
--colortextlink-s: <?php print $colortextlinkHsla['s']; ?>%;
--colortextlink-a: 1;
--colortextbackhmenu: #<?php print $colortextbackhmenu; ?>;
--colortextbackvmenu: #<?php print $colortextbackvmenu; ?>;
--colortopbordertitle1: rgb(<?php print $colortopbordertitle1; ?>);

View file

@ -195,6 +195,8 @@ $colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!g
$colortexttitlelink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTTITLELINK') ? $colortexttitlelink : $conf->global->THEME_ELDY_TEXTTITLELINK) : (empty($user->conf->THEME_ELDY_TEXTTITLELINK) ? $colortexttitlelink : $user->conf->THEME_ELDY_TEXTTITLELINK);
$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXT') ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT);
$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTLINK') ? $colortextlink : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK);
$colortextlinkHsla = colorHexToHsl($colortextlink, false, true);
$butactionbg = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_BTNACTION') ? $butactionbg : $conf->global->THEME_ELDY_BTNACTION) : (empty($user->conf->THEME_ELDY_BTNACTION) ? $butactionbg : $user->conf->THEME_ELDY_BTNACTION);
$textbutaction = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTBTNACTION') ? $textbutaction : $conf->global->THEME_ELDY_TEXTBTNACTION) : (empty($user->conf->THEME_ELDY_TEXTBTNACTION) ? $textbutaction : $user->conf->THEME_ELDY_TEXTBTNACTION);
$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_FONT_SIZE1') ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1);

View file

@ -442,3 +442,61 @@ div.pagination .btnTitle:hover .btnTitle-label{
background-color: #ddd;
border: 1px solid #ddd;
}
/*
* BUTTON With Low emphasis
*/
button.btn-low-emphasis{
text-align: center;
display: inline-block;
border: none;
outline: none;
cursor: pointer;
margin: 0;
padding: 0;
width: auto;
min-width: 1.5em;
min-height: 1.5em;
line-height: 1.5em;
overflow: visible;
background: transparent;
background-position: center; /* used for hover ripple effect */
background-size: 0%;
color: var(--colortextlink, inherit);
font: inherit;
line-height: normal;
/* Corrects font smoothing for webkit */
-webkit-font-smoothing: inherit;
-moz-osx-font-smoothing: inherit;
/* Corrects inability to style clickable input types in iOS */
-webkit-appearance: none;
transition: background 0.8s;/* used for hover ripple effect */
background: transparent radial-gradient(circle, transparent 1%, hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1) 1%, transparent 10%) center/15000%;
}
button.btn-low-emphasis.--btn-icon{
border-radius: 100%;
}
button.btn-low-emphasis :is(.fa, .fas){
color: var(--colortextlink, inherit);
opacity: 0.4;
}
button.btn-low-emphasis:is(:focus,:hover) :is(.fa, .fas){
opacity: 0.8;
}
button.btn-low-emphasis.--btn-icon:active {
background-color: hsla(var(--colortextlink-h),var(--colortextlink-s) ,var(--colortextlink-l) , 0.1);
background-size: 100%;
transition: background 0s;/* used for hover ripple effect */
}

View file

@ -198,6 +198,7 @@ $colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!ge
$colortexttitlelink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTTITLELINK') ? $colortexttitlelink : $conf->global->THEME_ELDY_TEXTTITLELINK) : (empty($user->conf->THEME_ELDY_TEXTTITLELINK) ? $colortexttitlelink : $user->conf->THEME_ELDY_TEXTTITLELINK);
$colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXT') ? $colortext : $conf->global->THEME_ELDY_TEXT) : (empty($user->conf->THEME_ELDY_TEXT) ? $colortext : $user->conf->THEME_ELDY_TEXT);
$colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTLINK') ? $colortext : $conf->global->THEME_ELDY_TEXTLINK) : (empty($user->conf->THEME_ELDY_TEXTLINK) ? $colortextlink : $user->conf->THEME_ELDY_TEXTLINK);
$colortextlinkHsla = colorHexToHsl($colortextlink, false, true);
$butactionbg = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_BTNACTION') ? $butactionbg : $conf->global->THEME_ELDY_BTNACTION) : (empty($user->conf->THEME_ELDY_BTNACTION) ? $butactionbg : $user->conf->THEME_ELDY_BTNACTION);
$textbutaction = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_TEXTBTNACTION') ? $textbutaction : $conf->global->THEME_ELDY_TEXTBTNACTION) : (empty($user->conf->THEME_ELDY_TEXTBTNACTION) ? $textbutaction : $user->conf->THEME_ELDY_TEXTBTNACTION);
$fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (!getDolGlobalString('THEME_ELDY_FONT_SIZE1') ? $fontsize : $conf->global->THEME_ELDY_FONT_SIZE1) : (empty($user->conf->THEME_ELDY_FONT_SIZE1) ? $fontsize : $user->conf->THEME_ELDY_FONT_SIZE1);
@ -350,6 +351,11 @@ $leftmenuwidth = 242;
--colortexttitlelink: rgba(<?php print $colortexttitlelink; ?>, 0.9);
--colortext: rgb(<?php print $colortext; ?>);
--colortextlink: rgb(<?php print $colortextlink; ?>);
--colortextlink: rgb(<?php print $colortextlink; ?>);
--colortextlink-h: <?php print $colortextlinkHsla['h']; ?>;
--colortextlink-l: <?php print $colortextlinkHsla['l']; ?>%;
--colortextlink-s: <?php print $colortextlinkHsla['s']; ?>%;
--colortextlink-a: 1;
--colortextbackhmenu: #<?php print $colortextbackhmenu; ?>;
--colortextbackvmenu: #<?php print $colortextbackvmenu; ?>;
--colortopbordertitle1: rgb(<?php print $colortopbordertitle1; ?>);