{% extends "base.html" %}
{% load humanize static hc_extras %}

{% block title %}Add Microsoft Teams - {% site_name %}{% endblock %}


{% block content %}
<div class="row">
    <div class="col-sm-12">
        <h1>Microsoft Teams</h1>

        <p>If your team uses <a href="https://products.office.com/en-us/microsoft-teams/group-chat-software">Microsoft Teams</a>,
        you can set up {% site_name %} to post status updates directly to an appropriate
        Microsoft Teams channel.</p>

        <h2>Setup Guide</h2>

        <div class="row ai-step">
            <div class="col-sm-6">
                <span class="step-no">1</span>
                <p>
                    Log into your Microsoft Teams account, click the <strong>Apps</strong> tab.
                </p>
                <p>
                    Search for the <strong>Incoming Webhook</strong> connector, and add it.
                </p>
            </div>
            <div class="col-sm-6">
                <div class="marker-wrap">
                    <span style="left: 6%; top: 83%;" class="marker"></span>
                    <img
                        class="ai-guide-screenshot"
                        alt="Add the Incoming Webhook connector"
                        src="{% static 'img/integrations/setup_msteams_1.png' %}" />
                </div>
            </div>
        </div>

        <div class="row ai-step">
            <div class="col-sm-6">
                <span class="step-no">2</span>
                <p>
                  Select the channel where you want {% site_name %} to post
                  notifications.
                </p>
            </div>
            <div class="col-sm-6">
                <img
                    class="ai-guide-screenshot"
                    alt="Select the channel"
                    src="{% static 'img/integrations/setup_msteams_2.png' %}">
            </div>
        </div>

        <div class="row ai-step">
            <div class="col-sm-6">
                <span class="step-no">3</span>
                <p>
                    Give the connector a descriptive name.
                </p>
                <p>
                    Optionally, upload an icon
                    (feel free to use <a href="{% static 'img/logo@2x.png' %}">this one</a>).
                </p>
                <p>
                    Click on <strong>Create</strong>.
                </p>
            </div>
            <div class="col-sm-6">
                <img
                    class="ai-guide-screenshot"
                    alt="Create the connector"
                    src="{% static 'img/integrations/setup_msteams_3.png' %}">
            </div>
        </div>

        <div class="row ai-step">
            <div class="col-sm-6">
                <span class="step-no">4</span>
                <p>
                    Copy the displayed webhook URL and paste it
                    in the form below. Save the integration, and you are done!
                </p>
            </div>
            <div class="col-sm-6">
                <div class="marker-wrap">
                    <span style="left: 42%; top: 72%;" class="marker"></span>
                    <img
                        class="ai-guide-screenshot"
                        alt="Copy the Webhook URL"
                        src="{% static 'img/integrations/setup_msteams_4.png' %}">
                </div>
            </div>
        </div>

        <h2>Integration Settings</h2>

        <form method="post" class="form-horizontal" action="{% url 'hc-add-msteams' %}">
            {% csrf_token %}
            <div class="form-group {{ form.value.css_classes }}">
                <label for="post-url" class="col-sm-2 control-label">Webhook URL</label>
                <div class="col-sm-10">
                    <input
                        id="post-url"
                        type="text"
                        class="form-control"
                        name="value"
                        placeholder="https://"
                        value="{{ form.value.value|default:"" }}">

                    {% if form.value.errors %}
                    <div class="help-block">
                        {{ form.value.errors|join:"" }}
                    </div>
                    {% endif %}
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-primary">Save Integration</button>
                </div>
            </div>
        </form>
    </div>
</div>
{% endblock %}
