On avance sur CadeauBienvenue

This commit is contained in:
2021-01-27 19:20:51 +01:00
parent 1a4eb8f45e
commit bdb2beef89
141 changed files with 211 additions and 9316 deletions

View File

@@ -146,10 +146,10 @@
</hook>
<!-- Additional fields for the register form -->
<!--<hook id="customer.family.register.form" class="CustomerFamily\Hook\CustomerFamilyRegisterFormHook">
<hook id="customer.family.register.form" class="CustomerFamily\Hook\CustomerFamilyRegisterFormHook">
<tag name="hook.event_listener" event="register.form-bottom" type="front" method="onRegisterFormBottom"/>
<tag name="hook.event_listener" event="register.after-javascript-include" type="front" method="onRegisterAfterJSInclude"/>
</hook>-->
</hook>
<!-- Showing customer family information -->
<hook id="customer.family.account.display" class="CustomerFamily\Hook\CustomerFamilyAccountDisplayHook">

View File

@@ -129,7 +129,7 @@ class CustomerFamilyFormListener extends BaseAction implements EventSubscriberIn
self::CUSTOMER_FAMILY_VAT_FIELD_NAME,
'text',
array(
'required' => true,
'required' => false,
'empty_data' => false,
'label' => self::trans('Vat'),
'label_attr' => array(

View File

@@ -89,7 +89,7 @@ class CustomerCustomerFamilyForm extends BaseForm
'siret',
'text',
array(
'required' => false,
'required' => true,
'empty_data' => false,
'label' => Translator::getInstance()->trans(
'Siret number',

View File

@@ -1,9 +1,10 @@
<?php
return array(
'By checking this check box this module will use the product price of Thelia instead of the the purchase price of CustomerFamily' => 'En cochant cette case, le module va utiliser le prix de vente du produit plutôt que son prix d\'achat.',
'Code' => 'Code',
'Customer' => 'Client',
'Customer family' => 'Famille clients',
'Customer family' => 'Vous êtes un ?',
'Customer family was created successfully' => 'La famille a été créée avec succès',
'Customer family was deleted successfully' => 'La famille a été supprimée avec succès',
'Customer family was updated successfully' => 'La famille a été modifiée avec succès',
@@ -16,5 +17,6 @@ return array(
'Siret number' => 'Numéro de SIRET',
'This field can\'t be empty' => 'Ce champs ne peut pas être vide',
'Title' => 'Nom',
'Use the product price' => 'Utiliser le prix de vente',
'Vat' => 'TVA intracommunautaire',
);

View File

@@ -1,7 +1,7 @@
<?php
return array(
'Customer family' => 'Famille de client',
'Customer family' => 'Informations professionnelles',
'Placeholder SIRET' => 'SIRET',
'Placeholder V.A.T.' => 'Taxe sur la Valeur Ajoutée',
'Select customer family' => 'Sélectionnez un type de compte',

View File

@@ -7,7 +7,7 @@
<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="Family of this customer" d="customerfamily"}</div>
<div class="col-md-12 title title-without-tabs">{intl l="Family of this customer" d="customerfamily.bo.default"}</div>
<div class="col-md-12">
<div class="col-md-12">
{form name="customer.customer.family.form"}
@@ -39,7 +39,7 @@
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l="Placeholder siret"}" value="{$_siret_}"{if $required} aria-required="true"{/if}{if !isset($error_focus) && $error} autofocus{/if}>
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l='Placeholder siret'}" value="{$_siret_}"{if $required} aria-required="true"{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
@@ -50,10 +50,10 @@
{form_field form=$form field="vat"}
<div class="form-group group-email {if $error}has-error{/if}">
<label class="control-label" for="{$label_attr.for}">{$label} <span class="required">*</span></label>
<label class="control-label" for="{$label_attr.for}">{$label}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l="Placeholder vat"}" value="{$_vat_}"{if $required} aria-required="true"{/if}{if !isset($error_focus) && $error} autofocus{/if}>
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l='Placeholder vat'}" value="{$_vat_}"{if $required} aria-required="true"{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}

View File

@@ -0,0 +1,26 @@
{default_translation_domain domain=$messageDomain}
{loop type="customer_customer_family" name="customer_customer_family" customer_id={$customerId} }
<div id="customer-customer-family-{$CUSTOMER_ID}-{$CUSTOMER_FAMILY_ID}">
{loop type="customer_family" name="customer_family" id={$CUSTOMER_FAMILY_ID} }
<table class="table" role="presentation" summary="{$title}">
<tbody>
<tr>
<th>{intl l='Customer family'}</th>
<td>{$TITLE_CUSTOMER_FAMILY}</td>
</tr>
{if $CODE != $particular}
{* The Customer should have a SIRET and a VAT. Display them. *}
<tr>
<th>{intl l='Siret number'}</th>
<td>{$SIRET}</td>
</tr>
<tr>
<th>{intl l='Vat'}</th>
<td>{$VAT}</td>
</tr>
{/if}
</tbody>
</table>
{/loop}
</div>
{/loop}

View File

@@ -0,0 +1,50 @@
{default_translation_domain domain=$messageDomain}
<fieldset id="register-customer-family" class="panel">
<div class="panel-heading">{intl l='Customer family'}</div>
<div class="panel-body">
{form_field form=$form field='customer_family_code'}
<div class="form-group {if $error} has-error{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<select name="{$name}" id="customer_family_code_select" class="form-control"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
<option value="" data-code="none"{if {$value} eq '' } selected="selected"{/if}>-- {intl l="Select customer family"} --</option>
{loop type="customer_family" name="customer_family"}
<option value="{$CODE}" data-code="{$CODE}"{if {$value} eq {$CODE} } selected="selected"{/if}>{$TITLE_CUSTOMER_FAMILY}</option>
{/loop}
</select>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{* Additional fields for CustomerCustomerFamily update. Should not be displayed if the customer is a particular one. *}
<div id="customer-family-extra-fields">
{form_field form=$form field='siret' }
<div class="form-group{if $error} has-error{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l='Placeholder SIRET'}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field='vat' }
<div class="form-group{if $error} has-error{/if}">
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l='Placeholder V.A.T.'}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
</div>
</div>
</fieldset>

View File

@@ -0,0 +1,16 @@
$('#customer_family_code_select').change(customerFamilyShowProFields);
/* Number for the customer family panel. */
$(document).ready(function (e) {
$('#number-customer-family').text($('#register-customer-family').prevAll('fieldset').length + 1);
customerFamilyShowProFields();
});
/* Hiding professional fields if the customer is not a professional one. */
function customerFamilyShowProFields() {
var data_code = $('#customer_family_code_select option:selected').attr('data-code');
$('#customer-family-extra-fields').css(
'display',
(data_code === 'particular' || data_code === 'none') ? 'none' : 'block'
);
}

View File

@@ -0,0 +1,11 @@
/* Hiding professional fields if the customer is not a professional one. */
function customerFamilyShowProFields() {
var data_code = $('#customer_family_code_select option:selected').attr('data-code');
$('#customer-family-extra-fields').css(
'display',
(data_code === 'particular' || data_code === 'none') ? 'none' : 'block'
);
}
$('#customer_family_code_select').change(customerFamilyShowProFields);
$(document).ready(customerFamilyShowProFields);

View File

@@ -0,0 +1,49 @@
<fieldset id="register-customer-family" class="panel panel-info">
<div class="panel-heading"><span id="number-customer-family"></span>.&nbsp;{intl l='Customer family-Section title' d='customerfamily.fo.custom'}</div>
<div class="panel-body">
{form_field form=$form field='customer_family_code'}
<div class="form-group {if $error} has-error{/if}">
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input col-sm-5">
<select name="{$name}" id="customer_family_code_select" class="form-control"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
<option value="" data-code="none">-- {intl l="Select customer family"} --</option>
{loop type="customer_family" name="customer_family"}
<option value="{$CODE}" data-code="{$CODE}" {if $IS_DEFAULT == 1} selected="selected"{/if}>{$TITLE_CUSTOMER_FAMILY}</option>
{/loop}
</select>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{* Additional fields for CustomerCustomerFamily creation. Should not be displayed if the customer is a particular one. *}
<div id="customer-family-extra-fields">
{form_field form=$form field='siret' }
<div class="form-group{if $error} has-error{/if}">
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input col-sm-5">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l='Placeholder SIRET'}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
{form_field form=$form field='vat' }
<div class="form-group{if $error} has-error{/if}">
<label class="control-label col-sm-3" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input col-sm-5">
<input type="text" name="{$name}" id="{$label_attr.for}" class="form-control" maxlength="255" placeholder="{intl l='Placeholder V.A.T.'}" value="{$value}" {if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->
{/form_field}
</div>
</div>
</fieldset>

View File

@@ -7,14 +7,14 @@
<label class="control-label" for="{$label_attr.for}">{$label}{if $required} <span class="required">*</span>{/if}</label>
<div class="control-input">
<select name="{$name}" id="customer_family_code_select" class="form-control"{if $required} aria-required="true" required{/if}{if !isset($error_focus) && $error} autofocus{/if}>
<option value="" data-code="none"{if "$value" == '' } selected="selected"{/if}>-- {intl l="Select customer family"} --</option>
{loop type="customer_family" name="customer_family"}
<option value="{$CODE}" data-code="{$CODE}" {if "$value" == "$CODE" } selected="selected"{/if}>{$TITLE_CUSTOMER_FAMILY}</option>
{/loop}
<option value="" data-code="none"{if "$value" == '' } selected="selected"{/if}>-- {intl l="Select customer family"} --</option>
{loop type="customer_family" name="customer_family"}
<option value="{$CODE}" data-code="{$CODE}" {if "$value" == "$CODE" } selected="selected"{/if}>{$TITLE_CUSTOMER_FAMILY}</option>
{/loop}
</select>
{if $error }
<span class="help-block">{$message}</span>
{assign var="error_focus" value="true"}
{assign var="error_focus" value="true"}
{/if}
</div>
</div><!--/.form-group-->