diff --git a/core/lib/Thelia/Action/Tax.php b/core/lib/Thelia/Action/Tax.php new file mode 100644 index 000000000..91e51b59f --- /dev/null +++ b/core/lib/Thelia/Action/Tax.php @@ -0,0 +1,104 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Action; + +use Propel\Runtime\ActiveQuery\Criteria; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Thelia\Core\Event\Tax\TaxEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Model\Tax as TaxModel; +use Thelia\Model\TaxQuery; + +class Tax extends BaseAction implements EventSubscriberInterface +{ + /** + * @param TaxEvent $event + */ + public function create(TaxEvent $event) + { + $tax = new TaxModel(); + + $tax + ->setDispatcher($this->getDispatcher()) + ->setType($event->getType()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setDescription($event->getDescription()) + ; + + $tax->save(); + + $event->setTax($tax); + } + + /** + * @param TaxEvent $event + */ + public function update(TaxEvent $event) + { + if (null !== $tax = TaxQuery::create()->findPk($event->getId())) { + + $tax + ->setDispatcher($this->getDispatcher()) + ->setType($event->getType()) + ->setLocale($event->getLocale()) + ->setTitle($event->getTitle()) + ->setDescription($event->getDescription()) + ->save() + ; + + + + $event->setTax($tax); + } + } + + /** + * @param TaxEvent $event + */ + public function delete(TaxEvent $event) + { + if (null !== $tax = TaxQuery::create()->findPk($event->getId())) { + + $tax + ->delete() + ; + + $event->setTax($tax); + } + } + + /** + * {@inheritDoc} + */ + public static function getSubscribedEvents() + { + return array( + TheliaEvents::TAX_CREATE => array("create", 128), + TheliaEvents::TAX_UPDATE => array("update", 128), + TheliaEvents::TAX_DELETE => array("delete", 128), + + ); + } +} diff --git a/core/lib/Thelia/Config/Resources/action.xml b/core/lib/Thelia/Config/Resources/action.xml index 939cc9d88..1ef84b5af 100755 --- a/core/lib/Thelia/Config/Resources/action.xml +++ b/core/lib/Thelia/Config/Resources/action.xml @@ -111,6 +111,11 @@ + + + + + diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index 5e2227989..19b9c97f6 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -117,6 +117,10 @@
+ + + + diff --git a/core/lib/Thelia/Config/Resources/routing/admin.xml b/core/lib/Thelia/Config/Resources/routing/admin.xml index 9803bc866..af05b667e 100755 --- a/core/lib/Thelia/Config/Resources/routing/admin.xml +++ b/core/lib/Thelia/Config/Resources/routing/admin.xml @@ -787,7 +787,28 @@ - + + + + Thelia\Controller\Admin\TaxController::updateAction + \d+ + + + + Thelia\Controller\Admin\TaxController::createAction + + + + Thelia\Controller\Admin\TaxController::processUpdateAction + + + + Thelia\Controller\Admin\TaxController::deleteAction + + + + + Thelia\Controller\Admin\TaxRuleController::defaultAction diff --git a/core/lib/Thelia/Controller/Admin/TaxController.php b/core/lib/Thelia/Controller/Admin/TaxController.php new file mode 100644 index 000000000..0c83aa4cb --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/TaxController.php @@ -0,0 +1,198 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + +use Thelia\Core\Event\Tax\TaxEvent; +use Thelia\Core\Event\TheliaEvents; +use Thelia\Form\TaxCreationForm; +use Thelia\Form\TaxModificationForm; +use Thelia\Form\TaxTaxListUpdateForm; +use Thelia\Model\TaxQuery; + +class TaxController extends AbstractCrudController +{ + public function __construct() + { + parent::__construct( + 'tax', + 'manual', + 'order', + + 'admin.configuration.tax.view', + 'admin.configuration.tax.create', + 'admin.configuration.tax.update', + 'admin.configuration.tax.delete', + + TheliaEvents::TAX_CREATE, + TheliaEvents::TAX_UPDATE, + TheliaEvents::TAX_DELETE + ); + } + + protected function getCreationForm() + { + return new TaxCreationForm($this->getRequest()); + } + + protected function getUpdateForm() + { + return new TaxModificationForm($this->getRequest()); + } + + protected function getCreationEvent($formData) + { + $event = new TaxEvent(); + + $event->setLocale($formData['locale']); + $event->setTitle($formData['title']); + $event->setDescription($formData['description']); + $event->setType($formData['type']); + + return $event; + } + + protected function getUpdateEvent($formData) + { + $event = new TaxEvent(); + + $event->setLocale($formData['locale']); + $event->setId($formData['id']); + $event->setTitle($formData['title']); + $event->setDescription($formData['description']); + $event->setType($formData['type']); + + return $event; + } + + protected function getDeleteEvent() + { + $event = new TaxEvent(); + + $event->setId( + $this->getRequest()->get('tax_id', 0) + ); + + return $event; + } + + protected function eventContainsObject($event) + { + return $event->hasTax(); + } + + protected function hydrateObjectForm($object) + { + $data = array( + 'id' => $object->getId(), + 'locale' => $object->getLocale(), + 'title' => $object->getTitle(), + 'description' => $object->getDescription(), + 'type' => $object->getType(), + ); + + // Setup the object form + return new TaxModificationForm($this->getRequest(), "form", $data); + } + + protected function getObjectFromEvent($event) + { + return $event->hasTax() ? $event->getTax() : null; + } + + protected function getExistingObject() + { + return TaxQuery::create() + ->joinWithI18n($this->getCurrentEditionLocale()) + ->findOneById($this->getRequest()->get('tax_id')); + } + + protected function getObjectLabel($object) + { + return $object->getTitle(); + } + + protected function getObjectId($object) + { + return $object->getId(); + } + + protected function getViewArguments() + { + return array(); + } + + protected function getRouteArguments($tax_id = null) + { + return array( + 'tax_id' => $tax_id === null ? $this->getRequest()->get('tax_id') : $tax_id, + ); + } + + protected function renderListTemplate($currentOrder) + { + // We always return to the feature edition form + return $this->render( + 'taxes-rules', + array() + ); + } + + protected function renderEditionTemplate() + { + // We always return to the feature edition form + return $this->render('tax-edit', array_merge($this->getViewArguments(), $this->getRouteArguments())); + } + + protected function redirectToEditionTemplate($request = null, $country = null) + { + // We always return to the feature edition form + $this->redirectToRoute( + "admin.configuration.taxes.update", + $this->getViewArguments($country), + $this->getRouteArguments() + ); + } + + /** + * Put in this method post object creation processing if required. + * + * @param TaxEvent $createEvent the create event + * @return Response a response, or null to continue normal processing + */ + protected function performAdditionalCreateAction($createEvent) + { + $this->redirectToRoute( + "admin.configuration.taxes.update", + $this->getViewArguments(), + $this->getRouteArguments($createEvent->getTax()->getId()) + ); + } + + protected function redirectToListTemplate() + { + $this->redirectToRoute( + "admin.configuration.taxes-rules.list" + ); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Core/Event/Tax/TaxEvent.php b/core/lib/Thelia/Core/Event/Tax/TaxEvent.php new file mode 100644 index 000000000..6136630ad --- /dev/null +++ b/core/lib/Thelia/Core/Event/Tax/TaxEvent.php @@ -0,0 +1,109 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Core\Event\Tax; +use Thelia\Core\Event\ActionEvent; +use Thelia\Model\Tax; + +class TaxEvent extends ActionEvent +{ + protected $tax = null; + + protected $locale; + protected $id; + protected $title; + protected $description; + protected $type; + + public function __construct(Tax $tax = null) + { + $this->tax = $tax; + } + + public function hasTax() + { + return ! is_null($this->tax); + } + + public function getTax() + { + return $this->tax; + } + + public function setTax(Tax $tax) + { + $this->tax = $tax; + + return $this; + } + + public function setDescription($description) + { + $this->description = $description; + } + + public function getDescription() + { + return $this->description; + } + + public function setId($id) + { + $this->id = $id; + } + + public function getId() + { + return $this->id; + } + + public function setTitle($title) + { + $this->title = $title; + } + + public function getTitle() + { + return $this->title; + } + + public function setLocale($locale) + { + $this->locale = $locale; + } + + public function getLocale() + { + return $this->locale; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getType() + { + return $this->type; + } +} diff --git a/core/lib/Thelia/Core/Event/TheliaEvents.php b/core/lib/Thelia/Core/Event/TheliaEvents.php index a21e0a9c9..c2f2721b8 100755 --- a/core/lib/Thelia/Core/Event/TheliaEvents.php +++ b/core/lib/Thelia/Core/Event/TheliaEvents.php @@ -519,6 +519,12 @@ final class TheliaEvents const CHANGE_DEFAULT_CURRENCY = 'action.changeDefaultCurrency'; + // -- Tax management --------------------------------------------- + + const TAX_CREATE = "action.createTax"; + const TAX_UPDATE = "action.updateTax"; + const TAX_DELETE = "action.deleteTax"; + // -- Tax Rules management --------------------------------------------- const TAX_RULE_CREATE = "action.createTaxRule"; diff --git a/core/lib/Thelia/Core/Template/Loop/Tax.php b/core/lib/Thelia/Core/Template/Loop/Tax.php index 1ddf18824..0248e60d8 100644 --- a/core/lib/Thelia/Core/Template/Loop/Tax.php +++ b/core/lib/Thelia/Core/Template/Loop/Tax.php @@ -152,11 +152,13 @@ class Tax extends BaseI18nLoop $loopResultRow = new LoopResultRow($loopResult, $tax, $this->versionable, $this->timestampable, $this->countable); $loopResultRow - ->set("ID" , $tax->getId()) - ->set("IS_TRANSLATED" , $tax->getVirtualColumn('IS_TRANSLATED')) - ->set("LOCALE" , $locale) - ->set("TITLE" , $tax->getVirtualColumn('i18n_TITLE')) - ->set("DESCRIPTION" , $tax->getVirtualColumn('i18n_DESCRIPTION')) + ->set("ID" , $tax->getId()) + ->set("TYPE" , $tax->getType()) + ->set("SERIALIZED_REQUIREMENTS" , $tax->getSerializedRequirements()) + ->set("IS_TRANSLATED" , $tax->getVirtualColumn('IS_TRANSLATED')) + ->set("LOCALE" , $locale) + ->set("TITLE" , $tax->getVirtualColumn('i18n_TITLE')) + ->set("DESCRIPTION" , $tax->getVirtualColumn('i18n_DESCRIPTION')) ; $loopResult->addRow($loopResultRow); diff --git a/core/lib/Thelia/Form/TaxCreationForm.php b/core/lib/Thelia/Form/TaxCreationForm.php new file mode 100644 index 000000000..31b0834d4 --- /dev/null +++ b/core/lib/Thelia/Form/TaxCreationForm.php @@ -0,0 +1,67 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Core\Translation\Translator; +use Thelia\TaxEngine\TaxEngine; +use Thelia\TaxEngine\TaxType; + +class TaxCreationForm extends BaseForm +{ + use StandardDescriptionFieldsTrait; + + protected function buildForm($change_mode = false) + { + $types = TaxEngine::getInstance()->getTaxTypeList(); + $typeList = array(); + foreach($types as $type) { + $classPath = "\\Thelia\\TaxEngine\\TaxType\\$type"; + $instance = new $classPath(); + $typeList[$type] = $instance->getTitle(); + } + + $this->formBuilder + ->add("locale", "text", array( + "constraints" => array(new NotBlank()) + )) + ->add("type", "choice", array( + "choices" => $typeList, + "required" => true, + "constraints" => array( + new Constraints\NotBlank(), + ), + "label" => Translator::getInstance()->trans("Type"), + "label_attr" => array("for" => "type_field"), + )) + ; + + $this->addStandardDescFields(array('postscriptum', 'chapo', 'locale')); + } + + public function getName() + { + return "thelia_tax_creation"; + } +} diff --git a/core/lib/Thelia/Form/TaxModificationForm.php b/core/lib/Thelia/Form/TaxModificationForm.php new file mode 100644 index 000000000..1c496440e --- /dev/null +++ b/core/lib/Thelia/Form/TaxModificationForm.php @@ -0,0 +1,66 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Model\TaxQuery; + +class TaxModificationForm extends TaxCreationForm +{ + protected function buildForm() + { + parent::buildForm(true); + + $this->formBuilder + ->add("id", "hidden", array( + "required" => true, + "constraints" => array( + new Constraints\NotBlank(), + new Constraints\Callback( + array( + "methods" => array( + array($this, "verifyTaxId"), + ), + ) + ), + ) + )) + ; + } + + public function getName() + { + return "thelia_tax_modification"; + } + + public function verifyTaxId($value, ExecutionContextInterface $context) + { + $tax = TaxQuery::create() + ->findPk($value); + + if (null === $tax) { + $context->addViolation("Tax ID not found"); + } + } +} diff --git a/core/lib/Thelia/Model/Tax.php b/core/lib/Thelia/Model/Tax.php index 7b9b22b6f..6752129a2 100755 --- a/core/lib/Thelia/Model/Tax.php +++ b/core/lib/Thelia/Model/Tax.php @@ -4,10 +4,13 @@ namespace Thelia\Model; use Thelia\Exception\TaxEngineException; use Thelia\Model\Base\Tax as BaseTax; +use Thelia\Model\Tools\ModelEventDispatcherTrait; use Thelia\TaxEngine\TaxType\BaseTaxType; class Tax extends BaseTax { + use ModelEventDispatcherTrait; + public function calculateTax($amount) { if(false === filter_var($amount, FILTER_VALIDATE_FLOAT)) { diff --git a/core/lib/Thelia/TaxEngine/TaxEngine.php b/core/lib/Thelia/TaxEngine/TaxEngine.php new file mode 100755 index 000000000..8e5a5695a --- /dev/null +++ b/core/lib/Thelia/TaxEngine/TaxEngine.php @@ -0,0 +1,71 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\TaxEngine; + +/** + * Class TaxEngine + * @package Thelia\TaxEngine + * @author Etienne Roudeix + */ +class TaxEngine +{ + static public function getInstance() + { + return new TaxEngine(); + } + + private function getTaxTypeDirectory() + { + return __DIR__ . "/TaxType"; + } + + public function getTaxTypeList() + { + $typeList = array(); + + try { + $directoryBrowser = new \DirectoryIterator($this->getTaxTypeDirectory($this->getTaxTypeDirectory())); + } catch (\UnexpectedValueException $e) { + return $typeList; + } + + /* browse the directory */ + foreach ($directoryBrowser as $directoryContent) { + /* is it a file ? */ + if (!$directoryContent->isFile()) { + continue; + } + + $fileName = $directoryContent->getFilename(); + $className = substr($fileName, 0, (1+strlen($directoryContent->getExtension())) * -1); + + if($className == "BaseTaxType") { + continue; + } + + $typeList[] = $className; + } + + return $typeList; + } +} diff --git a/core/lib/Thelia/TaxEngine/TaxType/BaseTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/BaseTaxType.php index 1e0a11ca7..f8bdd8647 100755 --- a/core/lib/Thelia/TaxEngine/TaxType/BaseTaxType.php +++ b/core/lib/Thelia/TaxEngine/TaxType/BaseTaxType.php @@ -41,6 +41,8 @@ abstract class BaseTaxType public abstract function getRequirementsList(); + public abstract function getTitle(); + public function calculate(Product $product, $untaxedPrice) { return $untaxedPrice * $this->pricePercentRetriever() + $this->fixAmountRetriever($product); diff --git a/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php index 32c78c1ac..e623528c2 100755 --- a/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php +++ b/core/lib/Thelia/TaxEngine/TaxType/FeatureFixAmountTaxType.php @@ -65,4 +65,9 @@ class FeatureFixAmountTaxType extends BaseTaxType 'feature' => new ModelValidIdType('Feature'), ); } + + public function getTitle() + { + return "Fix amount Tax depending on a feature"; + } } diff --git a/core/lib/Thelia/TaxEngine/TaxType/FeatureSlicePercentTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/FeatureSlicePercentTaxType.php index 311a83272..f1e95c5c7 100755 --- a/core/lib/Thelia/TaxEngine/TaxType/FeatureSlicePercentTaxType.php +++ b/core/lib/Thelia/TaxEngine/TaxType/FeatureSlicePercentTaxType.php @@ -49,4 +49,9 @@ class featureSlicePercentTaxType extends BaseTaxType 'slices' => new FloatToFloatArrayType(), ); } + + public function getTitle() + { + return "% slice Tax depending on a feature"; + } } diff --git a/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php index e62136d99..c93715571 100755 --- a/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php +++ b/core/lib/Thelia/TaxEngine/TaxType/FixAmountTaxType.php @@ -47,4 +47,9 @@ class FixAmountTaxType extends BaseTaxType 'amount' => new FloatType(), ); } + + public function getTitle() + { + return "Fix amount Tax"; + } } diff --git a/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php b/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php index 342f51a6d..6881b0288 100755 --- a/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php +++ b/core/lib/Thelia/TaxEngine/TaxType/PricePercentTaxType.php @@ -47,6 +47,9 @@ class PricePercentTaxType extends BaseTaxType 'percent' => new FloatType(), ); } -} -//600 / (1 + 0,10 + 0,10) =/= 600 / (1 + 0,10 ) + 600 / (1 + 0,10 ) \ No newline at end of file + public function getTitle() + { + return "Price % Tax"; + } +} diff --git a/templates/admin/default/tax-edit.html b/templates/admin/default/tax-edit.html new file mode 100644 index 000000000..435ace42b --- /dev/null +++ b/templates/admin/default/tax-edit.html @@ -0,0 +1,130 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='Edit a tax'}{/block} + +{block name="check-permissions"}admin.configuration.taxes.edit{/block} + +{block name="main-content"} + +
+ +
+ + + + {loop type="tax" name="tax" id=$tax_id backend_context="1" lang=$edit_language_id} + +
+
+ +
+ + {form name="thelia.admin.tax.modification"} + + + + {include + file = "includes/inner-form-toolbar.html" + hide_submit_buttons = false + + page_url = {url path="/admin/configuration/taxes/update/$tax_id"} + close_url = {url path="/admin/configuration/taxes_rules"} + } + + {* Be sure to get the product ID, even if the form could not be validated *} + + + {form_hidden_fields form=$form} + + {form_field form=$form field='success_url'} + + {/form_field} + + {form_field form=$form field='locale'} + + {/form_field} + + {if $form_error}
{$form_error_message}
{/if} + + {form_field form=$form field='title'} +
+ + +
+ {/form_field} + + {form_field form=$form field='description'} +
+ + + +
+ {/form_field} + + {form_field form=$form field='type'} +
+ + +
+ +
+
+ {/form_field} + +
+
+
+ +
+

{intl l='Tax created on %date_create. Last modification: %date_change' date_create={format_date date=$CREATE_DATE} date_change={format_date date=$UPDATE_DATE}}

+
+
+
+
+ + + {/form} +
+ +
+
+ + {/loop} + +
+ +{/block} + +{block name="javascript-initialization"} + + {javascripts file='assets/js/bootstrap-select/bootstrap-select.js'} + + {/javascripts} + + {javascripts file='assets/js/main.js'} + + {/javascripts} + + + + + +{/block} \ No newline at end of file diff --git a/templates/admin/default/taxes-rules.html b/templates/admin/default/taxes-rules.html index 67e8b414a..73eb35b40 100644 --- a/templates/admin/default/taxes-rules.html +++ b/templates/admin/default/taxes-rules.html @@ -21,6 +21,72 @@
+ +
+

{intl l="In order to manges your shop taxes you can manage"} {intl l="taxes"} {intl l="and"} {intl l="tax rules"}.

+

{intl l="Taxes define the amount of money which is add to a bought product."}

+

+ {intl l="Example :"} +

    +
  • {intl l="French 19.6% VAT is a tax which add a 19.6% tax to the product price."}
  • +
  • {intl l="Ecotax is a tax wich add a defined amount (throug a product feature) to the product price."}
  • +
+

+

{intl l="Tax rules are combination of different taxes."}

+

+ {intl l="Example :"} +

    +
  • {intl l="French 19.6% VAT with ecotax is the applicance of the ecotax (on the product price) then the applicance of the 19.6% tax (on the product price + the ecotax amount)."}
  • +
+

+

{intl l="you can combine taxes in tax rules and chose if they are applied one after the other or at the same time : it allows to apply taxes on an already taxed price or not."}

+
+ +
+
+ + + + + + + + + + + + {loop type="tax" name="taxes" backend_context="1"} + + + + + + + + {/loop} + + +
+ {intl l="Taxes"} + {loop type="auth" name="can_create" roles="ADMIN" permissions="admin.taxes.create"} + + + + {/loop} +
{intl l="Name"}{intl l="Description"}{intl l="Actions"}
{$TITLE}{$DESCRIPTION} +
+ {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes.change"} + + {/loop} + + {loop type="auth" name="can_change" roles="ADMIN" permissions="admin.configuration.taxes.change"} + + {/loop} +
+
+
+
+
@@ -41,7 +107,7 @@ - {loop type="tax-rule" name="taxes-rules"} + {loop type="tax-rule" name="taxes-rules" backend_context="1"} @@ -61,10 +127,10 @@ {/loop} - +
{$TITLE}
-
+
@@ -73,8 +139,8 @@ -{* -- Add tax rule confirmation dialog ----------------------------------- *} -{form name="thelia.admin.taxrule.add"} +{* -- Add tax confirmation dialog ----------------------------------- *} +{form name="thelia.admin.tax.add"} {if $form_error_message} {$taxCreateError = true} @@ -82,6 +148,99 @@ {$taxCreateError = false} {/if} +{* Capture the dialog body, to pass it to the generic dialog *} +{capture "tax_create_dialog"} + + {form_hidden_fields form=$form} + + {form_field form=$form field='locale'} + + {/form_field} + + {if $form_error}
{$form_error_message}
{/if} + + {form_field form=$form field='title'} +
+ + +
+ {/form_field} + + {form_field form=$form field='description'} +
+ + + +
+ {/form_field} + + {form_field form=$form field='type'} +
+ + +
+ +
+
+ {/form_field} + +{/capture} + + {include + file = "includes/generic-create-dialog.html" + + dialog_id = "tax_create_dialog" + dialog_title = {intl l="Create a new tax"} + dialog_body = {$smarty.capture.tax_create_dialog nofilter} + + dialog_ok_label = {intl l="Create"} + dialog_cancel_label = {intl l="Cancel"} + + form_action = {url path="/admin/configuration/taxes/add"} + form_enctype = {form_enctype form=$form} + form_error_message = $form_error_message + } + +{/form} + +{* -- Delete tax confirmation dialog ----------------------------------- *} + +{capture "tax_delete_dialog"} + + + {module_include location='tax_delete_form'} + +{/capture} + +{include + file = "includes/generic-confirm-dialog.html" + + dialog_id = "tax_delete_dialog" + dialog_title = {intl l="Delete tax"} + dialog_message = {intl l="Do you really want to delete this tax ?"} + + form_action = {url path='/admin/configuration/taxes/delete'} + form_content = {$smarty.capture.tax_delete_dialog nofilter} +} + +{* -- Add tax rule confirmation dialog ----------------------------------- *} +{form name="thelia.admin.taxrule.add"} + +{if $form_error_message} + {$taxRuleCreateError = true} +{else} + {$taxRuleCreateError = false} +{/if} + {* Capture the dialog body, to pass it to the generic dialog *} {capture "tax_rule_create_dialog"} @@ -154,15 +313,31 @@ {block name="javascript-initialization"} +{javascripts file='assets/js/bootstrap-select/bootstrap-select.js'} + +{/javascripts} + +{javascripts file='assets/js/main.js'} + +{/javascripts} + {/block} \ No newline at end of file