30if (!defined(
'NOREQUIREMENU')) {
31 define(
'NOREQUIREMENU',
'1');
33if (!defined(
'NOREQUIREHTML')) {
34 define(
'NOREQUIREHTML',
'1');
36if (!defined(
'NOREQUIREAJAX')) {
37 define(
'NOREQUIREAJAX',
'1');
41require
'../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
51$langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk"));
58 $sql =
"SELECT MIN(floor) as minfloor FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables";
59 $sql .=
" WHERE entity IN (".getEntity(
'takepos').
")";
60 $resql = $db->query($sql);
62 $obj = $db->fetch_object($resql);
63 if ($obj && !is_null($obj->minfloor)) {
64 $floor = (int) $obj->minfloor;
69$action =
GETPOST(
'action',
'aZ09');
70$left =
GETPOST(
'left',
'alpha');
75$newname =
GETPOST(
'newname',
'alpha');
76$mode =
GETPOST(
'mode',
'alpha');
78if (!$user->hasRight(
'takepos',
'run')) {
87if ($action ==
"getTables" && $user->hasRight(
'takepos',
'run')) {
90 $sql =
"SELECT rowid, entity, label, leftpos, toppos, floor";
91 $sql .=
" FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables";
92 $sql .=
" WHERE floor = ".((int) $floor).
" AND entity IN (".
getEntity(
'takepos').
")";
94 $resql = $db->query($sql);
95 while ($row = $db->fetch_array($resql)) {
96 $tmpplace = (int) $row[
'rowid'];
99 $result = $invoice->fetch(0,
'(PROV-POS'.$_SESSION[
'takeposterminal'].
'-'.$tmpplace.
')');
101 $row[
'occupied'] =
"red";
108 echo json_encode($rows);
112if ($action ==
"update" && $user->hasRight(
'takepos',
'run')) {
119 if ($left > 3 or $top > 4) {
120 $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET leftpos = ".((
int) $left).
", toppos = ".((
int) $top).
" WHERE rowid = ".((
int) $place));
122 $db->query(
"DELETE from ".MAIN_DB_PREFIX.
"takepos_floor_tables WHERE rowid = ".((
int) $place));
126if ($action ==
"updatename" && $user->hasRight(
'takepos',
'run')) {
127 $newname = preg_replace(
"/[^a-zA-Z0-9\s]/",
"", $newname);
128 if (strlen($newname) > 3) {
129 $newname = substr($newname, 0, 3);
131 $resql = $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET label='".$db->escape($newname).
"' WHERE rowid = ".((
int) $place));
134if ($action ==
"add" && $user->hasRight(
'takepos',
'run')) {
135 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".((int)
$conf->entity).
", '', '45', '45', ".((int) $floor).
")";
136 $asdf = $db->query($sql);
137 $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET label = rowid WHERE label = ''");
147$title =
'TakePOS - Dolibarr '.DOL_VERSION;
151$arrayofcss = array(
'/takepos/css/pos.css.php?a=xxx');
156<body style=
"overflow: hidden">
158<style
type=
"text/css">
160 background-image:url(img/
table.gif);
161 -moz-background-size:100% 100%;
162 -webkit-background-size:100% 100%;
163 background-size:100% 100%;
178var DragDrop=
'<?php echo $langs->trans("DragDrop"); ?>';
180function updateplace(idplace, left, top) {
181 console.log(
"updateplace idplace="+idplace+
" left="+left+
" top="+top);
184 url:
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
185 data: { action:
"update", left: left, top: top, place: idplace, token:
'<?php echo currentToken(); ?>' }
186 }).done(
function( msg ) {
187 window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode((string) ($floor)); ?>';
191function updatename(rowid) {
192 var after=$(
"#tablename"+rowid).text();
193 console.log(
"updatename rowid="+rowid+
" after="+after);
196 url:
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
197 data: { action:
"updatename", place: rowid, newname: after, token:
'<?php echo currentToken(); ?>' }
198 }).done(
function( msg ) {
199 window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode((string) ($floor)); ?>';
203function LoadPlace(place){
204 parent.location.href=
'index.php?place='+place;
208$( document ).ready(
function() {
209 $.getJSON(
'./floors.php?action=getTables&token=<?php echo newToken();?>&floor=<?php echo $floor; ?>',
function(data) {
210 $.each(data,
function(key, val) {
211 <?php
if ($mode ==
"edit") {?>
212 $(
'body').append(
'<div class="tablediv" contenteditable onblur="updatename('+val.rowid+
');" style="position: absolute; left: '+val.leftpos+
'%; top: '+val.toppos+
'%;" id="tablename'+val.rowid+
'">'+val.label+
'</div>');
213 $(
"#tablename"+val.rowid ).draggable(
216 $(
"#add").html(
"<?php echo $langs->trans("Delete
"); ?>");
219 var left=$(
this).offset().left*100/$(window).width();
220 var top=$(
this).offset().top*100/$(window).height();
221 updateplace($(
this).attr(
'id').substr(9), left, top);
226 $(
'#'+val.label).draggable().bind(
'click',
function(){
230 $(
'body').append(
'<div class="tablediv '+val.occupied+
'" onclick="LoadPlace('+val.rowid+
');" style="position: absolute; left: '+val.leftpos+
'%; top: '+val.toppos+
'%;" id="tablename'+val.rowid+
'">'+val.label+
'</div>');
238<?php
if ($user->admin) {?>
239<div style=
"position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;">
240 <?php
if ($mode ==
"edit") {?>
241<a
id=
"add" onclick=
"window.location.href='floors.php?mode=edit&action=add&token=<?php echo newToken() ?>&floor=<?php echo $floor; ?>';"><?php echo $langs->trans(
"AddTable"); ?></a>
243<a onclick=
"window.location.href='floors.php?mode=edit&token=<?php echo newToken() ?>&floor=<?php echo $floor; ?>';"><?php echo $langs->trans(
"Edit"); ?></a>
249<div style=
"position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;">
252 <?php
if ($floor > 0) { ?>
253 <img
class=
"valignmiddle" src=
"./img/arrow-prev.png" width=
"5%" onclick=
"location.href='floors.php?floor=<?php if ($floor > 0) {
261 <span
class=
"valignmiddle"><?php echo $langs->trans(
"Floor").
" ".$floor; ?></span>
262 <img src=
"./img/arrow-next.png" class=
"valignmiddle" width=
"5%" onclick=
"location.href='floors.php?floor=<?php $floor++;
$id
Support class for third parties, contacts, members, users or resources.
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage invoices.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
treeview li table
No Email.