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

View File

@@ -17,7 +17,7 @@
<article class="col-main" role="main" aria-labelledby="main-label"> <article class="col-main" role="main" aria-labelledby="main-label">
<h1 id="main-label" class="page-header">{intl l="Create New Account"}</h1> <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"> <form id="form-register" class="form-horizontal" action="" method="post" role="form">
<fieldset id="register-info" class="panel panel"> <fieldset id="register-info" class="panel panel">
@@ -41,13 +41,14 @@
<span class="help-block"><i class="icon-remove"></i> Invalid input!</span> <span class="help-block"><i class="icon-remove"></i> Invalid input!</span>
</div> </div>
</div><!--/.form-group--> </div><!--/.form-group-->
{form_field form=$form field="email"}
<div class="form-group group-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"> <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>
</div><!--/.form-group--> </div><!--/.form-group-->
{/form_field}
<div class="form-group group-phone"> <div class="form-group group-phone">
<label class="control-label" for="phone">Telephone: <span class="required">*</span></label> <label class="control-label" for="phone">Telephone: <span class="required">*</span></label>