<?php include_once WPAISAAS_PLUGIN_DIR_PATH . 'templates/partials/head.php'; ?>

<body class="g-sidenav-show  bg-gray-100">
<?php include_once WPAISAAS_PLUGIN_DIR_PATH . 'templates/partials/sidebar-left.php'; ?>
<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
    <!-- Navbar -->
	<?php include_once WPAISAAS_PLUGIN_DIR_PATH . 'templates/partials/navbar-top.php'; ?>
    <!-- End Navbar -->
	<?php
	$pricing_table = wpaisaas_get_option( 'pricing_table' );

	?>
    <div class="container-fluid py-4">
        <div class="container">
            <div class="row mb-3">
                <div class="col-md-8 offset-md-2">
                    <div class="card h-100 p-3 text-center">
                        <div class="overflow-hidden position-relative border-radius-lg bg-cover h-100"
                             style="background-image: url('<?php echo esc_url( WPAISAAS_PLUGIN_DIR_URL ) . "assets/img/ivancik.jpg" ?>');">
                            <span class="mask bg-gradient-dark"></span>
                            <div class="card-body position-relative z-index-1 d-flex flex-column h-100 p-3">
                                <h5 class="text-white font-weight-bolder mb-4 pt-2"><?php esc_html_e( 'Explore the power of AI', 'wpaisaas' ); ?></h5>
                                <p class="text-white"><?php esc_html_e( 'Select the best plan for your work.', 'wpaisaas' ); ?></p>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
			<?php
			if ( ! empty( $pricing_table ) ) {
				?>
                <div class="card-deck mb-3 text-center">
                    <div class="row">
                        <div class="col-lg-4 col-12">
                            <div class="card mb-4 box-shadow">
                                <div class="card-header">
                                    <h4 class="my-0 font-weight-normal"><?php echo esc_html( $pricing_table['plan_title_free'] ); ?></h4>
                                </div>
                                <div class="card-body">
                                    <h1 class="card-title pricing-card-title">
										<?php printf( '%s %s', esc_html( __( '$', 'wpaisaas' ) ), esc_html( $pricing_table['free_plan_price'] ) ); ?>
                                        <small class="text-muted"> <?php echo "/" . esc_html( $pricing_table['free_plan_price_period'] ); ?></small>
                                    </h1>
                                    <ul class="list-unstyled mt-3 mb-4">
										<?php
										foreach ( $pricing_table['free_sorter']['enabled'] as $item ) {
											printf( "<li class='text-primary'><i class='fa fa-check-circle' aria-hidden='true'></i> %s</li>", esc_html( $item ) );
										}
										foreach ( $pricing_table['free_sorter']['disabled'] as $item ) {
											printf( "<li class='text-secondary'><i class='fa fa-check-circle' aria-hidden='true'></i> %s</li>", esc_html( $item ) );
										}
										?>
                                    </ul>
                                    <form method="post"
                                          action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
                                        <input type="hidden" name="action" value="free_plan_action">
										<?php wp_nonce_field( 'free_nonce_action', 'free_plan_nonce' ); ?>
                                        <input type="hidden" name="plan" value="free">
                                        <button type="submit"
                                                class="btn btn-lg btn-block btn-outline-primary"><?php echo esc_html( $pricing_table['btn_title_free'] ); ?></button>
                                    </form>
                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4 col-12">
                            <div class="card mb-4 box-shadow">
                                <div class="card-header">
                                    <h4 class="my-0 font-weight-normal"><?php echo esc_html( $pricing_table['plan_title_pro'] ); ?></h4>
                                </div>
                                <div class="card-body">
                                    <h1 class="card-title pricing-card-title">
										<?php printf( '%s %s', esc_html( __( '$', 'wpaisaas' ) ), esc_html( $pricing_table['pro_plan_price'] ) ); ?>
                                        <small class="text-muted"> <?php echo "/" . esc_html( $pricing_table['pro_plan_price_period'] ); ?></small>
                                    </h1>
                                    <ul class="list-unstyled mt-3 mb-4">
										<?php
										foreach ( $pricing_table['pro_sorter']['enabled'] as $item ) {
											printf( "<li class='text-primary'><i class='fa fa-check-circle' aria-hidden='true'></i> %s</li>", esc_html( $item ) );
										}
										foreach ( $pricing_table['pro_sorter']['disabled'] as $item ) {
											printf( "<li class='text-secondary'><i class='fa fa-check-circle' aria-hidden='true'></i> %s</li>", esc_html( $item ) );
										}
										?>
                                    </ul>
                                    <form method="post"
                                          action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
                                        <input type="hidden" name="action" value="pro_plan_action">
										<?php wp_nonce_field( 'pro_nonce_action', 'pro_plan_nonce' ); ?>
                                        <input type="hidden" name="plan" value="pro">
                                        <button type="submit"
                                                class="btn btn-lg btn-block btn-outline-primary"><?php echo esc_html( $pricing_table['btn_title_pro'] ); ?></button>
                                    </form>

                                </div>
                            </div>
                        </div>
                        <div class="col-lg-4 col-12">
                            <div class="card mb-4 box-shadow">
                                <div class="card-header">
                                    <h4 class="my-0 font-weight-normal"><?php echo esc_html( $pricing_table['plan_title_enterprise'] ); ?></h4>
                                </div>
                                <div class="card-body">
                                    <h1 class="card-title pricing-card-title">
										<?php printf( '%s %s', esc_html( __( '$', 'wpaisaas' ) ), esc_html( $pricing_table['enterprise_plan_price'] ) ); ?>
                                        <small class="text-muted"> <?php echo "/" . esc_html( $pricing_table['enterprise_plan_price_period'] ); ?></small>
                                    </h1>
                                    <ul class="list-unstyled mt-3 mb-4">
										<?php
										foreach ( $pricing_table['enterprise_sorter']['enabled'] as $item ) {
											printf( "<li class='text-primary'><i class='fa fa-check-circle' aria-hidden='true'></i> %s</li>", esc_html( $item ) );
										}
										if ( isset( $pricing_table['enterprise_sorter']['disabled'] ) ) {
											foreach ( $pricing_table['enterprise_sorter']['disabled'] as $item ) {
												printf( "<li class='text-secondary'><i class='fa fa-check-circle' aria-hidden='true'></i> %s</li>", esc_html( $item ) );
											}
										}
										?>
                                    </ul>
                                    <form method="post"
                                          action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
                                        <input type="hidden" name="action" value="enterprise_plan_action">
										<?php wp_nonce_field( 'enterprise_nonce_action', 'enterprise_plan_nonce' ); ?>
                                        <input type="hidden" name="plan" value="enterprise">
                                        <button type="submit"
                                                class="btn btn-lg btn-block btn-outline-primary"><?php echo esc_html( $pricing_table['btn_title_enterprise'] ); ?></button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
				<?php
			}else {
                ?>
                <div class="alert alert-info text-center" role="alert">
                    <?php esc_html_e( 'Please add pricing table from the settings.', 'wpaisaas' ); ?>
                </div>
                <?php
            }
			?>
        </div>
    </div>
</main>

<?php include_once WPAISAAS_PLUGIN_DIR_PATH . 'templates/partials/footer.php'; ?>
