start creating ajax loader for address update event
This commit is contained in:
@@ -126,7 +126,7 @@
|
|||||||
<!-- address management -->
|
<!-- address management -->
|
||||||
|
|
||||||
<route id="admin.address.delete" path="/admin/address/delete" methods="post">
|
<route id="admin.address.delete" path="/admin/address/delete" methods="post">
|
||||||
<default key="_controller">Thelia\Controller\Admin\AddressController::deleteAddressAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AddressController::deleteAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<route id="admin.address.makeItDefault" path="/admin/address/use" methods="post">
|
<route id="admin.address.makeItDefault" path="/admin/address/use" methods="post">
|
||||||
@@ -137,6 +137,11 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\AddressController::createAction</default>
|
<default key="_controller">Thelia\Controller\Admin\AddressController::createAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.address.update.view" path="/admin/address/update/{address_id}">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\AddressController::updateAction</default>
|
||||||
|
<requirement key="address_id">\d+</requirement>
|
||||||
|
</route>
|
||||||
|
|
||||||
<!-- end address management -->
|
<!-- end address management -->
|
||||||
|
|
||||||
<!-- order management -->
|
<!-- order management -->
|
||||||
|
|||||||
@@ -22,9 +22,14 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
use Thelia\Core\Event\Address\AddressCreateOrUpdateEvent;
|
||||||
use Thelia\Core\Event\Address\AddressEvent;
|
use Thelia\Core\Event\Address\AddressEvent;
|
||||||
|
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
|
use Thelia\Form\AddressCreateForm;
|
||||||
|
use Thelia\Form\AddressUpdateForm;
|
||||||
use Thelia\Model\AddressQuery;
|
use Thelia\Model\AddressQuery;
|
||||||
|
use Thelia\Model\CustomerQuery;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,9 +37,30 @@ use Thelia\Model\AddressQuery;
|
|||||||
* @package Thelia\Controller\Admin
|
* @package Thelia\Controller\Admin
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
*/
|
*/
|
||||||
class AddressController extends BaseAdminController
|
class AddressController extends AbstractCrudController
|
||||||
{
|
{
|
||||||
public function deleteAddressAction()
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct(
|
||||||
|
'address',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
|
||||||
|
'admin.customer.update.view',
|
||||||
|
'admin.address.create',
|
||||||
|
'admin.address.update',
|
||||||
|
'admin.address.delete',
|
||||||
|
|
||||||
|
TheliaEvents::ADDRESS_CREATE,
|
||||||
|
TheliaEvents::ADDRESS_UPDATE,
|
||||||
|
TheliaEvents::ADDRESS_DELETE,
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public function deleteAddressAction()
|
||||||
{
|
{
|
||||||
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
if (null !== $response = $this->checkAuth("admin.customer.update")) return $response;
|
||||||
|
|
||||||
@@ -57,7 +83,7 @@ class AddressController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public function useAddressAction()
|
public function useAddressAction()
|
||||||
{
|
{
|
||||||
@@ -83,4 +109,210 @@ class AddressController extends BaseAdminController
|
|||||||
|
|
||||||
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the creation form for this object
|
||||||
|
*/
|
||||||
|
protected function getCreationForm()
|
||||||
|
{
|
||||||
|
return new AddressCreateForm($this->getRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the update form for this object
|
||||||
|
*/
|
||||||
|
protected function getUpdateForm()
|
||||||
|
{
|
||||||
|
return new AddressUpdateForm($this->getRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hydrate the update form for this object, before passing it to the update template
|
||||||
|
*
|
||||||
|
* @param \Thelia\Model\Address $object
|
||||||
|
*/
|
||||||
|
protected function hydrateObjectForm($object)
|
||||||
|
{
|
||||||
|
$data = array(
|
||||||
|
"label" => $object->getLabel(),
|
||||||
|
"title" => $object->getTitleId(),
|
||||||
|
"firstname" => $object->getFirstname(),
|
||||||
|
"lastname" => $object->getLastname(),
|
||||||
|
"address1" => $object->getAddress1(),
|
||||||
|
"address2" => $object->getAddress2(),
|
||||||
|
"address3" => $object->getAddress3(),
|
||||||
|
"zipcode" => $object->getZipcode(),
|
||||||
|
"city" => $object->getCity(),
|
||||||
|
"country" => $object->getCountryId(),
|
||||||
|
"cellphone" => $object->getCellphone(),
|
||||||
|
"phone" => $object->getPhone(),
|
||||||
|
"company" => $object->getCompany()
|
||||||
|
);
|
||||||
|
|
||||||
|
return new AddressUpdateForm($this->getRequest(), "form", $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the creation event with the provided form data
|
||||||
|
*
|
||||||
|
* @param unknown $formData
|
||||||
|
*/
|
||||||
|
protected function getCreationEvent($formData)
|
||||||
|
{
|
||||||
|
return $this->getCreateOrUpdateEvent($formData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the update event with the provided form data
|
||||||
|
*
|
||||||
|
* @param unknown $formData
|
||||||
|
*/
|
||||||
|
protected function getUpdateEvent($formData)
|
||||||
|
{
|
||||||
|
return $this->getCreateOrUpdateEvent($formData);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getCreateOrUpdateEvent($formData)
|
||||||
|
{
|
||||||
|
$event = new AddressCreateOrUpdateEvent(
|
||||||
|
$formData["label"],
|
||||||
|
$formData["title"],
|
||||||
|
$formData["firstname"],
|
||||||
|
$formData["lastname"],
|
||||||
|
$formData["address1"],
|
||||||
|
$formData["address2"],
|
||||||
|
$formData["address3"],
|
||||||
|
$formData["zipcode"],
|
||||||
|
$formData["city"],
|
||||||
|
$formData["country"],
|
||||||
|
$formData["cellphone"],
|
||||||
|
$formData["phone"],
|
||||||
|
$formData["company"],
|
||||||
|
$formData["is_default"]
|
||||||
|
);
|
||||||
|
|
||||||
|
$customer = CustomerQuery::create()->findPk($this->getRequest()->get("customer_id"));
|
||||||
|
|
||||||
|
$event->setCustomer($customer);
|
||||||
|
|
||||||
|
return $event;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the delete event with the provided form data
|
||||||
|
*/
|
||||||
|
protected function getDeleteEvent()
|
||||||
|
{
|
||||||
|
return new AddressEvent($this->getExistingObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the event contains the object, e.g. the action has updated the object in the event.
|
||||||
|
*
|
||||||
|
* @param unknown $event
|
||||||
|
*/
|
||||||
|
protected function eventContainsObject($event)
|
||||||
|
{
|
||||||
|
return null !== $event->getAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the created object from an event.
|
||||||
|
*
|
||||||
|
* @param unknown $createEvent
|
||||||
|
*/
|
||||||
|
protected function getObjectFromEvent($event)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an existing object from the database
|
||||||
|
*/
|
||||||
|
protected function getExistingObject()
|
||||||
|
{
|
||||||
|
return AddressQuery::create()->findPk($this->getRequest()->get('address_id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the object label form the object event (name, title, etc.)
|
||||||
|
*
|
||||||
|
* @param unknown $object
|
||||||
|
*/
|
||||||
|
protected function getObjectLabel($object)
|
||||||
|
{
|
||||||
|
return $object->getLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the object ID from the object
|
||||||
|
*
|
||||||
|
* @param unknown $object
|
||||||
|
*/
|
||||||
|
protected function getObjectId($object)
|
||||||
|
{
|
||||||
|
return $object->getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the main list template
|
||||||
|
*
|
||||||
|
* @param unknown $currentOrder, if any, null otherwise.
|
||||||
|
*/
|
||||||
|
protected function renderListTemplate($currentOrder)
|
||||||
|
{
|
||||||
|
// TODO: Implement renderListTemplate() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the edition template
|
||||||
|
*/
|
||||||
|
protected function renderEditionTemplate()
|
||||||
|
{
|
||||||
|
return $this->render('ajax/address-update-modal', array(
|
||||||
|
"address_id" => $this->getRequest()->get('address_id'),
|
||||||
|
"customer_id" => $this->getExistingObject()->getCustomerId()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to the edition template
|
||||||
|
*/
|
||||||
|
protected function redirectToEditionTemplate()
|
||||||
|
{
|
||||||
|
// TODO: Implement redirectToEditionTemplate() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect to the list template
|
||||||
|
*/
|
||||||
|
protected function redirectToListTemplate()
|
||||||
|
{
|
||||||
|
// TODO: Implement redirectToListTemplate() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put in this method post object delete processing if required.
|
||||||
|
*
|
||||||
|
* @param \Thelia\Core\Event\AddressEvent $deleteEvent the delete event
|
||||||
|
* @return Response a response, or null to continue normal processing
|
||||||
|
*/
|
||||||
|
protected function performAdditionalDeleteAction($deleteEvent)
|
||||||
|
{
|
||||||
|
$address = $deleteEvent->getAddress();
|
||||||
|
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put in this method post object creation processing if required.
|
||||||
|
*
|
||||||
|
* @param AddressCreateOrUpdateEvent $createEvent the create event
|
||||||
|
* @return Response a response, or null to continue normal processing
|
||||||
|
*/
|
||||||
|
protected function performAdditionalCreateAction($createEvent)
|
||||||
|
{
|
||||||
|
$address = $createEvent->getAddress();
|
||||||
|
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
111
templates/admin/default/ajax/address-update-modal.html
Normal file
111
templates/admin/default/ajax/address-update-modal.html
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
{* Update an Address *}
|
||||||
|
|
||||||
|
{form name="thelia.address.update"}
|
||||||
|
|
||||||
|
{* Capture the dialog body, to pass it to the generic dialog *}
|
||||||
|
{capture "edit_address_dialog"}
|
||||||
|
|
||||||
|
{form_hidden_fields form=$form}
|
||||||
|
|
||||||
|
{form_field form=$form field='label'}
|
||||||
|
<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='Label'}">
|
||||||
|
</div>
|
||||||
|
{/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>
|
||||||
|
|
||||||
|
<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="{$value}" 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="{$value}" title="{intl l={$label}}" placeholder="{intl l='Lastname'}">
|
||||||
|
</div>
|
||||||
|
{/form_field}
|
||||||
|
|
||||||
|
{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="{$value}" title="{intl l={$label}}" placeholder="{intl l='Address'}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
{form_field form=$form field='address2'}
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Additional address'}">
|
||||||
|
{/form_field}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
{form_field form=$form field='address3'}
|
||||||
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Additional address'}">
|
||||||
|
{/form_field}
|
||||||
|
</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="{$value}" 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="{$value}" 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}
|
||||||
|
|
||||||
|
{/capture}
|
||||||
|
|
||||||
|
{include
|
||||||
|
file = "includes/generic-create-dialog.html"
|
||||||
|
|
||||||
|
dialog_id = "edit_address_dialog"
|
||||||
|
dialog_title = {intl l="Edit an address"}
|
||||||
|
dialog_body = {$smarty.capture.edit_address_dialog nofilter}
|
||||||
|
|
||||||
|
dialog_ok_label = {intl l="Edit this address"}
|
||||||
|
dialog_cancel_label = {intl l="Cancel"}
|
||||||
|
|
||||||
|
form_action = {url path='/admin/address/update'}
|
||||||
|
form_enctype = {form_enctype form=$form}
|
||||||
|
form_error_message = $form_error_message
|
||||||
|
}
|
||||||
|
|
||||||
|
{/form}
|
||||||
@@ -295,6 +295,15 @@
|
|||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-global{
|
||||||
|
background: url("@{imgDir}/ajax-loader.gif") no-repeat;
|
||||||
|
height: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
line-height: 30px;
|
||||||
|
padding-left: 40px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.existing-image .col-sm-6{
|
.existing-image .col-sm-6{
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -171,7 +171,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|
||||||
<a class="btn btn-default btn-xs" title="{intl l='Edit this address'}" href="#edit_address_dialog" data-toggle="modal">
|
<a class="btn btn-default btn-xs customer-update-address" title="{intl l='Edit this address'}" href="#" data-id="{$ID}">
|
||||||
<span class="glyphicon glyphicon-edit"></span>
|
<span class="glyphicon glyphicon-edit"></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="address-update-modal"></div>
|
||||||
{* Add an Address *}
|
{* Add an Address *}
|
||||||
|
|
||||||
{form name="thelia.address.create"}
|
{form name="thelia.address.create"}
|
||||||
@@ -227,7 +227,10 @@
|
|||||||
{capture "address_creation_dialog"}
|
{capture "address_creation_dialog"}
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
{form_hidden_fields form=$form}
|
||||||
|
<input type="hidden" name="customer_id" value="{$customer_id}">
|
||||||
|
{form_field form=$form field='success_url'}
|
||||||
|
<input type="hidden" name="{$name}" value="{url path="/admin/customer/update/{$customer_id}"}" />
|
||||||
|
{/form_field}
|
||||||
{form_field form=$form field='label'}
|
{form_field form=$form field='label'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
@@ -246,7 +249,7 @@
|
|||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
|
|
||||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
|
||||||
{loop type="title" name="title1"}
|
{loop type="title" name="title1"}
|
||||||
<option value="{$ID}">{$LONG}</option>
|
<option value="{$ID}">{$LONG}</option>
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -257,21 +260,21 @@
|
|||||||
{form_field form=$form field='firstname'}
|
{form_field form=$form field='firstname'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<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='Firstname'}">
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Firstname'}" required>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='lastname'}
|
{form_field form=$form field='lastname'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<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='Lastname'}">
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Lastname'}" required>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='address1'}
|
{form_field form=$form field='address1'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<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='Address'}">
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Address'}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -290,21 +293,21 @@
|
|||||||
{form_field form=$form field='zipcode'}
|
{form_field form=$form field='zipcode'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<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='Zip code'}">
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='Zip code'}" required>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='city'}
|
{form_field form=$form field='city'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<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='City'}">
|
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l="{$label}"}" placeholder="{intl l='City'}" required>
|
||||||
</div>
|
</div>
|
||||||
{/form_field}
|
{/form_field}
|
||||||
|
|
||||||
{form_field form=$form field='country'}
|
{form_field form=$form field='country'}
|
||||||
<div class="form-group {if $error}has-error{/if}">
|
<div class="form-group {if $error}has-error{/if}">
|
||||||
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
<label for="{$label_attr.for}" class="control-label">{intl l="{$label}"} : </label>
|
||||||
<select name="{$name}" id="{$label_attr.for}" class="form-control">
|
<select name="{$name}" id="{$label_attr.for}" class="form-control" required>
|
||||||
{loop type="country" name="country1"}
|
{loop type="country" name="country1"}
|
||||||
<option value="{$ID}">{$TITLE}</option>
|
<option value="{$ID}">{$TITLE}</option>
|
||||||
{/loop}
|
{/loop}
|
||||||
@@ -331,117 +334,7 @@
|
|||||||
|
|
||||||
{/form}
|
{/form}
|
||||||
|
|
||||||
{* Update an Address *}
|
|
||||||
|
|
||||||
{form name="thelia.address.update"}
|
|
||||||
|
|
||||||
{* Capture the dialog body, to pass it to the generic dialog *}
|
|
||||||
{capture "edit_address_dialog"}
|
|
||||||
|
|
||||||
{form_hidden_fields form=$form}
|
|
||||||
|
|
||||||
{form_field form=$form field='label'}
|
|
||||||
<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='Label'}">
|
|
||||||
</div>
|
|
||||||
{/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>
|
|
||||||
|
|
||||||
<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="{$value}" 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="{$value}" title="{intl l={$label}}" placeholder="{intl l='Lastname'}">
|
|
||||||
</div>
|
|
||||||
{/form_field}
|
|
||||||
|
|
||||||
{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="{$value}" title="{intl l={$label}}" placeholder="{intl l='Address'}">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{form_field form=$form field='address2'}
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Additional address'}">
|
|
||||||
{/form_field}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
{form_field form=$form field='address3'}
|
|
||||||
<input type="text" id="{$label_attr.for}" name="{$name}" class="form-control" value="{$value}" title="{intl l={$label}}" placeholder="{intl l='Additional address'}">
|
|
||||||
{/form_field}
|
|
||||||
</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="{$value}" 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="{$value}" 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}
|
|
||||||
|
|
||||||
{/capture}
|
|
||||||
|
|
||||||
{include
|
|
||||||
file = "includes/generic-create-dialog.html"
|
|
||||||
|
|
||||||
dialog_id = "edit_address_dialog"
|
|
||||||
dialog_title = {intl l="Edit an address"}
|
|
||||||
dialog_body = {$smarty.capture.edit_address_dialog nofilter}
|
|
||||||
|
|
||||||
dialog_ok_label = {intl l="Edit this address"}
|
|
||||||
dialog_cancel_label = {intl l="Cancel"}
|
|
||||||
|
|
||||||
form_action = {url path='/admin/address/update'}
|
|
||||||
form_enctype = {form_enctype form=$form}
|
|
||||||
form_error_message = $form_error_message
|
|
||||||
}
|
|
||||||
|
|
||||||
{/form}
|
|
||||||
|
|
||||||
|
|
||||||
{* Default confirmation dialog *}
|
{* Default confirmation dialog *}
|
||||||
@@ -494,6 +387,20 @@
|
|||||||
$("a.customer-address-use").click(function(e){
|
$("a.customer-address-use").click(function(e){
|
||||||
$("#address_use_id").val($(this).data("id"));
|
$("#address_use_id").val($(this).data("id"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("a.customer-update-address").click(function(e){
|
||||||
|
var baseUrl = "{url path="/admin/address/update/"}";
|
||||||
|
//$('body').html('<div class="loading" ></div>');
|
||||||
|
$.ajax({
|
||||||
|
method: 'get',
|
||||||
|
url: baseUrl+$(this).data('id')
|
||||||
|
}).done(function(data){
|
||||||
|
//$(".loading").remove();
|
||||||
|
$("#address-update-modal").html(data);
|
||||||
|
$("#edit_address_dialog").modal("show");
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user