forked from Wavyzz/dolibarr
Make Setup of TakePOS faster with Ajax ON-Off Button.
This commit is contained in:
@@ -476,13 +476,14 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
|
||||
*
|
||||
* @param string $code Name of constant
|
||||
* @param array $input Array of options. ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
||||
* @param int $entity Entity to set
|
||||
* @param int $entity Entity to set. Use current entity if null.
|
||||
* @param int $revertonoff Revert on/off
|
||||
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only.
|
||||
* @return string
|
||||
*/
|
||||
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0)
|
||||
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@@ -531,8 +532,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
|
||||
</script>'."\n";
|
||||
|
||||
$out .= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
|
||||
$out .= '<span id="set_'.$code.'" class="linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on') : img_picto($langs->trans("Disabled"), 'switch_off')).'</span>';
|
||||
$out .= '<span id="del_'.$code.'" class="linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off') : img_picto($langs->trans("Enabled"), 'switch_on')).'</span>';
|
||||
$out .= '<span id="set_'.$code.'" class="linkobject '.(!empty($conf->global->$code) ? 'hideobject' : '').'">'.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
|
||||
$out .= '<span id="del_'.$code.'" class="linkobject '.(!empty($conf->global->$code) ? '' : 'hideobject').'">'.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).'</span>';
|
||||
$out .= "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -3077,7 +3077,7 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
|
||||
* @param int $srconly Return only content of the src attribute of img.
|
||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||
* @param string $alt Force alt for bind people
|
||||
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
|
||||
* @param string $morecss Add more class css on img tag (For example 'myclascss').
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only.
|
||||
* @return string Return img tag
|
||||
* @see img_object(), img_picto_common()
|
||||
|
||||
@@ -132,7 +132,7 @@ print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Terminals
|
||||
@@ -149,7 +149,8 @@ if (!empty($conf->service->enabled))
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("CashdeskShowServices");
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1);
|
||||
print ajax_constantonoff("CASHDESK_SERVICES", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno("CASHDESK_SERVICES", $conf->global->CASHDESK_SERVICES, 1);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
@@ -161,65 +162,12 @@ print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEP
|
||||
print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID');
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Bar Restaurant mode
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("EnableBarOrRestaurantFeatures");
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") {
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("OrderPrinters").' (<a href="'.DOL_URL_ROOT.'/takepos/admin/orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)';
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("OrderNotes");
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
{
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("BasicPhoneLayout");
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("ProductSupplements");
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->TAKEPOS_SUPPLEMENTS)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("SupplementCategory");
|
||||
print '<td colspan="2">';
|
||||
print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
|
||||
print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// VAT Grouped on ticket
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('TicketVatGrouped');
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Payment numpad
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("Paymentnumpad");
|
||||
print '<td colspan="2">';
|
||||
$array = array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad"));
|
||||
print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0);
|
||||
print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Sort product
|
||||
@@ -248,11 +196,20 @@ $array = array(0=>"eldy", 1=>$langs->trans("Colorful"));
|
||||
print $form->selectarray('TAKEPOS_COLOR_THEME', $array, (empty($conf->global->TAKEPOS_COLOR_THEME) ? '0' : $conf->global->TAKEPOS_COLOR_THEME), 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Payment numpad
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("Paymentnumpad");
|
||||
print '<td colspan="2">';
|
||||
$array = array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad"));
|
||||
print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Direct Payment
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans('DirectPaymentButton');
|
||||
print '<td colspan="2">';
|
||||
print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1);
|
||||
print ajax_constantonoff("TAKEPOS_DIRECT_PAYMENT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno("TAKEPOS_DIRECT_PAYMENT", $conf->global->TAKEPOS_DIRECT_PAYMENT, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Head Bar
|
||||
@@ -290,6 +247,70 @@ print "</td></tr>\n";
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Bar Restaurant mode
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">'.$langs->trans("Other").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("EnableBarOrRestaurantFeatures");
|
||||
print '</td>';
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno("TAKEPOS_BAR_RESTAURANT", $conf->global->TAKEPOS_BAR_RESTAURANT, 1);
|
||||
print "</td></tr>\n";
|
||||
|
||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT && $conf->global->TAKEPOS_PRINT_METHOD != "browser") {
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("OrderPrinters").' (<a href="'.DOL_URL_ROOT.'/takepos/admin/orderprinters.php?leftmenu=setup">'.$langs->trans("Setup").'</a>)';
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno("TAKEPOS_ORDER_PRINTERS", $conf->global->TAKEPOS_ORDER_PRINTERS, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("OrderNotes");
|
||||
print '<td colspan="2">';
|
||||
print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
{
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("BasicPhoneLayout");
|
||||
print '<td colspan="2">';
|
||||
//print $form->selectyesno("TAKEPOS_PHONE_BASIC_LAYOUT", $conf->global->TAKEPOS_PHONE_BASIC_LAYOUT, 1);
|
||||
print ajax_constantonoff("TAKEPOS_PHONE_BASIC_LAYOUT", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven value"><td>';
|
||||
print $langs->trans("ProductSupplements");
|
||||
print '<td colspan="2">';
|
||||
//print $form->selectyesno("TAKEPOS_SUPPLEMENTS", $conf->global->TAKEPOS_SUPPLEMENTS, 1);
|
||||
print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($conf->global->TAKEPOS_SUPPLEMENTS)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("SupplementCategory");
|
||||
print '<td colspan="2">';
|
||||
print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0);
|
||||
print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
// Sumup options
|
||||
if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
|
||||
print '<br>';
|
||||
@@ -298,7 +319,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td class="titlefield">'.$langs->trans("Sumup").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
Reference in New Issue
Block a user