Restored initial version

This commit is contained in:
Franck Allimant
2014-04-18 20:15:30 +02:00
parent 069211315d
commit 6ba5d6e925

View File

@@ -1,368 +1,390 @@
{extends file="admin-layout.tpl"} {extends file="admin-layout.tpl"}
{block name="page-title"}{intl l='Customer'}{/block} {block name="page-title"}{intl l='Customer'}{/block}
{block name="check-resource"}admin.customer{/block} {block name="check-resource"}admin.customer{/block}
{block name="check-access"}view{/block} {block name="check-access"}view{/block}
{block name="main-content"} {block name="main-content"}
<div class="customer"> <div class="customer">
<div id="wrapper" class="container"> <div id="wrapper" class="container">
<ul class="breadcrumb"> <ul class="breadcrumb">
<li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li> <li><a href="{url path='/admin/home'}">{intl l="Home"}</a></li>
<li><a href="{url path='/admin/customers'}">{intl l="Customers"}</a></li> <li><a href="{url path='/admin/customers'}">{intl l="Customers"}</a></li>
</ul> </ul>
{module_include location='customer_top'} {module_include location='customer_top'}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="general-block-decorator"> <div class="general-block-decorator">
{if $removal_error } {if $removal_error }
<div class="alert alert-danger fade in"> <div class="alert alert-danger fade in">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<h4 class="modal-title">{$error_message}</h4> <h4 class="modal-title">{$error_message}</h4>
</div> </div>
{/if} {/if}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-condensed" id="customer_list"> <table class="table table-striped table-condensed" id="customer_list">
<caption> <caption>
{intl l="Customers list"} {intl l="Customers list"}
{module_include location='customer_list_caption'} {module_include location='customer_list_caption'}
{loop type="auth" name="can_create" role="ADMIN" resource="admin.customer" access="CREATE"} {loop type="auth" name="can_create" role="ADMIN" resource="admin.customer" access="CREATE"}
<a class="btn btn-default btn-primary action-btn" title="{intl l='Add a new Customer'}" href="#add_customer_dialog" data-toggle="modal"> <a class="btn btn-default 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> <span class="glyphicon glyphicon-plus-sign"></span>
</a> </a>
{/loop} {/loop}
</caption> </caption>
{ifloop rel="customer_list"} {ifloop rel="customer_list"}
<thead> <thead>
<tr> <tr>
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
current_order=$customer_order current_order=$customer_order
order='reference' order='reference'
reverse_order='reference_reverse' reverse_order='reference_reverse'
path={url path='/admin/customers'} path={url path='/admin/customers'}
request_parameter_name='customer_order' request_parameter_name='customer_order'
label="{intl l='Reference'}" label="{intl l='Reference'}"
} }
</th> </th>
{module_include location='customer_list_header'} {module_include location='customer_list_header'}
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
current_order=$customer_order current_order=$customer_order
order='lastname' order='lastname'
reverse_order='lastname_reverse' reverse_order='lastname_reverse'
path={url path='/admin/customers'} path={url path='/admin/customers'}
request_parameter_name='customer_order' request_parameter_name='customer_order'
label="{intl l='Last name'}" label="{intl l='Last name'}"
} }
</th> </th>
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
current_order=$customer_order current_order=$customer_order
order='firstname' order='firstname'
reverse_order='firstname_reverse' reverse_order='firstname_reverse'
path={url path='/admin/customers'} path={url path='/admin/customers'}
request_parameter_name='customer_order' request_parameter_name='customer_order'
label="{intl l='First name'}" label="{intl l='First name'}"
} }
</th> </th>
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
current_order=$customer_order current_order=$customer_order
order='registration_date' order='registration_date'
reverse_order='registration_date_reverse' reverse_order='registration_date_reverse'
path={url path='/admin/customers'} path={url path='/admin/customers'}
request_parameter_name='customer_order' request_parameter_name='customer_order'
label="{intl l='Registration date'}" label="{intl l='Registration date'}"
} }
</th> </th>
<th class="object-title">{intl l='Date of last order'}</th> <th class="object-title">{intl l='Date of last order'}</th>
<th class="object-title">{intl l='Last order amount'}</th> <th class="object-title">{intl l='Last order amount'}</th>
{* TODO {* TODO
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
current_order=$customer_order current_order=$customer_order
order='last_order' order='last_order'
reverse_order='last_order_reverse' reverse_order='last_order_reverse'
path={url path='/admin/customers'} path={url path='/admin/customers'}
request_parameter_name='customer_order' request_parameter_name='customer_order'
label="{intl l='Date of last order'}" label="{intl l='Date of last order'}"
} }
</th> </th>
<th class="object-title"> <th class="object-title">
{admin_sortable_header {admin_sortable_header
current_order=$customer_order current_order=$customer_order
order='order_amount' order='order_amount'
reverse_order='order_amount_reverse' reverse_order='order_amount_reverse'
path={url path='/admin/customers'} path={url path='/admin/customers'}
request_parameter_name='customer_order' request_parameter_name='customer_order'
label="{intl l='Last order amount'}" label="{intl l='Last order amount'}"
} }
</th> </th>
*} *}
<th class="actions">{intl l='Actions'}</th> <th class="actions">{intl l='Actions'}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{loop name="customer_list" type="customer" current="false" visible="*" order=$customer_order backend_context="1" page=$page limit=#max_displayed_customers#} {loop name="customer_list" type="customer" current="false" visible="*" order=$customer_order backend_context="1" page=$page limit=$display_customer}
{assign "lastOrderDate" ''} {assign "lastOrderDate" ''}
{assign "lastOrderAmount" ''} {assign "lastOrderAmount" ''}
{assign "lastOrderCurrency" ''} {assign "lastOrderCurrency" ''}
{loop type="order" name="last-order" customer=$ID order="create-date-reverse" limit="1"} {loop type="order" name="last-order" customer=$ID order="create-date-reverse" limit="1"}
{assign "lastOrderDate" "{format_date date=$CREATE_DATE}"} {assign "lastOrderDate" "{format_date date=$CREATE_DATE}"}
{assign "lastOrderAmount" "{format_number number=$TOTAL_TAXED_AMOUNT}"} {assign "lastOrderAmount" "{format_number number=$TOTAL_TAXED_AMOUNT}"}
{loop type="currency" name="order-currency" id=$CURRENCY} {loop type="currency" name="order-currency" id=$CURRENCY}
{assign "lastOrderCurrency" $SYMBOL} {assign "lastOrderCurrency" $SYMBOL}
{/loop} {/loop}
{/loop} {/loop}
<tr> <tr>
<td><a href="{url path="/admin/customer/update" customer_id=$ID page=$page}">{$REF}</a></td> <td><a href="{url path="/admin/customer/update" customer_id=$ID page=$page}">{$REF}</a></td>
<td class="object-title"> <td class="object-title">
{$LASTNAME} {$LASTNAME}
</td> </td>
<td class="object-title"> <td class="object-title">
{$FIRSTNAME} {$FIRSTNAME}
</td> </td>
{module_include location='customer_list_row'} {module_include location='customer_list_row'}
<td> <td>
{format_date date=$CREATE_DATE} {format_date date=$CREATE_DATE}
</td> </td>
<td> <td>
{$lastOrderDate} {$lastOrderDate}
</td> </td>
<td> <td>
{$lastOrderCurrency} {$lastOrderAmount} {$lastOrderCurrency} {$lastOrderAmount}
</td> </td>
<td class="actions"> <td class="actions">
<div class="btn-group"> <div class="btn-group">
{loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"} {loop type="auth" name="can_change" role="ADMIN" resource="admin.customer" access="UPDATE"}
<a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path='/admin/customer/update' customer_id=$ID page=$page}"><i class="glyphicon glyphicon-edit"></i></a> <a class="btn btn-default btn-xs" title="{intl l='Edit this customer'}" href="{url path='/admin/customer/update' customer_id=$ID page=$page}"><i class="glyphicon glyphicon-edit"></i></a>
{/loop} {/loop}
{loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"} {loop type="auth" name="can_send_mail" role="ADMIN" resource="admin.customer" access="VIEW"}
<a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a> <a class="btn btn-default btn-xs" title="{intl l="Send a mail to this customer"}" href="mailto:{$EMAIL}"><span class="glyphicon glyphicon-envelope"></span></a>
{/loop} {/loop}
{loop type="auth" name="can_delete" role="ADMIN" resource="admin.customer" access="DELETE"} {loop type="auth" name="can_delete" role="ADMIN" resource="admin.customer" access="DELETE"}
<a class="btn btn-default btn-xs 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> <a class="btn btn-default btn-xs 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>
{/loop} {/loop}
</div> </div>
</td> </td>
</tr> </tr>
{/loop} {/loop}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="6"> <td colspan="6">
{include
file = "includes/pagination.html" <div class="text-center">
<ul class="pagination pagination-centered">
loop_ref = "customer_list"
max_page_count = 10 {if $page != 1}
page_url = "{url path="/admin/customers" customer_order=$customer_order}" <li><a href="{url path="/admin/customers" page="1"}">&laquo;</a></li>
} {/if}
</td> {pageloop rel="customer_list" numPage="20"}
</tr> {if $PAGE == $CURRENT && $PAGE > 2}
</tfoot> <li><a href="{url path="/admin/customers" page=$PREV}">&lsaquo;</a></li>
{/ifloop} {/if}
</table>
</div> {if $PAGE != $CURRENT}
</div> <li><a href="{url path="/admin/customers" page="{$PAGE}"}">{$PAGE}</a></li>
</div>
</div> {else}
<li class="active"><a href="#">{$PAGE}</a></li>
{/if}
{module_include location='customer_bottom'}
{if $PAGE == $END && $PAGE < $LAST}
{* Adding a new Category *} <li><a href="{url path="/admin/customers" page=$NEXT}">&rsaquo;</a></li>
{/if}
{/pageloop}
{form name="thelia.admin.customer.create"} {if $LAST > $CURRENT}
<li><a href="{url path="/admin/customers" page="$LAST"}">&raquo;</a></li>
{* Capture the dialog body, to pass it to the generic dialog *} {/if}
{capture "customer_creation_dialog"} </ul>
</div>
{form_hidden_fields form=$form}
</td>
{form_field form=$form field='success_url'} </tr>
{* on success, redirect to the edition page, _ID_ is replaced with the created object ID, see controller *} </tfoot>
<input type="hidden" name="{$name}" value="{url path='/admin/customer/update' customer_id='_ID_'}" /> {/ifloop}
{/form_field} </table>
</div>
{form_field form=$form field="password"} </div>
<input type="hidden" name="{$name}" value="random" /> </div>
{/form_field} </div>
{form_field form=$form field="password_confirm"}
<input type="hidden" name="{$name}" value="random" /> {module_include location='customer_bottom'}
{/form_field}
{* Adding a new Category *}
{form_field form=$form field="agreed"}
<input type="hidden" name="{$name}" value="on" />
{/form_field} {form name="thelia.admin.customer.create"}
{form_field form=$form field='company'} {* Capture the dialog body, to pass it to the generic dialog *}
<div class="form-group {if $error}has-error{/if}"> {capture "customer_creation_dialog"}
<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'}"> {form_hidden_fields form=$form}
</div>
{/form_field} {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=$form field='title'} <input type="hidden" name="{$name}" value="{url path='/admin/customer/update' customer_id='_ID_'}" />
<div class="form-group {if $error}has-error{/if}"> {/form_field}
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
{form_field form=$form field="password"}
<select name="{$name}" id="{$label_attr.for}" class="form-control"> <input type="hidden" name="{$name}" value="random" />
{loop type="title" name="title1"} {/form_field}
<option value="{$ID}">{$LONG}</option>
{/loop} {form_field form=$form field="password_confirm"}
</select> <input type="hidden" name="{$name}" value="random" />
</div> {/form_field}
{/form_field}
{form_field form=$form field="agreed"}
{form_field form=$form field='firstname'} <input type="hidden" name="{$name}" value="on" />
<div class="form-group {if $error}has-error{/if}"> {/form_field}
<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'}"> {form_field form=$form field='company'}
</div> <div class="form-group {if $error}has-error{/if}">
{/form_field} <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'}">
{form_field form=$form field='lastname'} </div>
<div class="form-group {if $error}has-error{/if}"> {/form_field}
<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'}"> {form_field form=$form field='title'}
</div> <div class="form-group {if $error}has-error{/if}">
{/form_field} <label for="{$label_attr.for}" class="control-label">{$label} : </label>
{form_field form=$form field='address1'} <select name="{$name}" id="{$label_attr.for}" class="form-control">
<div class="form-group {if $error}has-error{/if}"> {loop type="title" name="title1"}
<label for="{$label_attr.for}" class="control-label">{$label} : </label> <option value="{$ID}">{$LONG}</option>
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Address'}"> {/loop}
</div> </select>
</div>
<div class="form-group"> {/form_field}
{form_field form=$form 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 form=$form field='firstname'}
{/form_field} <div class="form-group {if $error}has-error{/if}">
</div> <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 class="form-group"> </div>
{form_field form=$form field='address3'} {/form_field}
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
{/form_field} {form_field form=$form field='lastname'}
</div> <div class="form-group {if $error}has-error{/if}">
{/form_field} <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'}">
{form_field form=$form field='zipcode'} </div>
<div class="form-group {if $error}has-error{/if}"> {/form_field}
<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'}"> {form_field form=$form field='address1'}
</div> <div class="form-group {if $error}has-error{/if}">
{/form_field} <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'}">
{form_field form=$form field='city'} </div>
<div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label> <div class="form-group">
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}"> {form_field form=$form field='address2'}
</div> <input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
{/form_field} {/form_field}
</div>
{form_field form=$form field='country'}
<div class="form-group {if $error}has-error{/if}"> <div class="form-group">
<label for="{$label_attr.for}" class="control-label">{$label} : </label> {form_field form=$form field='address3'}
<select name="{$name}" id="{$label_attr.for}" class="form-control"> <input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Additional address'}">
{loop type="country" name="country1"} {/form_field}
<option value="{$ID}">{$TITLE}</option> </div>
{/loop} {/form_field}
</select>
</div> {form_field form=$form field='zipcode'}
{/form_field} <div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
{form_field form=$form field='email'} <input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Zip code'}">
<div class="form-group {if $error}has-error{/if}"> </div>
<label for="{$label_attr.for}" class="control-label">{$label} : </label> {/form_field}
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Email address'}">
</div> {form_field form=$form field='city'}
{/form_field} <div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
{module_include location='customer_create_form'} <input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='City'}">
</div>
{/capture} {/form_field}
{include {form_field form=$form field='country'}
file = "includes/generic-create-dialog.html" <div class="form-group {if $error}has-error{/if}">
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
dialog_id = "add_customer_dialog" <select name="{$name}" id="{$label_attr.for}" class="form-control">
dialog_title = {intl l="Create a new customer"} {loop type="country" name="country1"}
dialog_body = {$smarty.capture.customer_creation_dialog nofilter} <option value="{$ID}">{$TITLE}</option>
{/loop}
dialog_ok_label = {intl l="Create this customer"} </select>
dialog_cancel_label = {intl l="Cancel"} </div>
{/form_field}
form_action = {url path='/admin/customer/create'}
form_enctype = {form_enctype form=$form} {form_field form=$form field='email'}
form_error_message = $form_error_message <div class="form-group {if $error}has-error{/if}">
} <label for="{$label_attr.for}" class="control-label">{$label} : </label>
{/form} <input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{$label}" placeholder="{intl l='Email address'}">
</div>
{* Delete confirmation dialog *} {/form_field}
{capture "delete_customer_dialog"} {module_include location='customer_create_form'}
<input type="hidden" name="page" value="{$page}">
<input type="hidden" name="customer_id" id="delete_customer_id"> {/capture}
{module_include location='customer_delete_form'} {include
{/capture} file = "includes/generic-create-dialog.html"
{include dialog_id = "add_customer_dialog"
file = "includes/generic-confirm-dialog.html" dialog_title = {intl l="Create a new customer"}
dialog_body = {$smarty.capture.customer_creation_dialog nofilter}
dialog_id = "delete_customer_dialog"
dialog_title = {intl l="Delete customer"} dialog_ok_label = {intl l="Create this customer"}
dialog_message = {intl l="Do you really want to delete this customer ?"} dialog_cancel_label = {intl l="Cancel"}
form_action = {url path='/admin/customer/delete'} form_action = {url path='/admin/customer/create'}
form_content = {$smarty.capture.delete_customer_dialog nofilter} form_enctype = {form_enctype form=$form}
form_id = "form_delete_customer" form_error_message = $form_error_message
} }
{/form}
{/block}
{* Delete confirmation dialog *}
{block name="javascript-initialization"}
{capture "delete_customer_dialog"}
<script type="text/javascript"> <input type="hidden" name="page" value="{$page}">
$(".customer-delete").click(function(){ <input type="hidden" name="customer_id" id="delete_customer_id">
$("#delete_customer_id").val($(this).attr("data-id"));
}); {module_include location='customer_delete_form'}
</script> {/capture}
{/block} {include
file = "includes/generic-confirm-dialog.html"
{block name="javascript-last-call"}
{module_include location='customers-js'} 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 = {url path='/admin/customer/delete'}
form_content = {$smarty.capture.delete_customer_dialog nofilter}
form_id = "form_delete_customer"
}
{/block}
{block name="javascript-initialization"}
<script type="text/javascript">
$(".customer-delete").click(function(){
$("#delete_customer_id").val($(this).attr("data-id"));
});
</script>
{/block}
{block name="javascript-last-call"}
{module_include location='customers-js'}
{/block} {/block}