GQL Modules - GraphQL Modules for Remote Client Browsers

Show the Console Log again.

You might need to restart the Messaging Service.

http://www.dankmoments.ml/oghorizon/chrome_2017-07-07_18-01-38.png

Do a Hard Reload by right-clicking on the Refresh button and selecting the 3rd option from the context menu…


If that does not help, clear your Browser Storage in the Application Tab, and do Hard Reload again …

Indicated by the arrow for userPW is actually the clear-text PIN (userPIN is an encrypted version that is not used). You can try clearing/deleting only the userPW instead of clearing the entire Cache, and try a reload.

@QMcKay - Awesome work man! I am having an impossible time getting this to run - can you help out? Bet I am just being dumb.

I have XAMPP as a web server. Downloaded your files from git and put them in webroot/sambapos

I have SambaPOS + Messaging server running. I have used it for other projects. Went ahead and configured the GraphQL details.

I fire up my web browser and visit http://localhost:8080/sambapos – which loads the index.html file but I do not get the menu or login prompts. I went into dev console -> network [filter: all] and I am not even seeing graphql replies or error. Screenshot attached, any help please :-S

Not even seeing GQL post requests. So the page simply downloads and does nothing.

The Network tab is not the best place to see errors. Look at the Console tab.

@QMcKay Alas -

Looks like your config.js file is messed up. Post the content of that file. For example:

// derive Server information from Address Bar (automatic)
var webHost  = location.hostname;  // myServer.com

If you want to hard-code the host, then you need to quote the value:

var webHost  = 'localhost';

In addition, the GQLport is not for your website address. It is for the GQL Service, which by default is 9000.

In fact, you should not need to change any of this, other than maybe the GQLport if your Message Server Service is set to run on something other than port 9000 …

// derive Server information from Address Bar (automatic)
var webHost  = location.hostname;  // myServer.com
var webPort  = location.port;      // blank assumes port 80
var webPath  = location.pathname;  // might be like /app/mysite/blah
var webParm  = location.search;    // things after '?', like ?module=customer_display
var webProto = location.protocol;  // usually http: or https:

var webUrl   = webProto + '//' + webHost + (location.port ? ':'+location.port : '') + webPath;

// Message Server
var msgsrv = webHost;

// GraphQL server
var GQLhost = msgsrv;
var GQLport     = '9000'; // Message Server Port (default 9000) as configured in Message Server Tool
var GQLpath     = '/api/graphql/';
var GQLurl      = webProto + '//' + GQLhost + ':' + GQLport + GQLpath;

Thanks! Some major progress, loading does now occur! This was my fault, I had made an error, but the POS module will not load for me now, any ideas?

For Entity types in my system I have: Members and Tables. My main POS screen is a digital layout of our place and it uses Tables entities.

This is from my config_modules.js
// POS
var menuName = ‘Misc’;
var departmentName = ‘Restaurant’;
var ticketTypeName = ‘Ticket’;
var POS_EntityTypes = [‘Tables’];
var POS_EntityTypesAuto = false; // override static Entity Types above with automatic Ticket Type Entity Types
var POS_PrintJobs = [‘Print Bill’,‘Print Orders to Kitchen Printer’];

Ok, so this …

var POS_EntityTypes = ['Tables'];

… is slightly misnamed at this point, as I explained in other posts. It is actually wanting the Entity Screen Names, not the Entity Types.

So what is the Name of the Entity Screen for Tables? Do you have more than one? What are they?

@QMcKay Sorry I read many posts, did not see it - I don’t mean to waste your time, I am very appreciative of your efforts.

I have multiple entity screens, one which has table entities is called “New Orders”, I also have “Customer Search” too which is not ticket based.

Update: Changing that var to an entity screen still fails. Is a certain type of entity screen expected?

For sure it will work with Entity Screens that are set to Automatic, or Custom (Layout too probably), if the Screen has a defined Entity Type.

I don’t think it will work with Screens that are set to “Search”.

The Screens I use in my setup are both Custom, and the Screen Name is the same as the Entity Type.

So you could even define some new ones, set them to Entity Type Members and Tables, and set the Name of the Screens to the same. That will work best if the Entity Type and the Screen Name is the same.

Thanks! I made a new screen with the following:

Ticket Type: Ticket (Ask Ticket Type)
View Mode: Layout
Entity Type: Tables
Entities (selected all my tables)
Mappings: all

I still get this error on the POS module, any ideas?

If I click to view the exact line: pos.js:sourcemap:2801 Uncaught TypeError: Cannot read property ‘name’ of null

Click on that ^ and Show a screenshot of the line in the code where it errors. It might have to do with the way your ‘Misc’ Menu is configured.

I need to see what is on line 2801 where the error is being reported, because my codebase is a lot different now, so I can only guess where it is happening. Probably here …

        mistuff += '<div class="menuItem"><div id="m_'+item.id+'" name="'+item.name+'" value="'+item.name+'" defaultOrderTags="'+defaultOrderTags+'" productId="'+item.productId+'" productName="'+item.product.name+'" portion="'+portion+'" catId="'+categoryId+'" catIdx="'+catIdx+'" class="mBtn" style="background:'+bgColor+';color:'+tColor+';" price="'+item.product.price+'" onClick="POS_menuItemClicked('+item.id+');">'+itemButtonText+'</div></div>';

… but a screenshot will show exactly which is null (item.name or item.product.name).

    mistuff += '<div class="menuItem"><div id="m_'+item.id+'" name="'+item.name+'" value="'+item.name+'" defaultOrderTags="'+defaultOrderTags+'" productId="'+item.productId+'" productName="'+item.product.name+'" portion="'+portion+'" catId="'+categoryId+'" catIdx="'+catIdx+'" class="mBtn" style="background:'+bgColor+';color:'+tColor+';" price="'+item.product.price+'" onClick="POS_menuItemClicked('+item.id+');">'+itemButtonText+'</div></div>';

That is what I see when I click on that and copy and paste the highlighted line. When I click it from chrome debug it places the cursor in the productName= field, see:

That is what I wanted to see. This indicates the item.product property is null, so it cannot derive the .name property.

The question is, “why not?”

What version of SambaPOS are you running?

Show your “Misc” Menu, the Category named “Menu”, by clicking on the Edit Product Properties Link …

Did you manage to update the repo with those changes you were working on? Id really love to test them out if you can. I just came back from my break, now i can really study it and put it to good use if possible

Voila! It had to do with Fast Menu being setup. I made a new menu with normal non fast menu specifics and it does work. I was using your code as a base for a project which I now finished, it’s a BAR POS extension of our normal restaurant side. I managed to INTEGRATE square support with Square’s Web API. It’s a popular US CC processor and it’s super cool, now from the base code above (your POS) I can now process payments. It’s very neat and makes it super easy to interface from an Android tablet with a normal browser. I love it.

Next issue: - it’s impossible for me to assign tables from your POS implementation, any idea why I get this error?

A Menu (or Category really) marked as Fast Menu should still work. That would not cause an issue AFAIK. However, you made me think of something else: did you have any Custom Command Buttons in the Category? Those Buttons would not have a Product, which is probably the cause. Going to check for that now on my system and see how I might be able to support them.


I am going to guess that the Entity Screen Name is not the same as the Entity Type. But my implementation treats them as the same thing. For example, if your Screen is called “All Tables” with Entity Type of “Tables”, then it won’t work. They need to be the same, that is, your Entity Screen Name must be “Tables” with Entity Type “Tables”.

I need to fix this. It is due to the way the early version of the code handled Entity Selection, before we had getEntityScreenItems Query, we had to use getEntities. Since I switched to getEntityScreenItems, it causes an issue because the Screen Name might be different than the Entity Type, and the Array of Objects that holds the Screen Items is assumed to be the Entity Type.

Not yet. Every time I go to update the Repo, I find something else to fix or get another idea. Won’t be long now I think, but I am going to fix the Entity Screen/Type thing first, because it is a real problem that people will struggle with.