{% load i18n %}
{% load tags %}
{% load common_tags %}
{% load astrobin_apps_platesolving_tags %}

<div class="modal hide fade" id="plate-solving-information-modal">
    <div class="modal-header">
        <a class="close" data-dismiss="modal">&times;</a>
        <h3>
            <i class="icon-location-arrow"></i>
            {% trans "Plate-solving information" %}
            <span class="loading hide" style="float: right; margin-right: 1rem">
                <div class="ld ld-ring ld-spin"></div>
            </span>
        </h3>
    </div>

    <div class="modal-body">
        <table class="table table-striped auto-layout valign-baseline">
            <tbody>
                <tr>
                    <td>{% trans "Status" %}</td>
                    <td class="status">
                        {% if instance_to_platesolve.solution %}
                            {{ instance_to_platesolve.solution | humanize_solution_status }}
                        {% else %}
                            {% trans "n/a" %}
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>{% trans "Started" %}</td>
                    <td class="started">
                        {% if instance_to_platesolve.solution %}
                            {% timestamp instance_to_platesolve.solution.created %}
                        {% else %}
                            {% trans "n/a" %}
                        {% endif %}
                    </td>
                </tr>
                {% if instance_to_platesolve.solution.settings.astrometry_net_publicly_visible %}
                    <tr>
                        <td>{% trans "Astrometry.net job" %}</td>
                        <td class="astrometry-job">
                            {% if instance_to_platesolve.solution and instance_to_platesolve.solution.submission_id %}
                                <a href="http://nova.astrometry.net/status/{{ instance_to_platesolve.solution.submission_id }}"
                                   target="_blank">
                                    {{ instance_to_platesolve.solution.submission_id }}
                                </a>
                            {% else %}
                                {% trans "n/a" %}
                            {% endif %}
                        </td>
                    </tr>
                {% endif %}
                <tr>
                    <td>{% trans "PixInsight job" %}</td>
                    <td class="pixinsight-job">
                        {% if instance_to_platesolve.solution %}
                            {{ instance_to_platesolve.solution.pixinsight_serial_number | default:_('n/a') }}
                        {% else %}
                            {% trans "n/a" %}
                        {% endif %}
                    </td>
                </tr>
                <tr>
                    <td>{% trans "PixInsight queue size" %}</td>
                    <td class="pixinsight-queue-size">
                        {% trans "n/a" %}
                    </td>
                </tr>
                <tr>
                    <td>{% trans "PixInsight stage" %}</td>
                    <td class="pixinsight-stage">
                        {% if advanced_solution_last_live_log_entry %}
                            {{ advanced_solution_last_live_log_entry.stage }}
                        {% else %}
                            {% trans "n/a" %}
                        {% endif %}
                    </td>
                </tr>
                {% if request.user|show_pixinsight_log:instance_to_platesolve.solution and advanced_solution_last_live_log_entry and advanced_solution_last_live_log_entry.log %}
                    <tr>
                        <td colspan="2">{% trans "PixInsight log" %}</td>
                    </tr>
                    <tr>
                        <td colspan="2" class="pixinsight-log">
                            <textarea rows="15">
                                {{ advanced_solution_last_live_log_entry.log }}
                            </textarea>
                        </td>
                    </tr>
                {% endif %}

                {% if instance_to_platesolve.solution.advanced_ra %}
                    <tr>
                        <td colspan="2">
                            <hr />
                        </td>
                    </tr>

                    <tr>
                        <td>{% trans "RA" %} ({% trans "center" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_ra }} {% trans "degrees" %}"
                                  class="ra-coordinates">
                                {{ instance_to_platesolve.solution.advanced_ra | ra_to_hms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "RA" %} ({% trans "top/left" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_ra_top_left }} {% trans "degrees" %}"
                                  class="ra-coordinates">
                                {{ instance_to_platesolve.solution.advanced_ra_top_left | ra_to_hms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "RA" %} ({% trans "top/right" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_ra_top_right }} {% trans "degrees" %}"
                                  class="ra-coordinates">
                                {{ instance_to_platesolve.solution.advanced_ra_top_right | ra_to_hms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "RA" %} ({% trans "bottom/right" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_ra_bottom_right }} {% trans "degrees" %}"
                                  class="ra-coordinates">
                                {{ instance_to_platesolve.solution.advanced_ra_bottom_right | ra_to_hms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "RA" %} ({% trans "bottom/left" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_ra_bottom_left }} {% trans "degrees" %}"
                                  class="ra-coordinates">
                                {{ instance_to_platesolve.solution.advanced_ra_bottom_left | ra_to_hms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                    </tr>

                    <tr>
                        <td colspan="2">
                            <hr />
                        </td>
                    </tr>

                    <tr>
                        <td>{% trans "Dec" %} ({% trans "center" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_dec }} {% trans "degrees" %}"
                                  class="dec-coordinates">
                                {{ instance_to_platesolve.solution.advanced_dec | dec_to_dms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "Dec" %} ({% trans "top/left" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_dec_top_left }} {% trans "degrees" %}"
                                  class="dec-coordinates">
                                {{ instance_to_platesolve.solution.advanced_dec_top_left | dec_to_dms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "Dec" %} ({% trans "top/right" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_dec_top_right }} {% trans "degrees" %}"
                                  class="dec-coordinates">
                                {{ instance_to_platesolve.solution.advanced_dec_top_right | dec_to_dms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "Dec" %} ({% trans "bottom/right" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_dec_bottom_right }} {% trans "degrees" %}"
                                  class="dec-coordinates">
                                {{ instance_to_platesolve.solution.advanced_dec_bottom_right | dec_to_dms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                        </td>
                    </tr>
                    <tr>
                        <td>{% trans "Dec" %} ({% trans "bottom/left" %})</td>
                        <td>
                            <abbr title="{{ instance_to_platesolve.solution.advanced_dec_bottom_left }} {% trans "degrees" %}"
                                  class="dec-coordinates">
                                {{ instance_to_platesolve.solution.advanced_dec_bottom_left | dec_to_dms:instance_to_platesolve.solution.advanced_pixscale }}
                            </abbr>
                        </td>
                        </td>
                    </tr>
                {% endif %}
            </tbody>
        </table>
    </div>

    <div class="modal-footer">
        <button class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
    </div>
</div>
