Merge branch 'frontend-dashboards-with-login' into 'master'
Frontend dashboards with login See merge request saburly/wiaas/new-wiaas!9
This commit was merged in pull request #9.
This commit is contained in:
@@ -65,4 +65,4 @@ COPY docker/php/.htaccess /var/www/html/
|
|||||||
|
|
||||||
RUN chown -R www-data:www-data /var/www/html
|
RUN chown -R www-data:www-data /var/www/html
|
||||||
|
|
||||||
CMD /init-scripts/setup.sh
|
CMD /init-scripts/setup.sh
|
||||||
|
|||||||
13
backend/.htaccess
Normal file
13
backend/.htaccess
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# BEGIN WordPress
|
||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteBase /
|
||||||
|
RewriteRule ^index\.php$ - [L]
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteRule . /index.php [L]
|
||||||
|
RewriteCond %{HTTP:Authorization} ^(.*)
|
||||||
|
RewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]
|
||||||
|
</IfModule>
|
||||||
|
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
|
||||||
|
# END WordPress
|
||||||
@@ -51,10 +51,10 @@ class Wiass_REST_Delivery_Process_API {
|
|||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
$step = gravity_flow()->get_step( $entry['workflow_step'] );
|
$step = gravity_flow()->get_step( $entry['workflow_step'] );
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'idOrder' => $entry['wiaas_delivery_order_id'],
|
'order_id' => $entry['wiaas_delivery_order_id'],
|
||||||
'orderNumber' => $entry['wiaas_delivery_order_id'],
|
'order_number' => $entry['wiaas_delivery_order_id'],
|
||||||
'status' => $entry['workflow_final_status'],
|
'status' => $entry['workflow_final_status'],
|
||||||
'stepAction' => $step->get_name(),
|
'step_action' => $step->get_name(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ class Wiaas_DB_Update {
|
|||||||
private static $db_updates = array(
|
private static $db_updates = array(
|
||||||
'20180728222206' => 'wiaas_db_update_enable_product_by_user_role',
|
'20180728222206' => 'wiaas_db_update_enable_product_by_user_role',
|
||||||
'20180801222206' => 'wiaas_db_update_setup_gravity',
|
'20180801222206' => 'wiaas_db_update_setup_gravity',
|
||||||
'20180802222206' => 'wiaas_db_update_add_delivery_process_forms'
|
'20180802222206' => 'wiaas_db_update_add_delivery_process_forms',
|
||||||
|
'20180807222206' => 'wiaas_db_update_setup_customer_capabilities'
|
||||||
);
|
);
|
||||||
|
|
||||||
public static function execute() {
|
public static function execute() {
|
||||||
|
|||||||
@@ -159,4 +159,4 @@ class Wiaas_Delivery_Process {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') );
|
add_action( 'gravityflow_loaded', array('Wiaas_Delivery_Process', 'init') );
|
||||||
|
|||||||
@@ -76,4 +76,11 @@ function wiaas_db_update_add_delivery_process_forms() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_action('gform_forms_post_import', $created_forms);
|
do_action('gform_forms_post_import', $created_forms);
|
||||||
|
}
|
||||||
|
|
||||||
|
function wiaas_db_update_setup_customer_capabilities() {
|
||||||
|
$customer_role = get_role('customer');
|
||||||
|
|
||||||
|
$customer_role->add_cap('read_private_shop_orders');
|
||||||
|
$customer_role->add_cap('read_shop_order');
|
||||||
}
|
}
|
||||||
@@ -246,4 +246,4 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step {
|
|||||||
|
|
||||||
return absint($value);
|
return absint($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,14 +42,14 @@ class Wiass_REST_Delivery_Process_Api_Test extends Wiaas_Unit_Test_Case {
|
|||||||
|
|
||||||
$this->assertTrue(is_array($pending_step));
|
$this->assertTrue(is_array($pending_step));
|
||||||
|
|
||||||
$this->assertArrayHasKey('idOrder', $pending_step);
|
$this->assertArrayHasKey('order_id', $pending_step);
|
||||||
$this->assertArrayHasKey('orderNumber', $pending_step);
|
$this->assertArrayHasKey('order_number', $pending_step);
|
||||||
$this->assertArrayHasKey('status', $pending_step);
|
$this->assertArrayHasKey('status', $pending_step);
|
||||||
$this->assertArrayHasKey('stepAction', $pending_step);
|
$this->assertArrayHasKey('step_action', $pending_step);
|
||||||
|
|
||||||
$this->assertEquals($pending_step['idOrder'], $this->order_id);
|
$this->assertEquals($pending_step['order_id'], $this->order_id);
|
||||||
$this->assertEquals($pending_step['orderNumber'], $this->order_id);
|
$this->assertEquals($pending_step['order_number'], $this->order_id);
|
||||||
$this->assertEquals($pending_step['status'], 'pending');
|
$this->assertEquals($pending_step['status'], 'pending');
|
||||||
$this->assertNotEmpty($pending_step['stepAction']);
|
$this->assertNotEmpty($pending_step['step_action']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
"wpackagist-plugin/mailchimp-for-woocommerce": "2.1.7",
|
"wpackagist-plugin/mailchimp-for-woocommerce": "2.1.7",
|
||||||
"wpackagist-plugin/woocommerce-gateway-paypal-express-checkout": "1.5.6",
|
"wpackagist-plugin/woocommerce-gateway-paypal-express-checkout": "1.5.6",
|
||||||
"wpackagist-plugin/jwt-authentication-for-wp-rest-api": "1.2.4",
|
"wpackagist-plugin/jwt-authentication-for-wp-rest-api": "1.2.4",
|
||||||
|
"wpackagist-plugin/capability-manager-enhanced": "1.5.9",
|
||||||
|
|
||||||
"3rdparty/gravityforms": "*",
|
"3rdparty/gravityforms": "*",
|
||||||
"3rdparty/gravityflow": "*"
|
"3rdparty/gravityflow": "*"
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
"wp plugin activate jwt-authentication-for-wp-rest-api",
|
"wp plugin activate jwt-authentication-for-wp-rest-api",
|
||||||
"wp plugin activate gravityforms",
|
"wp plugin activate gravityforms",
|
||||||
"wp plugin activate gravityflow",
|
"wp plugin activate gravityflow",
|
||||||
|
"wp plugin activate capability-manager-enhanced",
|
||||||
"wp plugin activate wiaas"
|
"wp plugin activate wiaas"
|
||||||
],
|
],
|
||||||
"update-db": [
|
"update-db": [
|
||||||
|
|||||||
24
backend/composer.lock
generated
24
backend/composer.lock
generated
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"_readme": [
|
"_readme": [
|
||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "16aac868dbf84d6c3cf7c41703e9085f",
|
"content-hash": "dca54e67b0185da192f5260baa4c162e",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "3rdparty/gravityflow",
|
"name": "3rdparty/gravityflow",
|
||||||
@@ -437,6 +437,26 @@
|
|||||||
"type": "wordpress-plugin",
|
"type": "wordpress-plugin",
|
||||||
"homepage": "https://wordpress.org/plugins/akismet/"
|
"homepage": "https://wordpress.org/plugins/akismet/"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "wpackagist-plugin/capability-manager-enhanced",
|
||||||
|
"version": "1.5.9",
|
||||||
|
"source": {
|
||||||
|
"type": "svn",
|
||||||
|
"url": "https://plugins.svn.wordpress.org/capability-manager-enhanced/",
|
||||||
|
"reference": "trunk"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://downloads.wordpress.org/plugin/capability-manager-enhanced.zip?timestamp=1532180189",
|
||||||
|
"reference": null,
|
||||||
|
"shasum": null
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"composer/installers": "~1.0"
|
||||||
|
},
|
||||||
|
"type": "wordpress-plugin",
|
||||||
|
"homepage": "https://wordpress.org/plugins/capability-manager-enhanced/"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "wpackagist-plugin/groups",
|
"name": "wpackagist-plugin/groups",
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
|
|||||||
@@ -23,16 +23,6 @@ if (file_exists($env_config)) {
|
|||||||
require_once $env_config;
|
require_once $env_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops redirect loop on login page
|
|
||||||
*/
|
|
||||||
define('FORCE_SSL_ADMIN', true);
|
|
||||||
// in some setups HTTP_X_FORWARDED_PROTO might contain
|
|
||||||
// a comma-separated list e.g. http,https
|
|
||||||
// so check for https existence
|
|
||||||
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
|
|
||||||
$_SERVER['HTTPS']='on';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URLs
|
* URLs
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,3 +5,13 @@ define('WP_DEBUG_DISPLAY', false);
|
|||||||
define('SCRIPT_DEBUG', false);
|
define('SCRIPT_DEBUG', false);
|
||||||
/** Disable all file modifications including updates and update notifications */
|
/** Disable all file modifications including updates and update notifications */
|
||||||
define('DISALLOW_FILE_MODS', true);
|
define('DISALLOW_FILE_MODS', true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops redirect loop on login page
|
||||||
|
*/
|
||||||
|
define('FORCE_SSL_ADMIN', true);
|
||||||
|
// in some setups HTTP_X_FORWARDED_PROTO might contain
|
||||||
|
// a comma-separated list e.g. http,https
|
||||||
|
// so check for https existence
|
||||||
|
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
|
||||||
|
$_SERVER['HTTPS']='on';
|
||||||
@@ -5,3 +5,13 @@ define('WP_DEBUG_DISPLAY', false);
|
|||||||
define('SCRIPT_DEBUG', false);
|
define('SCRIPT_DEBUG', false);
|
||||||
/** Disable all file modifications including updates and update notifications */
|
/** Disable all file modifications including updates and update notifications */
|
||||||
define('DISALLOW_FILE_MODS', true);
|
define('DISALLOW_FILE_MODS', true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops redirect loop on login page
|
||||||
|
*/
|
||||||
|
define('FORCE_SSL_ADMIN', true);
|
||||||
|
// in some setups HTTP_X_FORWARDED_PROTO might contain
|
||||||
|
// a comma-separated list e.g. http,https
|
||||||
|
// so check for https existence
|
||||||
|
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
|
||||||
|
$_SERVER['HTTPS']='on';
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Do not edit this file. Edit the config files found in the config/ dir instead.
|
* Do not edit this file. Edit the config files found in the config/ dir instead.
|
||||||
* This file is required in the root directory so WordPress can find it.
|
* This file is required in the root directory so WordPress can find it.
|
||||||
* WP is hardcoded to look in its own directory or one directory up for wp-config.php.
|
* WP is hardcoded to look in its own directory or one directory up for wp-config.php.
|
||||||
*/
|
*/
|
||||||
require_once(__DIR__ . '/vendor/autoload.php');
|
require_once(__DIR__ . '/vendor/autoload.php');
|
||||||
require_once(__DIR__ . '/config/application.php');
|
require_once(__DIR__ . '/config/application.php');
|
||||||
require_once(ABSPATH . 'wp-settings.php');
|
require_once(ABSPATH . 'wp-settings.php');
|
||||||
|
|||||||
@@ -24,4 +24,4 @@ WP_SECURE_AUTH_SALT=generate_me
|
|||||||
WP_LOGGED_IN_SALT=generate_me
|
WP_LOGGED_IN_SALT=generate_me
|
||||||
WP_NONCE_SALT=generate_me
|
WP_NONCE_SALT=generate_me
|
||||||
|
|
||||||
WP_JWT_AUTH_SECRET_KEY=generate_me
|
WP_JWT_AUTH_SECRET_KEY=generate_me
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
FROM php:7.0-apache
|
FROM php:7.0-apache
|
||||||
|
|
||||||
ARG API_URL
|
ARG API_URL
|
||||||
ENV REACT_APP_API_URL ${API_URL}
|
ENV REACT_APP_API_URL ${API_URL}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ export const receiveCustomerDetails = (json) => ({
|
|||||||
export const fetchCartCount = () => {
|
export const fetchCartCount = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(requestShopCartCount());
|
dispatch(requestShopCartCount());
|
||||||
|
//TODO : fetch cart count from woocommerce (requires plugin)
|
||||||
|
dispatch(receiveShopCartCount(0));
|
||||||
|
/*
|
||||||
return client.fetch({url: `${API_SERVER}/cart/api/getCartCount`}).then(response => {
|
return client.fetch({url: `${API_SERVER}/cart/api/getCartCount`}).then(response => {
|
||||||
if (typeof response.data !== 'undefined' && 'cartItemsCount' in response.data) {
|
if (typeof response.data !== 'undefined' && 'cartItemsCount' in response.data) {
|
||||||
dispatch(receiveShopCartCount(response.data.cartItemsCount));
|
dispatch(receiveShopCartCount(response.data.cartItemsCount));
|
||||||
@@ -64,6 +67,7 @@ export const fetchCartCount = () => {
|
|||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
client.onError(error, dispatch);
|
client.onError(error, dispatch);
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
import {API_SERVER} from '../../config';
|
|
||||||
import HtmlClient from '../../helpers/HtmlClient';
|
|
||||||
import {REQUEST_GADGETS, RECIEVE_GADGETS} from '../../constants/dashboardConstants';
|
import {REQUEST_GADGETS, RECIEVE_GADGETS} from '../../constants/dashboardConstants';
|
||||||
const htmlClient = new HtmlClient();
|
|
||||||
|
|
||||||
const requestGadgets = () => ({type: REQUEST_GADGETS});
|
const requestGadgets = () => ({type: REQUEST_GADGETS});
|
||||||
const recieveGadgets = (json) => ({
|
const recieveGadgets = (json) => ({
|
||||||
@@ -12,6 +9,19 @@ const recieveGadgets = (json) => ({
|
|||||||
export const fetchGadgets = () => {
|
export const fetchGadgets = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(requestGadgets());
|
dispatch(requestGadgets());
|
||||||
|
//TODO : check how to solve gadgets, don't use hardcoded values
|
||||||
|
const gadgets = [
|
||||||
|
{
|
||||||
|
name: 'CustomerOrderCentral',
|
||||||
|
idGadget: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'CustomerNextActions',
|
||||||
|
idGadget: 1,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
dispatch(recieveGadgets(gadgets));
|
||||||
|
/*
|
||||||
return htmlClient.fetch({
|
return htmlClient.fetch({
|
||||||
url: `${API_SERVER}/dashboards/api/getMyDashboard`
|
url: `${API_SERVER}/dashboards/api/getMyDashboard`
|
||||||
})
|
})
|
||||||
@@ -23,5 +33,6 @@ export const fetchGadgets = () => {
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
htmlClient.onError(error, dispatch);
|
htmlClient.onError(error, dispatch);
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {API_SERVER} from '../../config';
|
|
||||||
import HtmlClient from '../../helpers/HtmlClient';
|
|
||||||
import {REQUEST_NEXT_ACTIONS, RECIEVE_NEXT_ACTIONS} from '../../constants/dashboardConstants';
|
import {REQUEST_NEXT_ACTIONS, RECIEVE_NEXT_ACTIONS} from '../../constants/dashboardConstants';
|
||||||
|
import { API_SERVER } from '../../config';
|
||||||
|
import HtmlClient from '../../helpers/HtmlClient';
|
||||||
|
|
||||||
const client = new HtmlClient();
|
const client = new HtmlClient();
|
||||||
|
|
||||||
export const requestNextActions = () => ({
|
export const requestNextActions = () => ({
|
||||||
@@ -18,11 +19,11 @@ export const fetchNextActions = () => {
|
|||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(requestNextActions());
|
dispatch(requestNextActions());
|
||||||
return client.fetch({
|
return client.fetch({
|
||||||
url: `${API_SERVER}/dashboards/api/getNextActionsInfo`
|
url: `${API_SERVER}/wp-json/wiaas/next-delivery-steps`
|
||||||
})
|
})
|
||||||
.then(response => dispatch(recieveNextActions(response.data)))
|
.then(response => dispatch(recieveNextActions(response.data)))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
client.onError(error, dispatch);
|
client.onError(error, dispatch);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import {
|
|||||||
REQUEST_ORDERS,
|
REQUEST_ORDERS,
|
||||||
RECEIVE_ORDERS
|
RECEIVE_ORDERS
|
||||||
} from '../../constants/dashboardConstants';
|
} from '../../constants/dashboardConstants';
|
||||||
|
import {fromWCOrder} from '../../helpers/OrderHelper';
|
||||||
|
import { MAX_ORDER_COUNT } from '../../constants/ordersConstants';
|
||||||
const htmlClient = new HtmlClient();
|
const htmlClient = new HtmlClient();
|
||||||
|
|
||||||
export const requestOrders = () => ({
|
export const requestOrders = () => ({
|
||||||
@@ -21,13 +23,12 @@ export const fetchOrders = (viewAllOrders) => {
|
|||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(requestOrders());
|
dispatch(requestOrders());
|
||||||
return htmlClient.fetch({
|
return htmlClient.fetch({
|
||||||
url: `${API_SERVER}/dashboards/api/getOrderCentralInfo`,
|
url: `${API_SERVER}/wp-json/wc/v2/orders?per_page=${MAX_ORDER_COUNT}`,
|
||||||
method: 'post',
|
method: 'get',
|
||||||
data: {
|
})
|
||||||
viewAllOrders
|
.then(response => {
|
||||||
}
|
dispatch(recieveOrders(response.data.map(wcOrder => fromWCOrder(wcOrder))));
|
||||||
})
|
})
|
||||||
.then(response => dispatch(recieveOrders(response.data)))
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
htmlClient.onError(error, dispatch);
|
htmlClient.onError(error, dispatch);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -161,6 +161,68 @@ const validateRefreshToken = () => {
|
|||||||
export const getModules = () => {
|
export const getModules = () => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(requestModules());
|
dispatch(requestModules());
|
||||||
|
//TODO : check how to solve modules, don't hardocde values
|
||||||
|
const modules={
|
||||||
|
modules:{
|
||||||
|
modules:[
|
||||||
|
{
|
||||||
|
id:"19",
|
||||||
|
isInMenu:"0",
|
||||||
|
menuName:"Cart",
|
||||||
|
name:"Cart",
|
||||||
|
url:"cart",
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"14",
|
||||||
|
isInMenu:"0",
|
||||||
|
menuName:"ProfileSettings",
|
||||||
|
name:"ProfileSettings",
|
||||||
|
url:"profileSettings",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"23",
|
||||||
|
isInMenu:"0",
|
||||||
|
menuName:"OrderProjects",
|
||||||
|
name:"OrderProjects",
|
||||||
|
url:"orderProjects",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"15",
|
||||||
|
isInMenu:"0",
|
||||||
|
menuName:"Terms",
|
||||||
|
name:"Terms",
|
||||||
|
url:"terms",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"1",
|
||||||
|
isInMenu:"1",
|
||||||
|
menuName:"Overview",
|
||||||
|
name:"Dashboards",
|
||||||
|
url:"dashboards",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"18",
|
||||||
|
isInMenu:"1",
|
||||||
|
menuName:"Co-Market",
|
||||||
|
name:"CoMarket",
|
||||||
|
url:"co-market",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subModules:{
|
||||||
|
"co-market":[
|
||||||
|
{
|
||||||
|
menuName:"Orders",
|
||||||
|
name:"Orders",
|
||||||
|
url:"orders",
|
||||||
|
moduleUrl:"co-market",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispatch(recieveModules(modules));
|
||||||
|
/*
|
||||||
return htmlClient.fetch({
|
return htmlClient.fetch({
|
||||||
url: `${API_SERVER}/login/api/getModules`,
|
url: `${API_SERVER}/login/api/getModules`,
|
||||||
})
|
})
|
||||||
@@ -170,6 +232,7 @@ export const getModules = () => {
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
htmlClient.onError(error, dispatch);
|
htmlClient.onError(error, dispatch);
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ const API_VERSION = 'v2';
|
|||||||
|
|
||||||
const API_SERVER_BASE = process.env.REACT_APP_API_URL;
|
const API_SERVER_BASE = process.env.REACT_APP_API_URL;
|
||||||
const API_SERVER = API_SERVER_BASE;
|
const API_SERVER = API_SERVER_BASE;
|
||||||
|
const API_SERVER_LOGIN = API_SERVER + "/wp-admin";
|
||||||
|
|
||||||
export {API_SERVER_BASE, API_SERVER, APPLICATION_NAME}
|
export {API_SERVER_BASE, API_SERVER, APPLICATION_NAME, API_SERVER_LOGIN}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {API_SERVER_BASE} from '../config.js';
|
import {API_SERVER_LOGIN} from '../config.js';
|
||||||
|
|
||||||
const MODULE = 'AUTH_';
|
const MODULE = 'AUTH_';
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ export const loginMessages = {
|
|||||||
CHANGE_LATER: 'You can change your password in 5 minutes!',
|
CHANGE_LATER: 'You can change your password in 5 minutes!',
|
||||||
INVALID_REFRESH_TOKEN: 'Your session has expired!',
|
INVALID_REFRESH_TOKEN: 'Your session has expired!',
|
||||||
EXPIRED_SESSION : 'Your session has expired!',
|
EXPIRED_SESSION : 'Your session has expired!',
|
||||||
INVALID_USER_TYPE: 'Users with other roles than "customer" must use this url for login: ' + API_SERVER_BASE,
|
INVALID_USER_TYPE: 'Users with other roles than "customer" must use this url for login: ' + API_SERVER_LOGIN,
|
||||||
INVALID_CHANGE_TOKEN: 'Invalid change token value!',
|
INVALID_CHANGE_TOKEN: 'Invalid change token value!',
|
||||||
PASSWORDS_MISSING: 'Password can not be empty',
|
PASSWORDS_MISSING: 'Password can not be empty',
|
||||||
WRONG_USERNAME: 'Invalid username!',
|
WRONG_USERNAME: 'Invalid username!',
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ export const dashboardTexts = {
|
|||||||
},
|
},
|
||||||
statuses: {
|
statuses: {
|
||||||
open: 'Open',
|
open: 'Open',
|
||||||
'in-progress': 'In Progress',
|
processing: 'In Progress',
|
||||||
production: 'Production',
|
completed: 'Production',
|
||||||
'end-of-life': 'End Of Life',
|
'end-of-life': 'End Of Life',
|
||||||
canceled: 'Canceled',
|
cancelled: 'Cancelled',
|
||||||
'not-accepted': 'Not Accepted',
|
'not-accepted': 'Not Accepted',
|
||||||
invalid: 'Invalid',
|
invalid: 'Invalid',
|
||||||
pending: 'Pending'
|
pending: 'Pending'
|
||||||
|
|||||||
@@ -207,3 +207,5 @@ export const orderTexts = {
|
|||||||
PLACED_BY: 'Placed by'
|
PLACED_BY: 'Placed by'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const MAX_ORDER_COUNT = 5;
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
background: $not-accepted-status-color;
|
background: $not-accepted-status-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.in-progress {
|
.processing {
|
||||||
background: $in-progress-status-color;
|
background: $processing-status-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.next-action-details{
|
.next-action-details{
|
||||||
|
|||||||
@@ -31,15 +31,15 @@
|
|||||||
background: $open-status-color;
|
background: $open-status-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.in-progress {
|
.processing {
|
||||||
background: $in-progress-status-color;
|
background: $processing-status-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-open {
|
.line-open {
|
||||||
border-left: 3px $open-status-color solid;
|
border-left: 3px $open-status-color solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-in-progress {
|
.line-processing {
|
||||||
border-left: 3px $in-progress-status-color solid;
|
border-left: 3px $processing-status-color solid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ class NextActionItem extends Component {
|
|||||||
return (
|
return (
|
||||||
<Row className="next-actions-row">
|
<Row className="next-actions-row">
|
||||||
<Col xl="8">
|
<Col xl="8">
|
||||||
{nextAction.stepAction}
|
{nextAction.step_action}
|
||||||
</Col>
|
</Col>
|
||||||
<Col xl="4">
|
<Col xl="4">
|
||||||
<Link to={'orders/'+ nextAction.idOrder}>
|
<Link to={'orders/'+ nextAction.order_id}>
|
||||||
<div className={'next-actions-status ' + nextAction.status}>{dashboardTexts.statuses[nextAction.status]}</div>
|
<div className={'next-actions-status ' + nextAction.status}>{dashboardTexts.statuses[nextAction.status]}</div>
|
||||||
</Link>
|
</Link>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class NextActionsList extends Component {
|
|||||||
{
|
{
|
||||||
nextActions &&
|
nextActions &&
|
||||||
nextActions.map((nextAction, index) =>
|
nextActions.map((nextAction, index) =>
|
||||||
<NextActionItem key={'action-' + nextAction.orderNumber + index} nextAction={nextAction}/>
|
<NextActionItem key={'action-' + nextAction.order_number + index} nextAction={nextAction}/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</WiaasTableBody>
|
</WiaasTableBody>
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ class OrderItem extends Component {
|
|||||||
<WiaasTableRow className={'order-central-row line-' + order.status}>
|
<WiaasTableRow className={'order-central-row line-' + order.status}>
|
||||||
<WiaasTableCol header="#">
|
<WiaasTableCol header="#">
|
||||||
<i className="fa fa-list-alt package-photo" aria-hidden="true" />
|
<i className="fa fa-list-alt package-photo" aria-hidden="true" />
|
||||||
<div className="orderNumber">{order.orderNumber}</div>
|
<div className="orderNumber">{order.number}</div>
|
||||||
</WiaasTableCol>
|
</WiaasTableCol>
|
||||||
<WiaasTableCol header={dashboardTexts.tableHeaders.ORDER_DATE}>{order.orderDate}</WiaasTableCol>
|
<WiaasTableCol header={dashboardTexts.tableHeaders.ORDER_DATE}>{order.dateCreated}</WiaasTableCol>
|
||||||
{
|
{
|
||||||
isViewAllOrdersChecked &&
|
isViewAllOrdersChecked &&
|
||||||
<WiaasTableCol header={dashboardTexts.tableHeaders.PLACED_BY}>{order.placedBy}</WiaasTableCol>
|
<WiaasTableCol header={dashboardTexts.tableHeaders.PLACED_BY}>{order.placedBy}</WiaasTableCol>
|
||||||
@@ -25,7 +25,7 @@ class OrderItem extends Component {
|
|||||||
<WiaasTableCol header={dashboardTexts.tableHeaders.STATUS}>
|
<WiaasTableCol header={dashboardTexts.tableHeaders.STATUS}>
|
||||||
<div className={'status-icon ' + order.status}></div>{dashboardTexts.statuses[order.status]}
|
<div className={'status-icon ' + order.status}></div>{dashboardTexts.statuses[order.status]}
|
||||||
</WiaasTableCol>
|
</WiaasTableCol>
|
||||||
<WiaasTableCol><Link to={'orders/'+ order.idOrder}><Button className="wiaas-button">{dashboardTexts.buttons.DETAILS}</Button></Link></WiaasTableCol>
|
<WiaasTableCol><Link to={'orders/'+ order.id}><Button className="wiaas-button">{dashboardTexts.buttons.DETAILS}</Button></Link></WiaasTableCol>
|
||||||
</WiaasTableRow>
|
</WiaasTableRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class OrdersList extends Component {
|
|||||||
{
|
{
|
||||||
orders &&
|
orders &&
|
||||||
orders.map((order, index) =>
|
orders.map((order, index) =>
|
||||||
<OrderItem key={'order-' + order.orderNumber} order={order} isViewAllOrdersChecked={isViewAllOrdersChecked}/>
|
<OrderItem key={'order-' + order.number} order={order} isViewAllOrdersChecked={isViewAllOrdersChecked}/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</WiaasTableBody>
|
</WiaasTableBody>
|
||||||
|
|||||||
15
frontend/src/helpers/OrderHelper.js
Normal file
15
frontend/src/helpers/OrderHelper.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
|
export const fromWCOrder = (order) => {
|
||||||
|
return {
|
||||||
|
id: order.id,
|
||||||
|
number: order.number,
|
||||||
|
dateCreated: moment(order.date_created).format("Do MMM, YYYY"),
|
||||||
|
reference: 'reference field',
|
||||||
|
assignedTo: 'assigned to',
|
||||||
|
fixedPrice: order.total,
|
||||||
|
recurringPrice: 0,
|
||||||
|
status: order.status,
|
||||||
|
currency: order.currency
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user