<?php
namespace Elementor;

class headernine extends Widget_Base {
	
	public function get_name() {
		return 'headernine';
	}
	
	public function get_title() {
		return 'باکس سربرگ 7';
	}
	
	    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_1',
            [
                'label' => esc_html__( 'تنظیمات فعال سازی', 'woolentor' ),
            ]
        );
		$this->add_control(
			'farnamoneshow1',
			[
				'label' => __( 'نمایش حساب کاربری', 'plugin-domain' ),
				'type' => \Elementor\Controls_Manager::SWITCHER,
				'label_on' => __( 'نمایش', 'your-plugin' ),
				'label_off' => __( 'مخفی', 'your-plugin' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);
		
		
       $this->add_control(
			'farnamoneshow2',
			[
				'label' => __( 'نمایش سبد خرید', 'plugin-domain' ),
				'type' => \Elementor\Controls_Manager::SWITCHER,
				'label_on' => __( 'نمایش', 'your-plugin' ),
				'label_off' => __( 'مخفی', 'your-plugin' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);
		   $this->add_control(
			'farnamoneshow3',
			[
				'label' => __( 'نمایش علاقه مندی', 'plugin-domain' ),
				'type' => \Elementor\Controls_Manager::SWITCHER,
				'label_on' => __( 'نمایش', 'your-plugin' ),
				'label_off' => __( 'مخفی', 'your-plugin' ),
				'return_value' => 'yes',
				'default' => 'yes',
			]
		);
  
        $this->end_controls_section();



		 $this->start_controls_section(
            'farnam_product_style_2',
            [
                'label' => esc_html__( 'تنظیمات استایل و ظاهر', 'woolentor' ),
            ]
        );
             
 $this->add_control(
                        'titr-12-3w',
                        [
                            'label' => __( 'رنگ پس زمینه ایکون کاربری', 'woolentor' ),
                            'type' => Controls_Manager::HEADING,
                                              ]
                    );
					
						$this->add_group_control(
			\Elementor\Group_Control_Background::get_type(),
			[
				'name' => 'background2',
				'label' => esc_html__( 'پس زمینه', 'plugin-name' ),
				'types' => [ 'classic', 'gradient' ],
				'selector' => '{{WRAPPER}} .left-rr-user.mk-402-2.mr-402-1 .mik543 ',
			]
		);


		   

		   $this->add_control(
'color_farnam_3',
			[
				'label' => __( 'رنگ ایکون', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
				
				'selectors' => [
					'{{WRAPPER}} .left-rr-user.mk-402-2.mr-402-1 .mik543 .icon-user span::before' => 'color: {{VALUE}} !important',
				],
			]
           );

	
		   
		 	   $this->add_control(
'color_farnam_5',
			[
				'label' => __( 'رنگ پس زمینه دکمه خروج', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .ittyn2' => 'background: {{VALUE}} !important',
				],
			]
           );  
		   
		   	   	 	   $this->add_control(
'color_farnam_7',
			[
				'label' => __( 'رنگ متن دکمه خروج', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .ittyn2 .khorooj-sistem' => 'color: {{VALUE}} !important',
				],
			]
           );  
		   
		      	   	 
		   	   	 	   $this->add_control(
'color_farnam_754',
			[
				'label' => __( 'رنگ هاور دکمه ها', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .user-meta a:hover' => 'color: {{VALUE}} !important',
				],
			]
           );  
		   		      	   	 	   $this->add_control(
'color_farnam_9',
			[
				'label' => __( 'رنگ پس زمینه سبد خرید', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3.mr-402-2' => 'background: {{VALUE}} !important',
				],
			]
           ); 

		   $this->add_control(
'color_farnam_9765',
			[
				'label' => __( 'رنگ ایکون سبد خرید', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3.mr-402-2 .icon-basket i::before' => 'color: {{VALUE}} !important',
				],
			]
           );  
		   
		   		   
		   		      	   	 	   $this->add_control(
'color_farnam_10',
			[
				'label' => __( 'رنگ پس زمینه شمارنده', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3.mr-402-2 .sabadnumbercolor' => 'background: {{VALUE}} !important',
				],
			]
           );  
		   
		         	   	 	   $this->add_control(
'color_farnam_11',
			[
				'label' => __( 'رنگ متن شمارنده', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3.mr-402-2 .sabadnumbercolor' => 'color: {{VALUE}} !important',
				],
			]
           );  
		   
		   
		          	   	 	   $this->add_control(
'color_farnam_12',
			[
				'label' => __( 'رنگ پس زمینه حذف محصولات', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mini-cart-3 .remove.remove_from_cart_button' => 'background: {{VALUE}} !important',
				],
			]
           );  
		   
		   
		   	          	   	 	
     
		   
		   
		   
		      	   	 	   $this->add_control(
'color_farnam_148',
			[
				'label' => __( 'رنگ متن حذف محصولات', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .mini-cart-3 .remove.remove_from_cart_button' => 'color: {{VALUE}} !important;',
				],
			]
           );  
		   
		   
		    
		      	   	 	   $this->add_control(
'color_farnam_185',
			[
				'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_farnam_1r85',
			[
				'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_farnam_185mr',
			[
				'label' => __( 'رنگ پس زمینه علاقه مندی', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .src.left-sabad.mr-402-3' => 'background: {{VALUE}} !important',
				],
			]
           );  
		   	 	   $this->add_control(
'color_farnam_185mr2',
			[
				'label' => __( 'رنگ ایکون علاقه مندی', 'plugin-domain' ),
				'type' => Controls_Manager::COLOR,
			
				'selectors' => [
					'{{WRAPPER}} .src.left-sabad.mr-402-3' => 'color: {{VALUE}} !important',
				],
			]
           );  
		   $this->add_responsive_control(
                        'farnamborder1',
                        [
                            'label' => esc_html__( 'گردی ایکون کاربری', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .left-rr-user.mk-402-2.mr-402-1 .mik543' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
 $this->add_responsive_control(
                        'farnamborde54r1',
                        [
                            'label' => esc_html__( 'گردی باکس بازشونده حساب کاربری', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .left-rr-user.mk-402-2.bazshomik980.mik983343242 .user-meta' => '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}} .intrr1' => '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}} .ittyn2' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );
					
					$this->add_responsive_control(
                        'farnamborderer4',
                        [
                            'label' => esc_html__( 'گردی سبد خرید', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3.mr-402-2' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );	
								  $this->add_responsive_control(
                        'farnamborder4',
                        [
                            'label' => esc_html__( 'گردی شمارنده سبد خرید', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400.mk-402-3.mr-402-2 .sabadnumbercolor' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );	
									  $this->add_responsive_control(
                        'farnamborder5',
                        [
                            'label' => esc_html__( 'گردی باکس بازشونده سبد خرید', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .left-sabad.min-car-6.gtr-654.sabadcolortitle.cartnimshe-422-1400 .mini-cart-3' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                                '{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart-item.mini_cart_item' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );	
					
						  $this->add_responsive_control(
                        'farnamborder4453',
                        [
                            'label' => esc_html__( 'گردی دکمه های سبد خرید', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .mini-cart-3 .woocommerce-mini-cart__total.total' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                                '{{WRAPPER}} .ss-nn-xx-11 .left-sabad span' => '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(
                        'farnamborderer478',
                        [
                            'label' => esc_html__( 'گردی علاقه مندی', 'woolentor' ),
                            'type' => Controls_Manager::DIMENSIONS,
                            'selectors' => [
                                '{{WRAPPER}} .src.left-sabad.mr-402-3' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px !important;',
                            ],
                        ]
                    );	

$this->add_control(
                        'titr-124444-44r464345rw',
                        [
                            'label' => __( 'سایه ایکون کاربری', 'woolentor' ),
                            'type' => Controls_Manager::HEADING,
                                              ]
                    );
$this->add_group_control(
			\Elementor\Group_Control_Box_Shadow::get_type(),
			[
				'name' => 'box_shadow34',
				'selector' => '{{WRAPPER}} .mik543',
			]
		);

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

		?>

<div class="left-header-box header-one-one-4 ss-nn-xx-11">



 <?php if ( 'yes' === $settings['farnamoneshow1'] ) { ?>
<?php if ( is_user_logged_in() ) { ?>


<div class="left-rr-user mk-402-2 bazshomik980 mik983343242 mr-402-1">
<div class="mik543">
<span class="icon-user"><span class="path1"></span><span class="path2"></span></span>
</div>


<div class="user-meta">
   <div class="user-avatar45">
		<div class="intrr1"><?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="ittyn2">
<a class="khorooj-sistem" href="<?php echo home_url() ?>/my-account/customer-logout/">خروج از سایت</a>

</div>
        
    
    </div>
	
<a href="<?php echo home_url() ?>/my-account/"><i class="mdi mdi-view-dashboard-outline"></i>پنل کاربری </a>
<a href="<?php echo home_url() ?>/my-account/edit-account/"><i class="mdi mdi-account-outline"></i>ویرایش حساب کاربری </a>
<a href="<?php echo home_url() ?>/my-account/orders/"><i class="mdi mdi-card-bulleted-outline"></i> سفارش های شما </a>
<a href="<?php echo home_url() ?>/my-account/mywishlist/"><i class="mdi mdi-heart"></i> علاقه مندی های شما </a>

<div class="log-111">

<a  href="<?php echo home_url() ?>/my-account/customer-logout/"> <i class="mdi mdi-account-arrow-left-outline"></i>خروج از سایت </a>

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


 <?php } 
 else { ?>
 <a href="<?php echo home_url() ?>/my-account/" class="left-rr-user mk-402-2 mr-402-1">
<div class="mik543">
<span class="icon-user"><span class="path1"></span><span class="path2"></span></span>
</div>
</a>
 <?php } ?>
  <?php } ?>

 <?php if ( 'yes' === $settings['farnamoneshow2'] ) { ?>

 <span  class="left-sabad min-car-6 gtr-654 sabadcolortitle cartnimshe-422-1400 mk-402-3 mr-402-2">
<i class="icon-basket"><i class="path1"></i><i class="path2"></i><i class="path3"></i><i class="path4"></i><i class="path5"></i></i>


<span class="sabadnumbercolor"><div class="header-cart-count"><?php echo WC()->cart->get_cart_contents_count(); ?></div></span>
<div class="mini-cart-3">

<div class="widget_shopping_cart_content"><?php woocommerce_mini_cart(); ?></div> </div>
</span>
 <?php } ?>
  <?php if ( 'yes' === $settings['farnamoneshow3'] ) { ?>

  <a class="src left-sabad mr-402-3" href="<?php echo home_url() ?>/wishlist/">
<i style="color: <?php echo get_option('color4'); ?>" class="fi fi-rr-heart"></i>
</a>
<?php } ?>



</div>




 

  


		<?php
	}
	
	protected function _content_template() {

    }
	
	
}