{form name='pdr.place.view.main'}
<div class="form-container">

    {if $form_error}
    <div class="alert alert-danger">{$form_error_message}</div>
    {/if}

    {loop name="places" type="pdr_places" id="$place_id"}
    <form action="{url path='/admin/module/PointRetrait/edit' place_id=$place_id}" method="POST" class="clearfix"  {form_enctype form=$form}>
        {form_hidden_fields form=$form}

        {include file = "includes/inner-form-toolbar.html"
                hide_flags = true
                hide_submit_buttons = false
                page_url     = "{url path='/admin/module/PointRetrait/edit&place_id=$place_id'}"
                close_url    = "{url path='/admin/module/PointRetrait'}"
                current_tab = "main"
        }

        {form_field form=$form field="place_id"}
        <input type="hidden" name="{$name}" value="{$place_id}"/>
        {/form_field}

        <div class="row">
            <div class="col-md-4 form-inline">
                {form_field form=$form field="title"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d='pointretrait'}
                    </label>
                    <input type="text" id="{$label_attr.for}" class="form-control large" name="{$name}" value="{$TITLE}" {if $required}required{/if} />&nbsp
                </div>
                {form_error form=$form field="title"}{$message}{/form_error}
                {/form_field}
            </div>

            <div class="col-md-2">
                {form_field form=$form field="active"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                    </label>

                    <div class="make-switch switch-small toggle-active" data-id="{$ID}" data-on="success"
                         data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok'></i>"
                         data-off-label="<i class='glyphicon glyphicon-remove'></i>">
                        <input type="checkbox" class="link" {if $ACTIVE == 1}checked="checked"{/if}>
                    </div>
                    <input type="hidden" id="{$label_attr.for}" name="{$name}" value="{$ACTIVE}"/>
                </div>
                {/form_field}
            </div>

            <div class="col-md-2">
                {form_field form=$form field="price"}
                <div class="form-group form-inline">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="{$PRICE}" {if $required}required{/if} />&nbsp;€
                </div>
                {form_error form=$form field="price"}{$message}{/form_error}
                {/form_field}
            </div>

            <div class="col-md-4">
                {form_field form=$form field="minimum_amount"}
                <div class="form-group form-inline">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <input type="text" id="{$label_attr.for}" class="form-control etroit" name="{$name}" value="{$MINIMUM_AMOUNT}" {if $required}required{/if} />&nbsp;€
                </div>
                {form_error form=$form field="minimum_amount"}{$message}{/form_error}
                {/form_field}
            </div>

        </div>

        <div class="row">
            <div class="col-md-10">
                {form_field form=$form field="address1"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <div class="control-input">
                        <input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ADDRESS1}" maxlength="100" {if $required}required{/if} />
                    </div>
                </div>
                {form_error form=$form field="address1"}{$message}{/form_error}
                {/form_field}
            </div>
        </div>

        <div class="row">
            <div class="col-md-10">
                {form_field form=$form field="address2"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <div class="control-input">
                        <input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ADDRESS2}" maxlength="100" {if $required}required{/if} />
                    </div>
                </div>
                {form_error form=$form field="address2"}{$message}{/form_error}
                {/form_field}
            </div>
        </div>

        <div class="row">
            <div class="col-md-2">
                {form_field form=$form field="zipcode"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <div class="control-input">
                        <input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$ZIPCODE}" maxlength="10" {if $required}required{/if} />
                    </div>
                </div>
                {form_error form=$form field="zipcode"}{$message}{/form_error}
                {/form_field}
            </div>
            <div class="col-md-8">
                {form_field form=$form field="city"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <div class="control-input">
                        <input type="text" id="{$label_attr.for}" class="form-control" name="{$name}" value="{$CITY}" maxlength="100" {if $required}required{/if} />
                    </div>
                </div>
                {form_error form=$form field="city"}{$message}{/form_error}
                {/form_field}
            </div>
        </div>

        <div class="row">
            <div class="col-md-8">
                {form_field form=$form field="access_comment"}
                <div class="form-group">
                    <label class="control-label" for="{$label_attr.for}">
                        {intl l=$label d="pointretrait"}
                        {if $required}<span class="required">*</span>{/if}
                    </label>

                    <div class="control-input">
                        <textarea id="{$label_attr.for}" name="{$name}"  maxlength="400" class="form-control">{if $form_error}{$value}{/if}{$ACCESS_COMMENT}</textarea>
                    </div>
                    <span class="help-block">{intl l="Access comment help" d="pointretrait"}</span>
                </div>
                {form_error form=$form field="access_comment"}{$message}{/form_error}
                {/form_field}
            </div>
            <div class="col-md-4">
                <div class="bouton-geoloc">
                    <img src="{image file='assets/img/compass.svg' source='PointRetrait'}" alt="Geolocate" id="submit-geoloc"/>
                    <span>{intl l="Recenter map" d="pointretrait"}</span>
                </div>
                {form_field form=$form field="latitude"}
                <input type="hidden" value="{$LATITUDE}" id="{$label_attr.for}" name="{$name}">
                {/form_field}
                {form_field form=$form field="longitude"}
                <input type="hidden" value="{$LONGITUDE}" id="{$label_attr.for}" name="{$name}">
                {/form_field}
            </div>
        </div>


        <div class="row">
            <div class="col-md-12">
                <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBb07YA_unrh5w821I1xHxbeYb5KCF_WaM&callback=initMap&libraries=&v=weekly" async></script>
                <div id="map" class="locationMap"></div>
            </div>
        </div>

    </form>
    {/loop}
</div>
{/form}
