Compare commits
5 Commits
cart-valid
...
documents-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7be6fde42 | ||
|
|
6c656a0b26 | ||
|
|
c4d539f549 | ||
|
|
0ba27b2f1d | ||
|
|
e6b372f5d0 |
@@ -8,4 +8,50 @@ jQuery(document).ready(function($) {
|
|||||||
$('#general_product_data').find('.pricing').addClass('hide_if_wiaastemplate hide_if_bundle');
|
$('#general_product_data').find('.pricing').addClass('hide_if_wiaastemplate hide_if_bundle');
|
||||||
$('#general_product_data').find('.pricing').removeClass('show_if_bundle show_if_wiaastemplate');
|
$('#general_product_data').find('.pricing').removeClass('show_if_bundle show_if_wiaastemplate');
|
||||||
|
|
||||||
|
|
||||||
|
$( '.wiaas-search-documents' ).each(function() {
|
||||||
|
var element = $( this );
|
||||||
|
var searchTarget = $('#' + element.data('target'));
|
||||||
|
|
||||||
|
element.autocomplete({
|
||||||
|
source: function(request, response) {
|
||||||
|
$.get( window.ajaxurl, {
|
||||||
|
action: 'wiaas_json_search_documents',
|
||||||
|
query: request.term,
|
||||||
|
_ajax_nonce: element.data('search-nonce')
|
||||||
|
} ).done( function( documents ) {
|
||||||
|
response( documents || []);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
select: function(event, ui) {
|
||||||
|
if (!searchTarget || $('#wiaas_attached_document_' + ui.item.id).length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.get(window.ajaxurl, {
|
||||||
|
action: 'wiaas_link_document',
|
||||||
|
_ajax_nonce: element.data('link-nonce'),
|
||||||
|
id: ui.item.id
|
||||||
|
}).done( function (document) {
|
||||||
|
searchTarget.find('tbody').append(document);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.autocomplete( 'instance' )._renderItem = function( ul, item ) {
|
||||||
|
return $( '<li role="option" id="wiaas-document-autocomplete-' + item.id + '">' )
|
||||||
|
.text( item.name )
|
||||||
|
.appendTo( ul );
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#wiaas_attached_documents').delegate('.wiaas-remove-attached-document', 'click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var id = $(this).data('id');
|
||||||
|
|
||||||
|
$('#wiaas_attached_document_' + id).remove();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -152,18 +152,29 @@ $insert_new_document = $post->post_type !== 'wiaas_doc';
|
|||||||
|
|
||||||
response = response.response;
|
response = response.response;
|
||||||
|
|
||||||
|
var infoContainer = jQuery('#wiaas_upload_info');
|
||||||
|
|
||||||
if (response.substring(0, 6) === 'ERROR:') {
|
if (response.substring(0, 6) === 'ERROR:') {
|
||||||
jQuery('#wiaas_upload_errors').html('<span class="text-danger">' +
|
infoContainer.html('<span style="color: darkred;">' +
|
||||||
'<i class="fa fa-exclamation-triangle"></i>' +
|
'<i class="dashicons dashicons-warning"></i>' +
|
||||||
' ' + response.substring(6, response.length) +
|
' ' + response.substring(6, response.length) +
|
||||||
'</span>');
|
'</span>');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
infoContainer.html('<span style="color: darkgreen;">' +
|
||||||
|
'<i class="dashicons dashicons-yes"></i>' +
|
||||||
|
' ' + 'Document uploaded and linked' +
|
||||||
|
'</span>');
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($insert_new_document) {
|
if ($insert_new_document) {
|
||||||
?>
|
?>
|
||||||
$('#wiaas_attached_documents').find('tbody').append(response);
|
$('#wiaas_attached_documents').find('tbody').append(response);
|
||||||
|
|
||||||
|
$('.wiaas_documents_tab a').click();
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
?>
|
?>
|
||||||
@@ -252,7 +263,8 @@ $insert_new_document = $post->post_type !== 'wiaas_doc';
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="wiaas_upload_errors" style="color: darkred;">
|
<div id="wiaas_upload_info">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,62 +8,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
jQuery(document).ready(function ($) {
|
|
||||||
|
|
||||||
$( '.wiaas-search-documents' ).each(function() {
|
|
||||||
var element = $( this );
|
|
||||||
var searchTarget = $('#' + element.data('target'));
|
|
||||||
|
|
||||||
element.autocomplete({
|
|
||||||
source: function(request, response) {
|
|
||||||
$.get( window.ajaxurl, {
|
|
||||||
action: 'wiaas_json_search_documents',
|
|
||||||
query: request.term,
|
|
||||||
_ajax_nonce: '<?php echo wp_create_nonce('wiaas_json_search_documents') ?>'
|
|
||||||
} ).done( function( documents ) {
|
|
||||||
response( documents || []);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
|
||||||
select: function(event, ui) {
|
|
||||||
if (!searchTarget || $('#wiaas_attached_document_' + ui.item.id).length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.get(window.ajaxurl, {
|
|
||||||
action: 'wiaas_link_document',
|
|
||||||
_ajax_nonce: '<?php echo wp_create_nonce('wiaas_link_document') ?>',
|
|
||||||
id: ui.item.id
|
|
||||||
}).done( function (document) {
|
|
||||||
searchTarget.find('tbody').append(document);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.autocomplete( 'instance' )._renderItem = function( ul, item ) {
|
|
||||||
return $( '<li role="option" id="wiaas-document-autocomplete-' + item.id + '">' )
|
|
||||||
.text( item.name )
|
|
||||||
.appendTo( ul );
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#wiaas_attached_documents').delegate('.wiaas-remove-attached-document', 'click', function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var id = $(this).data('id');
|
|
||||||
|
|
||||||
$('#wiaas_attached_document_' + id).remove();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div id="wiaas_documents" class="panel woocommerce_options_panel">
|
<div id="wiaas_documents" class="panel woocommerce_options_panel">
|
||||||
<div class="options_group">
|
<div class="options_group">
|
||||||
<p class="form-field">
|
<p class="form-field">
|
||||||
<label style="font-weight: bold;" for="wiaas_addon_packages"><?php esc_html_e( 'Search documents:', 'wiaas' ); ?></label>
|
<label style="font-weight: bold;" for="wiaas_addon_packages"><?php esc_html_e( 'Search documents:', 'wiaas' ); ?></label>
|
||||||
<input type="text" data-target="wiaas_attached_documents" class="wiaas-search-documents"/>
|
<input
|
||||||
|
type="text"
|
||||||
|
data-target="wiaas_attached_documents"
|
||||||
|
data-search-nonce="<?php echo wp_create_nonce('wiaas_json_search_documents') ?>"
|
||||||
|
data-link-nonce="<?php echo wp_create_nonce('wiaas_link_document') ?>"
|
||||||
|
class="wiaas-search-documents"
|
||||||
|
/>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="options_group">
|
<div class="options_group">
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: This is temporary implemetation and will probably be changed during work on pending wiaas cart task
|
|
||||||
* Class Wiaas_Document_API
|
* Class Wiaas_Document_API
|
||||||
*/
|
*/
|
||||||
class Wiaas_Document_API {
|
class Wiaas_Document_API {
|
||||||
@@ -30,30 +29,26 @@ class Wiaas_Document_API {
|
|||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
register_rest_route( self::$namespace, 'documents/order/(?P<id>\d+)/(?P<type>[\w-]+)', array(
|
register_rest_route( self::$namespace, 'order/(?P<id>\d+)/item/(?P<item_id>\d+)/document/(?P<key>[\w-]+)', array(
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'id' => array(
|
'id' => array(
|
||||||
'description' => __( 'Order ID.', 'wiaas' ),
|
'description' => __( 'Order ID.', 'wiaas' ),
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'sanitize_callback' => 'absint',
|
'sanitize_callback' => 'absint',
|
||||||
),
|
)
|
||||||
'type' => array(
|
|
||||||
'description' => __( 'Order document type.', 'wiaas' ),
|
|
||||||
'type' => 'string',
|
|
||||||
'sanitize_callback' => 'sanitize_key',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'permission_callback' => 'is_user_logged_in',
|
'permission_callback' => 'is_user_logged_in',
|
||||||
'callback' => array(__CLASS__, 'download_order_document'),
|
'callback' => array(__CLASS__, 'download_order_item_document'),
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'item_id' => array(
|
'item_id' => array(
|
||||||
'description' => __( 'Package Order Item ID.', 'wiaas' ),
|
'description' => __( 'Package Order Item ID.', 'wiaas' ),
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
'sanitize_callback' => 'absint',
|
'sanitize_callback' => 'absint',
|
||||||
|
'required' => true
|
||||||
),
|
),
|
||||||
'document_key' => array(
|
'key' => array(
|
||||||
'description' => __( 'Unique key identifier for order document.', 'wiaas' ),
|
'description' => __( 'Unique key identifier for order document.', 'wiaas' ),
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'sanitize_callback' => 'sanitize_key',
|
'sanitize_callback' => 'sanitize_key',
|
||||||
@@ -62,6 +57,29 @@ class Wiaas_Document_API {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
register_rest_route(self::$namespace, 'order/(?P<id>\d+)/document/(?P<key>[\w-]+)', array(
|
||||||
|
'args' => array(
|
||||||
|
'id' => array(
|
||||||
|
'description' => __( 'Order ID.', 'wiaas' ),
|
||||||
|
'type' => 'integer',
|
||||||
|
'sanitize_callback' => 'absint',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'methods' => 'GET',
|
||||||
|
'permission_callback' => 'is_user_logged_in',
|
||||||
|
'callback' => array(__CLASS__, 'download_order_other_document'),
|
||||||
|
'args' => array(
|
||||||
|
'key' => array(
|
||||||
|
'description' => __( 'Unique key identifier for order document.', 'wiaas' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'sanitize_callback' => 'sanitize_key',
|
||||||
|
'required' => true
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,14 +94,23 @@ class Wiaas_Document_API {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download order document
|
* Download order item document
|
||||||
|
*
|
||||||
* @param WP_REST_Request $request
|
* @param WP_REST_Request $request
|
||||||
*/
|
*/
|
||||||
public static function download_order_document($request) {
|
public static function download_order_item_document($request) {
|
||||||
Wiaas_Document_Download::download_order_item_document(
|
Wiaas_Document_Download::download_order_item_document(
|
||||||
$request['id'],
|
$request['id'],
|
||||||
$request['item_id'],
|
$request['item_id'],
|
||||||
$request['type'],
|
$request['key']);
|
||||||
$request['document_key']);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download order document
|
||||||
|
*
|
||||||
|
* @param WP_REST_Request $request
|
||||||
|
*/
|
||||||
|
public static function download_order_other_document($request) {
|
||||||
|
Wiaas_Document_Download::download_order_other_document($request['id'], $request['key']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -740,6 +740,7 @@ class Wiaas_Cart {
|
|||||||
|
|
||||||
$documents_ids = array();
|
$documents_ids = array();
|
||||||
|
|
||||||
|
// Retrieve all document ids attached to cart content
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
if (!isset($item['_wiaas_standard_package'])) {
|
if (!isset($item['_wiaas_standard_package'])) {
|
||||||
continue;
|
continue;
|
||||||
@@ -757,16 +758,19 @@ class Wiaas_Cart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Retrieve all customer visible template documents attached to cart content
|
||||||
$q = new WP_Query();
|
$q = new WP_Query();
|
||||||
$retrieved_items = $q->query(array(
|
$retrieved_items = $q->query(array(
|
||||||
'post_status' => 'publish',
|
'post_status' => 'publish',
|
||||||
'post_type' => 'wiaas_doc',
|
'post_type' => 'wiaas_doc',
|
||||||
'post__in' => array_keys($documents_ids),
|
'post__in' => array_keys($documents_ids),
|
||||||
|
'meta_key' => '_wiaas_doc_visible',
|
||||||
|
'meta_value' => 'yes', // visible to customer
|
||||||
'tax_query' => array(
|
'tax_query' => array(
|
||||||
array(
|
array(
|
||||||
'taxonomy' => 'wiaas_doc_type',
|
'taxonomy' => 'wiaas_doc_type',
|
||||||
'field' => 'slug',
|
'field' => 'slug',
|
||||||
'terms' => array_keys(self::$cart_doc_types),
|
'terms' => array_keys(self::$cart_doc_types), // templates only
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -681,19 +681,12 @@ class Wiaas_Order {
|
|||||||
if (wiaas_is_order_item__standard_package($order_item)) {
|
if (wiaas_is_order_item__standard_package($order_item)) {
|
||||||
$documents = wiaas_get_standard_package_order_item_documents($order, $product_line['id']);
|
$documents = wiaas_get_standard_package_order_item_documents($order, $product_line['id']);
|
||||||
|
|
||||||
if (! empty($order_item['wiaas_delivery_documents'])) {
|
|
||||||
|
|
||||||
$documents = array_merge($documents, $order_item['wiaas_delivery_documents']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data['line_items'][$index] ['documents'] = $documents;
|
$data['line_items'][$index] ['documents'] = $documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_delivery_documents = $order->get_meta('wiaas_delivery_documents', true);
|
$data['documents'] = wiaas_get_order_other_documents($order->get_id());
|
||||||
$order_delivery_documents = empty($order_delivery_documents) ? array() : $order_delivery_documents;
|
|
||||||
$data['documents'] = $order_delivery_documents;
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class Wiaas_Shop_DB {
|
|||||||
|
|
||||||
$shops = array_map(function($result_row) {
|
$shops = array_map(function($result_row) {
|
||||||
return array(
|
return array(
|
||||||
'owner_id' => $result_row->shop_owner_id,
|
'owner_id' => absint($result_row->shop_owner_id),
|
||||||
'order_type' => $result_row->order_type
|
'order_type' => $result_row->order_type
|
||||||
);
|
);
|
||||||
}, $results);
|
}, $results);
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ class Wiaas_Delivery_Process_Action {
|
|||||||
|
|
||||||
$documents[] = array(
|
$documents[] = array(
|
||||||
'name' => $info['basename'],
|
'name' => $info['basename'],
|
||||||
|
'extension' => $info['extension'],
|
||||||
'url' => $acceptance_documents_field->get_download_url( $file_path, true )
|
'url' => $acceptance_documents_field->get_download_url( $file_path, true )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -365,18 +366,25 @@ class Wiaas_Delivery_Process_Action {
|
|||||||
|
|
||||||
$document = array(
|
$document = array(
|
||||||
'name' => $info['basename'],
|
'name' => $info['basename'],
|
||||||
|
'extension' => $info['extension'],
|
||||||
'url' => $document_field->get_download_url( $file_path, true )
|
'url' => $document_field->get_download_url( $file_path, true )
|
||||||
);
|
);
|
||||||
|
|
||||||
$discussion_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'workflow_discussion')[0];
|
$discussion_field = GFCommon::get_fields_by_type(GFAPI::get_form($action_entry['form_id']), 'workflow_discussion')[0];
|
||||||
$discussion_items = json_decode($action_entry[$discussion_field->id], ARRAY_A);
|
$discussion_items = json_decode($action_entry[$discussion_field->id], ARRAY_A);
|
||||||
|
|
||||||
$formated_comments = array();
|
$formatted_comments = array();
|
||||||
|
|
||||||
if (is_array($discussion_items)) {
|
if (is_array($discussion_items)) {
|
||||||
foreach ($discussion_items as $item) {
|
foreach ($discussion_items as $item) {
|
||||||
|
|
||||||
$formated_comments[] = $discussion_field->format_discussion_item( $item, 'text', $action_entry_id );
|
$formatted = $discussion_field->format_discussion_item( $item, 'text', $action_entry_id );
|
||||||
|
$formatted = explode("\n", $formatted);
|
||||||
|
|
||||||
|
$formatted_comments[] = array(
|
||||||
|
'header' => $formatted[0],
|
||||||
|
'value' => $formatted[1]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +416,7 @@ class Wiaas_Delivery_Process_Action {
|
|||||||
'action_id' => $action_entry['id'],
|
'action_id' => $action_entry['id'],
|
||||||
'document' => $document,
|
'document' => $document,
|
||||||
'status' => $status,
|
'status' => $status,
|
||||||
'comments' => $formated_comments
|
'comments' => $formatted_comments
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class Wiaas_Order_Fields {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$bundle_item->update_meta_data('wiaas_installation_date', $new_value);
|
$bundle_item->update_meta_data('_wiaas_installation_date', $new_value);
|
||||||
$bundle_item->save_meta_data();
|
$bundle_item->save_meta_data();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -121,7 +121,7 @@ class Wiaas_Order_Fields {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$bundle_documents = $bundle_item['wiaas_delivery_documents'];
|
$bundle_documents = $bundle_item->get_meta('_wiaas_documents', true);
|
||||||
if (empty($bundle_documents)) {
|
if (empty($bundle_documents)) {
|
||||||
$bundle_documents = array();
|
$bundle_documents = array();
|
||||||
}
|
}
|
||||||
@@ -140,15 +140,20 @@ class Wiaas_Order_Fields {
|
|||||||
foreach ($added_documents as $added_document) {
|
foreach ($added_documents as $added_document) {
|
||||||
$info = pathinfo( $added_document );
|
$info = pathinfo( $added_document );
|
||||||
|
|
||||||
|
$dir = wp_upload_dir();
|
||||||
|
$relative_file_path = str_replace($dir['baseurl'] . '/', '', $added_document);
|
||||||
|
|
||||||
$bundle_documents[] = array(
|
$bundle_documents[] = array(
|
||||||
'name' => $info['basename'],
|
'key' => wp_generate_uuid4(),
|
||||||
|
'name' => $info['filename'],
|
||||||
'extension' => $info['extension'],
|
'extension' => $info['extension'],
|
||||||
|
'version' => $relative_file_path,
|
||||||
'url' => $field->get_download_url( $added_document, true ),
|
'url' => $field->get_download_url( $added_document, true ),
|
||||||
'type' => $field->wiaasDocTypeFilter
|
'type' => $field->wiaasDocTypeFilter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bundle_item->update_meta_data('wiaas_delivery_documents', $bundle_documents);
|
$bundle_item->update_meta_data('_wiaas_documents', $bundle_documents);
|
||||||
$bundle_item->save_meta_data();
|
$bundle_item->save_meta_data();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -168,7 +173,7 @@ class Wiaas_Order_Fields {
|
|||||||
$added_documents = $new_documents;
|
$added_documents = $new_documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_documents = $order->get_meta('wiaas_delivery_documents', true);
|
$order_documents = $order->get_meta('_wiaas_other_documents', true);
|
||||||
if (empty($order_documents)) {
|
if (empty($order_documents)) {
|
||||||
$order_documents = array();
|
$order_documents = array();
|
||||||
}
|
}
|
||||||
@@ -176,15 +181,20 @@ class Wiaas_Order_Fields {
|
|||||||
foreach ($added_documents as $added_document) {
|
foreach ($added_documents as $added_document) {
|
||||||
$info = pathinfo( $added_document );
|
$info = pathinfo( $added_document );
|
||||||
|
|
||||||
|
$dir = wp_upload_dir();
|
||||||
|
$relative_file_path = str_replace($dir['baseurl'] . '/', '', $added_document);
|
||||||
|
|
||||||
$order_documents[] = array(
|
$order_documents[] = array(
|
||||||
'name' => $info['basename'],
|
'key' => wp_generate_uuid4(),
|
||||||
|
'name' => $info['filename'],
|
||||||
'extension' => $info['extension'],
|
'extension' => $info['extension'],
|
||||||
|
'version' => $relative_file_path,
|
||||||
'url' => $field->get_download_url( $added_document, true ),
|
'url' => $field->get_download_url( $added_document, true ),
|
||||||
'type' => $field->wiaasDocTypeFilter
|
'type' => $field->wiaasDocTypeFilter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$order->update_meta_data('wiaas_delivery_documents', $order_documents);
|
$order->update_meta_data('_wiaas_other_documents', $order_documents);
|
||||||
$order->save_meta_data();
|
$order->save_meta_data();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -216,7 +226,7 @@ class Wiaas_Order_Fields {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$bundle_item->update_meta_data('wiaas_installation', $selected_installation->get_id());
|
$bundle_item->update_meta_data('_wiaas_installation', $selected_installation->get_id());
|
||||||
$bundle_item->save_meta_data();
|
$bundle_item->save_meta_data();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,49 @@ class Wiaas_Document_Download {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download order other document (not binded to any bundle)
|
||||||
|
* @param int $order_id
|
||||||
|
* @param string $document_key
|
||||||
|
*/
|
||||||
|
public static function download_order_other_document($order_id, $document_key) {
|
||||||
|
$order = wc_get_order($order_id);
|
||||||
|
if (!$order) {
|
||||||
|
wp_die( __( 'Invalid Document Request.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 400 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$order_other_documents = wiaas_get_order_other_documents($order_id);
|
||||||
|
|
||||||
|
$order_document = null;
|
||||||
|
|
||||||
|
foreach ($order_other_documents as $order_other_document) {
|
||||||
|
|
||||||
|
if ($order_other_document['key'] === $document_key) {
|
||||||
|
|
||||||
|
$order_document = $order_other_document;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($order_document)) {
|
||||||
|
wp_die( __( 'Invalid Document Request.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 400 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
WC_Download_Handler::download_file_force(
|
||||||
|
$file_path,
|
||||||
|
pathinfo( $file_path, PATHINFO_FILENAME ) . '.' . pathinfo( $file_path, PATHINFO_EXTENSION )
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download document related to order item
|
* Download document related to order item
|
||||||
*
|
*
|
||||||
@@ -91,7 +134,7 @@ class Wiaas_Document_Download {
|
|||||||
* @param $type
|
* @param $type
|
||||||
* @param $document_key
|
* @param $document_key
|
||||||
*/
|
*/
|
||||||
public static function download_order_item_document($order_id, $item_id, $type, $document_key) {
|
public static function download_order_item_document($order_id, $item_id, $document_key) {
|
||||||
$order = wc_get_order($order_id);
|
$order = wc_get_order($order_id);
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
wp_die( __( 'Invalid Document Request.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 400 ) );
|
wp_die( __( 'Invalid Document Request.', 'wiaas' ), __( 'Download Error', 'wiaas' ), array( 'response' => 400 ) );
|
||||||
@@ -106,7 +149,7 @@ class Wiaas_Document_Download {
|
|||||||
|
|
||||||
$order_document = null;
|
$order_document = null;
|
||||||
foreach ($item_documents as $item_document) {
|
foreach ($item_documents as $item_document) {
|
||||||
if ($item_document['key'] === $document_key && $item_document['type'] === $type) {
|
if ($item_document['key'] === $document_key) {
|
||||||
$order_document = $item_document;
|
$order_document = $item_document;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,17 @@ function wiaas_documents_upload_dir() {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function wiaas_get_document_version_path($version) {
|
function wiaas_get_document_version_path($version) {
|
||||||
|
|
||||||
|
// documents uploaded with gravity forms have relevant path to form entry upload folder
|
||||||
|
if (strpos($version, 'gravity_forms') !== false) {
|
||||||
|
|
||||||
|
$wp_uploads = wp_upload_dir();
|
||||||
|
$wp_uploads_dir = $wp_uploads['basedir'];
|
||||||
|
|
||||||
|
return $wp_uploads_dir . '/' . $version;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return wiaas_documents_upload_dir() . '/' . $version;
|
return wiaas_documents_upload_dir() . '/' . $version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +193,7 @@ function wiaas_get_standard_package_order_item_documents($order, $package_item_i
|
|||||||
|
|
||||||
return array_map(function($doc) {
|
return array_map(function($doc) {
|
||||||
// append document extension and name information
|
// append document extension and name information
|
||||||
$doc['extension'] = wiaas_get_doc_version_extension($doc['version']);
|
$doc['extension'] = isset($doc['extension']) ? $doc['extension'] : wiaas_get_doc_version_extension($doc['version']);
|
||||||
$doc['name'] = isset($doc['name']) ? $doc['name'] : wiaas_get_doc_version_filename($doc['version']);
|
$doc['name'] = isset($doc['name']) ? $doc['name'] : wiaas_get_doc_version_filename($doc['version']);
|
||||||
|
|
||||||
return $doc;
|
return $doc;
|
||||||
@@ -222,4 +233,20 @@ function wiaas_get_order_item_documents($order_item, $doc_type = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $filtered_documents;
|
return $filtered_documents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve order other documents (not binded to any order item)
|
||||||
|
*
|
||||||
|
* @param int $order_id
|
||||||
|
*
|
||||||
|
* @return array|mixed
|
||||||
|
*/
|
||||||
|
function wiaas_get_order_other_documents($order_id) {
|
||||||
|
|
||||||
|
$order = wc_get_order($order_id);
|
||||||
|
|
||||||
|
$documents = $order->get_meta('_wiaas_other_documents', true);
|
||||||
|
|
||||||
|
return empty($documents) ? array() : $documents;
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
updateMessages
|
updateMessages
|
||||||
} from '../notification/notificationActions';
|
} from '../notification/notificationActions';
|
||||||
import HtmlClient from '../../helpers/HtmlClient';
|
import HtmlClient from '../../helpers/HtmlClient';
|
||||||
|
import { fromWiaasCustomerAcceptance } from '../../helpers/ProcessHelper';
|
||||||
|
|
||||||
const htmlClient = new HtmlClient();
|
const htmlClient = new HtmlClient();
|
||||||
|
|
||||||
@@ -32,7 +33,11 @@ export const fetchCustomerAcceptance = (idOrder) => {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
dispatch(recieveCustomerAcceptance(response.data));
|
dispatch(
|
||||||
|
recieveCustomerAcceptance(
|
||||||
|
fromWiaasCustomerAcceptance(response.data)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import {
|
import {
|
||||||
API_SERVER
|
API_SERVER
|
||||||
} from '../../config';
|
} from '../../config';
|
||||||
|
import { fromWiaasCustomerQuestionnaire } from '../../helpers/ProcessHelper';
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
UPLOAD_CUSTOMER_QUESTIONNAIRE,
|
UPLOAD_CUSTOMER_QUESTIONNAIRE,
|
||||||
@@ -41,7 +43,8 @@ export const fetchCustomerQuestionnaires = (idOrder) => {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (typeof response.data !== 'undefined') {
|
if (typeof response.data !== 'undefined') {
|
||||||
dispatch(receiveCustomerQuestionnaires(response.data));
|
const questionnairesData = response.data.map(cData => fromWiaasCustomerQuestionnaire(cData));
|
||||||
|
dispatch(receiveCustomerQuestionnaires(questionnairesData));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|||||||
@@ -70,10 +70,10 @@ class CartUploadDocument extends Component {
|
|||||||
<h1 className="drop-zone-icon">
|
<h1 className="drop-zone-icon">
|
||||||
<i className="fa fa-upload"></i>
|
<i className="fa fa-upload"></i>
|
||||||
</h1>
|
</h1>
|
||||||
<h6 className="drop-zone-text">{uploadedDocument.name}</h6>
|
<p className="drop-zone-text">
|
||||||
<span className="drop-zone-text">
|
Drag and drop or click to replace <strong>{uploadedDocument.name}.{uploadedDocument.extension}</strong>
|
||||||
Drag and drop or click to replace file
|
</p>
|
||||||
</span>
|
<p className="drop-zone-text">To upload multiple files, please pack the files to one zip-file and upload the zip-file</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
: (
|
: (
|
||||||
@@ -81,9 +81,10 @@ class CartUploadDocument extends Component {
|
|||||||
<h1 className="drop-zone-icon pending-upload">
|
<h1 className="drop-zone-icon pending-upload">
|
||||||
<i className="fa fa-upload"></i>
|
<i className="fa fa-upload"></i>
|
||||||
</h1>
|
</h1>
|
||||||
<span className="drop-zone-text">
|
<p className="drop-zone-text">
|
||||||
Drag and drop or click to upload file
|
Drag and drop or click to upload file
|
||||||
</span>
|
</p>
|
||||||
|
<p className="drop-zone-text">To upload multiple files, please pack the files to one zip-file and upload the zip-file</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ class CoMarketCatalogSelect extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps){
|
componentWillReceiveProps(nextProps){
|
||||||
// if(nextProps.activeModule==='cart' && nextProps.shops && nextProps.cartItems && nextProps.cartItems.length > 0){
|
if(nextProps.activeModule==='cart' && nextProps.shops && nextProps.cartItems && nextProps.cartItems.length > 0){
|
||||||
// const cartShop = this.props.shops.find( shop => { return shop.id === this.props.cartItems[0].idCommercialLead });
|
const cartShop = nextProps.shops.find( shop => { return shop.id === nextProps.cartItems[0].idCommercialLead });
|
||||||
// nextProps.dispatch(selectShop(cartShop));
|
nextProps.dispatch(selectShop(cartShop));
|
||||||
// }
|
}
|
||||||
|
|
||||||
if(nextProps.shops && nextProps.idCommercialLead && nextProps.activeModule === 'co-market'){
|
if(nextProps.shops && nextProps.idCommercialLead && nextProps.activeModule === 'co-market'){
|
||||||
const shop = nextProps.shops.find( shop => {return shop.id === nextProps.idCommercialLead });
|
const shop = nextProps.shops.find( shop => {return shop.id === nextProps.idCommercialLead });
|
||||||
|
|||||||
@@ -3,8 +3,18 @@ import {connect} from 'react-redux';
|
|||||||
import OrderDocumentsGroup from './OrderDocumentsGroup.jsx';
|
import OrderDocumentsGroup from './OrderDocumentsGroup.jsx';
|
||||||
import {orderTexts} from '../../../constants/ordersConstants';
|
import {orderTexts} from '../../../constants/ordersConstants';
|
||||||
import WiaasBox from "../../../mainComponents/box/WiaasBox";
|
import WiaasBox from "../../../mainComponents/box/WiaasBox";
|
||||||
|
import {API_SERVER} from "../../../config";
|
||||||
|
import FileDownloader from "../../../helpers/FileDownloader";
|
||||||
|
|
||||||
|
const fileHandler = new FileDownloader();
|
||||||
|
|
||||||
class OrderDocuments extends Component {
|
class OrderDocuments extends Component {
|
||||||
|
|
||||||
|
downloadDocument(orderId, document){
|
||||||
|
const fileUrl = `${API_SERVER}/wp-json/wiaas/order/${orderId}/document/${document.key}`;
|
||||||
|
fileHandler.download(fileUrl, `${document.name}.${document.extension}`);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {orderInfo} = this.props;
|
const {orderInfo} = this.props;
|
||||||
|
|
||||||
@@ -23,14 +33,13 @@ class OrderDocuments extends Component {
|
|||||||
<WiaasBox mainTitle={orderTexts.labels.OTHER_DOCS}>
|
<WiaasBox mainTitle={orderTexts.labels.OTHER_DOCS}>
|
||||||
{
|
{
|
||||||
orderInfo.documents.map((document, index) => (
|
orderInfo.documents.map((document, index) => (
|
||||||
<a className="document-link-big" key={'order-document-' + index} download href={document.url}>
|
<a id={'document-' + document.key} key={'order-document-' + document.key}>
|
||||||
<span className="document-link">
|
<div onClick={() => {this.downloadDocument(orderInfo.id, document)}} className="document-link-big">
|
||||||
<i className={`fa fa-4x fa-${document.icon}`} aria-hidden="true"></i>
|
<i className={`fa fa-4x fa-${document.icon}`} aria-hidden="true"></i>
|
||||||
<div>
|
<div>
|
||||||
{document.name}
|
{document.name}
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</div></a>
|
||||||
</a>
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</WiaasBox>
|
</WiaasBox>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class OrderDocumentsGroup extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
downloadDocument(orderId, itemId, document){
|
downloadDocument(orderId, itemId, document){
|
||||||
const fileUrl = `${API_SERVER}/wp-json/wiaas/documents/order/${orderId}/${document.type}?item_id=${itemId}&document_key=${document.key}`;
|
const fileUrl = `${API_SERVER}/wp-json/wiaas/order/${orderId}/item/${itemId}/document/${document.key}`;
|
||||||
fileHandler.download(fileUrl, `${document.name}.${document.extension}`);
|
fileHandler.download(fileUrl, `${document.name}.${document.extension}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,20 +28,6 @@ class OrderDocumentsGroup extends Component {
|
|||||||
<WiaasBox mainTitle={documentsGroup.name}>
|
<WiaasBox mainTitle={documentsGroup.name}>
|
||||||
{
|
{
|
||||||
documentsGroup.documents.map((document, index) => {
|
documentsGroup.documents.map((document, index) => {
|
||||||
if (document.url) {
|
|
||||||
|
|
||||||
return (
|
|
||||||
<a key={'order-document-' + index} download href={document.url}>
|
|
||||||
<div className="document-link" className="document-link-big">
|
|
||||||
<i className={`fa fa-4x fa-${document.icon}`} aria-hidden="true"></i>
|
|
||||||
<div>
|
|
||||||
{document.name}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a id={'document-' + document.key} key={'order-document-' + document.key}>
|
<a id={'document-' + document.key} key={'order-document-' + document.key}>
|
||||||
<div onClick={() => {this.downloadDocument(orderId, documentsGroup.orderItemId, document)}} className="document-link-big">
|
<div onClick={() => {this.downloadDocument(orderId, documentsGroup.orderItemId, document)}} className="document-link-big">
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ class CustomerAcceptance extends Component {
|
|||||||
activeClassName="upload-file-accept"
|
activeClassName="upload-file-accept"
|
||||||
onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(step.idOrder, acceptedFiles, rejectedFiles)}}>
|
onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(step.idOrder, acceptedFiles, rejectedFiles)}}>
|
||||||
<h5 className="drop-zone-text">{orderTexts.labels.UPLOAD_ACCEPTANCE_LABEL}</h5>
|
<h5 className="drop-zone-text">{orderTexts.labels.UPLOAD_ACCEPTANCE_LABEL}</h5>
|
||||||
|
<p className="drop-zone-text">To upload multiple files, please pack the files to one zip-file and upload the zip-file</p>
|
||||||
</Dropzone>
|
</Dropzone>
|
||||||
</Col>
|
</Col>
|
||||||
<Col xl="4" lg="7" md="8">
|
<Col xl="4" lg="7" md="8">
|
||||||
@@ -148,7 +149,7 @@ class CustomerAcceptance extends Component {
|
|||||||
{
|
{
|
||||||
customerAcceptance.documents.map((document, index) => <div key={'acceptance-documnet-' + index}>
|
customerAcceptance.documents.map((document, index) => <div key={'acceptance-documnet-' + index}>
|
||||||
<span className="document-link">
|
<span className="document-link">
|
||||||
<i className={'fa fa-file'}></i> <a download href={document.url}> {document.name} </a>
|
<i className={`fa fa-${document.icon}`}></i> <a download href={document.url}> {document.name} </a>
|
||||||
</span>
|
</span>
|
||||||
<span className="document-status">
|
<span className="document-status">
|
||||||
{document.validation} <div className={'status-icon ' + document.validation}></div>
|
{document.validation} <div className={'status-icon ' + document.validation}></div>
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ class ValidateQuestionnaire extends Component {
|
|||||||
customerQuestionnaires.map((customerQuestionnaryAction) =>
|
customerQuestionnaires.map((customerQuestionnaryAction) =>
|
||||||
<ValidateQuestionnaireItem
|
<ValidateQuestionnaireItem
|
||||||
action={customerQuestionnaryAction}
|
action={customerQuestionnaryAction}
|
||||||
key={'validate-questionnaire-' + customerQuestionnaryAction.action_id}
|
key={'validate-questionnaire-' + customerQuestionnaryAction.actionId}
|
||||||
orderPackage={orderPackages.find( orderPackage => orderPackage.orderItemId === customerQuestionnaryAction.item_id)}
|
orderPackage={orderPackages.find( orderPackage => orderPackage.orderItemId === customerQuestionnaryAction.orderItemId)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ValidateQuestionnaireItem extends Component {
|
|||||||
uploadFile(action,acceptedFiles, rejectedFiles) {
|
uploadFile(action,acceptedFiles, rejectedFiles) {
|
||||||
if(acceptedFiles && acceptedFiles.length){
|
if(acceptedFiles && acceptedFiles.length){
|
||||||
const file = acceptedFiles[0];
|
const file = acceptedFiles[0];
|
||||||
this.props.dispatch(uploadCustomerQuestionnaire(action.order_id, action.action_id, file));
|
this.props.dispatch(uploadCustomerQuestionnaire(action.orderId, action.actionId, file));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(rejectedFiles && rejectedFiles.length) {
|
// if(rejectedFiles && rejectedFiles.length) {
|
||||||
@@ -48,7 +48,7 @@ class ValidateQuestionnaireItem extends Component {
|
|||||||
<div>
|
<div>
|
||||||
|
|
||||||
<span className="document-link">
|
<span className="document-link">
|
||||||
<i className={'fa fa-file'}></i> <a download href={document.url}> {document.name} </a>
|
<i className={`fa fa-${document.icon}`}></i> <a download href={document.url}> {document.name} </a>
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<span className="document-status">
|
<span className="document-status">
|
||||||
@@ -59,7 +59,8 @@ class ValidateQuestionnaireItem extends Component {
|
|||||||
(action.comments && action.comments.length > 0) &&
|
(action.comments && action.comments.length > 0) &&
|
||||||
<div>
|
<div>
|
||||||
{action.comments.map((comment, key) => <div key={'step-comment-' + document.idDocument + '-' + key} className="step-comment">
|
{action.comments.map((comment, key) => <div key={'step-comment-' + document.idDocument + '-' + key} className="step-comment">
|
||||||
<div>{comment}</div>
|
<strong>{comment.header}</strong>
|
||||||
|
<p>{comment.value}</p>
|
||||||
</div>)}
|
</div>)}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -71,6 +72,7 @@ class ValidateQuestionnaireItem extends Component {
|
|||||||
activeClassName="upload-file-accept"
|
activeClassName="upload-file-accept"
|
||||||
onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(action, acceptedFiles, rejectedFiles)}}>
|
onDrop={(acceptedFiles, rejectedFiles)=>{this.uploadFile(action, acceptedFiles, rejectedFiles)}}>
|
||||||
<h5 className="drop-zone-text">{orderTexts.labels.SELECT_OR_DROP}</h5>
|
<h5 className="drop-zone-text">{orderTexts.labels.SELECT_OR_DROP}</h5>
|
||||||
|
<p className="drop-zone-text">To upload multiple files, please pack the files to one zip-file and upload the zip-file</p>
|
||||||
</Dropzone>
|
</Dropzone>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
@@ -79,12 +81,21 @@ class ValidateQuestionnaireItem extends Component {
|
|||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
<span className="document-link">
|
<span className="document-link">
|
||||||
<i className={'fa fa-file'}></i> <a download href={document.url}> {document.name} </a>
|
<i className={`fa fa-${document.icon}`}></i> <a download href={document.url}> {document.name} </a>
|
||||||
</span>
|
</span>
|
||||||
<br />
|
<br />
|
||||||
<span className="document-status">
|
<span className="document-status">
|
||||||
{action.status.replace(/-/g,' ')} <div className={'status-icon ' + action.status}></div>
|
{action.status.replace(/-/g,' ')} <div className={'status-icon ' + action.status}></div>
|
||||||
</span>
|
</span>
|
||||||
|
{
|
||||||
|
(action.comments && action.comments.length > 0) &&
|
||||||
|
<div>
|
||||||
|
{action.comments.map((comment, key) => <div key={'step-comment-' + document.idDocument + '-' + key} className="step-comment">
|
||||||
|
<strong>{comment.header}</strong>
|
||||||
|
<p>{comment.value}</p>
|
||||||
|
</div>)}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ $link-line-height: 1.5rem;
|
|||||||
.upload-file-drop-zone {
|
.upload-file-drop-zone {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 3px dashed $borderColor;
|
border: 3px dashed $borderColor;
|
||||||
height: 10rem;
|
padding: 2rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,6 @@ $link-line-height: 1.5rem;
|
|||||||
|
|
||||||
.drop-zone-text {
|
.drop-zone-text {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 4rem 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.document-link {
|
.document-link {
|
||||||
@@ -357,7 +356,6 @@ $link-line-height: 1.5rem;
|
|||||||
|
|
||||||
.drop-zone-text {
|
.drop-zone-text {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 4rem 0;
|
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ const iconTypes = {
|
|||||||
xls: 'file-excel-o',
|
xls: 'file-excel-o',
|
||||||
xlsx: 'file-excel-o',
|
xlsx: 'file-excel-o',
|
||||||
ppt: 'file-powerpoint-o',
|
ppt: 'file-powerpoint-o',
|
||||||
pptx: 'file-powerpoint-o'
|
pptx: 'file-powerpoint-o',
|
||||||
|
zip: 'file-zip-o'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getDocumentIcon = extension => {
|
export const getDocumentIcon = extension => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import {getDocumentIcon} from "./DocumentHelper";
|
||||||
|
|
||||||
export const fromWiaasProcessStep = (step) => {
|
export const fromWiaasProcessStep = (step) => {
|
||||||
return {
|
return {
|
||||||
@@ -13,4 +14,31 @@ export const fromWiaasProcessStep = (step) => {
|
|||||||
shortDesc: step.short_desc,
|
shortDesc: step.short_desc,
|
||||||
status: step.status,
|
status: step.status,
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fromWiaasCustomerAcceptance = cData => {
|
||||||
|
|
||||||
|
return {
|
||||||
|
actionId: cData['action_id'],
|
||||||
|
expiration: cData.expiration,
|
||||||
|
declineReason: cData['decline_reason'],
|
||||||
|
status: cData.status,
|
||||||
|
documents: cData.documents ? cData.documents.map(document => {
|
||||||
|
document.icon = getDocumentIcon(document.extension);
|
||||||
|
return document;
|
||||||
|
}) : []
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fromWiaasCustomerQuestionnaire = cData => {
|
||||||
|
const document = cData.document;
|
||||||
|
document.icon = getDocumentIcon(document.extension);
|
||||||
|
return {
|
||||||
|
actionId: cData['action_id'],
|
||||||
|
orderItemId: cData['item_id'],
|
||||||
|
document,
|
||||||
|
status: cData.status,
|
||||||
|
orderId: cData['order_id'],
|
||||||
|
comments: cData.comments
|
||||||
|
};
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user