Le module MondialRelay n'était pas commité

This commit is contained in:
2020-12-05 09:32:52 +01:00
parent 9572b71f14
commit ef16a65ce8
143 changed files with 16232 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Form;
use MondialRelay\MondialRelay;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Thelia\Form\BaseForm;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class InsuranceCreateForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
'max_value',
'number',
[
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
'label' => $this->translator->trans('Cart value', [], MondialRelay::DOMAIN_NAME),
]
)->add(
'price_with_tax',
'number',
[
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
'label' => $this->translator->trans('Insurance price', [], MondialRelay::DOMAIN_NAME),
]
)
;
}
}

View File

@@ -0,0 +1,50 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Form;
use MondialRelay\MondialRelay;
use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
use Thelia\Form\BaseForm;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class InsurancesUpdateForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
'max_value',
'collection',
[
"type" => 'number',
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
'label' => $this->translator->trans('Cart value', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [ ],
'allow_add' => true,
'allow_delete' => true,
]
)->add(
'price_with_tax',
'collection',
[
"type" => 'number',
"constraints" => [new GreaterThanOrEqual([ 'value' => 0 ])],
'label' => $this->translator->trans('Insurance price', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [ ],
'allow_add' => true,
'allow_delete' => true,
]
)
;
}
}

View File

@@ -0,0 +1,47 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Form;
use MondialRelay\Model\MondialRelayZoneConfiguration;
use MondialRelay\MondialRelay;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Form\BaseForm;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class PriceAttributesUpdateForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
'delivery_time',
'integer',
[
"constraints" => [new GreaterThan([ 'value' => 0 ])],
'label' => $this->translator->trans('Delivery delay', [], MondialRelay::DOMAIN_NAME),
]
)->add(
'delivery_type',
'choice',
[
"choices" => [
MondialRelayZoneConfiguration::RELAY_DELIVERY_TYPE => $this->translator->trans('Relay delivery', [], MondialRelay::DOMAIN_NAME),
MondialRelayZoneConfiguration::HOME_DELIVERY_TYPE => $this->translator->trans('Home delivery', [], MondialRelay::DOMAIN_NAME),
MondialRelayZoneConfiguration::ALL_DELIVERY_TYPE => $this->translator->trans('Home and relay delivery', [], MondialRelay::DOMAIN_NAME)
],
'label' => $this->translator->trans('Delivery type', [], MondialRelay::DOMAIN_NAME),
]
)
;
}
}

View File

@@ -0,0 +1,42 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Form;
use MondialRelay\MondialRelay;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Form\BaseForm;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class PriceCreateForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
'max_weight',
'number',
[
"constraints" => [new GreaterThan([ 'value' => 0 ])],
'label' => $this->translator->trans('Weight up to...', [], MondialRelay::DOMAIN_NAME),
]
)->add(
'price',
'number',
[
"constraints" => [new GreaterThan([ 'value' => 0 ])],
'label' => $this->translator->trans('Price', [], MondialRelay::DOMAIN_NAME),
]
)
;
}
}

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Form;
use MondialRelay\MondialRelay;
use Symfony\Component\Validator\Constraints\GreaterThan;
use Thelia\Form\BaseForm;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class PricesUpdateForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
'max_weight',
'collection',
[
"type" => "number",
"constraints" => [new GreaterThan([ 'value' => 0 ])],
'label' => $this->translator->trans('Weight up to...', [], MondialRelay::DOMAIN_NAME),
'allow_add' => true,
'allow_delete' => true,
]
)->add(
'price',
'collection',
[
"type" => "number",
"constraints" => [new GreaterThan([ 'value' => 0 ])],
'label' => $this->translator->trans('Price', [], MondialRelay::DOMAIN_NAME),
'allow_add' => true,
'allow_delete' => true,
]
)
;
}
}

View File

@@ -0,0 +1,105 @@
<?php
/*************************************************************************************/
/* Copyright (c) Franck Allimant, CQFDev */
/* email : thelia@cqfdev.fr */
/* web : http://www.cqfdev.fr */
/* */
/* For the full copyright and license information, please view the LICENSE */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace MondialRelay\Form;
use MondialRelay\MondialRelay;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Form\BaseForm;
/**
* @author Franck Allimant <franck@cqfdev.fr>
*/
class SettingsForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add(
MondialRelay::CODE_ENSEIGNE,
'text',
[
"constraints" => [new NotBlank()],
'label' => $this->translator->trans('Mondial Relay store code', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans('This is the store code, as provided by Mondial Relay.', [], MondialRelay::DOMAIN_NAME)
]
]
)->add(
MondialRelay::PRIVATE_KEY,
'text',
[
"constraints" => [new NotBlank()],
'label' => $this->translator->trans('Private key', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans('Your private key, as provided by Mondial Relay.', [], MondialRelay::DOMAIN_NAME)
]
]
)->add(
MondialRelay::ALLOW_HOME_DELIVERY,
'checkbox',
[
'required' => false,
'label' => $this->translator->trans('Allow home delivery', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans('Check this box to allow delivery at customer address in supported countries.', [], MondialRelay::DOMAIN_NAME)
]
]
)->add(
MondialRelay::ALLOW_RELAY_DELIVERY,
'checkbox',
[
'required' => false,
'label' => $this->translator->trans('Allow relay delivery', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans('Check this box to allow delivery in relays in supported countries.', [], MondialRelay::DOMAIN_NAME)
]
]
)->add(
MondialRelay::ALLOW_INSURANCE,
'checkbox',
[
'required' => false,
'label' => $this->translator->trans('Allow optional insurance', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans('Check this box to allow an optionnal insurance selection depending on cart value.', [], MondialRelay::DOMAIN_NAME)
]
]
)->add(
MondialRelay::WEBSERVICE_URL,
'text',
[
'label' => $this->translator->trans('Mondial Relay Web service WSDL URL', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans('This is the URL of the Mondial Relay web service WSDL.', [], MondialRelay::DOMAIN_NAME)
]
]
)->add(
MondialRelay::GOOGLE_MAPS_API_KEY,
'text',
[
'label' => $this->translator->trans('Google Map API Key', [], MondialRelay::DOMAIN_NAME),
'label_attr' => [
'help' => $this->translator->trans(
'This key is required to display relays map. <a href="%get_key_url">Click here</a> to get one.',
[ "%get_key_url" => "https://developers.google.com/maps/documentation/javascript/get-api-key" ],
MondialRelay::DOMAIN_NAME
)
]
]
);
;
}
}