<div class="site card hoverable" idsite="{{ site.idsite }}" type="{{ site.type }}" ng-class="{'editingSite': site.editMode==true}">
<div class="card-content">

    <div class="row" ng-if="!site.editMode">

        <div class="col m3">
            <h4>{{ site.name }}</h4>
            <ul>
                <li><span class="title">{{ 'General_Id'|translate }}:</span> {{ site.idsite }}</li>
                <li ng-show="availableTypes.length > 1"><span class="title">{{ 'SitesManager_Type'|translate }}:</span> {{ currentType.name }}</li>
                <li ng-show="site.idsite && howToSetupUrl">
                    <a target="{{ isInternalSetupUrl ? '_self' : '_blank' }}" title="{{ 'SitesManager_ShowTrackingTag'|translate }}"
                       ng-href="{{ howToSetupUrl }}{{ isInternalSetupUrl ? '&idSite=' + site.idsite + '&period=' + period + '&date=' + date +'&updated=false' : ''}}">
                        {{ 'SitesManager_ShowTrackingTag'|translate }}
                    </a>
                </li>
            </ul>
        </div>
        <div class="col m4">
            <ul>
                <li><span class="title">{{ 'SitesManager_Timezone'|translate }}:</span> {{ site.timezone_name }}</li>
                <li><span class="title">{{ 'SitesManager_Currency'|translate }}:</span> {{ site.currency_name }}</li>
                <li ng-show="site.ecommerce == 1">
                    <span class="title">{{ 'Goals_Ecommerce'|translate }}:</span> {{ 'General_Yes'|translate }}
                </li>
                <li ng-show="site.sitesearch == 1">
                    <span class="title">{{ 'Actions_SubmenuSitesearch'|translate }}:</span> {{ 'General_Yes'|translate }}
                </li>
            </ul>
        </div>
        <div class="col m4">
            <ul>
                <li>
                    <span class="title">{{ 'SitesManager_Urls'|translate }}</span>:
                    <span ng-repeat="url in site.alias_urls">
                        <a target=_blank rel="noreferrer noopener" ng-href="{{ url }}">{{ url }}{{$last ? '' : ', '}}</a>
                    </span>
                </li>
                <li ng-show="site.excluded_ips.length">
                    <span class="title">{{ 'SitesManager_ExcludedIps'|translate }}:</span>
                    {{ site.excluded_ips.join(', ') }}
                </li>
                <li ng-show="site.excluded_parameters.length">
                    <span class="title">{{ 'SitesManager_ExcludedParameters'|translate }}:</span>
                    {{ site.excluded_parameters.join(', ') }}
                </li>
                <li ng-if="site.excluded_user_agents.length">
                    <span class="title">{{ 'SitesManager_ExcludedUserAgents'|translate }}:</span>
                    {{ site.excluded_user_agents.join(', ') }}
                </li>
            </ul>
        </div>
        <div class="col m1 text-right">
            <ul>
                <li>
                    <button class="table-action" ng-click="editSite()" title="{{ 'General_Edit'|translate }}">
                        <span class="icon-edit"></span>
                    </button>
                </li>
                <li>
                    <button class="table-action" ng-show="site.idsite" ng-click="openDeleteDialog()" title="{{ 'General_Delete'|translate }}">
                        <span class="icon-delete"></span>
                    </button>
                </li>
            </ul>
        </div>

    </div>

    <div ng-if="site.editMode">

        <div class="form-group row">
            <div class="col s12 m6 input-field">
                <input type="text" ng-model="site.name" maxlength="90" placeholder="{{ 'General_Name'|translate }}" />
                <label>{{ 'General_Name'|translate }}</label>
            </div>
            <div class="col s12 m6"></div>
        </div>

        <div piwik-activity-indicator loading="site.isLoading"></div>

        <div ng-repeat="settingsPerPlugin in measurableSettings">
            <div ng-repeat="setting in settingsPerPlugin.settings">
                <div piwik-form-field="setting" all-settings="settingsPerPlugin.settings"></div>
            </div>
        </div>

        <div piwik-field uicontrol="select" name="currency"
             ng-model="site.currency"
             data-title="{{ 'SitesManager_Currency'|translate }}"
             inline-help="{{ 'SitesManager_CurrencySymbolWillBeUsedForGoals' | translate }}"
             options='currencies'>
        </div>

        <div piwik-field uicontrol="select" name="timezone"
             ng-model="site.timezone"
             data-title="{{ 'SitesManager_Timezone'|translate }}"
             inline-help="#timezoneHelpText"
             options='timezones'>
        </div>

        <div id="timezoneHelpText" class="inline-help-node">
            <div ng-include="'plugins/SitesManager/templates/help/timezone-help.html'"></div>
        </div>

        <div class="editingSiteFooter">
            <input ng-show="!site.isLoading" type="submit" class="btn" value="{{ 'General_Save' | translate }}" ng-click="saveSite()"/>
            <button class="btn btn-link" ng-click="cancelEditSite(site)">{{ 'General_Cancel' | translate:'':'' }}</button>
        </div>

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