diff --git a/admin/class-wc-invoice-payment-admin.php b/admin/class-wc-invoice-payment-admin.php
index a27fe19..8dcabee 100755
--- a/admin/class-wc-invoice-payment-admin.php
+++ b/admin/class-wc-invoice-payment-admin.php
@@ -1133,6 +1133,7 @@ public function add_invoice_form_submit_handle(): void {
'total' => $totalAmount,
)
);
+
$order->update_meta_data('wcip_extra_data', $extraData);
$order->update_meta_data('wcip_footer_notes', $footerNotes);
@@ -1163,6 +1164,7 @@ public function add_invoice_form_submit_handle(): void {
$order->add_meta_data('lkn_ini_date', $iniDate->format('Y-m-d'));
$order->calculate_totals();
+
$order->save();
$orderId = $order->get_id();
diff --git a/admin/class-wc-invoice-payment-table.php b/admin/class-wc-invoice-payment-table.php
index ef07ce5..aadcc6d 100755
--- a/admin/class-wc-invoice-payment-table.php
+++ b/admin/class-wc-invoice-payment-table.php
@@ -1517,8 +1517,6 @@ public function lkn_wcip_list_table_data($order_by = '', $order = '', $search_te
$iniDate = $invoice->get_meta('lkn_ini_date');
$iniDate = empty($iniDate) ? '-' : date($dateFormat, strtotime($iniDate));
- echo "";
-
$data_array[] = [
'lkn_wcip_id' => $invoiceId,
'lkn_wcip_client' => $invoice->get_billing_first_name(),
diff --git a/admin/js/wc-invoice-payment-subscription.js b/admin/js/wc-invoice-payment-subscription.js
index 2b2a4c3..87fd0a2 100755
--- a/admin/js/wc-invoice-payment-subscription.js
+++ b/admin/js/wc-invoice-payment-subscription.js
@@ -1 +1,13 @@
-document.querySelector("subscriptionTab_options.subscriptionTab_tab").style.display = "none"
\ No newline at end of file
+showTab()
+document.querySelector("#_lkn-wcip-subscription-product").onchange = ()=>{showTab()}
+
+function showTab(){
+ let subscriptionCheckbox = document.querySelector("#_lkn-wcip-subscription-product")
+ let subscriptionTab = document.querySelector(".subscriptionTab_options.subscriptionTab_tab")
+
+ if(subscriptionCheckbox.checked){
+ subscriptionTab.style.display = ""
+ }else{
+ subscriptionTab.style.display = "none"
+ }
+}
\ No newline at end of file
diff --git a/includes/class-wc-invoice-payment-endpoint.php b/includes/class-wc-invoice-payment-endpoint.php
new file mode 100644
index 0000000..483d3c4
--- /dev/null
+++ b/includes/class-wc-invoice-payment-endpoint.php
@@ -0,0 +1,20 @@
+ 'POST',
+ 'callback' => array($this, 'createInvoice'),
+ ));
+ }
+
+ public function createInvoice($request) {
+ $parameters = $request->get_params();
+
+ return new WP_REST_Response(json_encode($parameters), 200);
+ }
+
+
+}
diff --git a/includes/class-wc-invoice-payment-subscription.php b/includes/class-wc-invoice-payment-subscription.php
index 1b277b0..fd9d5e0 100644
--- a/includes/class-wc-invoice-payment-subscription.php
+++ b/includes/class-wc-invoice-payment-subscription.php
@@ -1,8 +1,8 @@
ID, '_lkn-wcip-subscription-product', true );
$products_type['subscriptionCheckbox'] = array(
@@ -15,38 +15,28 @@ public function addCheckbox( $products_type ) {
return $products_type;
}
- public function addTab( $tabs ) {
+ public function add_tab( $tabs ) {
$tabs['subscriptionTab'] = array(
'label' => __( 'Subscription', 'wc-invoice-payment' ),
'target' => 'lkn-wcip-subscription-data',
'class' => array(),
'priority' => 90,
);
- return apply_filters( 'testee5', $tabs );
+ return apply_filters( 'testee5', $tabs ); //TODO Remover teste
}
- function meu_processo_de_validacao( $order_id ) {
- // Obtenha o pedido
- $order = wc_get_order( $order_id );
- echo "";
- add_option($order_id."Teste", json_encode($_POST));
- // Iterar sobre os itens do pedido
-
- }
- //TODO Finalizar logica de intervalo de geração de fatura com o WP Crontrol
- //TODO Fazer logica para o campo de intervalo não ser obrigatório quando estiver invisivel
- //TODO Alterar classes e traduções
- public function addTextFieldToSubscriptionTab() {
+ //TODO Terminar logica de exibição dos campos na criação de fatura com WP Cron
+ //TODO Alterar traduções
+ public function add_text_field_to_subscription_tab() {
global $post;
- $subscription_number = get_post_meta( $post->ID, 'wps_sfw_subscription_number', true );
- $subscription_interval = get_post_meta( $post->ID, 'wps_sfw_subscription_interval', true );
-
+ $subscription_number = get_post_meta( $post->ID, 'lkn_wcip_subscription_interval_number', true );
+ $subscription_interval = get_post_meta( $post->ID, 'lkn_wcip_subscription_interval_type', true );
echo <<
-
-
-
-