{{ content_top }}
<div class="extention-item">
    <div class="ibox">
        <div class="ibox-content">
            <h1>
                {{ extension.name }}
                {{ extension.current_version }}
            </h1>
            <p>{{ extension.description_short }}</p>
        </div>
    </div>
    <div class="row">
        <div class="col-md-3">
            <div class="ibox">
                <img src="{{ extension.processed_images.2.url }}" class="img-responsive"/>
            </div>
            <div class="ibox">
                <div class="ibox-title">
                    User Actions
                </div>
                <div class="ibox-content">
                    
                    {% if extension.installable  and  not extension.installed %} 
                        <!-- install -->
                        <a class="btn btn-success btn-block m-b popup-extension" data-href="{{ extension.popup }}&theme=extension_thumb_row"  data-toggle="tooltip" data-original-title="Install"><span class="fa fa-magic"></span> Install</a>
                    {% endif %} 
                    
                    {% if extension.updatable  and  extension.installed %} 
                        <!-- update -->
                        <a class="btn btn-success btn-block m-b popup-extension" data-href="{{ extension.popup }}&theme=extension_thumb_row&action=update"  data-toggle="tooltip" data-original-title="Update"><span class="fa fa-refresh"></span> Update</a>
                    {% endif %} 
                    
                   
                    {% if extension.purchasable %} 
                        <!-- purchase -->
                        <div  >
                            {% if extension.price %} 
                             <select class="form-control m-b">
                                {% for price in extension %}
                                <option value="{{ price.extension_recurring_price_id }}">{{ price.recurring_price_format }} / {{ price.recurring_duration }} days</option>
                                {% endfor %}
                            </select>
                            {% endif %} 
                            <a class="btn btn-primary btn-block m-b popup-purchase" data-href="{{ extension.popup_purchase }}" data-extension-id="{{ extension.extension_id }}">Get it</a>
                        </div>
                    {% endif %} 
                     

                    {% if extension.installed %} 
                        <!-- delete -->
                        <a class="btn btn-danger btn-block m-b delete-extension" data-href="{{ extension.uninstall }}&theme=extension_thumb_row"  data-toggle="tooltip" data-original-title="Delete"><span class="fa fa-trash-o"></span> Delete</a>    
                    {% endif %} 

                    {% if extension.suspendable  and  not extension.installed %} 
                        <!-- suspend -->
                        <a class="btn btn-danger btn-block m-b suspend-extension" data-href="{{ extension.suspend }}" data-toggle="tooltip" data-original-title="Suspend"><span class="fa fa-ban"></span> Suspend</a>
                    {% endif %}                 
                    
                    {% if extension.activate %} 
                        <!-- activate -->
                        <a class="btn btn-success btn-block m-b activate-extension hide" data-href="{{ extension.activate }}"  data-toggle="tooltip" data-original-title="Activate"><span class="fa fa-power-off "></span> Activate</a>
                    {% endif %} 

                    {% if extension.deactivate %} 
                        <!-- deactivate -->
                        <a class="btn btn-danger btn-block m-b deactivate-extension hide" data-href="{{ extension.deactivate }}"  data-toggle="tooltip" data-original-title="Deactivate"><span class="fa fa-power-off "></span> Deactivate</a>
                    {% endif %} 
                    
                    
                    {% if extension.commercial and not extension.purchasable and not extension.installable %} 
                        <!-- pay invoice -->
                        <a class="btn btn-danger btn-block m-b" href="{{ extension.billing }}" data-toggle="tooltip" data-original-title="Billing">Pay invoice</a>
                    {% endif %} 

                    
                </div>
            </div>
            {% if extension.installed or extension.admin or extension.testable %} 
            <div class="ibox">
                <div class="ibox-title">
                    Developer & Tester Actions
                    {% if extension.downloadable and extension.tester_status_id %}
                        {% if extension.tester_status_id == 0 or extension.tester_status_id == 3 or  extension.tester_status_id == 6 %} 
                            <span class="label label-danger pull-right">
                        {% endif %} 
                        {% if extension.tester_status_id  ==  1  or  extension.tester_status_id  ==  2  or  extension.tester_status_id  ==  4 %} 
                            <span class="label label-info pull-right">
                        {% endif %} 
                        {% if extension.tester_status_id  ==  5 %} 
                            <span class="label label-success pull-right">
                        {% endif %} 
                        
                            {{ attribute(_context, "text_tester_status_"~extension.tester_status_id) }}
                        </span>
                    {% endif %} 
                </div>
                <div class="ibox-content">

                    {% if extension.installed %}  
                        <!-- json -->
                        <a class="btn btn-info  show-extension-json" data-href="{{ extension.json }}" data-toggle="tooltip" data-original-title="mbooth.json"><span class="fa fa-code"></span></a>
                    {% endif %} 
                    {% if extension.admin %} 
                        <!-- admin -->
                        <a class="btn btn-info " href="{{ extension.admin }}"  data-toggle="tooltip" data-original-title="Admin"><span class="fa fa-pencil"></span></a>
                    {% endif %} 

                    {% if extension.submittable  and  extension.installed %} 
                        <!-- submit -->
                        <a class="btn btn-warning submit-extension" data-href="{{ extension.submit }}" data-toggle="tooltip" data-original-title="Submit"><span class="fa fa-cloud-upload"></span></a>
                    {% endif %} 

                    {% if extension.downloadable  and  extension.installed %} 
                        <!-- download -->
                        <a class="btn btn-default download-extension" data-href="{{ extension.download }}"  data-toggle="tooltip" data-original-title="Download"><span class="fa fa-download"></span></a>
                        <!-- filemanager -->
                        <a class="btn btn-default " href="{{ extension.filemanager }}"  data-toggle="tooltip" data-original-title="Filemanager"><span class="fa fa-file-code-o"></span></a>
                    {% endif %} 

                    {% if extension.testable %} 
        
                        <a class="btn btn-primary approve-extension" data-href="{{ extension.approve }}" data-toggle="tooltip" data-original-title="Approve"><span class="fa fa-thumbs-up"></span></a>
                        <a class="btn btn-danger disapprove-extension" data-href="{{ extension.disapprove }}" data-toggle="tooltip" data-original-title="Disaprove"><span class="fa fa-thumbs-down"></span></a>
                        <a class="btn btn-warning popup-extension" data-href="{{ extension.popup }}&theme=extension_thumb_row&action=test" data-toggle="tooltip" data-original-title="Test"><span class="fa fa-cloud-download"></span></a>
              
                    {% endif %} 


                </div>
            </div>
            {% endif %} 
            {{ developer }}
        </div>
        <div class="col-md-9">
            <div class="ibox">
                <div class="ibox-content">
                    {% if extension.downloadable  and  extension.tester_comment %} 
                        <div class="alert alert-info">{{ extension.tester_comment }}</div>
                    {% endif %} 
                    <div class="description">{{ extension.description }}</div>
                </div>
            </div>
            <!-- <pre>  
                print_r(extension )
            </pre>  -->
        </div>
    </div>
</div>
<script>
    $(document).on('click', '.purchase .btn', function(){
        var href = $(this).attr('href');
            href += '&extension_recurring_price_id='+$(this).parents('.purchase').find('select').val();
            //console.log(href);
            location.href = href;
        return false;

    });
</script>
{{ content_bottom }}