File "admin-stores-edit.tmpl"

Full Path: /srv/www/www.cadoro.it/src/templates/admin-stores-edit.tmpl
File size: 15.16 KB
MIME-type: text/html
Charset: utf-8

{extends file='layout-admin.tmpl'}
<html>
  <body>
    {block name="breadcrumbs"}
    <div class="breadcrumbs">
      <a href="{$base_url}/admin/stores">Punti Vendita</a> <span class="divider">&raquo;</span>
      <strong>{$store.slug}</strong>
    </div>
    {/block}
    {block name="content"}
    <div class="sheet">
      <div class="sheet-header">
        <h1>
          Modifica punto vendita
          <small>{$store.slug}</small>
        </h1>
      </div>
      <div class="sheet-body">
        {if $errors}
        <div class="alert alert-danger">
          <strong>ATTENZIONE: si sono verificati degli errori, correggere prima di proseguire!</strong>
        </div>
        {/if}
        <form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
          <fieldset>
            <legend>Informazioni di base</legend>
            <div class="form-group{if isset($errors.slug)} error{/if}">
              <label class="control-label col-md-3" for="slug">SLUG</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="slug" name="slug" value="{_f('slug', $store)}">
                {if isset($errors.slug)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.title)} error{/if}">
              <label class="control-label col-md-3" for="title">Titolo</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="title" name="title" value="{_f('title', $store)}">
                {if isset($errors.title)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.type)} error{/if}">
              <label class="control-label col-md-3" for="type">Tipo</label>
              <div class="controls col-md-9">
                <select name="type" class="form-control">
                  <option value=""></option>
                  {html_options options=$STORE_TYPES selected=_f('type', $store)}
                </select>
                {if isset($errors.type)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.address)} error{/if}">
              <label class="control-label col-md-3" for="address">Indirizzo</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="address" name="address" value="{_f('address', $store)}">
                {if isset($errors.address)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.zipcode)} error{/if}">
              <label class="control-label col-md-3" for="zipcode">CAP</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="zipcode" name="zipcode" value="{_f('zipcode', $store)}">
                {if isset($errors.zipcode)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.city)} error{/if}">
              <label class="control-label col-md-3" for="city">Città</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="city" name="city" value="{_f('city', $store)}">
                {if isset($errors.city)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.province)} error{/if}">
              <label class="control-label col-md-3" for="province">Provincia</label>
              <div class="controls col-md-9">
                <select name="province" id="province" class="form-control">
                  <option value=""></option>
                  {html_options options=$PROVINCES selected=_f('province', $store)}
                </select>
                {if isset($errors.province)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.lat)} error{/if}">
              <label class="control-label col-md-3" for="lat">Latitudine / Longitudine</label>
              <div class="controls col-md-3">
                <input type="text" class="form-control" id="lat" name="lat" value="{_fn('lat', $store, 8)}" placeholder="Latitudine" data-behaviour="numeric">
                {if isset($errors.lat)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
              <div class="controls col-md-3">
                <input type="text" class="form-control" id="lng" name="lng" value="{_fn('lng', $store, 8)}" placeholder="Longitudine" data-behaviour="numeric">
                {if isset($errors.website)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
              <div class="controls col-md-3">
                <a href="" class="btn btn-default btn-block" data-behaviour="geocode"><i class="glyphicon glyphicon-map-marker"></i> Geocodifica</a>
              </div>
            </div>
            <div class="form-group{if isset($errors.phone)} error{/if}">
              <label class="control-label col-md-3" for="phone">Telefono</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="phone" name="phone" value="{_f('phone', $store)}">
                {if isset($errors.phone)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.email)} error{/if}">
              <label class="control-label col-md-3" for="email">Email</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="email" name="email" value="{_f('email', $store)}">
                {if isset($errors.email)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.services)} error{/if}">
              <label class="control-label col-md-3" for="services">Servizi</label>
              <div class="controls col-md-9">
                {foreach $STORE_SERVICES as $k => $v}
                <div class="checkbox">
                  <label>
                    <input type="checkbox" name="services[]" value="{$k}"{if in_array($k, _f('services', $store, []))} checked="checked"{/if}> {$v}
                  </label>
                </div>
                {/foreach}
                {if isset($errors.services)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
          </fieldset>
          <fieldset class="mt30">
            <legend>Orario di apertura</legend>
            <div class="form-group{if isset($errors.openings_1)} error{/if}">
              <label class="control-label col-md-3" for="openings_1">Lunedì</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_1" name="openings_1" value="{_f('openings_1', $store)}">
                {if isset($errors.openings_1)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.openings_2)} error{/if}">
              <label class="control-label col-md-3" for="openings_2">Martedì</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_2" name="openings_2" value="{_f('openings_2', $store)}">
                {if isset($errors.openings_2)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.openings_3)} error{/if}">
              <label class="control-label col-md-3" for="openings_3">Mercoledì</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_3" name="openings_3" value="{_f('openings_3', $store)}">
                {if isset($errors.openings_3)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.openings_4)} error{/if}">
              <label class="control-label col-md-3" for="openings_4">Giovedì</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_4" name="openings_4" value="{_f('openings_4', $store)}">
                {if isset($errors.openings_4)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.openings_5)} error{/if}">
              <label class="control-label col-md-3" for="openings_5">Venerdì</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_5" name="openings_5" value="{_f('openings_5', $store)}">
                {if isset($errors.openings_5)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.openings_6)} error{/if}">
              <label class="control-label col-md-3" for="openings_6">Sabato</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_6" name="openings_6" value="{_f('openings_6', $store)}">
                {if isset($errors.openings_6)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.openings_7)} error{/if}">
              <label class="control-label col-md-3" for="openings_7">Domenica</label>
              <div class="controls col-md-9">
                <input type="text" class="form-control" id="openings_7" name="openings_7" value="{_f('openings_7', $store)}">
                {if isset($errors.openings_7)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
          </fieldset>
          <fieldset class="mt30">
            <legend>Immagini</legend>
            <div class="form-group{if isset($errors.image_1)} error{/if}">
              <label class="control-label col-md-3" for="image_1">Immagine 1</label>
              <div class="controls col-md-9">
                <input type="file" class="form-control" id="image_1" name="image_1" value="">
                {if isset($store.image_1) and $store.image_1}
                <p class="mt20">
                  <input type="hidden" name="image_1" value="{$store.image_1}">
                  <img src="{$base_url}/assets/{$store.image_1}" alt="{$store.name}" class="img-responsive img-editable" id="img_image_1">
                </p>
                {/if}
                {if isset($errors.image_1)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.image_2)} error{/if}">
              <label class="control-label col-md-3" for="image_2">Immagine 2</label>
              <div class="controls col-md-9">
                <input type="file" class="form-control" id="image_2" name="image_2" value="">
                {if isset($store.image_2) and $store.image_2}
                <p class="mt20">
                  <input type="hidden" name="image_2" value="{$store.image_2}">
                  <img src="{$base_url}/assets/{$store.image_2}" alt="{$store.name}" class="img-responsive img-editable" id="img_image_2">
                </p>
                {/if}
                {if isset($errors.image_2)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.image_3)} error{/if}">
              <label class="control-label col-md-3" for="image_3">Immagine 3</label>
              <div class="controls col-md-9">
                <input type="file" class="form-control" id="image_3" name="image_3" value="">
                {if isset($store.image_3) and $store.image_3}
                <p class="mt20">
                  <input type="hidden" name="image_3" value="{$store.image_3}">
                  <img src="{$base_url}/assets/{$store.image_3}" alt="{$store.name}" class="img-responsive img-editable" id="img_image_3">
                </p>
                {/if}
                {if isset($errors.image_3)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.image_4)} error{/if}">
              <label class="control-label col-md-3" for="image_4">Immagine 4</label>
              <div class="controls col-md-9">
                <input type="file" class="form-control" id="image_4" name="image_4" value="">
                {if isset($store.image_4) and $store.image_4}
                <p class="mt20">
                  <input type="hidden" name="image_4" value="{$store.image_4}">
                  <img src="{$base_url}/assets/{$store.image_4}" alt="{$store.name}" class="img-responsive img-editable" id="img_image_4">
                </p>
                {/if}
                {if isset($errors.image_4)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
            <div class="form-group{if isset($errors.image_5)} error{/if}">
              <label class="control-label col-md-3" for="image_5">Immagine 5</label>
              <div class="controls col-md-9">
                <input type="file" class="form-control" id="image_5" name="image_5" value="">
                {if isset($store.image_5) and $store.image_5}
                <p class="mt20">
                  <input type="hidden" name="image_5" value="{$store.image_5}">
                  <img src="{$base_url}/assets/{$store.image_5}" alt="{$store.name}" class="img-responsive img-editable" id="img_image_5">
                </p>
                {/if}
                {if isset($errors.image_5)}<p class="help-block error">Campo obbligatorio!</p>{/if}
              </div>
            </div>
          </fieldset>
          <div class="form-group form-actions"><div class="col-md-offset-3 col-md-9">
            <button type="submit" class="btn btn-success">Salva le modifiche</button>
            <a href="{$base_url}/admin/stores" class="btn btn-default">Annulla</a>
          </div></div>
        </form>
      </div>
    </div>
    {/block}
    {block name="jstail"}
    <script>{literal}
      var geocoder = new google.maps.Geocoder()
      $('[data-behaviour=geocode]').click(function (e) {
        e.preventDefault()
        var address = $('#address').val() + ', ' + $('#city').val() + ', ' + $('#province').val()
        geocoder.geocode({'address': address}, function(results, status) {
          if (status === google.maps.GeocoderStatus.OK) {
           $('#lat').val(results[0].geometry.location.lat().toFixed(8).toString().replace('.', ','))
           $('#lng').val(results[0].geometry.location.lng().toFixed(8).toString().replace('.', ','))
          } else {
           alert("Geocodifica non riuscita: " + address);
          }
        });
      })
    {/literal}</script>
    {/block}
  </body>
</html>