From 953bf005a177a33a4f7df7afaff4917397ff7edb Mon Sep 17 00:00:00 2001 From: mespeche Date: Wed, 11 Sep 2013 11:39:33 +0200 Subject: [PATCH] - Change boolean type to integer type for update_logged_in_user field - Create view for customer modification --- core/lib/Thelia/Form/CustomerModification.php | 58 +++++-- templates/admin/default/customer-edit.html | 152 ++++++++++++++++++ templates/admin/default/customers.html | 10 +- 3 files changed, 206 insertions(+), 14 deletions(-) create mode 100644 templates/admin/default/customer-edit.html diff --git a/core/lib/Thelia/Form/CustomerModification.php b/core/lib/Thelia/Form/CustomerModification.php index 61f1e0834..358154a18 100755 --- a/core/lib/Thelia/Form/CustomerModification.php +++ b/core/lib/Thelia/Form/CustomerModification.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; +use Thelia\Core\Translation\Translator; /** * Class CustomerModification @@ -56,60 +57,93 @@ class CustomerModification extends BaseForm { $this->formBuilder - ->add('update_logged_in_user', 'boolean') // In a front office context, update the in-memory logged-in user data + ->add('update_logged_in_user', 'integer') // In a front office context, update the in-memory logged-in user data ->add("firstname", "text", array( "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_attr" => 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" + ) )) ; } diff --git a/templates/admin/default/customer-edit.html b/templates/admin/default/customer-edit.html new file mode 100644 index 000000000..d3f9b6bc5 --- /dev/null +++ b/templates/admin/default/customer-edit.html @@ -0,0 +1,152 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Edit a customer'}{/block} + +{block name="check-permissions"}admin.customer.edit{/block} + +{block name="main-content"} +
+ +
+ + {loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" lang="$edit_language_id"} + + + +
+
+
+ +
+ {intl l="Edit customer $FIRSTNAME $LASTNAME"} +
+ +
+
+ + {form name="thelia.customer.modification"} +
+ + {* Be sure to get the customer ID, even if the form could not be validated *} + + + {include file="includes/inner-form-toolbar.html"} + + {form_hidden_fields form=$form} + + {form_field form=$form field='success_url'} + + {/form_field} + + {if $form_error}
{$form_error_message}
{/if} + +
+ + {form_field form=$form field='title'} +
+ + + +
+ {/form_field} + + {form_field form=$form field='firstname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='lastname'} +
+ + +
+ {/form_field} + +
+ +
+ {loop name="address" type="address" customer="$customer_id" backend_context="1"} + + {form_field form=$form field='address1'} +
+ + +
+ {/form_field} + + {form_field form=$form field='address2'} +
+ +
+ {/form_field} + + {form_field form=$form field='address3'} +
+ +
+ {/form_field} + + {form_field form=$form field='zipcode'} +
+ + +
+ {/form_field} + + {form_field form=$form field='city'} +
+ + +
+ {/form_field} + + {form_field form=$form field='country'} +
+ + +
+ {/form_field} + + {/loop} +
+ +
+ {/form} + +
+
+ +
+
+ +
+ + {/loop} + + {elseloop rel="customer_edit"} +
+
+
+ {intl l="Sorry, customer ID=$customer_id was not found."} +
+
+
+ {/elseloop} + +
+
+{/block} \ No newline at end of file diff --git a/templates/admin/default/customers.html b/templates/admin/default/customers.html index 570c38bdc..faec8fb34 100644 --- a/templates/admin/default/customers.html +++ b/templates/admin/default/customers.html @@ -9,7 +9,7 @@ {assign var=customer_page value={$smarty.get.page|default:1}} -
+
@@ -150,7 +150,13 @@ {/form_field} - + {form_field form=$form field='company'} +
+ + +
+ {/form_field} + {form_field form=$form field='title'}