updating customer form

This commit is contained in:
Manuel Raynaud
2013-09-10 14:50:51 +02:00
parent 9ef1b17ea5
commit 79e40013e2
2 changed files with 60 additions and 19 deletions

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CustomerQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerCreation
@@ -43,55 +44,88 @@ class CustomerCreation extends BaseForm
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "firstname"
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "lastname"
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "address"
"label_for" => array(
"for" => "address"
),
"label" => Translator::getInstance()->trans("Street Address")
))
->add("address2", "text", array(
"label" => "Address Line 2"
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
)
))
->add("address3", "text", array(
"label" => "Address Line 3"
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
)
))
->add("phone", "text", array(
"label" => "phone"
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
)
))
->add("cellphone", "text", array(
"label" => "cellphone"
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "zipcode"
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "city"
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "country"
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
->add("title", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "title"
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
->add("email", "email", array(
"constraints" => array(
@@ -104,9 +138,12 @@ class CustomerCreation extends BaseForm
)
))
),
"label" => "email"
"label" => Translator::getInstance()->trans("Email Address"),
"label_attr" => array(
"for" => "email"
)
))
->add("email_confirm", "email", array(
/* ->add("email_confirm", "email", array(
"constraints" => array(
new Constraints\Callback(array(
"methods" => array(
@@ -116,13 +153,16 @@ class CustomerCreation extends BaseForm
))
),
"label" => "email confirmation"
))
))*/
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => "password"
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(

View File

@@ -17,7 +17,7 @@
<article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Create New Account"}</h1>
{form name=""}
{form name="thelia.customer.creation"}
<form id="form-register" class="form-horizontal" action="" method="post" role="form">
<fieldset id="register-info" class="panel panel">
@@ -41,13 +41,14 @@
<span class="help-block"><i class="icon-remove"></i> Invalid input!</span>
</div>
</div><!--/.form-group-->
{form_field form=$form field="email"}
<div class="form-group group-email">
<label class="control-label" for="email">Email Address: <span class="required">*</span></label>
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="email" name="email" id="email" class="form-control" placeholder="johndoe@domain.com" required>
<input type="email" name="{$name}" id="{$label_attr.for}" class="form-control" placeholder="johndoe@domain.com" required value="">
</div>
</div><!--/.form-group-->
{/form_field}
<div class="form-group group-phone">
<label class="control-label" for="phone">Telephone: <span class="required">*</span></label>