- Change boolean type to integer type for update_logged_in_user field
- Create view for customer modification
This commit is contained in:
@@ -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"
|
||||
)
|
||||
))
|
||||
;
|
||||
}
|
||||
|
||||
152
templates/admin/default/customer-edit.html
Normal file
152
templates/admin/default/customer-edit.html
Normal file
@@ -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"}
|
||||
<div class="customers edit-customer">
|
||||
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
{loop name="customer_edit" type="customer" current="false" id="$customer_id" backend_context="1" lang="$edit_language_id"}
|
||||
|
||||
<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>
|
||||
<li>{intl l='Editing customer "%name"' name="{$FIRSTNAME} {$LASTNAME}"}</li>
|
||||
</ul>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 general-block-decorator">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl l="Edit customer $FIRSTNAME $LASTNAME"}
|
||||
</div>
|
||||
|
||||
<div class="form-container">
|
||||
<div class="col-md-12">
|
||||
|
||||
{form name="thelia.customer.modification"}
|
||||
<form method="POST" action="{url path='/admin/customers/save'}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{* Be sure to get the customer ID, even if the form could not be validated *}
|
||||
<input type="hidden" name="customer_id" value="{$customer_id}" />
|
||||
|
||||
{include file="includes/inner-form-toolbar.html"}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customers'}" />
|
||||
{/form_field}
|
||||
|
||||
{if $form_error}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$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 form=$form field='firstname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$FIRSTNAME}" title="{intl l="{$label}"}" placeholder="{intl l='Firstname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='lastname'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$LASTNAME}" title="{intl l="{$label}"}" placeholder="{intl l='Lastname'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
{loop name="address" type="address" customer="$customer_id" backend_context="1"}
|
||||
|
||||
{form_field form=$form field='address1'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS1}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address2'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS2}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='address3'}
|
||||
<div class="form-group">
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ADDRESS3}" title="{intl l="{$label}"}" placeholder="{intl l='Additional address'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='zipcode'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$ZIPCODE}" title="{intl l="{$label}"}" placeholder="{intl l='Zip code'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='city'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$CITY}" title="{intl l="{$label}"}" placeholder="{intl l='City'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='country'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
||||
{loop type="country" name="country1"}
|
||||
<option value="{$ID}">{$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{/loop}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="customer_edit"}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-error">
|
||||
{intl l="Sorry, customer ID=$customer_id was not found."}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
@@ -9,7 +9,7 @@
|
||||
{assign var=customer_page value={$smarty.get.page|default:1}}
|
||||
|
||||
|
||||
<div class="catalog">
|
||||
<div class="customer">
|
||||
<div id="wrapper" class="container">
|
||||
|
||||
|
||||
@@ -150,7 +150,13 @@
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin/customer/update/_ID_'}" />
|
||||
{/form_field}
|
||||
|
||||
|
||||
{form_field form=$form field='company'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Company'}">
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='title'}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||
|
||||
Reference in New Issue
Block a user