fix: consolidate backend changes and fix icon imports
- Add standard .gitignore patterns (node_modules, .env, IDE files) - Coupon.php: fix data structure for DataTable, add status filter - Order.php: fix data structure to match OrderListItem expectations - Product.php: add multi-currency prices array, unify nonce to 'formipay-admin' - client.js: fix AJAX action names to match PHP (underscores → hyphens) - OrderList.js: fix icon import (Icons.list), add response handling - OrderListItem.js: fix icon import (Icons.seen)
This commit is contained in:
@@ -646,7 +646,7 @@ class Order {
|
||||
|
||||
// React admin
|
||||
printf(
|
||||
'<div id="formipay-admin-root" data-formipay-mount="%s"></div>',
|
||||
'<div class="wrap"><div id="formipay-admin-root" data-formipay-mount="%s"></div></div>',
|
||||
esc_attr($page)
|
||||
);
|
||||
|
||||
@@ -933,21 +933,31 @@ class Order {
|
||||
|
||||
// Process filtered orders
|
||||
if (!empty($get_filtered_orders)) {
|
||||
foreach ($get_filtered_orders as $key => $order) {
|
||||
foreach ($get_filtered_orders as $key => $order) {
|
||||
$currency = explode(':::', formipay_get_post_meta($order->form_id, 'product_currency'));
|
||||
$code = !empty($currency[0]) ? $currency[0] : '';
|
||||
// Prepare order data
|
||||
$code = !empty($currency[0]) ? $currency[0] : '';
|
||||
|
||||
// Keep status as-is (with hyphens) to match STATUS_COLORS keys
|
||||
$status = $order->status;
|
||||
|
||||
// Transform form_data to the structure expected by OrderListItem
|
||||
$raw_form_data = maybe_unserialize($order->form_data);
|
||||
$transformed_form_data = [];
|
||||
if (is_array($raw_form_data)) {
|
||||
foreach ($raw_form_data as $field_key => $field_value) {
|
||||
$transformed_form_data[] = [
|
||||
'name' => $field_key,
|
||||
'value' => is_array($field_value) && isset($field_value['value']) ? $field_value['value'] : $field_value,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$orders[] = [
|
||||
'ID' => $order->id,
|
||||
'form' => get_the_title($order->form_id),
|
||||
'date' => $order->created_date,
|
||||
'payment_gateway' => ucwords(str_replace('_', ' ', $order->payment_gateway)),
|
||||
'status' => ucwords(str_replace('-', ' ', $order->status)),
|
||||
'total' => [
|
||||
'flag' => formipay_get_flag_by_currency($code),
|
||||
'name' => $code,
|
||||
'value' => formipay_price_format($order->total, $order->form_id),
|
||||
]
|
||||
'id' => $order->id,
|
||||
'created_date' => $order->created_date,
|
||||
'form_data' => $transformed_form_data,
|
||||
'total_formatted' => formipay_price_format($order->total, $order->form_id),
|
||||
'status' => $status,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user