<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

use Elex\MultiVendor\Model\AdminPayment;
?>

	<div class="elex-multi-vendor-for-woocommerce-wrap elex-multi-vendor-for-woocommerce-wrap-front overflow-hidden d-flex flex-fill">
	   

		<!-- ======================main content============ -->
		<div class="elex-multi-vendor-for-woocommerce-main ps-2 " style="height:100vh">
		<!-- ===========side panel open button========= -->
	<div class="d-flex gap-4 my-2 align-items-center elex-multi-vendor-for-woocommerce-side-panel-open-div d-md-none">
				<!-- side panel open button -->
				<button class=" btn  p-1 shadow-none fs-5   bg-white text-primary position-relative " id="elex-multi-vendor-for-woocommerce-side-panel-open-btn"><svg height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M0 96C0 78.3 14.3 64 32 64l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 128C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32l384 0c17.7 0 32 14.3 32 32s-14.3 32-32 32L32 288c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32L32 448c-17.7 0-32-14.3-32-32s14.3-32 32-32l384 0c17.7 0 32 14.3 32 32z"/></svg></button>
				<div class="fs-5 fw-semi-bold m-0 ">Payments</div>
			</div>
			<div class=" h-100 ">
				<div class="d-flex bg-info bg-opacity-10  justify-content-between">
					<ul class="elex-multi-vendor-for-woocommerce-shipping-link d-flex gap-3 nav px-3">
						<li class="nav-item">
							<a href="?menu_tab=account_data" class="nav-link active">Accounts & Data</a>
						</li>
						<li class="nav-item">
							<a href="?menu_tab=settlement_history" class="nav-link">Settlement History</a>
						</li>
					</ul>

				</div>

				<!-- ======================main content============ -->
				<div class="elex-multi-vendor-for-woocommerce-main ps-2  ">


					<div class="row pe-4 py-2">
						<div class="" style="max-width: 600px;">
	
							<!-- Data from Last Settelment. -->
							<div class="border border-primary rounded-3 mb-3 p-2">
								<div class="fs-6 mb-1 fw-semi-bold">Data for the Settlement.</div>
								<div class="row ">
									<div class="col-lg-4 col-md-6 col-sm-6">
										<div class="ratio ratio-1x1 border border-5 border-primary rounded-circle">
											<div class="d-flex align-items-center justify-content-center">
												<div class="text-center">
													<div class="fs-6 m-0 mb-1">Total Earnings</div>	
													<div class="fs-4 mb-1 fw-semi-bold"><?php echo wp_kses_post( wc_price( get_post_meta( $store_id, 'elex_mv_vendor_total_earning', true ) ) ); ?></div>
												</div>
											</div>
										</div>
									</div>
									<div class="col-lg-8 col-md-6 col-sm-6 d-flex flex-column gap-1 justify-content-between">

										<div class="d-flex mb-2 align-items-center gap-1">
											<div class="text-secondary">Total Sales:</div>
											<div class="fs-6 fw-semi-bold m-0"><?php echo wp_kses_post( wc_price( get_post_meta( $store_id, 'elex_mv_vendor_total_sales', true ) ) ); ?></div>
										</div>

										<div class="d-flex mb-2  align-items-center gap-1">
											<div class="text-secondary">Refunds:</div>
											<div class="fs-6 fw-semi-bold m-0"><?php echo wp_kses_post( wc_price( get_post_meta( $store_id, 'elex_mv_vendor_last_settlement_refund', true ) ) ); ?></div>
										</div>

										<div class="d-flex mb-2  align-items-center gap-1">
											<div class="text-secondary">Next Settlement(Approx):</div>
											<div class="fs-6 fw-semi-bold m-0"><?php echo wp_kses_post( wc_price( get_post_meta( $store_id, 'elex_mv_vendor_earning', true ) ) ); ?></div>
										</div>

										<div class="d-flex mb-2  align-items-center gap-1">
											<div class="text-secondary">Next Settlement Date:</div>
											<?php  
											$settlement_date = AdminPayment::get_settlement_date( $store_id ); 
											$date_fomat      = get_option( 'date_format' );
											?>
											<div class="fs-6 fw-semi-bold m-0"><?php echo esc_html( gmdate( $date_fomat , strtotime( sanitize_text_field( $settlement_date ) ) ) ); ?></div>
										</div>
									</div>
								</div>

							</div>

							<!-- paypal -->
							<div class="mb-3">
								<!-- Please Add Your PayPal Account to Preform Transiction -->
								<div class="mb-3">
									<div class="fs-6 mb-1 fw-semi-bold">Please Add Your PayPal Account to Perform Transaction.</div>
									<img src="<?php echo esc_url( ELEX_MULTI_VENDOR_MAIN_URL_PATH ); ?>assets/icons/paypal-card.png" alt="" class="w-100 h-30">
								</div>

								<!-- PayPal Email Id -->
								<form id ="email_id_vendor">
								<?php wp_nonce_field( 'elex_mv_payment_nonce', 'vendor_payment_nonce' ); ?>
								<input type="hidden" name="action" value="elex_mv_vendor_payment_mail"></input>
								<input type="hidden" name="store_id" value="<?php echo esc_attr( $store_id ); ?>"></input>
								<div class="mb-3">
									<div class="fs-6 mb-1 fw-semi-bold">PayPal Email Id(Optional)</div>
									<input type="text" name="elex_vendor_paypal_mail" class="form-control" value="<?php echo esc_attr( get_post_meta( $store_id, 'elex_mv_paypal_email', true ) ); ?>"placeholder="Enter Your PayPal Email Id">
								</div>
								<div class="fs-6 fst-italic mb-1">If you wish to receive settlement amount in your PayPal account kindly provide the repective email ID to the Admin, Who will then initiate the settlement process</div>
								<button class="btn btn-primary w-100 vendor_paypal_mail" type="button">Save Changes</button>
								</form>
							</div>

						</div>


					</div>

				</div>





			</div>









		</div>







	</div>
	
