29if (!defined(
'NOREQUIREMENU')) {
30 define(
'NOREQUIREMENU',
'1');
32if (!defined(
'NOREQUIREHTML')) {
33 define(
'NOREQUIREHTML',
'1');
35if (!defined(
'NOREQUIREAJAX')) {
36 define(
'NOREQUIREAJAX',
'1');
40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
43$langs->loadLangs(array(
"bills",
"orders",
"commercial",
"cashdesk"));
50$action =
GETPOST(
'action',
'aZ09');
51$left =
GETPOST(
'left',
'alpha');
56$newname =
GETPOST(
'newname',
'alpha');
57$mode =
GETPOST(
'mode',
'alpha');
59if (!$user->hasRight(
'takepos',
'run')) {
68if ($action ==
"getTables" && $user->hasRight(
'takepos',
'run')) {
69 $sql =
"SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables WHERE floor = ".((int) $floor).
" AND entity IN (".
getEntity(
'takepos').
")";
70 $resql = $db->query($sql);
72 while ($row = $db->fetch_array($resql)) {
74 $result = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
'takeposterminal'].
'-'.$row[
'rowid'].
')');
76 $row[
'occupied'] =
"red";
82 echo json_encode($rows);
86if ($action ==
"update" && $user->hasRight(
'takepos',
'run')) {
93 if ($left > 3 or $top > 4) {
94 $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET leftpos = ".((
int) $left).
", toppos = ".((
int) $top).
" WHERE rowid = ".((
int) $place));
96 $db->query(
"DELETE from ".MAIN_DB_PREFIX.
"takepos_floor_tables WHERE rowid = ".((
int) $place));
100if ($action ==
"updatename" && $user->hasRight(
'takepos',
'run')) {
101 $newname = preg_replace(
"/[^a-zA-Z0-9\s]/",
"", $newname);
102 if (strlen($newname) > 3) {
103 $newname = substr($newname, 0, 3);
105 $resql = $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET label='".$db->escape($newname).
"' WHERE rowid = ".((
int) $place));
108if ($action ==
"add" && $user->hasRight(
'takepos',
'run')) {
109 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".$conf->entity.
", '', '45', '45', ".((int) $floor).
")";
110 $asdf = $db->query($sql);
111 $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET label = rowid WHERE label = ''");
121$title =
'TakePOS - Dolibarr '.DOL_VERSION;
125$arrayofcss = array(
'/takepos/css/pos.css.php?a=xxx');
130<body style=
"overflow: hidden">
132<style
type=
"text/css">
134 background-image:url(img/
table.gif);
135 -moz-background-size:100% 100%;
136 -webkit-background-size:100% 100%;
137 background-size:100% 100%;
152var DragDrop=
'<?php echo $langs->trans("DragDrop"); ?>';
154function updateplace(idplace, left, top) {
155 console.log(
"updateplace idplace="+idplace+
" left="+left+
" top="+top);
158 url:
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
159 data: { action:
"update", left: left, top: top, place: idplace, token:
'<?php echo currentToken(); ?>' }
160 }).done(
function( msg ) {
161 window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode((string) ($floor)); ?>';
165function updatename(rowid) {
166 var after=$(
"#tablename"+rowid).text();
167 console.log(
"updatename rowid="+rowid+
" after="+after);
170 url:
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
171 data: { action:
"updatename", place: rowid, newname: after, token:
'<?php echo currentToken(); ?>' }
172 }).done(
function( msg ) {
173 window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode((string) ($floor)); ?>';
177function LoadPlace(place){
178 parent.location.href=
'index.php?place='+place;
182$( document ).ready(
function() {
183 $.getJSON(
'./floors.php?action=getTables&token=<?php echo newToken();?>&floor=<?php echo $floor; ?>',
function(data) {
184 $.each(data,
function(key, val) {
185 <?php
if ($mode ==
"edit") {?>
186 $(
'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>');
187 $(
"#tablename"+val.rowid ).draggable(
190 $(
"#add").html(
"<?php echo $langs->trans("Delete
"); ?>");
193 var left=$(
this).offset().left*100/$(window).width();
194 var top=$(
this).offset().top*100/$(window).height();
195 updateplace($(
this).attr(
'id').substr(9), left, top);
200 $(
'#'+val.label).draggable().bind(
'click',
function(){
204 $(
'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>');
212<?php
if ($user->admin) {?>
213<div style=
"position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;">
214 <?php
if ($mode ==
"edit") {?>
215<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>
217<a onclick=
"window.location.href='floors.php?mode=edit&token=<?php echo newToken() ?>&floor=<?php echo $floor; ?>';"><?php echo $langs->trans(
"Edit"); ?></a>
223<div style=
"position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;">
226 <?php
if ($floor > 1) { ?>
227 <img
class=
"valignmiddle" src=
"./img/arrow-prev.png" width=
"5%" onclick=
"location.href='floors.php?floor=<?php if ($floor > 1) {
235 <span
class=
"valignmiddle"><?php echo $langs->trans(
"Floor").
" ".$floor; ?></span>
236 <img src=
"./img/arrow-next.png" class=
"valignmiddle" width=
"5%" onclick=
"location.href='floors.php?floor=<?php $floor++;
Class to manage invoices.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
treeview li table
No Email.
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.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.