<?php
/**
 * Product commission Template
 *
 * @since 3.0.0
 * @package wc-affiliate
 */

echo wp_kses_post( "<div class='wf-affiliate_commission'>" );
woocommerce_wp_select(
	array(
		'id'            => 'affiliate_commission',
		'type'          => 'checkbox',
		'class'         => 'affiliate_commission',
		'wrapper_class' => '',
		'label'         => __( 'Affiliate Commission', 'wc-affiliate' ),
		'value'         => get_post_meta( get_the_ID(), 'affiliate_commission', true ),
		'options'       => array(
			'default'  => __( 'Default', 'wc-affiliate' ),
			'disabled' => __( 'Disabled', 'wc-affiliate' ),
			'custom'   => __( 'Custom', 'wc-affiliate' ),
		),
	)
);

$_commission_type = get_post_meta( get_the_ID(), 'commission_type', true );
$commission_type  = ! empty( $_commission_type ) ? $_commission_type : wca_get_option( 'basic', 'commission.commission_type' );
woocommerce_wp_select(
	array(
		'id'            => 'commission_type',
		'class'         => '',
		'wrapper_class' => '',
		'label'         => '',
		'selected'      => true,
		'value'         => $commission_type,
		'options'       => array(
			''        => __( 'Commission Type', 'wc-affiliate' ),
			'fixed'   => __( 'Fixed', 'wc-affiliate' ),
			'percent' => __( 'Percent', 'wc-affiliate' ),
		),
	)
);

$_commission_amount = get_post_meta( get_the_ID(), 'commission_amount', true );
$commission_amount  = ! empty( $_commission_amount ) ? $_commission_amount : wca_get_option( 'basic', 'commission.commission_amount' );
woocommerce_wp_text_input(
	array(
		'id'            => 'commission_amount',
		'type'          => 'number',
		'class'         => '',
		'wrapper_class' => '',
		'label'         => '',
		'value'         => $commission_amount,
	)
);

echo wp_kses_post( '</div>' );
