mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix phonenumber -> telephone for thirdparty
This commit is contained in:
parent
e9236875d2
commit
e32b8b0942
@ -93,7 +93,6 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue';
|
||||
import OnTheFlyCreate from './Create.vue';
|
||||
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
||||
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
||||
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
||||
|
||||
export default {
|
||||
name: 'OnTheFly',
|
||||
@ -218,21 +217,24 @@ export default {
|
||||
|
||||
case 'thirdparty':
|
||||
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||
/* never executed ? */
|
||||
/* never executed ? Yes, when editing thirdparty... */
|
||||
break;
|
||||
|
||||
default:
|
||||
if (typeof this.type === 'undefined') { // action=create or addContact
|
||||
console.log('will rewrite data');
|
||||
console.log('will rewrite data');
|
||||
if (this.action === 'addContact') {
|
||||
type = 'thirdparty'
|
||||
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||
console.log('data original', data);
|
||||
data.parent = {type: "thirdparty", id: this.parent.id};
|
||||
// data.civility = {type: 'chill_main_civility', id: civility.id };
|
||||
// data.profession = {type: 'third_party_profession', id: profession.id };
|
||||
} else {
|
||||
console.log('im here')
|
||||
type = this.$refs.castNew.radioType;
|
||||
data = this.$refs.castNew.castDataByType();
|
||||
console.log(data)
|
||||
console.log('saveAction', data)
|
||||
}
|
||||
} else {
|
||||
throw 'error with object type';
|
||||
|
@ -40,6 +40,10 @@ class PhonenumberNormalizer implements NormalizerInterface, DenormalizerInterfac
|
||||
*/
|
||||
public function denormalize($data, $type, $format = null, array $context = [])
|
||||
{
|
||||
if ("" == trim($data)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->phoneNumberUtil->parse($data, $this->defaultCarrierCode);
|
||||
} catch (NumberParseException $e) {
|
||||
|
@ -170,7 +170,7 @@ export default {
|
||||
console.log('data', payload.data)
|
||||
body.name = payload.data.name;
|
||||
body.email = payload.data.email;
|
||||
body.telephone = payload.data.phonenumber;
|
||||
body.telephone = payload.data.telephone;
|
||||
body.address = payload.data.address ? { id: payload.data.address.address_id } : null;
|
||||
|
||||
makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body)
|
||||
|
@ -61,9 +61,9 @@
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<address-render-box :address="thirdparty.address" :isMultiline="isMultiline"></address-render-box>
|
||||
</li>
|
||||
<li v-if="thirdparty.phonenumber">
|
||||
<li v-if="thirdparty.telephone">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<a :href="'tel: ' + thirdparty.phonenumber">{{ thirdparty.phonenumber }}</a>
|
||||
<a :href="'tel: ' + thirdparty.telephone">{{ thirdparty.telephone }}</a>
|
||||
</li>
|
||||
<li v-if="thirdparty.email">
|
||||
<i class="fa fa-li fa-envelope-o"></i>
|
||||
@ -78,9 +78,9 @@
|
||||
<i class="fa fa-li fa-map-marker"></i>
|
||||
<address-render-box :address="thirdparty.address" :isMultiline="isMultiline"></address-render-box>
|
||||
</li>
|
||||
<li v-if="thirdparty.phonenumber">
|
||||
<li v-if="thirdparty.telephone">
|
||||
<i class="fa fa-li fa-mobile"></i>
|
||||
<a :href="'tel: ' + thirdparty.phonenumber">{{ thirdparty.phonenumber }}</a>
|
||||
<a :href="'tel: ' + thirdparty.telephone">{{ thirdparty.telephone }}</a>
|
||||
</li>
|
||||
<li v-if="thirdparty.email">
|
||||
<i class="fa fa-li fa-envelope-o"></i>
|
||||
|
@ -116,12 +116,12 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="phonenumber"><i class="fa fa-fw fa-phone"></i></span>
|
||||
<span class="input-group-text" id="telephone"><i class="fa fa-fw fa-phone"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="thirdparty.phonenumber"
|
||||
v-model="thirdparty.telephone"
|
||||
v-bind:placeholder="$t('thirdparty.phonenumber')"
|
||||
v-bind:aria-label="$t('thirdparty.phonenumber')"
|
||||
aria-describedby="phonenumber" />
|
||||
aria-describedby="telephone" />
|
||||
</div>
|
||||
|
||||
<div v-if="parent">
|
||||
@ -266,10 +266,10 @@ export default {
|
||||
this.thirdparty.name = query;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
let dependencies = [];
|
||||
dependencies.push(this.loadProfessions());
|
||||
dependencies.push(this.loadCivilities());
|
||||
mounted() {
|
||||
let dependencies = [];
|
||||
dependencies.push(this.loadProfessions());
|
||||
dependencies.push(this.loadCivilities());
|
||||
if (this.action !== 'create') {
|
||||
if (this.id) {
|
||||
dependencies.push(this.loadData());
|
||||
|
@ -62,7 +62,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
||||
}, $thirdParty->getTypesAndCategories()),
|
||||
'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context),
|
||||
'address' => $this->normalizer->normalize($thirdParty->getAddress(), $format, ['address_rendering' => 'short']),
|
||||
'phonenumber' => $this->normalizer->normalize($thirdParty->getTelephone()),
|
||||
'telephone' => $this->normalizer->normalize($thirdParty->getTelephone()),
|
||||
'email' => $thirdParty->getEmail(),
|
||||
'isChild' => $thirdParty->isChild(),
|
||||
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
||||
|
Loading…
x
Reference in New Issue
Block a user