<?php echo wp_kses( $args['before_widget'], wp_kses_allowed_html( 'post' ) ); ?>

<?php if ( ! empty( $instance['title'] ) ) : ?>
    <?php echo wp_kses( $args['before_title'], wp_kses_allowed_html( 'post' ) ); ?>
    <?php echo esc_attr( $instance['title'] ); ?>
    <?php echo wp_kses( $args['after_title'], wp_kses_allowed_html( 'post' ) ); ?>
<?php endif; ?>

<div id="favorites-controller" data-ng-controller="FavoritesController">
	<div class="property-micro" data-ng-repeat="property in properties">
        <a data-ng-href="{{ property.permalink }}">
            <img src="/" data-ng-src="{{ property.src }}" class="attachment-thumb wp-post-image" alt="">                        
        </a>
        
        <h3>
            <a data-ng-href="{{ property.permalink }}">{{ property.title }}</a>
        </h3>

        <div class="property-micro-actions">
        	<a class="property-micro-actions-remove" data-ng-click="remove(property.id)">
        		<i class="fa fa-times"></i>
        	</a>
        </div><!-- /.property-micro-actions -->
    </div><!-- /.property-micro -->

    <?php if ( is_user_logged_in() ) : ?>
	    <div data-ng-show="!properties.length" class="nothing-found">
	    	<?php echo __( 'No properties found.', 'realia' ); ?>
	    </div>
	<?php else: ?>
		<?php $link = Realia_Utilities::get_link_for_login(); ?>
    	<?php if ( $link ) : ?>
    		<?php echo sprintf( __( 'Please <a href="%s">log in</a>.', 'realia' ), $link ); ?>
    	<?php else: ?>
			<?php echo __( 'Please log in before.', 'realia' ); ?>
		<?php endif; ?>
	<?php endif; ?>

    <?php $favorites_page = get_theme_mod( 'realia_general_favorites_page', null ); ?>
    <?php if ( ! empty( $favorites_page ) ) : ?>
        <div data-ng-show="properties.length">
        	<a href="<?php echo get_permalink( $favorites_page ); ?>" class="btn"><?php echo __( 'Vew favorites', 'realia' ); ?></a>
        </div>
    <?php endif; ?>
</div><!-- /#compare-controller -->

<?php echo wp_kses( $args['after_widget'], wp_kses_allowed_html( 'post' ) ); ?>