Skip to content

Instantly share code, notes, and snippets.

View Blair2004's full-sized avatar
🏠
Working from home

Blair Jersyer Blair2004

🏠
Working from home
View GitHub Profile
@Blair2004
Blair2004 / actions.php
Created January 25, 2020 13:38
create a frontend UI for NexoPOS
<?php
class Actions extends Tendoo_Module {
public function load_frontend()
{
include_once( dirname( __FILE__ ) . '/../file/to/your/controller.php' );
$controller = new YourController;
if ( $this->uri->segment(1) === '' && $this->uri->segment(2) === null ) {
return $controller->index();
<?php
$orderBuilder = new OrderReceiptBuilder( 30 ); // where 30 is the order id
$order = $orderBuilder->get();
// Looping Over Products
$order->products->each( function( $product ) {
$product->price;
$product->gross_price;
$product->tax;
$product->total_tax;
@Blair2004
Blair2004 / queable.js
Created October 7, 2018 15:51
This help you to run queable promises and stop the execution if one promise reject an error.
function queuePromises({ promises, param, index = 0, total = 0, results = [] }) {
// promisesArray, _item
if( total === 0 ) {
total = promises.length;
}
console.log( `index is ${index}` );
return new Promise( ( resolve, reject ) => {
if( promises[ index ] !== undefined ) {
@Blair2004
Blair2004 / HelloWorldModuleMenu3.php
Created August 24, 2018 22:48
Create a menu before dashboard
<?php
class MyModule extends Tendoo_Module // should alway extends Tendoo module
{
public function __construct()
{
parent::__construct();
$this->events->add_filter( 'admin_menus', [ $this, 'menus' ]);
}
/**
<?php
class MyModule extends Tendoo_Module // should alway extends Tendoo module
{
public function __construct()
{
parent::__construct();
$this->events->add_filter( 'admin_menus', [ $this, 'menus' ]);
}
/**
@Blair2004
Blair2004 / HelloWorldNexoPOS.php
Created August 24, 2018 22:33
How to create a menu for a module
<?php
class MyModule extends Tendoo_Module // should alway extends Tendoo module
{
public function __construct()
{
parent::__construct();
$this->events->add_filter( 'admin_menus', [ $this, 'menus' ]);
}
/**
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$this->Gui->col_width(1, 4);
$this->Gui->add_meta( array(
'col_id' => 1,
'namespace' => 'helloworld',
'type' => 'unwrapped'
) );
<?php
class HelloWorldController extends Tendoo_Module
{
public function __construt()
{
parent::__construct();
}
/**
* Index Method
<?php
class HelloWorldController extends Tendoo_Module
{
public function __construt()
{
parent::__construct();
}
/**
* Index Method
<?php
global $Routes;
$Routes->get( '/hellow/world', 'HelloWorldController@index' );