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$action =
GETPOST(
'action',
'aZ09');
59$left =
GETPOST(
'left',
'alpha');
64$newname =
GETPOST(
'newname',
'alpha');
65$mode =
GETPOST(
'mode',
'alpha');
67if (!$user->hasRight(
'takepos',
'run')) {
76if ($action ==
"getTables" && $user->hasRight(
'takepos',
'run')) {
79 $sql =
"SELECT rowid, entity, label, leftpos, toppos, floor";
80 $sql .=
" FROM ".MAIN_DB_PREFIX.
"takepos_floor_tables";
81 $sql .=
" WHERE floor = ".((int) $floor).
" AND entity IN (".
getEntity(
'takepos').
")";
83 $resql = $db->query($sql);
84 while ($row = $db->fetch_array($resql)) {
85 $tmpplace = (int) $row[
'rowid'];
88 $result = $invoice->fetch(
'',
'(PROV-POS'.$_SESSION[
'takeposterminal'].
'-'.$tmpplace.
')');
90 $row[
'occupied'] =
"red";
97 echo json_encode($rows);
101if ($action ==
"update" && $user->hasRight(
'takepos',
'run')) {
108 if ($left > 3 or $top > 4) {
109 $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET leftpos = ".((
int) $left).
", toppos = ".((
int) $top).
" WHERE rowid = ".((
int) $place));
111 $db->query(
"DELETE from ".MAIN_DB_PREFIX.
"takepos_floor_tables WHERE rowid = ".((
int) $place));
115if ($action ==
"updatename" && $user->hasRight(
'takepos',
'run')) {
116 $newname = preg_replace(
"/[^a-zA-Z0-9\s]/",
"", $newname);
117 if (strlen($newname) > 3) {
118 $newname = substr($newname, 0, 3);
120 $resql = $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET label='".$db->escape($newname).
"' WHERE rowid = ".((
int) $place));
123if ($action ==
"add" && $user->hasRight(
'takepos',
'run')) {
124 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"takepos_floor_tables(entity, label, leftpos, toppos, floor) VALUES (".
$conf->entity.
", '', '45', '45', ".((int) $floor).
")";
125 $asdf = $db->query($sql);
126 $db->query(
"UPDATE ".MAIN_DB_PREFIX.
"takepos_floor_tables SET label = rowid WHERE label = ''");
136$title =
'TakePOS - Dolibarr '.DOL_VERSION;
140$arrayofcss = array(
'/takepos/css/pos.css.php?a=xxx');
145<body style=
"overflow: hidden">
147<style
type=
"text/css">
149 background-image:url(img/
table.gif);
150 -moz-background-size:100% 100%;
151 -webkit-background-size:100% 100%;
152 background-size:100% 100%;
167var DragDrop=
'<?php echo $langs->trans("DragDrop"); ?>';
169function updateplace(idplace, left, top) {
170 console.log(
"updateplace idplace="+idplace+
" left="+left+
" top="+top);
173 url:
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
174 data: { action:
"update", left: left, top: top, place: idplace, token:
'<?php echo currentToken(); ?>' }
175 }).done(
function( msg ) {
176 window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode((string) ($floor)); ?>';
180function updatename(rowid) {
181 var after=$(
"#tablename"+rowid).text();
182 console.log(
"updatename rowid="+rowid+
" after="+after);
185 url:
"<?php echo DOL_URL_ROOT.'/takepos/floors.php'; ?>",
186 data: { action:
"updatename", place: rowid, newname: after, token:
'<?php echo currentToken(); ?>' }
187 }).done(
function( msg ) {
188 window.location.href=
'floors.php?mode=edit&floor=<?php echo urlencode((string) ($floor)); ?>';
192function LoadPlace(place){
193 parent.location.href=
'index.php?place='+place;
197$( document ).ready(
function() {
198 $.getJSON(
'./floors.php?action=getTables&token=<?php echo newToken();?>&floor=<?php echo $floor; ?>',
function(data) {
199 $.each(data,
function(key, val) {
200 <?php
if ($mode ==
"edit") {?>
201 $(
'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>');
202 $(
"#tablename"+val.rowid ).draggable(
205 $(
"#add").html(
"<?php echo $langs->trans("Delete
"); ?>");
208 var left=$(
this).offset().left*100/$(window).width();
209 var top=$(
this).offset().top*100/$(window).height();
210 updateplace($(
this).attr(
'id').substr(9), left, top);
215 $(
'#'+val.label).draggable().bind(
'click',
function(){
219 $(
'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>');
227<?php
if ($user->admin) {?>
228<div style=
"position: absolute; left: 0.1%; top: 0.8%; width:8%; height:11%;">
229 <?php
if ($mode ==
"edit") {?>
230<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>
232<a onclick=
"window.location.href='floors.php?mode=edit&token=<?php echo newToken() ?>&floor=<?php echo $floor; ?>';"><?php echo $langs->trans(
"Edit"); ?></a>
238<div style=
"position: absolute; left: 25%; bottom: 8%; width:50%; height:3%;">
241 <?php
if ($floor > 1) { ?>
242 <img
class=
"valignmiddle" src=
"./img/arrow-prev.png" width=
"5%" onclick=
"location.href='floors.php?floor=<?php if ($floor > 1) {
250 <span
class=
"valignmiddle"><?php echo $langs->trans(
"Floor").
" ".$floor; ?></span>
251 <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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.