diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 3235171df..7aaad391a 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -37,6 +37,11 @@ Thelia\Controller\Admin\CustomerController::indexAction + + Thelia\Controller\Admin\CustomerController::viewAction + \d+ + + diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index 04c8842cd..99ae37d21 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -37,4 +37,12 @@ class CustomerController extends BaseAdminController return $this->render("customers", array("display_customer" => 20)); } + + public function viewAction($customer_id) + { + + return $this->render("customer-edit", array( + "customer_id" => $customer_id + )); + } } \ No newline at end of file diff --git a/core/lib/Thelia/Form/CustomerCreation.php b/core/lib/Thelia/Form/CustomerCreation.php index 1bc88407b..f95dd33d5 100755 --- a/core/lib/Thelia/Form/CustomerCreation.php +++ b/core/lib/Thelia/Form/CustomerCreation.php @@ -43,19 +43,28 @@ class CustomerCreation extends BaseForm "constraints" => array( new Constraints\NotBlank() ), - "label" => "firstname" + "label" => "Firstname", + "label_attr" => array( + "for" => "firstname" + ) )) ->add("lastname", "text", array( "constraints" => array( new Constraints\NotBlank() ), - "label" => "lastname" + "label" => "Lastname", + "label_attr" => array( + "for" => "lastname" + ) )) ->add("address1", "text", array( "constraints" => array( new Constraints\NotBlank() ), - "label" => "address" + "label" => "Address", + "label_attr" => array( + "for" => "address" + ) )) ->add("address2", "text", array( "label" => "Address Line 2" @@ -64,28 +73,43 @@ class CustomerCreation extends BaseForm "label" => "Address Line 3" )) ->add("phone", "text", array( - "label" => "phone" + "label" => "Phone", + "label_attr" => array( + "for" => "phone" + ) )) ->add("cellphone", "text", array( - "label" => "cellphone" + "label" => "Cellphone", + "label_attr" => array( + "for" => "cellphone" + ) )) ->add("zipcode", "text", array( "constraints" => array( new Constraints\NotBlank() ), - "label" => "zipcode" + "label" => "Zip code", + "label_attr" => array( + "for" => "zipcode" + ) )) ->add("city", "text", array( "constraints" => array( new Constraints\NotBlank() ), - "label" => "city" + "label" => "City", + "label_attr" => array( + "for" => "city" + ) )) ->add("country", "text", array( "constraints" => array( new Constraints\NotBlank() ), - "label" => "country" + "label" => "Country", + "label_attr" => array( + "for" => "country" + ) )) ->add("title", "text", array( "constraints" => array( @@ -104,7 +128,10 @@ class CustomerCreation extends BaseForm ) )) ), - "label" => "email" + "label" => "Email", + "label_attr" => array( + "for" => "email" + ) )) ->add("email_confirm", "email", array( "constraints" => array( @@ -115,14 +142,20 @@ class CustomerCreation extends BaseForm ) )) ), - "label" => "email confirmation" + "label" => "Email confirmation", + "label_attr" => array( + "for" => "email-confirmation" + ) )) ->add("password", "password", array( "constraints" => array( new Constraints\NotBlank(), new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4))) ), - "label" => "password" + "label" => "Password", + "label_attr" => array( + "for" => "password" + ) )) ->add("password_confirm", "password", array( "constraints" => array( @@ -132,7 +165,10 @@ class CustomerCreation extends BaseForm array($this, "verifyPasswordField") ))) ), - "label" => "password confirmation" + "label" => "Password confirmation", + "label_attr" => array( + "for" => "password-confirmation" + ) )) ; diff --git a/templates/admin/default/customers.html b/templates/admin/default/customers.html index ea498f72c..e7a8c37d2 100644 --- a/templates/admin/default/customers.html +++ b/templates/admin/default/customers.html @@ -10,130 +10,198 @@
-
+
- {module_include location='customer_top'} + {module_include location='customer_top'} -
-
-
- -
- {intl l="Customers list"} +
+
+
+ + + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.customers.create"} + + + + {/loop} + - {ifloop rel="customer_list"} - - - + {ifloop rel="customer_list"} + + + - + - {module_include location='category_list_header'} + {module_include location='category_list_header'} - + - + - + - - - + + + - - {loop name="customer_list" type="customer" current="false" visible="*" last_order="1" backend_context="1" page={$customer_page} limit={$display_customer}} - - + + {loop name="customer_list" type="customer" current="false" visible="*" last_order="1" backend_context="1" page={$customer_page} limit={$display_customer}} + + - + - + - {module_include location='customer_list_row'} + {module_include location='customer_list_row'} - + - - + + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"} + + {/loop} + {loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"} + + {/loop} + {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"} + + {/loop} + + - - {/loop} - - {/ifloop} -
+ {intl l="Customers list"} - {module_include location='customer_list_caption'} + {module_include location='customer_list_caption'} - {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.customers.create"} - - - - {/loop} -
- {intl l="customer ref"} -
+ {intl l="customer ref"} + - {intl l="company"} - + {intl l="company"} + - {intl l="firstname & lastname"} - + {intl l="firstname & lastname"} + - {intl l="last order"} - + {intl l="last order"} + {intl l='order amount'}{intl l='order amount'}{intl l='Actions'}
{intl l='Actions'}
{#REF}
{#REF} - {#COMPANY} - + {#COMPANY} + - {#FIRSTNAME} {#LASTNAME} - + {#FIRSTNAME} {#LASTNAME} + - {format_date date=$LASTORDER_DATE} - + {format_date date=$LASTORDER_DATE} + - {format_number number=$LASTORDER_AMOUNT} - -
+
+ {format_number number=$LASTORDER_AMOUNT} + +
- {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.customer.edit"} - - {/loop} - {loop type="auth" name="can_send_mail" roles="ADMIN" permissions="admin.customer.sendMail"} - - {/loop} - {loop type="auth" name="can_delete" roles="ADMIN" permissions="admin.customer.delete"} - - {/loop} -
-
+ + {/loop} + + {/ifloop} +
+
+
+ + + {module_include location='customer_bottom'} +
+
+ +
    + {if #customer_page != 1} +
  • «
  • + {else} +
  • «
  • + {/if} + + {pageloop rel="customer_list"} + {if #PAGE != #CURRENT} +
  • #PAGE
  • + {else} +
  • #PAGE
  • + {/if} + + {if #PAGE == #LAST && #LAST != #CURRENT} +
  • »
  • + {else} +
  • »
  • + {/if} + {/pageloop} +
+
+
+
+ {* Adding a new Category *} - {module_include location='customer_bottom'} -
-
-
    - {if #customer_page != 1} -
  • «
  • - {else} -
  • «
  • - {/if} + {form name="thelia.customer.creation"} - {pageloop rel="customer_list"} - {if #PAGE != #CURRENT} -
  • #PAGE
  • - {else} -
  • #PAGE
  • - {/if} + {* Capture the dialog body, to pass it to the generic dialog *} + {capture "customer_creation_dialog"} - {if #PAGE == #LAST && #LAST != #CURRENT} -
  • »
  • - {else} -
  • »
  • - {/if} - {/pageloop} -
-
-
+ {form_hidden_fields form=$form} -
- + {form_field form=$form field='success_url'} + {* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} + + {/form_field} + + {form_field form=$form field='firstname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='lastname'} +
+ + +
+ {/form_field} + + {form_field form=$form field='address1'} +
+ + +
+ +
+ {form_field form=$form field='address2'} + + {/form_field} +
+ +
+ {form_field form=$form field='address3'} + + {/form_field} +
+ {/form_field} + + + + {/capture} + + {include + file = "includes/generic-create-dialog.html" + + dialog_id = "add_customer_dialog" + dialog_title = {intl l="Create a new customer"} + dialog_body = {$smarty.capture.customer_creation_dialog nofilter} + + dialog_ok_label = {intl l="Create this customer"} + dialog_cancel_label = {intl l="Cancel"} + + form_action = {url path='/admin/customer/create'} + form_enctype = {form_enctype form=$form} + form_error_message = $form_error_message + } + {/form} {/block} \ No newline at end of file