Jelajahi Sumber

Look and feel v18

Laurent Destailleur 2 tahun lalu
induk
melakukan
1be9364971

+ 24 - 24
htdocs/core/class/html.form.class.php

@@ -609,22 +609,22 @@ class Form
 	}
 
 	/**
-	 *    Show a text and picto with tooltip on text or picto.
+	 *  Show a text and picto with tooltip on text or picto.
 	 *  Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip
 	 *
-	 * @param string $text Text to show
-	 * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded.
-	 * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2
-	 * @param int $direction -1=image is before, 0=no image, 1=image is after
-	 * @param string $img Html code for image (use img_xxx() function to get it)
-	 * @param string $extracss Add a CSS style to td tags
-	 * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
-	 * @param string $incbefore Include code before the text
-	 * @param int $noencodehtmltext Do not encode into html entity the htmltext
-	 * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key)
-	 * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
-	 * @return    string                            Code html du tooltip (texte+picto)
-	 * @see    textwithpicto() Use thisfunction if you can.
+	 * 	@param 	string 	$text 				Text to show
+	 * 	@param 	string 	$htmltext 			HTML content of tooltip. Must be HTML/UTF8 encoded.
+	 * 	@param 	int 	$tooltipon 			1=tooltip on text, 2=tooltip on image, 3=tooltip sur les 2
+	 * 	@param 	int 	$direction 			-1=image is before, 0=no image, 1=image is after
+	 * 	@param 	string 	$img 				Html code for image (use img_xxx() function to get it)
+	 * 	@param 	string 	$extracss 			Add a CSS style to td tags
+	 * 	@param 	int 	$notabs 			0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
+	 * 	@param 	string 	$incbefore 			Include code before the text
+	 * 	@param 	int 	$noencodehtmltext 	Do not encode into html entity the htmltext
+	 * 	@param 	string 	$tooltiptrigger 	''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key)
+	 * 	@param 	int 	$forcenowrap 		Force no wrap between text and picto (works with notabs=2 only)
+	 * 	@return string                      Code html du tooltip (texte+picto)
+	 * 	@see    textwithpicto() 			Use thisfunction if you can.
 	 */
 	public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0)
 	{
@@ -725,16 +725,16 @@ class Form
 	/**
 	 *    Show a text with a picto and a tooltip on picto
 	 *
-	 * @param string $text Text to show
-	 * @param string $htmltext Content of tooltip
-	 * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
-	 * @param string $type Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'
-	 * @param string $extracss Add a CSS style to td, div or span tag
-	 * @param int $noencodehtmltext Do not encode into html entity the htmltext
-	 * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
-	 * @param string $tooltiptrigger ''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable')
-	 * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only)
-	 * @return    string                        HTML code of text, picto, tooltip
+	 * @param 	string 		$text 				Text to show
+	 * @param 	string 		$htmltext 			Content of tooltip
+	 * @param 	int 		$direction 			1=Icon is after text, -1=Icon is before text, 0=no icon
+	 * @param 	string 		$type 				Type of picto ('info', 'infoclickable', 'help', 'helpclickable', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none'
+	 * @param 	string 		$extracss 			Add a CSS style to td, div or span tag
+	 * @param 	int 		$noencodehtmltext 	Do not encode into html entity the htmltext
+	 * @param 	int 		$notabs 			0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
+	 * @param 	string 		$tooltiptrigger 	''=Tooltip on hover and hidden on smartphone, 'abconsmartphone'=Tooltip on hover and on click on smartphone, 'abc'=Tooltip on click (abc is a unique key, clickable link is on image or on link if param $type='none' or on both if $type='xxxclickable')
+	 * @param 	int 		$forcenowrap 		Force no wrap between text and picto (works with notabs=2 only)
+	 * @return	string                        	HTML code of text, picto, tooltip
 	 */
 	public function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 3, $tooltiptrigger = '', $forcenowrap = 0)
 	{

+ 45 - 23
htdocs/holiday/card.php

@@ -1003,44 +1003,66 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
 		print '<input type="hidden" name="token" value="'.newToken().'" />'."\n";
 		print '<input type="hidden" name="action" value="add" />'."\n";
 
+		print dol_get_fiche_head();
+
+		//print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br><br>';
+
+		print '<table class="border centpercent">';
+		print '<tbody>';
+
+		// User for leave request
+		print '<tr>';
+		print '<td class="titlefield fieldrequired tdtop">'.$langs->trans("User").'</td>';
+		print '<td><div class="inline-block">';
+		if ($cancreate && !$cancreateall) {
+			print img_picto('', 'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500 inline-block');
+			//print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
+		} else {
+			print img_picto('', 'user').$form->select_dolusers($fuserid ? $fuserid : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500 inline-block');
+		}
+		print '</div>';
+
 		if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
-			print dol_get_fiche_head('', '', '', -1);
+			print '<div class="leaveuserbalance paddingtop inline-block floatright badge badge-status0 badge-status margintoponsmartphone">';
 
 			$out = '';
 			$nb_holiday = 0;
 			$typeleaves = $object->getTypes(1, 1);
 			foreach ($typeleaves as $key => $val) {
-				$nb_type = $object->getCPforUser($user->id, $val['rowid']);
+				$nb_type = $object->getCPforUser(($fuserid ? $fuserid : $user->id), $val['rowid']);
 				$nb_holiday += $nb_type;
 
 				$out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': <strong>'.($nb_type ? price2num($nb_type) : 0).'</strong><br>';
 				//$out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
 			}
-			print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>';
-			print $out;
-
-			print dol_get_fiche_end();
-		} elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
-			print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
-		}
+			print ' &nbsp; &nbsp; ';
 
-		print dol_get_fiche_head();
-
-		//print '<span>'.$langs->trans('DelayToRequestCP',$object->getConfCP('delayForRequest')).'</span><br><br>';
+			$htmltooltip = $langs->trans("Detail").'<br>';
+			$htmltooltip .= $out;
 
-		print '<table class="border centpercent">';
-		print '<tbody>';
+			print $form->textwithtooltip($langs->trans('SoldeCPUser', round($nb_holiday, 5)).' '.img_picto('', 'help'), $htmltooltip);
 
-		// User for leave request
-		print '<tr>';
-		print '<td class="titlefield fieldrequired">'.$langs->trans("User").'</td>';
-		print '<td>';
-		if ($cancreate && !$cancreateall) {
-			print img_picto('', 'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500');
-			//print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
-		} else {
-			print img_picto('', 'user').$form->select_dolusers($fuserid ? $fuserid : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500');
+			print '</div>';
+			if (!empty($conf->use_javascript_ajax)) {
+				print '<script>';
+				print '$( document ).ready(function() {
+					jQuery("#fuserid").change(function() {
+						console.log("We change to user id "+jQuery("#fuserid").val());
+						if (jQuery("#fuserid").val() == '.((int) $user->id).') {
+							jQuery(".leaveuserbalance").show();
+						} else {
+							jQuery(".leaveuserbalance").hide();
+						}
+					});
+				});';
+				print '</script>';
+			}
+		} elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
+			print '<div class="leaveuserbalance paddingtop">';
+			print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE);
+			print '</div>';
 		}
+
 		print '</td>';
 		print '</tr>';
 

+ 1 - 1
htdocs/langs/en_US/holiday.lang

@@ -29,7 +29,7 @@ DescCP=Description
 SendRequestCP=Create leave request
 DelayToRequestCP=Leave requests must be made at least <b>%s day(s)</b> before them.
 MenuConfCP=Balance of leave
-SoldeCPUser=Leave balance (in days) <b>%s</b>
+SoldeCPUser=Leave balance (in days) : <b>%s</b>
 ErrorEndDateCP=You must select an end date greater than the start date.
 ErrorSQLCreateCP=An SQL error occurred during the creation:
 ErrorIDFicheCP=An error has occurred, the leave request does not exist.

+ 2 - 2
htdocs/langs/fr_FR/holiday.lang

@@ -5,7 +5,7 @@ Holiday=Demande de congés
 CPTitreMenu=Demande de congés
 MenuReportMonth=État mensuel
 MenuAddCP=Créer demande de congés
-MenuCollectiveAddCP=Nouvelle demande de congé collectif
+MenuCollectiveAddCP=Demande de congé collectif
 NotActiveModCP=Vous devez activer le module Congés pour afficher cette page.
 AddCP=Créer une demande de congés
 DateDebCP=Date Début
@@ -95,7 +95,7 @@ UseralreadyCPexist=Une demande de congé a déjà été faite pour cette périod
 groups=Groupes
 users=Utilisateurs
 AutoSendMail=Envoi automatique d'email
-NewHolidayForGroup=Nouvelle demande de congé collectif
+NewHolidayForGroup=Demande de congé collectif
 SendRequestCollectiveCP=Envoyer la demande de congé collectif
 AutoValidationOnCreate=Validation automatique
 FirstDayOfHoliday=Premier jour de congés

+ 2 - 0
htdocs/theme/eldy/global.inc.php

@@ -1744,6 +1744,8 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
 	.hideonsmartphone { display: none; }
 	.hideonsmartphoneimp { display: none !important; }
 
+	.margintoponsmartphone { margin-top: 6px; }
+
 	span.pictotitle {
 		margin-<?php echo $left; ?>: 0 !important;
 	}

+ 4 - 2
htdocs/theme/md/style.css.php

@@ -1968,6 +1968,8 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
 	.hideonsmartphone { display: none; }
 	.hideonsmartphoneimp { display: none !important; }
 
+	.margintoponsmartphone { margin-top: 6px; }
+
 	select.minwidth100imp, select.minwidth100, select.minwidth200, select.minwidth200imp, select.minwidth300 {
 		width: calc(100% - 40px) !important;
 		display: inline-block;
@@ -1988,13 +1990,13 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select
 	.smallonsmartphone {
 		font-size: 0.8em;
 	}
-	
+
 	.nopaddingtoponsmartphone {
 		padding-top: 0 !important;
 	}
 	.nopaddingbottomonsmartphone {
 		padding-bottom: 0 !important;
-	}	
+	}
 }
 
 /* Force values for small screen 570 */