<div class="chat_modal_wrap md_modal_wrap" my-modal-position>

  <div class="md_modal_head">
    <div class="md_modal_title_wrap">
      <div class="md_modal_actions_wrap clearfix">
        <a class="md_modal_action md_modal_action_close" ng-click="$close()" my-i18n="modal_close"></a>
        <a class="md_modal_action" ng-if="hasRights('edit_title')" ng-click="editChannel()" my-i18n="modal_edit"></a>
      </div>
      <div class="md_modal_title" ng-switch="isMegagroup">
        <span ng-switch-when="true" my-i18n="group_modal_info"></span>
        <span ng-switch-default my-i18n="channel_modal_info"></span>
      </div>
    </div>

    <div class="peer_modal_profile_wrap clearfix">
      <div class="peer_modal_photo_wrap pull-left" ng-switch="photo.updating">
        <div ng-switch-when="true" class="peer_modal_photo md_photo_loading loading_dots">
          <i></i><i></i><i></i>
        </div>
        <a ng-switch-default ng-click="openPhoto(chatFull.chat_photo.id, {p: -chatFull.chat.id})" class="peer_modal_photo" my-peer-photolink="::-chatFull.chat.id" img-class="peer_modal_photo" no-open="true" watch="true" ng-class="{disabled: !chatFull.chat.photo.photo_small}" ng-disabled="!chatFull.chat.photo.photo_small"></a>
      </div>
      <div class="peer_modal_profile">
        <div class="peer_modal_profile_name" my-peer-link="-chatFull.chat.id" verified="true"></div>
        <div class="peer_modal_profile_description" ng-if="chatFull.participants_count > 0" ng-switch="isMegagroup">
          <ng-pluralize ng-switch-when="true"
                        count="chatFull.participants_count"
                        when="group_modal_pluralize_participants">
          </ng-pluralize>
          <ng-pluralize ng-switch-default
                        count="chatFull.participants_count"
                        when="group_modal_pluralize_subscribers">
          </ng-pluralize>
        </div>
      </div>
    </div>
  </div>

  <div class="md_modal_split_actions_wrap">
    <div class="md_modal_split_actions" ng-switch="hasRights('edit_photo')">
      <div ng-switch-when="true" class="md_modal_split_action">
        <input my-file-upload  type="file" multiple="false" class="im_attach_input" size="120" accept="image/x-png, image/png, image/gif, image/jpeg" title="{{'group_modal_update_photo' | i18n}}" />
        <i class="md_modal_split_action_camera"></i>
      </div>
      <a ng-switch-default class="md_modal_split_action" href="" ng-click="goToHistory()" title="{{'user_modal_send_message' | i18n}}">
        <i class="md_modal_split_action_msg"></i>
      </a>
    </div>
  </div>

  <div class="md_modal_body">

    <div class="md_modal_sections clearfix">

      <div class="md_modal_iconed_section_wrap md_modal_iconed_section_number" ng-if="chatFull.rAbout || chatFull.chat.username || chatFull.chat.pFlags.creator">
        <i class="md_modal_section_icon md_modal_section_icon_about"></i>

        <div class="md_modal_section_param_wrap" ng-if="chatFull.about.length > 0">
          <div class="md_modal_section_param_value">
            <span ng-bind-html="chatFull.rAbout"></span>
          </div>
          <div class="md_modal_section_param_name" my-i18n="channel_modal_description"></div>
        </div>

        <div class="md_modal_section_param_wrap" ng-if="chatFull.chat.username">
          <div class="md_modal_section_param_value">
            <a class="settings_modal_username_link" ng-click="shareLink($event)" ng-bind="'https://t.me/' + chatFull.chat.username" ng-href="https://t.me/{{chatFull.chat.username}}" target="_blank"></a>
          </div>
          <div class="md_modal_section_param_name" my-i18n="channel_modal_share_link"></div>
        </div>

        <div class="md_modal_section_param_wrap" ng-if="!chatFull.chat.username &amp;&amp; chatFull.chat.pFlags.creator">
          <div class="md_modal_section_param_value" ng-switch="chatFull.exported_invite._">
            <a ng-switch-when="chatInviteExported" class="settings_modal_username_link" ng-click="shareLink($event)" ng-bind="chatFull.exported_invite.link" ng-href="{{chatFull.exported_invite.link}}" target="_blank"></a>
            <span ng-switch-default my-i18n="channel_modal_share_loading">
              <my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
            </span>
          </div>
          <div class="md_modal_section_param_name" my-i18n="channel_modal_share_link"></div>
        </div>
      </div>

      <div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="hasRights('invite') || chatFull.chat.pFlags.left">
        <i class="md_modal_section_icon md_modal_section_icon_person"></i>

        <div class="md_modal_section_link_wrap" ng-switch="chatFull.chat.pFlags.left">
          <a ng-switch-when="true" class="md_modal_section_link" ng-click="joinChannel()" my-i18n="channel_modal_join"></a>
          <a ng-switch-default class="md_modal_section_link" ng-click="inviteToChannel()" my-i18n="channel_modal_add_member"></a>
        </div>

      </div>

      <div class="md_modal_iconed_section_wrap md_modal_iconed_section_toggle">
        <i class="md_modal_section_icon md_modal_section_icon_notification"></i>

        <a class="md_modal_section_toggle_wrap tg_checkbox" ng-click="settings.notifications = !settings.notifications" ng-class="settings.notifications ? 'tg_checkbox_on' : ''">
          <span class="icon icon-checkbox-outer"><i class="icon-checkbox-inner"></i></span>
          <span class="tg_checkbox_label" my-i18n="group_modal_notifications"></span>
        </a>

      </div>

      <div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="isMegagroup && !chatFull.chat.username && !chatFull.chat.pFlags.left && !chatFull.chat.pFlags.kicked">
        <i class="md_modal_section_icon md_modal_section_icon_more"></i>

        <div class="md_modal_section_link_wrap">
          <a class="md_modal_section_link" ng-click="flushHistory()" my-i18n="group_modal_menu_clear_history"></a>
        </div>

      </div>

      <div class="md_modal_iconed_section_wrap md_modal_iconed_section_link" ng-if="chatFull.chat.pFlags.creator || !chatFull.chat.pFlags.left && !chatFull.chat.pFlags.kicked && !isMegagroup">
        <i class="md_modal_section_icon md_modal_section_icon_more"></i>

        <div class="md_modal_section_link_wrap" ng-if="!chatFull.chat.pFlags.left && !chatFull.chat.pFlags.kicked && !isMegagroup">
          <a class="md_modal_section_link" ng-click="leaveChannel()" my-i18n="channel_modal_leave_channel"></a>
        </div>

        <div class="md_modal_section_link_wrap" ng-if="chatFull.chat.pFlags.creator">
          <a class="md_modal_section_link md_modal_section_link_danger" ng-click="deleteChannel()" ng-switch="isMegagroup">
            <span ng-switch-when="true" my-i18n="group_modal_delete_group"></span>
            <span ng-switch-default my-i18n="channel_modal_delete_channel"></span>
          </a>
        </div>

      </div>

    </div>

    <div ng-if="participants.length > 0">

      <div class="md_modal_section_splitter"></div>

      <div class="md_modal_iconed_section_wrap md_modal_iconed_section_peers">
        <i class="md_modal_section_icon md_modal_section_icon_people"></i>

        <div class="md_modal_section_peers_wrap">

          <div class="md_modal_list_peer_wrap clearfix" ng-repeat="participant in participants">

            <a ng-if="participant.canLeave" ng-click="leaveChannel()" class="md_modal_list_peer_action pull-right" my-i18n="group_modal_menu_leave"></a>
            <a ng-if="participant.canKick" ng-click="kickFromChannel(participant.user_id)" class="md_modal_list_peer_action pull-right" my-i18n="group_modal_members_kick"></a>

            <a class="md_modal_list_peer_photo pull-left" my-peer-photolink="::participant.user_id" img-class="md_modal_list_peer_photo"></a>

            <div class="md_modal_list_peer_name">
              <a class="md_modal_list_peer_name" my-peer-link="participant.user_id"></a>
            </div>
            <div class="md_modal_list_peer_description" my-user-status="::participant.user_id" bot-chat-privacy="true"></div>
          </div>

        </div>

      </div>

    </div>
  </div>


</div>
