Skip to content

Commit f55b119

Browse files
committed
fix: personal data row inner block
1 parent f44f7e0 commit f55b119

7 files changed

Lines changed: 19 additions & 13 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks'], 'version' => '6b367cd01e8bb61dfd0a'];
1+
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks'], 'version' => '743c996e1df71c631ae5'];

build/personal-data-table/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'], 'version' => 'b973b3662f9ee0c4c3e3'];
1+
<?php return ['dependencies' => ['react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'], 'version' => 'f2161e666b36d62f2bfb'];

build/personal-data-table/personal-data-row/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/blocks/personal-data-table/edit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const Edit = () => {
99
<div className="container px-0">
1010
<InnerBlocks
1111
allowedBlocks={ [
12-
'prefill-gravity-forms/personal-data-row',
12+
'owc-prefill-gravity-forms/personal-data-row',
1313
] }
1414
template={ [
15-
[ 'prefill-gravity-forms/personal-data-row' ],
15+
[ 'owc-prefill-gravity-forms/personal-data-row' ],
1616
] }
1717
renderAppender={ () => <InnerBlocks.ButtonBlockAppender /> }
1818
/>

resources/js/blocks/personal-data-table/personal-data-row/edit.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@ import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
66
import {
77
PanelBody,
88
TabPanel,
9-
TextControl,
109
SelectControl,
1110
} from '@wordpress/components';
1211
import { useSelect } from '@wordpress/data';
13-
import { useEffect, useState } from '@wordpress/element';
12+
import { useEffect } from '@wordpress/element';
1413

1514
/**
1615
* Internal dependencies
@@ -31,7 +30,7 @@ export default function Edit( { attributes, setAttributes, clientId } ) {
3130
useEffect( () => {
3231
if (
3332
blockParents.length > 0 &&
34-
'prefill-gravity-forms/personal-data-table' ===
33+
'owc-prefill-gravity-forms/personal-data-table' ===
3534
blockParents[ blockParents.length - 1 ]
3635
) {
3736
setAttributes( { isChildOfTable: true } );
@@ -66,8 +65,6 @@ export default function Edit( { attributes, setAttributes, clientId } ) {
6665
return str.charAt( 0 ).toLowerCase() + str.slice( 1 );
6766
};
6867

69-
const DynamicElement = htmlElement || 'div';
70-
7168
const selectSupplierControl = (
7269
<SelectControl
7370
help="Selecteer de juiste leverancier die ingesteld is in de algemene instellingen."

src/PrefillGravityForms/Services/PersonalDataService.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace OWC\PrefillGravityForms\Services;
46

57
use Exception;
@@ -50,6 +52,14 @@ private function key(string $key): string
5052
return 'naam.voornamen';
5153
}
5254

55+
if ('enableu' === strtolower($this->supplier) && 'verblijfplaats.woonplaats' === $key) {
56+
return 'verblijfplaats.woonplaatsnaam';
57+
}
58+
59+
if ('enableu' === strtolower($this->supplier) && 'verblijfplaats.straat' === $key) {
60+
return 'verblijfplaats.straatnaam';
61+
}
62+
5363
return $key;
5464
}
5565

@@ -73,7 +83,7 @@ private function format(string $key, string $value): string
7383
$keyFormatMapping = [
7484
'geslachtsaanduiding' => fn ($value) => ucfirst($value),
7585
'naam.voornaam' => fn ($value) => explode(' ', $value)[0],
76-
'geboorte.datum.datum' => fn ($value) => date_i18n(get_option('date_format', 'j F Y'), strtotime($value)),
86+
'geboorte.datum.datum' => fn ($value) => '' !== $value ? date_i18n(get_option('date_format', 'j F Y'), strtotime($value)) : '',
7787
];
7888

7989
if (isset($keyFormatMapping[$key])) {
@@ -82,5 +92,4 @@ private function format(string $key, string $value): string
8292

8393
return $value;
8494
}
85-
8695
}

0 commit comments

Comments
 (0)