From f5988052925b70d0929c50877823f1a7ab0f57b5 Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Fri, 21 Jul 2023 11:05:47 +0600 Subject: [PATCH 01/37] =?UTF-8?q?=E2=9A=99=EF=B8=8FUpdate:=20Fields=20comm?= =?UTF-8?q?ission=20show=20condition=20for=20multipurpose=20use?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/components/Fields.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/admin/components/Fields.vue b/src/admin/components/Fields.vue index 467ea107a0..8070a5d6ca 100644 --- a/src/admin/components/Fields.vue +++ b/src/admin/components/Fields.vue @@ -71,7 +71,8 @@ - @@ -46,9 +46,9 @@
@@ -56,7 +56,7 @@ {{ getError( fieldData.label ) }}

- {{ getValidationErrorMessage( fieldData.name ) }} + {{ getValidationErrorMessage( fieldData.name ) }}

@@ -68,8 +68,8 @@
@@ -77,36 +77,23 @@ {{ getError( fieldData.label ) }}

- {{ getValidationErrorMessage( fieldData.name ) }} + {{ getValidationErrorMessage( fieldData.name ) }}

- @@ -330,7 +317,7 @@
  • {{ optionVal.value }} + @click.prevent="removeItem( optionKey, fieldData.name )">
  • @@ -344,7 +331,7 @@
    - From 13fe0bb73a96dd32a8d9674bcb6c317f43e290cb Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Tue, 25 Jul 2023 12:00:04 +0600 Subject: [PATCH 05/37] =?UTF-8?q?=E2=9A=A1=EF=B8=8FReset=20Fields.vue=20an?= =?UTF-8?q?d=20SocialFields.vue=20component=20to=20normal=20component=20as?= =?UTF-8?q?=20develop=20branch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/components/Fields.vue | 1668 ++++++++++++------------- src/admin/components/SocialFields.vue | 52 +- 2 files changed, 860 insertions(+), 860 deletions(-) diff --git a/src/admin/components/Fields.vue b/src/admin/components/Fields.vue index c9efe78eba..2e5ad56e62 100644 --- a/src/admin/components/Fields.vue +++ b/src/admin/components/Fields.vue @@ -34,7 +34,7 @@ {{ getError( fieldData.label ) }}

    - {{ getValidationErrorMessage( fieldData.name ) }} + {{ getValidationErrorMessage( fieldData.name ) }}

    @@ -46,9 +46,9 @@
    @@ -56,7 +56,7 @@ {{ getError( fieldData.label ) }}

    - {{ getValidationErrorMessage( fieldData.name ) }} + {{ getValidationErrorMessage( fieldData.name ) }}

    @@ -68,8 +68,8 @@
    @@ -77,7 +77,7 @@ {{ getError( fieldData.label ) }}

    - {{ getValidationErrorMessage( fieldData.name ) }} + {{ getValidationErrorMessage( fieldData.name ) }}

    @@ -164,7 +164,7 @@

    - {{ getValidationErrorMessage( fieldData.name ) }} + {{ getValidationErrorMessage( fieldData.name ) }}

    @@ -278,7 +278,7 @@ @@ -317,7 +317,7 @@
  • {{ optionVal.value }} + @click.prevent="removeItem( optionKey, fieldData.name )">
  • @@ -331,7 +331,7 @@
    - From 19e6e431346b12099e9320979d5b2fd980bfd820 Mon Sep 17 00:00:00 2001 From: Aunshon <32583103+Aunshon@users.noreply.github.com> Date: Tue, 25 Jul 2023 18:02:06 +0600 Subject: [PATCH 06/37] =?UTF-8?q?=E2=9A=A1=EF=B8=8FRedesign=20withdraw=20m?= =?UTF-8?q?ethod=20and=20charge=20ui=20and=20save=20active=20withdraw=20an?= =?UTF-8?q?d=20charge=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/Admin/Settings.php | 5 +- includes/Withdraw/functions.php | 24 + src/admin/components/Fields.vue | 2386 ++++++++++------- src/admin/components/Fields/CombineInput.vue | 13 +- .../components/Fields/WithdrawMethods.vue | 159 ++ 5 files changed, 1654 insertions(+), 933 deletions(-) create mode 100644 src/admin/components/Fields/WithdrawMethods.vue diff --git a/includes/Admin/Settings.php b/includes/Admin/Settings.php index 0af5767cdf..07363d4aca 100644 --- a/includes/Admin/Settings.php +++ b/includes/Admin/Settings.php @@ -581,10 +581,11 @@ public function get_settings_fields() { 'withdraw_methods' => [ 'name' => 'withdraw_methods', 'label' => __( 'Withdraw Methods', 'dokan-lite' ), - 'desc' => __( 'Select suitable withdraw methods for vendors', 'dokan-lite' ), - 'type' => 'multicheck', + 'desc' => __( 'Select suitable withdraw methods for vendors and set withdrawal charges', 'dokan-lite' ), + 'type' => 'withdraw-methods', 'default' => apply_filters( 'dokan_settings_withdraw_methods_default', [ 'paypal' => 'paypal' ] ), 'options' => dokan_withdraw_get_methods(), + 'options_inputs_key' => 'withdraw_charges', 'tooltip' => __( 'Check to add available payment methods for vendors to withdraw money.', 'dokan-lite' ), ], 'withdraw_limit' => [ diff --git a/includes/Withdraw/functions.php b/includes/Withdraw/functions.php index e519f2b887..e25d5f64cc 100644 --- a/includes/Withdraw/functions.php +++ b/includes/Withdraw/functions.php @@ -537,3 +537,27 @@ function dokan_is_withdraw_method_enabled( $method_id ) { && array_key_exists( $method_id, $payment_methods ) && ! empty( $payment_methods[ $method_id ] ); } + +function dokan_withdraw_get_method_charges() { + $charges = dokan_get_option( 'withdraw_charges', 'dokan_withdraw', '' ); + $methods = array_keys( dokan_withdraw_get_methods() ); + $default_val = [ + 'fixed' => '', + 'percentage' => '', + ]; + + if ( empty( $charges ) || ! is_array( $charges ) ) { + $charges = []; + + foreach ( $methods as $method ) { + $charges[ $method ] = $default_val; + } + } else { + foreach ( $methods as $method ) { + $charges[ $method ]['fixed'] = ! empty( $charges[ $method ]['fixed'] ) ? wc_format_decimal( $charges[ $method ]['fixed'] ) : ''; + $charges[ $method ]['percentage'] = ! empty( $charges[ $method ]['percentage'] ) ? wc_format_decimal( $charges[ $method ]['percentage'] ) : ''; + } + } + + return $charges; +} diff --git a/src/admin/components/Fields.vue b/src/admin/components/Fields.vue index 2e5ad56e62..6a3b4d308b 100644 --- a/src/admin/components/Fields.vue +++ b/src/admin/components/Fields.vue @@ -1,7 +1,15 @@