{extends file="admin-layout.tpl"} {block name="no-return-functions"} {$admin_current_location = 'customer'} {/block} {block name="page-title"}{intl l='Edit a customer'}{/block} {block name="check-resource"}admin.customer{/block} {block name="check-access"}view{/block} {block name="main-content"}
{loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" with_prev_next_info="true" lang="$edit_language_id"}
{hook name="customer-edit.top" customer_id=$customer_id}
{intl l="Edit customer %firstname %lastname (Ref : %ref)" firstname={$FIRSTNAME} lastname={$LASTNAME} ref={$REF}}
{if $HAS_PREVIOUS != 0} {else} {/if} {if $HAS_NEXT != 0} {else} {/if}
{form name="thelia.admin.customer.update"} {include file="includes/inner-form-toolbar.html" hide_flags = true close_url = {url path='/admin/customers'} } {form_hidden_fields} {form_field field='success_url'} {/form_field} {if $form_error}
{$form_error_message}
{/if} {loop name="address" type="address" customer="$customer_id" backend_context="1" default="true"}

{intl l="Customer informations"}

{form_field field='title'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='firstname'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='lastname'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='email'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='discount'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='reseller'}
{$label}
{/form_field} {form_field field='password'}
{$label} (leave blank to keep current customer password) {if $required} *{/if} :
{/form_field}

{intl l="Default address"}

{form_field field='company'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='address1'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='address2'}
{/form_field} {form_field field='address3'}
{/form_field} {form_field field='zipcode'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='city'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='country'} {$countryFieldId=$label_attr.for}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='state'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='phone'}
{$label}{if $required} *{/if} :
{/form_field} {form_field field='cellphone'}
{$label}{if $required} *{/if} :
{/form_field} {/loop}

{intl l="Other addresses"}

{ifloop rel="address"}

{intl l="Address"} | {intl l="Actions"}
--- | ---
{loop name="address" type="address" customer="$customer_id" backend_context="1" default="0"}
{$LABEL} |
{/loop}

{/ifloop} {elseloop rel="address"}
{intl l="This customer has not defined any delivery address"}
{/elseloop}
{/form}
{intl l="orders for this customer"}

{intl l="Order n°"} | {intl l="Date & Hour"} | {intl l="Amount"} | {intl l="Status"} {hook name="customer.orders-table-header" location="orders_table_header" customer_id=$customer_id }
--- | --- | --- | ---
{loop type="order" name="order-list" customer="{$customer_id}" backend_context="1" status='*' page={$page_order} limit={config key="number_default_results_per_page.order_list" default=20}} {loop type="order-status" name="order-status" id=$STATUS} {assign "orderStatus" $TITLE} {assign "orderStatusLabel" "order_$CODE"} {/loop}
{$REF} | {format_date date=$CREATE_DATE} | {format_money number=$TOTAL_TAXED_AMOUNT} | {$orderStatus} {hook name="customer.orders-table-row" location="orders_table_row" customer_id=$customer_id order_id=$ID}
{/loop} {elseloop rel="order-list"}
{intl l="No orders fo this customer."}
{/elseloop}
{include file = "includes/pagination.html" page_param_name = "order_page" loop_ref = "order-list" max_page_count = 10 page_url = {url path="/admin/customer/update" customer_id=$customer_id page=$page} page_param_name = "page_order" }

{hook name="customer.edit" location="customer-edit" customer_id=$customer_id} {hook name="customer-edit.bottom" customer_id=$customer_id} {/loop} {elseloop rel="customer_edit"}
{intl l="Sorry, customer ID=%id was not found." id={$customer_id}}
{/elseloop}
{* -- Add an Address -------------------------------------------------------- *} {form name="thelia.admin.address.create"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "address_creation_dialog"} {include file='includes/customer_address_form_fields.html' customer_id=$customer_id page=$page dialog_type="new"} {hook name="customer.address-create-form" location="customer_address_create_form" customer_id=$customer_id page=$page} {/capture} {include file = "includes/generic-create-dialog.html" dialog_id = "address_creation_dialog" dialog_title = {intl l="Create a customer address"} dialog_body = {$smarty.capture.address_creation_dialog nofilter} dialog_ok_label = {intl l="Create this address"} dialog_cancel_label = {intl l="Cancel"} form_action = {url path='/admin/address/create'} form_enctype = {form_enctype} form_error_message = $form_error_message } {/form} {* -- Update an Address ----------------------------------------------------- *} {if $address_id > 0} {form name="thelia.admin.address.update"} {* Capture the dialog body, to pass it to the generic dialog *} {capture "address_update_dialog"} {include file='includes/customer_address_form_fields.html' customer_id=$customer_id page=$page dialog_type="update"} {hook name="customer.address-update-form" location="customer_address_update_form" customer_id=$customer_id page=$page} {/capture} {include file = "includes/generic-create-dialog.html" dialog_id = "address_update_dialog" dialog_title = {intl l="Edit a customer address"} dialog_body = {$smarty.capture.address_update_dialog nofilter} dialog_ok_label = {intl l="Save this address"} dialog_cancel_label = {intl l="Cancel"} form_action = {url path="/admin/address/save"} form_enctype = {form_enctype} form_error_message = $form_error_message } {/form} {/if} {* -- Confirm making an address the default --------------------------------- *} {capture "use_address_dialog"} {/capture} {include file = "includes/generic-confirm-dialog.html" dialog_id = "use_address_dialog" dialog_title = {intl l="Use address by default"} dialog_message = {intl l="Do you really want to use this address by default ?"} form_action = {url path='/admin/address/use'} form_content = {$smarty.capture.use_address_dialog nofilter} } {* -- Delete confirmation dialog -------------------------------------------- *} {capture "delete_address_dialog"} {hook name="customer.address-delete-form" location="customer_address_delete_form" customer_id=$customer_id page=$page} {/capture} {include file = "includes/generic-confirm-dialog.html" dialog_id = "delete_address_dialog" dialog_title = {intl l="Delete address"} dialog_message = {intl l="Do you really want to delete this address ?"} form_action = {token_url path='/admin/address/delete'} form_content = {$smarty.capture.delete_address_dialog nofilter} } {/block} {block name="javascript-initialization"} {javascripts file='assets/js/thelia-states.js'}
{/javascripts}
{/block} {block name="javascript-last-call"} {hook name="customer.edit-js" location="customer-edit-js" customer_id=$customer_id} {/block}