The dolimobile back office must be integrated into a normal dolibarr module.
So when you deploy dolimobile in your dolibarr module you will have a few new folders that will appear:
mobile This folder will contain all the source code for the mobile part (front-end in React, see below).pwa the folder into which the contents of the “compiled” mobile application will be copied, as well as the entry point api.phpsmartmaker-api the folder in which you will store the php controllers and mappers for your objects, which will be accessible via the api.php router in the pwa
As well as a file smartmaker-api-prepend.php which is used to factorise code and avoid having php headers that are too verbose.
Dolibarr objects can't be directly transposed into react, so we've developed a mapping system that matches dolibarr objects with their react equivalent.
Each dolibarr class that needs to be mapped can be mapped using a set of fine-tuned techniques, details of which can be found below.
For example, for the dolibarr Company object you will find a dmCompany class in the smartAuth project.
If your module provides a SmartInter object, for example, you can map its fields to react simply by implementing a dmSmartInter file.
More details on the mapping_dolibarr_-_react
This is where you implement the various entry points to the API dedicated to your application.
This php router includes the following grammar:
Route::get('login'… corresponds to the http request GET /loginThis PHP router makes it extremely easy to 'track' the various actions possible on your API!
For example, a GET /login calls the index function of the AuthController class class and a POST /login calls the login function of this same class …
Route::get('login', AuthController::class, 'index');
Route::post('login', AuthController::class, 'login');
Want to implement a logout? It's easy: add a line to api.php
Route::post('logout', AuthController::class, 'logout', true);
And implement the logout function in your AuthController …
/**
* @api {post} /logout Logout
* @apiDescription Logout and close session
* @apiName PostLogout
* @apiGroup Auth
*
*/
public function logout($payload)
{
Note: this function is of course already implemented natively in DoliMobile