454 lines
24 KiB
HTML
454 lines
24 KiB
HTML
{extends file="admin-layout.tpl"}
|
|
|
|
{block name="no-return-functions"}
|
|
{$admin_current_location = 'customer'}
|
|
{/block}
|
|
|
|
{block name="page-title"}{intl l='Customer'}{/block}
|
|
|
|
{block name="check-resource"}admin.customer{/block}
|
|
{block name="check-access"}view{/block}
|
|
|
|
{block name="main-content"}
|
|
<div class="customer">
|
|
<div id="wrapper" class="container">
|
|
|
|
<ul class="breadcrumb">
|
|
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
|
|
<li><a href="{url path='/admin/customers'}">{intl l="Customers"}</a></li>
|
|
</ul>
|
|
|
|
{hook name="customer.top" location="customer_top" }
|
|
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="general-block-decorator">
|
|
{if $removal_error }
|
|
<div class="alert alert-danger">
|
|
{$error_message}
|
|
</div>
|
|
{/if}
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-condensed" id="customer_list">
|
|
<caption>
|
|
{intl l="Customers list"}
|
|
|
|
{hook name="customers.caption" location="customer_list_caption" }
|
|
|
|
{loop type="auth" name="can_create" role="ADMIN" resource="admin.customer" access="CREATE"}
|
|
<a class="btn btn-primary action-btn" title="{intl l='Add a new Customer'}" href="#add_customer_dialog" data-toggle="modal">
|
|
<span class="glyphicon glyphicon-plus-sign"></span>
|
|
</a>
|
|
{/loop}
|
|
</caption>
|
|
|
|
{ifloop rel="customer_list"}
|
|
<thead>
|
|
<tr>
|
|
<th class="object-title">
|
|
{admin_sortable_header
|
|
current_order=$customer_order
|
|
order='reference'
|
|
reverse_order='reference_reverse'
|
|
path={url path='/admin/customers'}
|
|
request_parameter_name='customer_order'
|
|
label="{intl l='Reference'}"
|
|
}
|
|
</th>
|
|
|
|
<th class="object-title">
|
|
{admin_sortable_header
|
|
current_order=$customer_order
|
|
order='lastname'
|
|
reverse_order='lastname_reverse'
|
|
path={url path='/admin/customers'}
|
|
request_parameter_name='customer_order'
|
|
label="{intl l='Last name'}"
|
|
}
|
|
</th>
|
|
|
|
<th class="object-title">
|
|
{admin_sortable_header
|
|
current_order=$customer_order
|
|
order='firstname'
|
|
reverse_order='firstname_reverse'
|
|
path={url path='/admin/customers'}
|
|
request_parameter_name='customer_order'
|
|
label="{intl l='First name'}"
|
|
}
|
|
</th>
|
|
|
|
<th>Société</th>
|
|
|
|
{hook name="customers.header" location="customer_list_header" }
|
|
|
|
<th class="object-title">
|
|
{admin_sortable_header
|
|
current_order=$customer_order
|
|
order='registration_date'
|
|
reverse_order='registration_date_reverse'
|
|
path={url path='/admin/customers'}
|
|
request_parameter_name='customer_order'
|
|
label="{intl l='Registration date'}"
|
|
}
|
|
</th>
|
|
|
|
<th class="object-title">{intl l='Date of last order'}</th>
|
|
<th class="object-title">{intl l='Last order amount'}</th>
|
|
|
|
{* TODO
|
|
<th class="object-title">
|
|
{admin_sortable_header
|
|
current_order=$customer_order
|
|
order='last_order'
|
|
reverse_order='last_order_reverse'
|
|
path={url path='/admin/customers'}
|
|
request_parameter_name='customer_order'
|
|
label="{intl l='Date of last order'}"
|
|
}
|
|
</th>
|
|
|
|
<th class="object-title">
|
|
{admin_sortable_header
|
|
current_order=$customer_order
|
|
order='order_amount'
|
|
reverse_order='order_amount_reverse'
|
|
path={url path='/admin/customers'}
|
|
request_parameter_name='customer_order'
|
|
label="{intl l='Last order amount'}"
|
|
}
|
|
</th>
|
|
*}
|
|
<th class="actions">{intl l='Actions'}</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{loop name="customer_list" type="customer" current="false" visible="*" order=$customer_order backend_context="1" page=$page limit={config key="number_default_results_per_page.customer_list" default=20} search_term=$search search_in="ref,firstname,lastname,email"}
|
|
{$lastOrderDate = ''}
|
|
{$lastOrderAmount = ''}
|
|
{$lastOrderCurrency = ''}
|
|
{$hasOrders = false}
|
|
|
|
{loop type="order" name="last-order" customer=$ID order="create-date-reverse" limit="1"}
|
|
{$lastOrderDate = {format_date date=$CREATE_DATE}}
|
|
{$lastOrderAmount = {format_number number=$TOTAL_TAXED_AMOUNT}}
|
|
{loop type="currency" name="order-currency" id=$CURRENCY}
|
|
{$lastOrderCurrency = $SYMBOL}
|
|
{$hasOrders = true}
|
|
{/loop}
|
|
{/loop}
|
|
|
|
<tr>
|
|
<td><a href="{url path="/admin/customer/update" customer_id=$ID page=$page}">{$REF}</a></td>
|
|
|
|
<td class="object-title">
|
|
{$LASTNAME}
|
|
</td>
|
|
|
|
<td class="object-title">
|
|
{$FIRSTNAME}
|
|
</td>
|
|
|
|
<td class="object-title">
|
|
{loop type="address" name="def" customer=$ID default=1}
|
|
{$COMPANY}
|
|
{/loop}
|
|
</td>
|
|
|
|
|
|
{hook name="customers.row" location="customer_list_row" customer_id={$ID}}
|
|
|
|
<td>
|
|
{format_date date=$CREATE_DATE}
|
|
</td>
|
|
|
|
<td>
|
|
{$lastOrderDate}
|
|
</td>
|
|
|
|
<td>
|
|
{$lastOrderCurrency} {$lastOrderAmount}
|
|
</td>
|
|
<td class="actions">
|
|
<div class="btn-toolbar btn toolbar-primary">
|
|
<span class="glyphicon glyphicon-cog"></span>
|
|
</div>
|
|
<div class="toolbar-options hidden">
|
|
{loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"}
|
|
<a title="{intl l='Edit this customer'}" href="{url path='/admin/customer/update' customer_id=$ID page=$page}"><span class="glyphicon glyphicon-edit"></span></a>
|
|
{/loop}
|
|
{loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"}
|
|
<a title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
|
|
{/loop}
|
|
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.customer" access="DELETE"}
|
|
{if $hasOrders}
|
|
<a class="disabled" title="{intl l='This customer has orders, and can\'t be deleted.'}" href="#"><span class="glyphicon glyphicon-question-sign"></span></a>
|
|
{else}
|
|
<a class="customer-delete" title="{intl l='Delete this customer and all his orders'}" href="#delete_customer_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
|
|
{/if}
|
|
{/loop}
|
|
</div>
|
|
</td>
|
|
|
|
</tr>
|
|
{/loop}
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td colspan="100">
|
|
{include
|
|
file = "includes/pagination.html"
|
|
|
|
loop_ref = "customer_list"
|
|
max_page_count = 10
|
|
page_url = {url path="/admin/customers" search_term=$search search_in="ref,firstname,lastname,email" customer_order=$customer_order}
|
|
}
|
|
|
|
</td>
|
|
</tr>
|
|
</tfoot>
|
|
{/ifloop}
|
|
|
|
{elseloop rel="customer_list"}
|
|
<tr>
|
|
<td colspan="7">
|
|
<div class="alert alert-info">
|
|
{intl l='You have no registred customers for the moment.'}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{/elseloop}
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
{hook name="customer.bottom" location="customer_bottom" }
|
|
</div>
|
|
</div>
|
|
|
|
{* Adding a new Category *}
|
|
|
|
|
|
{form name="thelia.admin.customer.create"}
|
|
|
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
|
{capture "customer_creation_dialog"}
|
|
|
|
{form_hidden_fields}
|
|
|
|
{form_field field='success_url'}
|
|
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *}
|
|
<input type="hidden" name="{$name}" value="{url path='/admin/customer/update' customer_id='_ID_'}" />
|
|
{/form_field}
|
|
|
|
{*
|
|
We use "dummmy-password" here, because the creation form is common to back & front, and that we need a
|
|
valid password. This is just a workaround.
|
|
The password will be forced to a more secure value in the CustomerController.
|
|
*}
|
|
|
|
|
|
{form_field field="password"}
|
|
<input type="hidden" name="{$name}" value="dummmy-password" />
|
|
{/form_field}
|
|
|
|
{form_field field="password_confirm"}
|
|
<input type="hidden" name="{$name}" value="dummmy-password" />
|
|
{/form_field}
|
|
|
|
{form_field field='company'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Company'}">
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field='title'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
|
|
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
|
{loop type="title" name="title1"}
|
|
<option value="{$ID}">{$LONG}</option>
|
|
{/loop}
|
|
</select>
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field='firstname'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Firstname'}">
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field='lastname'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Lastname'}">
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field='address1'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Address'}">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{form_field field='address2'}
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
|
{/form_field}
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
{form_field field='address3'}
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
|
|
{/form_field}
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field='zipcode'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Zip code'}">
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field='city'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}">
|
|
</div>
|
|
{/form_field}
|
|
|
|
{form_field field="country"}
|
|
{$countryFieldId=$label_attr.for}
|
|
<div class="form-group group-country{if $error} has-error{/if}">
|
|
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
|
|
<div class="control-input">
|
|
<select name="{$name}" id="{$label_attr.for}" class="form-control"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
|
|
<option value="">-- {intl l="Select Country"} --</option>
|
|
{loop type="country" name="country.list"}
|
|
<option value="{$ID}"
|
|
{if $value != ""}
|
|
{if $value == $ID}selected{/if}
|
|
{else}
|
|
{if $IS_DEFAULT}selected{/if}
|
|
{/if}
|
|
|
|
>{$TITLE}</option>
|
|
{/loop}
|
|
</select>
|
|
{if $error }
|
|
<span class="help-block">{$message}</span>
|
|
{assign var="error_focus" value="true"}
|
|
{/if}
|
|
</div>
|
|
</div><!--/.form-group-->
|
|
{/form_field}
|
|
|
|
{form_field field="state"}
|
|
<div class="form-group group-state{if $error} has-error{/if}">
|
|
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
|
|
<div class="control-input">
|
|
<select name="{$name}" id="{$label_attr.for}"
|
|
data-thelia-state="1" data-thelia-country="#{$countryFieldId}" data-thelia-toggle=".group-state"
|
|
class="form-control"{if !isset($error_focus) && $error} autofocus{/if}>
|
|
<option value="">-- {intl l="Select State"} --</option>
|
|
{loop type="state" name="state.list"}
|
|
<option value="{$ID}" data-country="{$COUNTRY}"
|
|
{if $value != ""}
|
|
{if $value == $ID}selected{/if}
|
|
{/if}
|
|
>{$TITLE}</option>
|
|
{/loop}
|
|
</select>
|
|
{if $error }
|
|
<span class="help-block">{$message}</span>
|
|
{assign var="error_focus" value="true"}
|
|
{/if}
|
|
</div>
|
|
</div><!--/.form-group-->
|
|
{/form_field}
|
|
|
|
{form_field field='email'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Email address'}">
|
|
</div>
|
|
{/form_field}
|
|
{if {config key="customer_confirm_email"}}
|
|
{form_field field='email_confirm'}
|
|
<div class="form-group {if $error}has-error{/if}">
|
|
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Email confirmation address'}">
|
|
</div>
|
|
{/form_field}
|
|
{/if}
|
|
|
|
{hook name="customer.create-form" location="customer_create_form" }
|
|
|
|
{/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_error_message = $form_error_message
|
|
}
|
|
{/form}
|
|
|
|
{* Delete confirmation dialog *}
|
|
|
|
{capture "delete_customer_dialog"}
|
|
<input type="hidden" name="page" value="{$page}">
|
|
<input type="hidden" name="customer_id" id="delete_customer_id">
|
|
|
|
{hook name="customer.delete-form" location="customer_delete_form" }
|
|
{/capture}
|
|
|
|
{include
|
|
file = "includes/generic-confirm-dialog.html"
|
|
|
|
dialog_id = "delete_customer_dialog"
|
|
dialog_title = {intl l="Delete customer"}
|
|
dialog_message = {intl l="Do you really want to delete this customer ?"}
|
|
|
|
form_action = {token_url path='/admin/customer/delete'}
|
|
form_content = {$smarty.capture.delete_customer_dialog nofilter}
|
|
form_id = "form_delete_customer"
|
|
}
|
|
|
|
{/block}
|
|
|
|
{block name="javascript-initialization"}
|
|
|
|
{javascripts file='assets/js/thelia-states.js'}
|
|
<script src="{$asset_url}"></script>
|
|
{/javascripts}
|
|
|
|
<script type="text/javascript">
|
|
$(".customer-delete").click(function(){
|
|
$("#delete_customer_id").val($(this).attr("data-id"));
|
|
});
|
|
</script>
|
|
|
|
{/block}
|
|
|
|
{block name="javascript-last-call"}
|
|
{hook name="customers.js" location="customers-js" }
|
|
{/block}
|