GQL Modules - GraphQL Modules for Remote Client Browsers

I can help. I’m pretty sure you’ll love it.

4 Likes

5 posts were split to a new topic: Customer Display on Second Monitor?

Well… These samples are really exciting but we need to clarify something.

What @QMcKay did here is one of the biggest (really biggest) contribution in the entire SambaPOS history. However the intention of that release is demonstrating us what can be done with new SambaPOS GraphQL API. If you’re not interested in GQL at the moment, it will be a better idea to wait until we officially release related products. At this point it will be really hard to fulfill support requests regarding these samples.

5 Likes

It is a very big proof of concept and not meant to be a supported live project. If you want to use it you will need to study it on your own for the most part. Learn how to code HTML, PHP, and learn the GQL then implement your own solution.

4 Likes

I always create HTML based samples but there is no reason to limit it with HTML. IOS or Android developers can also benefit from GraphQL API.

3 Likes

Yes very power full feature and i very happy all of this,
All not to live, i just think at my mind how if i going be live with this feature. All just for testing.

I think this was meant for you… or if not, it gives you the basic commands… :wink:

Anyway, Git is a source control tool. GitHub is an online repository where you can store projects, for free if they are public.

You Clone your GitHub repository using Git to your local system (i.e. your local Git repository). Then you can make changes, when you want to update, you do a Commit, which groups your changes together and lets you add a description as to what you have done. You can then Push your commits back to the GitHub repository. Others who have cloned your repository are able to Pull your changes to their local repository at any time, and therefore can merge with their changes.

If you host the project on GitHub, others can also contribute their changes to your code. They can also do a Pull Request to request you include their changes into your main code branch.

This is a very basic overview of how Git and GitHub works. I was reluctant at first to use them a few years back, but now I do all projects on GitHub, it really saves a lot of time and you don’t have to worry about keeping backups of changes as the full history is always available (even in a local repository - if I clone your repository, I also get all your previous changes with it).

You can try out this great little interactive guide on how to get started with Git here Hello World - GitHub Docs. There is lots of additional help here also.

To use Git on your system, you can install Git, which works command line, or can work integrated with tools like Visual Studio Code. You can also download the GitHub Desktop software which is a great tool that lets you use Git and GitHub without any commands.

3 Likes

What does $GQLpath in zconfigs\config.php have to be set to?

Leave it set as-is. This is hard-coded in the SambaPOS Message Server and should not be changed in the code.

$GQLpath = '/api/graphql/';

Over the next couple days, I am going to create a non-PHP version so that setup/implementation is easier, especially since the most popular Modules are probably the Customer Display and the Kitchen Display.

Because of the requirement for PHP by certain Modules, some of them will be removed, but I will leave intact any Modules that have no PHP requirement.

The Modules that will be in the non-PHP version will be:

  • Customer Display
  • Kitchen Display
  • Ticket Explorer
  • CHAT

The Modules that will be unavailable due to their PHP dependency are:

  • Timeclock (does not require PHP per-say, but uses Reports)
  • Timeclock Policies
  • Reports
  • Task Editor
  • Punch Editor (not currently functioning anyway)
  • [Authentication] (we cannot “Login” to the system without PHP)
5 Likes

Download attached to first post.


P.S. a new version of the PHP version is also attached. I changed a lot of stuff, and moved things around quite a bit so that I could make maintenance of PHP/noPHP easier to manage.

The configuration instructions have been updated, but as a heads-up, most configuration has been moved from the PHP file into a JS file …

From:

zconfigs\config.php

To:

zconfigs\config.js
4 Likes

New versions of both PHP and non-PHP uploaded. Get them from the first post.

I managed to get more Modules working for the non-PHP version …

Modules available in the non-PHP version:

  • Customer Display
  • Kitchen Display
  • Ticket Explorer
  • CHAT
  • Timeclock
  • Timeclock Policies *
  • Punch Editor * (not currently functioning)
  • Task Editor *

Modules not available in the non-PHP version:

  • Reports (PHP required to query DB for Report List and Report Templates)
  • [Authentication] (we cannot “Login” to the system without PHP)

NOTE:

* These Modules (marked above with an asterisk (*)) use Task Types. Though they are available in the non-PHP version, they are unaware of any Task Type Custom Fields. This is because PHP must be used to query the DB to discover Custom Fields. So these Modules have somewhat limited functionality in the non-PHP version:

  • Timeclock Policies *
  • Punch Editor * (not currently functioning)
  • Task Editor *
3 Likes

My first Git… I think I did it correctly …

https://github.com/QTMcKay/SambaPOS-GQLmodules

Whether you use the non-PHP version or the PHP version really only depends on the “index” file that you choose to use as the default site root document:

  • index.html (non-PHP version)
  • index.php (PHP version)

… the rest of the base code is identical, except that the PHP version calls upon other *.php files in \zconfigs and \zincludes


Cool. This will make management much easier. I used Netbeans 8 to do all of this, since that is what I use for editing, and it has Git built-in.

6 Likes

Amazing stuff here… This is simply awesome!!!. It will be better if you can add git url to your first post so people who wants to contribute may find it easily.

1 Like

2016-10-23 Update with a lot of changes:

  • Renamed zjscommon.js to core.js
  • All PHP code and files Removed, except /zjs/lib/ipinfo.php (new).
  • PHP code removal requires special Custom Reports in SambaPOS (see Forum).
  • Added GQL Authentication for v5.1.61+
  • Added User Authentication by PIN.
  • Added User Auth Bypass by Client IP address.
  • IP Bypass uses local service by ipinfo.php (preferred), Client Service by WebRTC (fallback 1), or external service (fallback 2).
  • Added Browser Local storage (preferred) and Cookie storage (fallback) to cache SESSIONID, Username and PIN Hash.

:bulb: NOTE: There are lot of new parameters/variables in /zconfigs/config.js that you should check and set to coincide with your system.

:warning: Removal of all PHP code requires “special” Custom Reports in SambaPOS.

1 Like

Hmm… I can’t find getCurrentTicket.

getCurrentTicket is only available inside SambaPOS Terminal JScript. It is not a Query that you can use from a Client Browser, nor in GraphiQL. It will not work, because it is not available to remote clients.

There should not be that Query anywhere in GQLmodules. But you should have a JScript function call in SambaPOS that uses that Query. This is shown in the setup instructions for Customer Display.

3 Likes

Yes, I saw that on Customer Display. Wow, still a lot of hidden syntax to explore :wink:

No it is only getCurrentTicket lol…

2 Likes

Hi @QMcKay, this is an awesome feature for sambaPos, it is possible to export all reports and script to a file so we can easily import it in SambaPos if i am not asking too much ?