23 Commits

Author SHA1 Message Date
Bilal Catic
2cdef7c31e Merge branch 'remove-co-market' into 'development'
Remove Co-Market from customer interface

See merge request saburly/wiaas/new-wiaas!85

(cherry picked from commit f33c6aa6e2)

1726c3d7 Remove Co-Market from customer interface
2018-12-05 13:20:43 +00:00
Bilal Catic
f51d9f5512 Merge branch 'development' into 'master'
Bugfixes

See merge request saburly/wiaas/new-wiaas!73
2018-11-19 15:42:25 +00:00
Almira
3db4b71c3f Merge branch 'fix-location-details-field' into 'development'
Fix location details field

See merge request saburly/wiaas/new-wiaas!74
2018-11-19 15:32:55 +00:00
Bilal Catic
3df6397280 remove comment 2018-11-19 16:30:04 +01:00
Bilal Catic
e548e2a31c break project name and location details if too long 2018-11-19 16:29:22 +01:00
Almira
3d37a88247 Merge branch 'ticketing-integration' into 'development'
add helpdesk module

See merge request saburly/wiaas/new-wiaas!66
2018-11-19 12:44:16 +00:00
Bilal Catic
30e5d594ad highlight helpdesk when selected 2018-11-19 13:38:12 +01:00
Bilal Catic
dd93677def add helpdesk module 2018-11-19 13:38:12 +01:00
Nedim Uka
4de01d93d1 Merge branch 'fix-bundle-link-in-order-details' into 'development'
set commercial id to real id, not object

See merge request saburly/wiaas/new-wiaas!72
2018-11-19 12:37:09 +00:00
Bilal Catic
2fdae06a59 set commercial id to real id, not object 2018-11-19 13:30:07 +01:00
Almira
d0533b3d6e Merge branch 'support-email' into 'development'
Added support for sending customer emails

See merge request saburly/wiaas/new-wiaas!69
2018-11-19 12:24:10 +00:00
Nedim Uka
35e670fa52 removved debug log 2018-11-19 13:15:50 +01:00
Nedim Uka
f56377f606 Handled proper endpoint naming 2018-11-19 12:35:04 +01:00
Almira
95a9fd2110 Merge branch 'fix-additional-days-bug' into 'development'
add only working days

See merge request saburly/wiaas/new-wiaas!70
2018-11-19 11:11:34 +00:00
Nedim Uka
752df56d4a Fixed bug where order note text is saved as order ID 2018-11-19 11:31:46 +01:00
Bilal Catic
e1594f3a7f Merge branch 'fixes' into 'development'
Fixes

See merge request saburly/wiaas/new-wiaas!71
2018-11-19 10:15:26 +00:00
Almira Krdzic
4f97df5b45 Merge branch 'development' into fixes 2018-11-18 22:10:24 +01:00
Almira Krdzic
ef5cf00983 Fix hidden metadata 2018-11-18 22:10:01 +01:00
Bilal Catic
ca0fed674f add only working days 2018-11-16 20:30:47 +01:00
Bilal Catic
fb66d56d9c Merge branch 'installation-fix' into 'development'
Fix installation selection

See merge request saburly/wiaas/new-wiaas!68
2018-11-16 19:20:35 +00:00
Nedim Uka
a07c0e4584 Added support for sending customer emails 2018-11-16 17:16:28 +01:00
Almira Krdzic
3708c9fb30 Fix installation selection 2018-11-16 15:59:16 +01:00
Bilal Catic
c630452d0b Merge branch 'fix-tests' into 'development'
Fix and remove broken tests

See merge request saburly/wiaas/new-wiaas!67
2018-11-16 09:38:51 +00:00
22 changed files with 191 additions and 69 deletions

View File

@@ -0,0 +1,68 @@
<?php
class Wiaas_Support_Api {
/**
* Endpoint namespace.
*
* @var string
*/
private static $namespace = 'wiaas';
private static $rest_base = 'support';
public static function register_routes() {
register_rest_route(self::$namespace, self::$rest_base . '/send-support-email', array(
'methods' => 'POST',
'callback' => array(__CLASS__, 'send_support_email'),
'permission_callback' => 'is_user_logged_in',
'args' => array(
'id' => array(
'description' => __('Order ID.', 'wiaas'),
'type' => 'integer',
'required' => true,
'sanitize_callback' => 'absint',
),
'support_text' => array(
'description' => __('Email text.', 'wiaas'),
'type' => 'string',
'required' => true
)
)
));
}
/**
* Send support email and save massage to order notes
*
* @param WP_REST_Request $request Request data.
*
* @return WP_REST_Response
*/
public static function send_support_email($request) {
$order_id = $request['id'];
$message = $request['support_text'];
$order = wc_get_order($order_id);
$customer_id = $order->get_customer_id();
$customer = get_user_by('id', $customer_id);
$mailer = WC()->mailer();
$recipient = WIAAS_SUPPORT_EMAIL;
$subject = __('Customer: '.$customer->get('first_name').', '.''.$customer->get('last_name').' needs support for order number: ' .$order->get_order_number());
$headers = array();
$success = $mailer->send( $recipient, $subject, $message, $headers );
if ($success) {
wc_create_order_note($order_id , $message, true );
return wiaas_api_notice('EMAIL_SENT', 'success');
}
return wiaas_api_notice('EMAIL_NOT_SENT', 'failed');
}
}

View File

@@ -43,7 +43,8 @@ class Wiaas_API {
include_once dirname( __FILE__ ) . '/api/class-wiaas-order-projects-api.php';
include_once dirname( __FILE__ ) . '/api/class-wiaas-wc- package-api-integration.php';
include_once dirname( __FILE__ ) . '/api/class-wiaas-wc-package-api-integration.php';
include_once dirname( __FILE__ ) . '/api/class-wiaas-support-api.php';
// API functions
include_once dirname( __FILE__ ) . '/api/wiaas-api-functions.php';
@@ -58,6 +59,7 @@ class Wiaas_API {
'Wiass_REST_User_API',
'Wiaas_REST_Customer_API',
'Wiaas_Order_Projects_API',
'Wiaas_Support_Api',
);
foreach ( $controllers as $controller ) {

View File

@@ -473,8 +473,8 @@ class Wiaas_Cart {
'_wiaas_supplier_organization_id',
'_wiaas_product_price',
'_wiaas_earliest_installation_additional_days',
'wiaas_installation',
'wiaas_installation_date'
'_wiaas_installation',
'_wiaas_installation_date'
) );
}

View File

@@ -436,7 +436,7 @@ class Wiaas_Order {
if (! $missing_estimated) {
$earliest_installation_date = max($max_estimated_date, $max_confirmed_date);
$earliest_installation_date = strtotime('+' . self::get_additional_days_prior_installation($order->id) . ' days', $earliest_installation_date);
$earliest_installation_date = strtotime('+' . self::get_additional_days_prior_installation($order->id) . ' weekdays', $earliest_installation_date);
}
$order->update_meta_data('_wiaas_final_confirmed_delivery_date', $max_confirmed_date);
@@ -475,7 +475,6 @@ class Wiaas_Order {
$commercial_lead_organization_info = $order->get_meta('_wiaas_commercial_lead_info', true);
if (! empty($commercial_lead_org_id) && empty($commercial_lead_organization_info)) {
$commercial_lead_organization_info = wiaas_get_organization_info($commercial_lead_org_id);
$data['commercial_lead'] = array(
@@ -487,8 +486,7 @@ class Wiaas_Order {
}
if (!empty($commercial_lead_organization_info)) {
$commercial_lead_organization_info['id'] = $commercial_lead_organization_info;
$commercial_lead_organization_info['id'] = $commercial_lead_org_id;
$data['commercial_lead'] = $commercial_lead_organization_info;
}

View File

@@ -88,12 +88,15 @@ class Wiaas_Delivery_Process_Step_Assignee {
$mapped_assignees = array();
$order_id = self::get_order_id_for_step($step);
$order_id = self::_get_order_id_for_step($step);
$order = wc_get_order($order_id);
foreach ($assignees as $assignee) {
/**
* Handle step assignee for installation company field
*/
if (strpos($assignee->get_type(), 'wiaas_installation_') !== false) {
$item_id = $assignee->get_id();
@@ -120,11 +123,15 @@ class Wiaas_Delivery_Process_Step_Assignee {
continue;
}
/**
* Handle step assignee for order role
*/
if ($assignee->get_type() === 'wiaas_order_role') {
$order_role = $assignee->get_id();
// Assign step to order customer
if ($order_role === 'customer') {
$customer_user_id = $order->get_customer_id();
@@ -157,7 +164,7 @@ class Wiaas_Delivery_Process_Step_Assignee {
* @return bool|int Order id on success, false if step does not have associated order id
*
*/
public static function get_order_id_for_step(Gravity_Flow_Step $step) {
private static function _get_order_id_for_step(Gravity_Flow_Step $step) {
$entry = $step->get_entry();

View File

@@ -23,7 +23,7 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step {
$settings_api = $this->get_common_settings_api();
$forms = $this->get_action_forms_choices();
$forms = Wiaas_Delivery_Process_Action::get_action_forms();
$form_choices[] = array( 'label' => esc_html__( 'Select a Form', 'wiaas' ), 'value' => '' );
foreach ( $forms as $form ) {
@@ -86,8 +86,18 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step {
return $label;
}
/**
* Update status
*
* @param bool $status
*/
public function update_step_status($status = false) {
/**
* If status is being updated after manual step completion ('Next Step' or 'Previous Step') change default
* behavior of settings status to cancelled if manual action is sending flow to next step.
* Instead of default cancelled status set complete status for this step.
*/
if ($status === 'cancelled' && $admin_action = rgpost( 'wiaas_delivery_process_navigation_action' )) {
list( $base_admin_action, $step_id ) = rgexplode( '|', $admin_action, 2 );
@@ -104,10 +114,10 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step {
}
/**
* Process Wiass Delivery Process Step
*
* Process Wiaas Delivery Process Step
*
*
* @return bool
* @return bool We will always return false because step will be completed only by manual user action
*/
function process() {
@@ -198,28 +208,22 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step {
return $entry_meta;
}
/**
* Retrieves forms that are valid options for delivery step action
*
* PRIVATE
*
*/
/**
* Create action entry to trigger subworkflow
* @param $target_form
* @param $order_id
*
* @return array
*/
public function get_action_forms_choices() {
return Wiaas_Delivery_Process_Action::get_action_forms();
}
/**
* Retrieves target form entry id created when step was started
* @return int
*/
public function get_target_form_entry_id() {
$value = gform_get_meta($this->get_entry_id(), 'wiaas_delivery_step_' . $this->get_id() .'_entry_id');
return absint($value);
}
private function _create_single_action_entry($target_form, $order_id) {
$action_entries_ids = array();
@@ -248,6 +252,14 @@ class Wiaas_Delivery_Process_Step extends Gravity_Flow_Step {
}
/**
* Create action form entries for every bundle in order to trigger subworkflows
*
* @param $target_form
* @param $order_id
*
* @return array
*/
private function _create_per_bundle_action_entries($target_form, $order_id) {
$action_entries_ids = array();

View File

@@ -306,30 +306,16 @@ class Wiaas_Order_Fields {
}
}
public static function get_value_from_order_field($entry, $field) {
switch ($field->type) {
case 'wiaas_order_bundle':
$value = $entry[$field->id];
list ($order_id, $item_id) = explode('|', $value);
if ( ! empty($order_id) && ! empty($item_id)) {
return array(
'id' => $item_id,
'name' => $field->get_selected_bundle_display_name($value)
);
}
return null;
case '':
}
}
/**
* Create new entry for order delivery process action form
*
* @param int $order_id
* @param array $form
* @param int|null $bundle_item_id
*
* @return array|bool
*/
public static function map_order_to_entry($order_id, $form, $bundle_item_id = null) {
if (empty($form['fields']) ||
@@ -430,9 +416,9 @@ class Wiaas_Order_Fields {
}
// installation is already selected
if (!empty($bundle_item->get_meta('wiaas_installation', true))) {
if (!empty($bundle_item->get_meta('_wiaas_installation', true))) {
$entry[(string) $field->id] = 'wiaas_installation_' . $order->get_id() . '|' . $bundle_item->get_meta('wiaas_installation', true);
$entry[(string) $field->id] = 'wiaas_installation_' . $order->get_id() . '|' . $bundle_item->get_meta('_wiaas_installation', true);
continue;
}
@@ -461,6 +447,7 @@ class Wiaas_Order_Fields {
$installation_item = $installation_items[0];
$entry[(string) $field->id] = 'wiaas_installation_' . $order->get_id() . '|' . $installation_item->get_id();
} else if (count($installation_items) > 1) {
// force admin to select installation

View File

@@ -20,7 +20,8 @@ class Wiaas_Document_Download {
}
/**
* Handle download for order documents by gravity flow steps
* Handle download of order documents by gravity flow steps for wordpress administration interface
*
*/
public static function admin_gf_order_document_download() {
@@ -44,6 +45,8 @@ class Wiaas_Document_Download {
}
/**
* Handle document download for wordpress administration interface
*
* Since only REST api uses JWT Authentication this endpoint will work only for users
* that are logged in directly to wordpress
*/
@@ -84,7 +87,8 @@ class Wiaas_Document_Download {
}
/**
* Download order other document (not binded to any bundle)
* Download order other document (not related to any order item)
*
* @param int $order_id
* @param string $document_key
*/
@@ -113,8 +117,6 @@ class Wiaas_Document_Download {
$file_path = wiaas_get_document_version_path($order_document['version']);
error_log($file_path);
if (!file_exists($file_path)) {
wp_die( __( 'Document not found.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 404 ) );
}

View File

@@ -76,6 +76,7 @@ define('SENDGRID_FROM_NAME', env('WP_SENDGRID_FROM_NAME' ?: 'Wiaas'));
* Wiaas Env variables
*/
define('WIAAS_CUSTOMER_INTERFACE', env('WIAAS_CUSTOMER_INTERFACE') ?: WP_HOME);
define('WIAAS_SUPPORT_EMAIL', env('WIAAS_SUPPORT_EMAIL') ?: 'support@co-ideation.com');
/**
* Custom Settings
@@ -89,4 +90,4 @@ define('DISALLOW_FILE_EDIT', true);
*/
if (!defined('ABSPATH')) {
define('ABSPATH', $webroot_dir . '/wp/');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

View File

@@ -165,6 +165,13 @@ export const getModules = () => {
url: 'cart',
isInMenu: '0'
},
{
id: '20',
name: 'HelpDesk',
menuName: 'Helpdesk',
url: 'helpdesk',
isInMenu: '0'
},
{
id: '14',
name: 'ProfileSettings',

View File

@@ -325,12 +325,13 @@ export const setSupportMessage = (message) => ({
supportText: message
});
export const sendSupportMail = (orderInfo, orderPackages, supportText) => {
export const sendSupportMail = (orderInfo, orderPackages, support_text) => {
let id = orderInfo.id;
return dispatch => {
return htmlClient.fetch({
url: `${API_SERVER}/orders/api/sendSupportMail`,
url: `${API_SERVER}/wp-json/wiaas/support/send-support-email`,
method: 'post',
data: {orderInfo, orderPackages, supportText}
data: {id, support_text}
})
.then(response => {
if (typeof response.data !== 'undefined' && 'messages' in response.data) {

View File

@@ -1,4 +1,4 @@
const APPLICATION_NAME = 'Co-Market';
const APPLICATION_NAME = 'WIAAS Market';
const API_VERSION = 'v2';
const API_SERVER_BASE = process.env.REACT_APP_API_URL;

View File

@@ -4,6 +4,7 @@ import CoMarketContainer from '../containers/coMarket/CoMarketContainer.jsx';
import CartContainer from '../containers/cart/CartContainer.jsx';
import TermsContainer from '../containers/terms/TermsContainer.jsx';
import ProfileSettingsContainer from '../containers/profileSettings/ProfileSettingsContainer.jsx';
import HelpDeskContainer from '../containers/HelpDesk/HelpDeskContainer.jsx';
export const MainContainers = {
Dashboards: {
@@ -22,6 +23,10 @@ export const MainContainers = {
container: CartContainer,
params: []
},
HelpDesk:{
container: HelpDeskContainer,
params: []
},
Terms: {
container: TermsContainer,
params: []

View File

@@ -0,0 +1,11 @@
import React, {Component} from 'react';
import './style/HelpDesk.css';
class HelpDeskContainer extends Component {
render() {
return (<iframe src='https://wiaas.freshservice.com/support/login'></iframe>);
}
}
export default HelpDeskContainer;

View File

@@ -0,0 +1,6 @@
iframe {
display: block;
border: none;
width: 100%;
height: 100vh;
}

View File

@@ -28,12 +28,12 @@ class CoMarketPackagesContainer extends Component {
<Row>
<Col xl="8" lg="8" md="8" sm="12" xs="12">
<WiaasBox id="co-market-big-commercial">
<img className="description-photo" src="https://res.cloudinary.com/co-market/image/upload/v1524472688/Co-Market/CoMarketStartsida_MAIN.jpg" alt="big-commercial"/>
<img className="description-photo" src="/static/img/WIAAS_Market_banner.jpg" alt="big-commercial"/>
</WiaasBox>
</Col>
<Col xl="4" lg="4" md="4" sm="12" xs="12">
<WiaasBox id="co-market-commercials">
<img alt="wiaas commercial" src="https://res.cloudinary.com/co-market/image/upload/v1524472688/Co-Market/CoMarketStartsida_OFFERCoor.jpg" className="commercial-photo"/>
<img alt="wiaas commercial" src="/static/img/WIAAS_Market_SMO_infobox.jpg" className="commercial-photo"/>
</WiaasBox>
</Col>
</Row>

View File

@@ -80,7 +80,7 @@ class OrderInfo extends Component {
<Col xl="2">
<div>
<div className="subtitle"><h6>{orderTexts.labels.REFERENCE}:</h6></div>
<span>{orderInfo.reference || '-'}</span>
<span className="reference">{orderInfo.reference || '-'}</span>
</div>
<div>
<div className="subtitle"><h6>{orderTexts.labels.BID}:</h6></div>
@@ -139,7 +139,7 @@ class OrderInfo extends Component {
<Col xl="2">
<div>
<div className="subtitle"><h6>{orderTexts.labels.PROJECT}:</h6></div>
<span>{orderInfo.projectName || '-'}</span>
<span className="project-name">{orderInfo.projectName || '-'}</span>
</div>
<div className="terms-link">

View File

@@ -7,6 +7,14 @@ $link-line-height: 1.5rem;
margin-top: 0.5rem;
}
.reference{
word-break: break-all;
}
.project-name{
word-break: break-all;
}
.info-color {
margin-top: 0.2rem;
padding-left: 0.2rem;

View File

@@ -84,6 +84,13 @@ class Menu extends Component {
)
}
</Nav>
<Nav className="nav-btn-cart navbar-right" navbar>
<NavItem
id="nav-button-helpdesk"
className={(this.props.activeModule === 'helpdesk') ? "navbar-button active" : "navbar-button"}>
<NavLink tag={Link} to="/helpdesk">Helpdesk</NavLink>
</NavItem>
</Nav>
<Nav className="nav-btn-cart navbar-right" navbar>
<NavItem id="nav-button-cart" className="navbar-button">
<NavLink tag={Link} to="/cart">