From 4ca634b41c93f2cfed9795e839249457a843301f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sat, 11 Mar 2017 12:04:28 +0100 Subject: [PATCH] Better look and feel --- htdocs/product/stock/product.php | 95 +++++++------- .../product/stock/tpl/stockcorrection.tpl.php | 11 +- .../product/stock/tpl/stocktransfer.tpl.php | 5 + htdocs/societe/soc.php | 4 +- htdocs/theme/eldy/style.css.php | 52 ++++---- htdocs/theme/md/style.css.php | 1 - htdocs/variants/combinations.php | 120 +++++++++++------- 7 files changed, 160 insertions(+), 128 deletions(-) diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 14cd07ec817..f12316591d0 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -110,7 +110,7 @@ $parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if($action == 'addlimitstockwarehouse') { +if ($action == 'addlimitstockwarehouse') { $seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); @@ -625,7 +625,8 @@ if ($id > 0 || $ref) print '</td></tr>'; // Real stock - $text_stock_options = ''; + $text_stock_options = $langs->trans("RealStockDesc").'<br>'; + $text_stock_options.= $langs->trans("RealStockWillAutomaticallyWhen").'<br>'; $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)?$langs->trans("DeStockOnShipment").'<br>':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'<br>':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'<br>':''); @@ -642,57 +643,55 @@ if ($id > 0 || $ref) $stocktheo = price2num($object->stock_theorique, 'MS'); + $found=0; + $helpondiff='<strong>'.$langs->trans("StockDiffPhysicTeoric").':</strong><br>'; + // Number of customer orders running + if (! empty($conf->commande->enabled)) + { + if ($found) $helpondiff.='<br>'; else $found=1; + $helpondiff.=$langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; + $result=$object->load_stats_commande(0,'0'); + if ($result < 0) dol_print_error($db,$object->error); + $helpondiff.=' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; + } + + // Number of product from customer order already sent (partial shipping) + if (! empty($conf->expedition->enabled)) + { + if ($found) $helpondiff.='<br>'; else $found=1; + $result=$object->load_stats_sending(0,'2'); + $helpondiff.=$langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; + } + + // Number of supplier order running + if (! empty($conf->fournisseur->enabled)) + { + if ($found) $helpondiff.='<br>'; else $found=1; + $result=$object->load_stats_commande_fournisseur(0,'3,4'); + $helpondiff.=$langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; + $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); + if ($result < 0) dol_print_error($db,$object->error); + $helpondiff.=' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; + } + + // Number of product from supplier order already received (partial receipt) + if (! empty($conf->fournisseur->enabled)) + { + if ($found) $helpondiff.='<br>'; else $found=1; + $helpondiff.=$langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; + } + // Calculating a theorical value - print '<tr><td>'.$langs->trans("VirtualStock").'</td>'; - print "<td>".(empty($stocktheo)?0:$stocktheo); + print '<tr><td>'; + print $form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")); + print '</td>'; + print "<td>"; + //print (empty($stocktheo)?0:$stocktheo); + print $form->textwithpicto((empty($stocktheo)?0:$stocktheo), $helpondiff); if ($object->seuil_stock_alerte != '' && ($object->stock_theorique < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '</td>'; print '</tr>'; - print '<tr><td>'; - print $langs->trans("StockDiffPhysicTeoric"); - print '</td>'; - print '<td>'; - - $found=0; - // Number of customer orders running - if (! empty($conf->commande->enabled)) - { - if ($found) print '<br>'; else $found=1; - print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; - $result=$object->load_stats_commande(0,'0'); - if ($result < 0) dol_print_error($db,$object->error); - print ' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; - } - - // Number of product from customer order already sent (partial shipping) - if (! empty($conf->expedition->enabled)) - { - if ($found) print '<br>'; else $found=1; - $result=$object->load_stats_sending(0,'2'); - print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; - } - - // Number of supplier order running - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '<br>'; else $found=1; - $result=$object->load_stats_commande_fournisseur(0,'3,4'); - print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; - $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); - if ($result < 0) dol_print_error($db,$object->error); - print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; - } - - // Number of product from supplier order already received (partial receipt) - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '<br>'; else $found=1; - print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; - } - - print '</td></tr>'; - // Last movement $sql = "SELECT max(m.datem) as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 757407a6692..28fd3dfadea 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -21,12 +21,14 @@ <!-- BEGIN PHP TEMPLATE STOCKCORRECTION.TPL.PHP --> <?php + $productref = ''; if ($object->element == 'product') $productref = $object->ref; $langs->load("productbatch"); - if (empty($id)) $id = $object->id; + + if (empty($id)) $id = $object->id; print '<script type="text/javascript" language="javascript"> jQuery(document).ready(function() { @@ -46,6 +48,9 @@ print load_fiche_titre($langs->trans("StockCorrection"),'','title_generic.png'); print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n"; + + dol_fiche_head(); + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="correct_stock">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; @@ -127,12 +132,14 @@ print '</table>'; + dol_fiche_end(); + print '<div class="center">'; print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans('Save')).'">'; print ' '; print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; print '</div>'; + print '</form>'; - ?> <!-- END PHP STOCKCORRECTION.TPL.PHP --> diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 407d8a714d8..ed367742f1c 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -48,6 +48,9 @@ print load_fiche_titre($langs->trans("StockTransfer"),'','title_generic.png'); print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$id.'" method="post">'."\n"; + + dol_fiche_head(); + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="transfert_stock">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; @@ -123,6 +126,8 @@ print '</table>'; + dol_fiche_end(); + print '<div class="center">'; print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans('Save')).'">'; print ' '; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 79a8d9cae94..474a037d23f 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1514,13 +1514,13 @@ else // Ref/ID if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print '<tr><td>'.$langs->trans("ID").'</td><td colspan="3">'; + print '<tr><td class="titlefieldcreate">'.$langs->trans("ID").'</td><td colspan="3">'; print $object->ref; print '</td></tr>'; } // Name - print '<tr><td class="titlefield">'.fieldLabel('ThirdPartyName','name',1).'</td>'; + print '<tr><td class="titlefieldcreate">'.fieldLabel('ThirdPartyName','name',1).'</td>'; print '<td colspan="3"><input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.dol_escape_htmltag($object->name).'" autofocus="autofocus"></td></tr>'; // Alias names (commercial, trademark or alias names) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 85fdd49f8ef..6c6869ce7d4 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -260,24 +260,12 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla background-color: #FFF; } -textarea:focus, button:focus { - /* v6 box-shadow: 0 0 4px #8091BF; */ - border: 1px solid #aaa !important; -} -input:focus, select:focus { - border-bottom: 1px solid #666; -} input.select2-input { border-bottom: none ! important; } .select2-choice { border: none; - border-bottom: solid 1px rgba(0,0,0,.1) !important; /* required to avoid to lose bottom line when focus is lost on select2. */ -} - -textarea.cke_source:focus -{ - box-shadow: none; + border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */ } .liste_titre input[name=month], .liste_titre input[name=month_lim] { @@ -288,7 +276,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla font-family: <?php print $fontlist ?>; border: none; - border-bottom: solid 1px rgba(0,0,0,.1); + border-bottom: solid 1px rgba(0,0,0,.2); outline: none; margin: 0px 0px 0px 0px; } @@ -296,22 +284,34 @@ input { line-height: 17px; } input, select { - border-bottom: solid 1px rgba(0,0,0,.1); - padding: 4px; margin-left:0px; margin-bottom:1px; margin-top:1px; } + +/* Focus definitions must be after standard definition */ +textarea:focus, button:focus { + /* v6 box-shadow: 0 0 4px #8091BF; */ + border: 1px solid #aaa !important; +} +input:focus, select:focus { + border-bottom: 1px solid #666; +} +textarea.cke_source:focus +{ + box-shadow: none; +} + select { /* padding: 4px 4px 2px 1px; */ } textarea { border-radius: 0; - border-top:solid 1px rgba(0,0,0,.1); - border-left:solid 1px rgba(0,0,0,.1); - border-right:solid 1px rgba(0,0,0,.1); - border-bottom:solid 1px rgba(0,0,0,.1); + border-top:solid 1px rgba(0,0,0,.2); + border-left:solid 1px rgba(0,0,0,.2); + border-right:solid 1px rgba(0,0,0,.2); + border-bottom:solid 1px rgba(0,0,0,.2); padding:4px; margin-left:0px; @@ -378,7 +378,8 @@ input:-webkit-autofill { ::-moz-placeholder { color:#bbb; } /* firefox 19+ */ :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } - +input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight] { margin-right: 6px; } +input[name=surface] { margin-right: 4px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } @@ -2297,7 +2298,7 @@ table.border td, div.border div div.tagtd { padding: 3px 2px 3px 2px; border-collapse: collapse; } -div.tabBar .fichecenter table.border>tbody>tr>td, div.tabBar .fichecenter div.border div div.tagtd +div.tabBar .fichecenter table.border>tbody>tr>td, div.tabBar .fichecenter div.border div div.tagtd, div.tabBar div.border div div.tagtd { padding-top: 4px; border-bottom: 1px solid #E0E0E0; @@ -3908,8 +3909,8 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ -.select2-container .select2-choice { - border-bottom: solid 1px rgba(0,0,0,.1); +.select2-choice, .select2-container .select2-choice { + border-bottom: solid 1px rgba(0,0,0,.2); } .select2-container .select2-choice > .select2-chosen { margin-right: 23px; @@ -3937,14 +3938,13 @@ div.dataTables_length select { border-top: none !important; border-left: none !important; border-right: none !important; - border-bottom: solid 1px rgba(0,0,0,.1); } .select2-drop.select2-drop-above { box-shadow: none !important; } .select2-drop.select2-drop-above.select2-drop-active { border-top: 1px solid #ccc; - border-bottom: solid 1px rgba(0,0,0,.1); + border-bottom: solid 1px rgba(0,0,0,.2); } .select2-container-active .select2-choice, .select2-container-active .select2-choices { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 481c3483724..425b4a4fb2f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -292,7 +292,6 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla outline: none; margin: 0px 0px 0px 0px; } - input, select { border-bottom: solid 1px rgba(0,0,0,.1); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index dc1edd01ef0..03e45a328e8 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -278,6 +278,7 @@ if (! empty($id) || ! empty($ref)) { dol_fiche_end(); } + // Create or edit a varian if ($action == 'add' || ($action == 'edit')) { if ($action == 'add') { @@ -311,21 +312,24 @@ if (! empty($id) || ! empty($ref)) { info: [] }; - <?php foreach ($productCombination2ValuePairs1 as $pc2v): - $prodattr_val->fetch($pc2v->fk_prod_attr_val); + <?php + foreach ($productCombination2ValuePairs1 as $pc2v) { + $prodattr_val->fetch($pc2v->fk_prod_attr_val); ?> - variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>); - variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = { - attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>], - value: { - id: <?php echo $pc2v->fk_prod_attr_val ?>, - label: '<?php echo $prodattr_val->value ?>' - } - }; - <?php endforeach ?> + variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>); + variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = { + attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>], + value: { + id: <?php echo $pc2v->fk_prod_attr_val ?>, + label: '<?php echo $prodattr_val->value ?>' + } + }; + <?php + } + ?> restoreAttributes = function() { - jQuery("select[name=attribute]").empty().append('<option value=""></option>'); + jQuery("select[name=attribute]").empty().append('<option value="-1"> </option>'); jQuery.each(variants_available, function (key, val) { if (jQuery.inArray(val.id, variants_selected.index) == -1) { @@ -354,12 +358,11 @@ if (! empty($id) || ! empty($ref)) { }; jQuery(document).ready(function() { - jQuery("select#attribute").change(function () { - + console.log("Change of field attribute"); var select = jQuery("select#value"); - if (!jQuery(this).val().length) { + if (!jQuery(this).val().length || jQuery(this).val() == '-1') { select.empty(); return; } @@ -375,9 +378,12 @@ if (! empty($id) || ! empty($ref)) { } select.empty(); + /* console.log(data.length); */ jQuery(data).each(function (key, val) { - jQuery("select#value").append('<option value="' + val.id + '">' + val.value + '</option>'); + keyforoption = val.id + valforoption = val.value + jQuery("select#value").append('<option value="' + keyforoption + '">' + valforoption + '</option>'); }); }); }); @@ -429,31 +435,36 @@ if (! empty($id) || ! empty($ref)) { }); }); </script> - <?php } ?> - - <form method="post" id="combinationform"> + <?php + } + + print '<form method="post" id="combinationform">'; + print dol_fiche_head(); + + ?> + <table class="border" style="width: 100%"> - <?php if ($action == 'add'): ?> + <?php if ($action == 'add') { ?> <tr> - <td style="width: 25%"><label for="attribute"><?php echo $langs->trans('ProductAttribute') ?></label></td> - <td colspan="2"><select id="attribute" name="attribute"> - <option value=""></option> + <td class="titlefieldcreate fieldrequired"><label for="attribute"><?php echo $langs->trans('ProductAttribute') ?></label></td> + <td colspan="2"><select class="flat minwidth100" id="attribute" name="attribute"> + <option value="-1"> </option> <?php foreach ($prodattr_all as $attr): ?> <option value="<?php echo $attr->id ?>"><?php echo $attr->label ?></option> <?php endforeach ?> </select></td> </tr> <tr> - <td style="width: 25%"><label for="value"><?php echo $langs->trans('Value') ?></label></td> + <td class="fieldrequired"><label for="value"><?php echo $langs->trans('Value') ?></label></td> <td colspan="2"> - <select id="value" name="value"> - <option value=""></option> + <select class="flat minwidth100" id="value" name="value"> + <option value="-1"> </option> </select> </td> </tr> - <?php endif; ?> + <?php } ?> <tr> - <td style="width: 25%" class="fieldrequired"><label for="features"><?php echo $langs->trans('Features') ?></label></td> + <td class="titlefieldcreate fieldrequired"><label for="features"><?php echo $langs->trans('Features') ?></label></td> <td><select multiple style="width: 100%" id="features"> <?php foreach ($productCombination2ValuePairs1 as $pc2v): ?> @@ -468,26 +479,33 @@ if (! empty($id) || ! empty($ref)) { </td> </tr> <tr> - <td style="width: 25%"><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td> + <td><label for="price_impact"><?php echo $langs->trans('PriceImpact') ?></label></td> <td colspan="2"><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>"> <input type="checkbox" id="price_impact_percent" name="price_impact_percent" <?php echo $price_impact_percent ? ' checked' : '' ?>> <label for="price_impact_percent"><?php echo $langs->trans('PercentageVariation') ?></label></td> </tr> <tr> - <td style="width: 25%"><label for="weight_impact"><?php echo $langs->trans('WeightImpact') ?></label></td> + <td><label for="weight_impact"><?php echo $langs->trans('WeightImpact') ?></label></td> <td colspan="2"><input type="text" id="weight_impact" name="weight_impact" value="<?php echo price($weight_impact) ?>"></td> </tr> </table> - <br> - <div style="text-align: center"><input type="submit" value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans('Save') ?>" class="button"></div> - <?php foreach ($productCombination2ValuePairs1 as $pc2v): ?> + <?php + print dol_fiche_end(); + ?> + + <div style="text-align: center"> + + <input type="submit" value="<?php echo $action == 'add' ? $langs->trans('Create') : $langs->trans('Save') ?>" class="button"></div> + + <?php foreach ($productCombination2ValuePairs1 as $pc2v): ?> <input type="hidden" name="features[]" value="<?php echo $pc2v->fk_prod_attr.':'.$pc2v->fk_prod_attr_val ?>"> - <?php endforeach; ?> - </form> + <?php endforeach; ?> <?php - } else { - + print '</form>'; + } + else + { if ($action === 'delete') { if ($prodcomb->fetch($valueid) > 0) { @@ -565,7 +583,22 @@ if (! empty($id) || ! empty($ref)) { <input type="submit" value="<?php echo $langs->trans("Apply") ?>" class="button"> <br> <br> - <?php } ?> + <?php } + + + print '<div class="tabsAction">'; + print ' <div class="inline-block divButAction">'; + if ($productCombinations) { + print '<a href="combinations.php?id='.$id.'&action=copy" class="butAction">'.$langs->trans('Copy').'</a>'; + } + print '<a href="combinations.php?id='.$id.'&action=add" class="butAction">'.$langs->trans('NewProductCombination').'</a>'; + print '<a href="generator.php?id='.$id.'" class="butAction">'.$langs->trans('ProductCombinationGenerator').'</a>'; + print ' </div>'; + print '</div>'; + + + + ?> <table class="liste"> <tr class="liste_titre"> @@ -618,17 +651,6 @@ if (! empty($id) || ! empty($ref)) { <?php endif ?> <?php - - print '<div class="tabsAction">'; - print ' <div class="inline-block divButAction">'; - if ($productCombinations) { - print ' <a href="combinations.php?id='.$id.'&action=copy" class="butAction">'.$langs->trans('Copy').'</a>'; - } - print ' <a href="generator.php?id='.$id.'" class="butAction">'.$langs->trans('ProductCombinationGenerator').'</a> - <a href="combinations.php?id='.$id.'&action=add" class="butAction">'.$langs->trans('NewProductCombination').'</a>'; - print ' </div>'; - print '</div>'; - } } -- GitLab