{{!
    This file is part of Moodle - http://moodle.org/
    
    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    
    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    Course settings template for Navigatr Badges plugin.
    
    @package    local_navigatr
    @copyright  2025 Navigatr
    @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    @template   local_navigatr/course/course_settings
    
    Template context variables:
    @var bool existing_mapping Whether an existing badge mapping exists for the course
    @var string provider_name The name of the Navigatr provider
    @var string badge_name The name of the badge
    @var string badge_description (Optional) The description of the badge
    @var string badge_image_url (Optional) The URL to the badge image
    @var string badge_url (Optional) The URL to view the badge on Navigatr
    @var string change_url The URL to change the badge mapping
    @var string remove_url The URL to remove the badge mapping
}}
{{#existing_mapping}}
<div class="alert alert-info current-mapping">
    <h4>{{#str}}current_mapping, local_navigatr{{/str}}</h4>
    
    <div class="mapping-content">
        {{#badge_image_url}}
        <div class="badge-image-container">
            <img src="{{badge_image_url}}" alt="{{badge_name}}" />
        </div>
        {{/badge_image_url}}
        
        <div class="mapping-details">
            <p><strong>{{#str}}provider, local_navigatr{{/str}}:</strong> {{provider_name}}</p>
            
            <p><strong>{{#str}}badge, local_navigatr{{/str}}:</strong> {{badge_name}}
                {{#badge_url}}
                <a href="{{badge_url}}" target="_blank" class="btn btn-sm btn-link">{{#str}}view_badge, local_navigatr{{/str}}</a>
                {{/badge_url}}
            </p>
            
            {{#badge_description}}
            <p><strong>{{#str}}badgedesc, local_navigatr{{/str}}:</strong> {{badge_description}}</p>
            {{/badge_description}}
        </div>
    </div>
    
    <div class="mapping-actions">
        <a href="{{change_url}}" class="btn btn-secondary">{{#str}}change_mapping, local_navigatr{{/str}}</a>
        <a href="{{remove_url}}" class="btn btn-outline-danger" onclick="return confirm('{{#str}}remove_mapping_confirm, local_navigatr{{/str}}')">{{#str}}remove_mapping, local_navigatr{{/str}}</a>
    </div>
</div>
{{/existing_mapping}}
