start area configuration tempalte
This commit is contained in:
@@ -125,8 +125,9 @@
|
||||
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Shipping\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Shipping\AreaModificationForm"/>
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Area\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Area\AreaModificationForm"/>
|
||||
<form name="thelia.admin.area.country" class="Thelia\Form\Area\AreaCountryForm"/>
|
||||
|
||||
</forms>
|
||||
|
||||
|
||||
89
core/lib/Thelia/Form/Area/AreaCountryForm.php
Normal file
89
core/lib/Thelia/Form/Area/AreaCountryForm.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program 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 */
|
||||
/* */
|
||||
/* This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form\Area;
|
||||
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class AreaCountryForm
|
||||
* @package Thelia\Form\Area
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AreaCountryForm extends BaseForm
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* in this function you add all the fields you need for your Form.
|
||||
* Form this you have to call add method on $this->formBuilder attribute :
|
||||
*
|
||||
* $this->formBuilder->add("name", "text")
|
||||
* ->add("email", "email", array(
|
||||
* "attr" => array(
|
||||
* "class" => "field"
|
||||
* ),
|
||||
* "label" => "email",
|
||||
* "constraints" => array(
|
||||
* new \Symfony\Component\Validator\Constraints\NotBlank()
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
* ->add('age', 'integer');
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
protected function buildForm()
|
||||
{
|
||||
$this->formBuilder
|
||||
->add('area_id', 'integer', array(
|
||||
'constraints' => array(
|
||||
new GreaterThan(array('value' => 0)),
|
||||
new NotBlank()
|
||||
)
|
||||
|
||||
))
|
||||
->add('country_id', 'integer', array(
|
||||
'constraints' => array(
|
||||
new GreaterThan(array('value' => 0)),
|
||||
new NotBlank()
|
||||
),
|
||||
'label_attr' => array(
|
||||
'for' => 'area_country'
|
||||
),
|
||||
'label' => Translator::getInstance()->trans('Country')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string the name of you form. This name must be unique
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'thelia_area_country';
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/category' category_id={$category_d}}" />
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/category' category_id={$category_id}}" />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='locale'}
|
||||
|
||||
@@ -28,23 +28,33 @@
|
||||
<div class="col-md-4">
|
||||
|
||||
|
||||
|
||||
{form name="thelia.admin.area.country"}
|
||||
<form method="POST" action="">
|
||||
<label class="control-label" for="">{intl l="Country"}</label>
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path="/admin/configuration/shipping_configuration/update/{$area_id}"}" >
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='area_id'}
|
||||
<input type="hidden" name="{$name}" value="{$area_id}">
|
||||
{/form_field}
|
||||
{form_field form=$form field='country_id'}
|
||||
<label class="control-label" for="{$label_attr.for}">{intl l="Country"}</label>
|
||||
|
||||
<div class="input-group">
|
||||
<select name="" id="" data-toggle="selectpicker">
|
||||
<option value="1">France</option>
|
||||
<option value="2">Monaco</option>
|
||||
<option value="3">Nouvelle-Calédonie</option>
|
||||
<select name="{$name}" id="{$label_attr.for}" data-toggle="selectpicker">
|
||||
{loop name="country-without-area" type="country" with_area="0" backend_context="1" lang=$lang_id}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-plus-sign"></span> {intl l="Add this country"}</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/form_field}
|
||||
</form>
|
||||
|
||||
{/form}
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
@@ -57,38 +67,24 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop name="country-area" type="country" area=$area_id backend_context="1"}
|
||||
<tr>
|
||||
<td>Wallis-et-Futuna</td>
|
||||
<td>{$TITLE}</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this country'}" href="#delete_country_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Polynésie française</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this country'}" href="#delete_country_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>USA - Alabama</td>
|
||||
<td>
|
||||
<a class="btn btn-default btn-xs" title="{intl l='Delete this country'}" href="#delete_zone_dialog" data-id="{$ID}" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="active">
|
||||
<td colspan="2">
|
||||
<form method="POST" action="">
|
||||
<label for="" class="control-label">{intl l="Freight"}</label>
|
||||
<label for="" class="control-label">{intl l="Postage"}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="" id="" placeholder="Freight value">
|
||||
<input type="text" class="form-control" name="" id="" placeholder="Postage">
|
||||
<span class="input-group-addon">€</span>
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default btn-primary"><span class="glyphicon glyphicon-check"></span></button>
|
||||
|
||||
Reference in New Issue
Block a user