<?php
namespace Elementor;

class mobilebar extends Widget_Base {
	
	public function get_name() {
		return 'mobilebar';
	}
	
	public function get_title() {
		return 'المان منو موبایل';
	}
	
	    public function get_icon() {
		return 'eicon eicon-header';
    }
    
    public function get_categories() {
        return [ 'farnam' ];
    }
	
protected function _register_controls() {

		$this->start_controls_section(
			'section_title',
			[
				'label' => __( 'Content', 'elementor' ),
			]
		);
		
		$this->add_control(
			'posts_per_page',
			[
				'label' => __( 'عنوان', 'elementor' ),
				'label_block' => true,
				'type' => Controls_Manager::TEXT,
				'placeholder' => __( 'یک عنوان وارد کنید', 'elementor' ),
			]
		);
       		$this->end_controls_section();

       $this->start_controls_section(
            'farnam_product_style_2',
            [
                'label' => esc_html__( 'تنظیمات استایل و ظاهر', 'woolentor' ),
            ]
        );
             $this->add_control(
'color-two45645',
			[
				'label' => __( 'رنگ هاور دکمه ها', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #tesztwef .min-icon-footer:hover i' => 'color: {{VALUE}} !important',
					'{{WRAPPER}} #tesztwef .min-icon-footer:hover .text-alaghe' => 'color: {{VALUE}} !important',
				],
			]
		);
        $this->add_control(
'color-two1',
			[
				'label' => __( 'پس زمینه دکمه خانه', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #tesztwef .min-icon-footer .fi.fi-rr-home' => 'background: {{VALUE}} !important',
				],
			]
		);

    $this->add_control(
'color-two2',
			[
				'label' => __( 'رنگ ایکون خانه', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #tesztwef .min-icon-footer .fi.fi-rr-home' => 'color: {{VALUE}} !important',
				],
			]
		);
		
		        $this->add_control(
'color-two3',
			[
				'label' => __( 'هاور پس زمینه دکمه خانه', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #tesztwef .min-icon-footer:hover .fi.fi-rr-home' => 'background: {{VALUE}} !important',
				],
			]
		);

    $this->add_control(
'color-two4',
			[
				'label' => __( 'هاور رنگ ایکون خانه', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #tesztwef .min-icon-footer:hover .fi.fi-rr-home' => 'color: {{VALUE}} !important',
				],
			]
		);
		
			        $this->add_control(
'color-two5',
			[
				'label' => __( 'پس زمینه شمارنده سبد خرید', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #shopbot .sabadnumbercolor' => 'background: {{VALUE}} !important',
				],
			]
		);


       $this->add_control(
'color-two6',
			[
				'label' => __( 'رنگ متن شمارنده سبد خرید', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} #shopbot .sabadnumbercolor' => 'color: {{VALUE}} !important',
				],
			]
		);

			        $this->add_control(
'color-two7',
			[
				'label' => __( 'پس زمینه دکمه خروج از پنجره', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .closeiran-s' => 'background: {{VALUE}} !important',
				],
			]
		);

     $this->add_control(
'color-two8',
			[
				'label' => __( 'رنگ متن دکمه خروج از پنجره', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .closeiran-s' => 'color: {{VALUE}} !important',
				],
			]
		);

    $this->add_control(
'color-two9',
			[
				'label' => __( 'رنگ پس زمینه دکمه حذف محصولات', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mini-cart-3 .remove.remove_from_cart_button' => 'background: {{VALUE}} !important',
				],
			]
		);
		
		
		    $this->add_control(
'color-two10',
			[
				'label' => __( 'رنگ متن دکمه حذف محصولات', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mini-cart-3 .remove.remove_from_cart_button' => 'color: {{VALUE}} !important',
				],
			]
		);
		
		
		
		
    $this->add_control(
'color-two11',
			[
				'label' => __( 'رنگ پس زمینه دکمه تسویه حساب', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart__buttons .button:nth-child(2)' => 'background: {{VALUE}} !important',
				],
			]
		);
		
		    $this->add_control(
'color-two12',
			[
				'label' => __( 'رنگ متن دکمه تسویه حساب', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart__buttons .button:nth-child(2)' => 'color: {{VALUE}} !important',
				],
			]
		);
			    $this->add_control(
'color-two13',
			[
				'label' => __( 'رنگ پس زمینه دکمه خروج', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .modal-etel111 .khorooj-sistem' => 'background: {{VALUE}} !important',
				],
			]
		);
			    $this->add_control(
'color-two14',
			[
				'label' => __( 'رنگ متن دکمه خروج', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .modal-etel111 .khorooj-sistem' => 'color: {{VALUE}} !important',
				],
			]
		);
		
			    $this->add_control(
'color-two15',
			[
				'label' => __( 'رنگ هاور متن لینک های حساب کاربری', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .user-meta a:hover' => 'color: {{VALUE}} !important',
				],
			]
		);
		
		  $this->add_control(
'color-two16',
			[
				'label' => __( 'رنگ المان کنار اطلاعیه ها', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .modal-etel111 .elktwo::before' => 'background: {{VALUE}} !important',
				],
			]
		);
		
		
		
			   $this->add_responsive_control(
                        'farnamborder1',
                        [
                            'label' => esc_html__( 'گردی دور دکمه خانه', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .min-icon-footer .fi.fi-rr-home' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
   $this->add_responsive_control(
                        'farnamborder2',
                        [
                            'label' => esc_html__( 'گردی دکمه های سبد خرید', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .mini-cart-3 .quantity' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                                '{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart__total.total' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                                '{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart__buttons .button' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                                '{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart__buttons .button:nth-child(2)' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
					
					
			   $this->add_responsive_control(
                        'farnamborder2576567',
                        [
                            'label' => esc_html__( 'گردی تصویر کاربری', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .modal-etel111 .in1 img' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
					
					  $this->add_responsive_control(
                        'farnamborder42',
                        [
                            'label' => esc_html__( 'گردی تصویر کاربری', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .modal-etel111 .in1 img' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
					
					  $this->add_responsive_control(
                        'farnamborder3',
                        [
                            'label' => esc_html__( 'گردی دکمه خروج', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .modal-etel111 .khorooj-sistem' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
       		$this->end_controls_section();

		
	}
	
		protected function render() {
		$settings = $this->get_settings_for_display();
		

		?>
		
			
		<div id="myshopmodalq" class="modal-iran-hazf">

  <!-- modalq content -->
  <div class="modaldakhel">
  
    <span class="closeq closeiran-s">&times; خروج از این پنجره</span></div>

<div class="sepid-mini-cart-header saasdadsasd23">
<div class="sabad-mobile-test mini-cart-3">
<div class="widget_shopping_cart_content"><?php woocommerce_mini_cart(); ?></div> 
</div>
</div>
</div>




		
		<div id="searchmodal" class="modal-iran-hazf">

  <!-- modalq content -->
  <div class="modalqdakhel">
  
    <span class="closew1 closeiran-s">&times; خروج از این پنجره</span></div>
<div class="modal-etel111">
	 
	 
	 <div class="etela-bazsho-1">
	<?php	include es_TPL_PATH . 'header-mobile.php'; ?>

</div>

</div></div>




	<div id="etelmodal" class="modal-iran-hazf">

  <!-- modalq content -->
  <div class="modaldakhel">
  
    <span class="closee closeiran-s">&times; خروج از این پنجره</span></div>
<div class="modal-etel111">
<div class="sepid-head-bazsho">
<div class="sepid-head-bazsho-1">
   <div class="user-avatar">
		<div class="in1"><?php

// Get current user id
$user_id = get_current_user_id();

// Get attachment id
$attachment_id = get_user_meta( $user_id, 'avatar', true );

// Get default avatar URL
$default_avatar = wp_get_attachment_image_src(get_option('avatar_default'), '100');

// True
if ( $attachment_id ) {

  // Get image url
  $image_url = wp_get_attachment_url( $attachment_id );

  // Display image
  if ( $image_url ) {
    echo wp_get_attachment_image( $attachment_id, '100' );
  } else {
    // Display default avatar
    echo '<img src="' . esc_url($default_avatar[0]) . '" alt="اواتار" width="100" height="100">';
  }
} else {

  // Display default avatar
  echo '<img src="' . get_template_directory_uri() . '/img/user.jpg' . '" alt="اواتار پیشفرض" width="100" height="100">';
}
?></div>
       <div class="in2">
	   <span>
	   سلام
	   <?php global $current_user;
      get_currentuserinfo();
      echo '' . $current_user->user_firstname . "\n";
?>
</span>
<a class="khorooj-sistem" href="<?php echo home_url() ?>/my-account/customer-logout/">خروج از سایت</a>

</div>
        
    
    </div>
	
	<div class="sepid-head-bazsho-2">
<div class="user-meta">
<a href="<?php echo home_url() ?>/my-account/"><i class="fi fi-rr-user"></i> پنل کاربری </a>
<a href="<?php echo home_url() ?>/my-account/edit-account/"><i class="fi fi-rr-edit"></i> ویرایش حساب کاربری </a>
<a href="<?php echo home_url() ?>/my-account/orders/"><i class="fi fi-rr-shopping-cart"></i> سفارش های شما </a>
<a href="<?php echo home_url() ?>/my-account/mywishlist/"><i class="fi fi-rr-heart"></i> علاقه مندی های شما </a>

</div>
</div>

</div>

</div>
</div>
</div>

</div>
		<div class="navar-paiin-site" id="tesztwef">
		<div class="min-icon-footer" id="shopbot">
		<div class="sabad-foot-433">
		<i class="fi fi-rr-shopping-bag"></i>
				 <span class="sabadnumbercolor"><div class="header-cart-count"><?php echo WC()->cart->get_cart_contents_count(); ?></div></span>
</div>
				<span class="text-alaghe">سبد خرید</span>


		</div>
		<script>
		// Get the modalq
var modalq = document.getElementById("myshopmodalq");

// Get the button that opens the modalq
var btn = document.getElementById("shopbot");

// Get the <span> element that closes the modalq
var span = document.getElementsByClassName("closeq")[0];

// When the user clicks on the button, open the modalq
btn.onclick = function() {
  modalq.style.display = "block";
}

// When the user clicks on <span> (x), close the modalq
span.onclick = function() {
  modalq.style.display = "none";
}

// When the user clicks anywhere outside of the modalq, close it
window.onclick = function(event) {
  if (event.target == modalq) {
    modalq.style.display = "none";
  }
}


 </script>
		<div class="min-icon-footer" id="searchbot">
		<i class="fi fi-rr-bell-ring"></i>
				<span class="text-alaghe">اطلاعیه ها</span>

		</div>
		
		<script>
		// Get the modalq
var modalq1 = document.getElementById("searchmodal");

// Get the button that opens the modalq
var btn = document.getElementById("searchbot");

// Get the <span> element that closes the modalq
var span = document.getElementsByClassName("closew1")[0];

// When the user clicks on the button, open the modalq
btn.onclick = function() {
  modalq1.style.display = "block";
}

// When the user clicks on <span> (x), close the modalq
span.onclick = function() {
  modalq1.style.display = "none";
}

// When the user clicks anywhere outside of the modalq, close it
window.onclick = function(event) {
  if (event.target == modalq1) {
    modalq1.style.display = "none";
  }
}

</script>

		<a class="min-icon-footer" href="<?php echo get_home_url(); ?>" data-label="<?php echo esc_attr(get_bloginfo('name')); ?>">
    <i class="fi fi-rr-home"></i>
</a>
		
		<a class="min-icon-footer" data-label="علاقه مندی" href="<?php echo home_url() ?>/wishlist/">
		<i class="fi fi-rr-heart"></i>
		<span class="text-alaghe">علاقه مندی</span>
		</a>
				<?php if ( is_user_logged_in() ) { ?>

		<div class="min-icon-footer" id="etelbot">
		<i class="fi fi-rr-user"></i>
				<span class="text-alaghe">منو کاربر</span>

		</div>
		
					<script>
		// Get the modalq
var modalq2 = document.getElementById("etelmodal");

// Get the button that opens the modalq
var btn = document.getElementById("etelbot");

// Get the <span> element that closes the modalq
var span = document.getElementsByClassName("closee")[0];

// When the user clicks on the button, open the modalq
btn.onclick = function() {
  modalq2.style.display = "block";
}

// When the user clicks on <span> (x), close the modalq
span.onclick = function() {
  modalq2.style.display = "none";
}

// When the user clicks anywhere outside of the modalq, close it
window.onclick = function(event) {
  if (event.target == modalq2) {
    modalq2.style.display = "none";
  }
}

</script>
		<?php } 
 else { ?>
 
 <a class="min-icon-footer" href="<?php echo home_url() ?>/my-account/" data-label="حساب کاربری">
		<i class="fi fi-rr-user"></i>
				<span class="text-alaghe">ورود</span>

		</a>
  <?php } ?>
 

		</div>
		<?php
	}
	
	
	protected function _content_template() {

    }
	
	
}