<ion-view view-title="{{'User' | translate}} {{user.username}}">
  <ion-content class="has-footer">
      <ion-refresher
        pulling-text="{{'Pull_to_refresh' | translate}}..."
        on-refresh="doRefresh()">
      </ion-refresher>
    <div class="o_userProfileBackground">
        <img ng-src="{{user.avatar}}" class="o_userImgCircular" />
        <h3 class="o_text_white">{{user.username}}</h3>
        <p>{{user.description}}</p>
        <p>{{user.email}}</p>
        <p ng-show="storageuser._id==user._id">
            <md-button class="o_grey500" ng-href="#/app/editUser">Edit profile</md-button>
        </p>
    </div>
    <div class="">
        <div class="row">
          <a class="tab-item" ng-show="user.telegram"
          ng-href="http://telegram.me/{{user.telegram}}">
              <i class="icon ion-paper-airplane"></i>
              @{{user.telegram}}
          </a>
          <a class="tab-item">
              <i class="icon ion-android-car"></i>
              {{user.travels.length}} Travels
          </a>
          <a class="tab-item">
              <i class="icon ion-ios-heart"></i>
              {{user.favs.length}} favs
          </a>
        </div>

        <div class="o-text-right">
          <div ng-show="storageusername && storageusername!=user.username">
            <a ng-show="arrayObjectIndexOf(user.favs, storageusername, 'username')==-1" ng-click="favUser()">
              <img class="o-imgMenu" src="img/unlike.png" />
            </a>
            <a ng-show="arrayObjectIndexOf(user.favs, storageusername, 'username')!=-1" ng-click="unfavUser()">
              <img class="o-imgMenu" src="img/like.png" />
            </a>
          </div>
          <!--<a ng-repeat="join in user.favs" ng-href="#/app/users/{{join.joinedUsername}}" class="button button-small button-dark">
              <img ng-src="img/avatars/{{join.joinedAvatar}}.png" class="o-img-joined" />{{join.joinedUsername}}<br>
          </a>-->
        </div>
    </div>
    <div class="item">
        <img src="{{user.faircoin}}" style="width: 100%;" />
    </div>
    <div class="item item-body">
        {{'current_publications_of' | translate}} {{user.username}}:
        <div class="o_text_purple600">{{user.travels.length}} {{'publications' | translate}}</div>

        <a ng-repeat="travel in user.travels | orderBy: 'date'" class="item item-avatar" href="#/app/travels/{{travel._id}}">
          <img ng-src="img/{{travel.type}}.png">
          <h2>{{travel.title}}
              <div class="item-note">
                  <div class="o_text_purple400">{{travel.date | date:"HH:mm a"}}</div>
                  <div class="o_text_purple400">{{travel.date | date:"dd/MM/yyyy"}}</div>
              </div>
          </h2>

          <div class="item-note">
              <p class="" ng-show="travel.modality=='offering'">{{'n_Seats' | translate}}: {{travel.seats}}</p>
              <p class="" ng-show="travel.modality=='asking'">{{'n_People' | translate}}: {{travel.seats}}</p>
          </div>
          <p>
              {{travel.description}}
          </p>
        </a>
    </div>
  </ion-content>
</ion-view>
