From 0bd7d6f7c651feb244f39aca5f610b0b49e5a3f1 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 18 Oct 2022 11:00:57 +0200 Subject: [PATCH 1/7] - editieren von stammdaten im infocentertool --- .../system/infocenter/InfoCenter.php | 86 +++++++++++++++++++ .../models/person/Geschlecht_model.php | 14 +++ .../views/system/infocenter/stammdaten.php | 86 ++++++++++++++----- public/js/infocenter/stammdaten.js | 84 ++++++++++++++++++ system/phrasesupdate.php | 22 ++++- 5 files changed, 271 insertions(+), 21 deletions(-) create mode 100644 application/models/person/Geschlecht_model.php create mode 100644 public/js/infocenter/stammdaten.js diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 48c50bb4a..deaee0e10 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -121,6 +121,7 @@ class InfoCenter extends Auth_Controller 'unlockPerson' => 'infocenter:rw', 'saveFormalGeprueft' => 'infocenter:rw', 'saveDocTyp' => 'infocenter:rw', + 'updateStammdaten' => 'infocenter:rw', 'saveNachreichung' => 'infocenter:rw', 'getPrestudentData' => 'infocenter:r', 'getLastPrestudentWithZgvJson' => 'infocenter:r', @@ -172,6 +173,8 @@ class InfoCenter extends Auth_Controller $this->load->model('codex/Zgv_model', 'ZgvModel'); $this->load->model('codex/Zgvmaster_model', 'ZgvmasterModel'); $this->load->model('codex/Nation_model', 'NationModel'); + $this->load->model('person/Kontakt_model', 'KontaktModel'); + $this->load->model('person/Geschlecht_model', 'GeschlechtModel'); // Loads libraries $this->load->library('PersonLogLib'); @@ -1320,6 +1323,85 @@ class InfoCenter extends Auth_Controller $this->outputJsonSuccess('success'); } + public function updateStammdaten() + { + if (isEmptyString($this->input->post('nachname')) || + isEmptyString($this->input->post('geschlecht')) || + isEmptyString($this->input->post('gebdatum'))) + { + $this->terminateWithJsonError($this->p->t('infocenter', 'stammdatenFeldFehlt')); + } + + $datum = explode('.', $this->input->post('gebdatum')); + + if (!checkdate($datum[1], $datum[0], $datum[2])) + { + $this->terminateWithJsonError($this->p->t('infocenter', 'datumUngueltig')); + } + + $person_id = $this->input->post('personid'); + + $update = $this->PersonModel->update( + array + ( + 'person_id' => $person_id + ), + array + ( + 'titelpre' => isEmptyString($this->input->post('titelpre')) ? null : $this->input->post('titelpre'), + 'vorname' => isEmptyString($this->input->post('vorname')) ? null : $this->input->post('vorname'), + 'nachname' => $this->input->post('nachname'), + 'titelpost' => isEmptyString($this->input->post('titelpost')) ? null : $this->input->post('titelpost'), + 'gebdatum' => isEmptyString($this->input->post('gebdatum')) ? null : date("Y-m-d", strtotime($this->input->post('gebdatum'))), + 'svnr' => isEmptyString($this->input->post('svnr')) ? null : $this->input->post('svnr'), + 'staatsbuergerschaft' => isEmptyString($this->input->post('buergerschaft')) ? null : $this->input->post('buergerschaft'), + 'geschlecht' => $this->input->post('geschlecht'), + 'geburtsnation' => isEmptyString($this->input->post('gebnation')) ? null : $this->input->post('gebnation'), + 'gebort' => isEmptyString($this->input->post('gebort')) ? null : $this->input->post('gebort'), + 'updateamum' => date('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + + if (isError($update)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + + $kontakte = $this->input->post('kontakt'); + foreach($kontakte as $kontakt) + { + $kontaktExists = $this->KontaktModel->loadWhere(array( + 'kontakt_id' => $kontakt['id'], + 'person_id' => $person_id, + )); + + if (hasData($kontaktExists)) + { + $kontaktExists = getData($kontaktExists)[0]; + + if ($kontaktExists->kontakt === $kontakt['value']) + continue; + + $update = $this->KontaktModel->update( + array + ( + 'kontakt_id' => $kontakt['id'] + ), + array + ( + 'kontakt' => isEmptyString($kontakt['value']) ? null : $kontakt['value'], + 'updateamum' => date('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + + if (isError($update)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + } + } + + $this->outputJsonSuccess('Success'); + } + public function saveNachreichung($person_id) { $nachreichungAm = $this->input->post('nachreichungAm'); @@ -1996,6 +2078,9 @@ class InfoCenter extends Auth_Controller $this->NationModel->addOrder('langtext'); $allNations = getData($this->NationModel->load()); + $this->GeschlechtModel->addOrder('sort'); + $allGenders = getData($this->GeschlechtModel->load()); + $data = array ( 'zgvpruefungen' => $zgvpruefungen, 'abwstatusgruende' => $abwstatusgruende, @@ -2004,6 +2089,7 @@ class InfoCenter extends Auth_Controller 'all_zgvs' => $allZGVs, 'all_zgvs_master' => $allZGVsMaster, 'all_nations' => $allNations, + 'all_genders' => $allGenders ); return $data; diff --git a/application/models/person/Geschlecht_model.php b/application/models/person/Geschlecht_model.php new file mode 100644 index 000000000..60ac3ba15 --- /dev/null +++ b/application/models/person/Geschlecht_model.php @@ -0,0 +1,14 @@ +dbTable = 'public.tbl_geschlecht'; + $this->pk = 'geschlecht'; + } +} diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index a80439bfe..595f86b1a 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -1,60 +1,93 @@
-
+
- titelpre)): ?> - + - + - + + + + + + - titelpost)): ?> - - - - - + + + + + + + + - +
p->t('person','titelpre')) ?>titelpre ?>
p->t('person','vorname')) ?>vorname ?>
p->t('person','nachname')) ?> - nachname ?>
p->t('person','titelpost')) ?>
p->t('person','titelpost')) ?>titelpost ?>
p->t('person','geburtsdatum')) ?> - gebdatum), 'd.m.Y') ?>
p->t('person','svnr')) ?> - svnr ?>
p->t('person','staatsbuergerschaft')) ?> - staatsbuergerschaft ?>
p->t('person','geschlecht')) ?> - geschlecht ?>
p->t('person','geburtsnation')) ?> - geburtsnation ?>
p->t('person','geburtsort')) ?>gebort ?>
- +
@@ -83,7 +116,10 @@ kontakt; endif; - echo $kontakt->kontakt; + if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) + echo 'kontakt; if ($kontakt->kontakttyp === 'email'): ?> @@ -126,6 +162,16 @@ target='_blank'> p->t('infocenter','zugangBewerbung') ?> + diff --git a/public/js/infocenter/stammdaten.js b/public/js/infocenter/stammdaten.js new file mode 100644 index 000000000..d63df7b2f --- /dev/null +++ b/public/js/infocenter/stammdaten.js @@ -0,0 +1,84 @@ +$(document).ready(function () +{ + var personid = $("#hiddenpersonid").val(); + + $('.editStammdaten').click(function() + { + Stammdaten._show(); + }); + + $('.cancelStammdaten').click(function() + { + Stammdaten._hide(); + }); + + $('.saveStammdaten').click(function() + { + var kontakt = []; + $('.kontakt_nummer').each(function(){ + kontakt.push({ + id: $(this).data('value'), + value: $(this).val() + }); + }); + + var data = { + "personid" : personid, + "titelpre" : $('#titelpre').val(), + "vorname" : $('#vorname').val(), + "nachname" : $('#nachname').val(), + "titelpost" : $('#titelpost').val(), + "gebdatum" : $('#gebdatum').val(), + "svnr" : $('#svnr').val(), + "buergerschaft" : $('#buergerschaft').val(), + "geschlecht" : $('#geschlecht').val(), + "gebnation" : $('#gebnation').val(), + "gebort" : $('#gebort').val(), + "kontakt" : kontakt + + }; + Stammdaten.update(personid, data); + }); +}); + +var Stammdaten = { + update: function(personid, data) + { + FHC_AjaxClient.ajaxCallPost( + CALLED_PATH + "/updateStammdaten/", + data, + { + successCallback: function(data, textStatus, jqXHR) { + if (FHC_AjaxClient.isSuccess(data)) + { + FHC_DialogLib.alertSuccess("Done!"); + Stammdaten._hide(); + } + else + { + FHC_DialogLib.alertError(FHC_AjaxClient.getError(data)); + } + }, + errorCallback: function() { + FHC_DialogLib.alertWarning("Fehler beim Speichern!"); + } + } + ); + }, + + _hide: function() + { + $('.stammdaten_form').find('input, select').attr('readonly', true); + + $('.editActionStammdaten').hide(); + $('.editStammdaten').show(); + }, + + _show: function() + { + $('.stammdaten_form').find('input, select').attr('readonly', false); + + $('.editActionStammdaten').show(); + $('.editStammdaten').hide(); + } +} \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 8ac09cee0..3151eb0f5 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -17137,7 +17137,27 @@ array( 'insertvon' => 'system' ) ) - ) + ), + array( + 'app' => 'infocenter', + 'category' => 'infocenter', + 'phrase' => 'stammdatenFeldFehlt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Bitte Nachname, Geschlecht und Geburtsdatum ausfüllen.', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'Please fill out the last name, gender and date of birth.', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 53dc6b3c631f708d995a8ba43979f421e2a51bb8 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Fri, 21 Oct 2022 11:07:52 +0200 Subject: [PATCH 2/7] - tag closed --- application/views/system/infocenter/stammdaten.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index 595f86b1a..6dba795d9 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -117,7 +117,7 @@ kontakt; endif; if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) - echo ''; else echo $kontakt->kontakt; if ($kontakt->kontakttyp === 'email'): From 572e53f554f2d290d8f3d2241dbbfb134634c7b8 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 25 Oct 2022 07:02:13 +0200 Subject: [PATCH 3/7] - addon angepassst fuer die stammdaten --- application/views/system/infocenter/stammdaten.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index 6dba795d9..ac8f6347c 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -111,13 +111,13 @@ - @@ -100,7 +93,6 @@
p->t('global','kontakt')) ?> kontakttyp) ?> - kontakttyp.'">';?> + kontakttyp.'" data-value="'. $kontakt->kontakt .'">';?> kontakttyp === 'email'): ?> kontakt; endif; if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) - echo ''; + echo ''; else echo $kontakt->kontakt; if ($kontakt->kontakttyp === 'email'): From 9192befce1cf461f9474865b1f7bddf7dd685346 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 25 Oct 2022 07:08:29 +0200 Subject: [PATCH 4/7] - stammdaten include --- application/views/system/infocenter/infocenterZgvDetails.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/views/system/infocenter/infocenterZgvDetails.php b/application/views/system/infocenter/infocenterZgvDetails.php index 62fefbec8..5bfb6c603 100644 --- a/application/views/system/infocenter/infocenterZgvDetails.php +++ b/application/views/system/infocenter/infocenterZgvDetails.php @@ -26,7 +26,8 @@ 'public/js/tablesort/tablesort.js', 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', - 'public/js/infocenter/zgvUeberpruefung.js' + 'public/js/infocenter/zgvUeberpruefung.js', + 'public/js/infocenter/stammdaten.js', ), 'phrases' => array( 'infocenter' => array( From 4518eab1a81a94697c8ee6b4293ba7a8a5dd8e2f Mon Sep 17 00:00:00 2001 From: ma0048 Date: Tue, 25 Oct 2022 07:14:47 +0200 Subject: [PATCH 5/7] - stammdaten include --- application/views/system/infocenter/infocenterDetails.php | 3 ++- application/views/system/infocenter/infocenterZgvDetails.php | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 76a371c11..c8b16a1c3 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -27,7 +27,8 @@ 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', 'public/js/infocenter/zgvUeberpruefung.js', - 'public/js/infocenter/docUeberpruefung.js' + 'public/js/infocenter/docUeberpruefung.js', + 'public/js/infocenter/stammdaten.js' ), 'phrases' => array( 'infocenter' => array( diff --git a/application/views/system/infocenter/infocenterZgvDetails.php b/application/views/system/infocenter/infocenterZgvDetails.php index 5bfb6c603..62fefbec8 100644 --- a/application/views/system/infocenter/infocenterZgvDetails.php +++ b/application/views/system/infocenter/infocenterZgvDetails.php @@ -26,8 +26,7 @@ 'public/js/tablesort/tablesort.js', 'public/js/infocenter/messageList.js', 'public/js/infocenter/infocenterDetails.js', - 'public/js/infocenter/zgvUeberpruefung.js', - 'public/js/infocenter/stammdaten.js', + 'public/js/infocenter/zgvUeberpruefung.js' ), 'phrases' => array( 'infocenter' => array( From 651a4a97e7f22138ce7ac683445a08fcedd2a8f6 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 2 Nov 2022 16:50:53 +0100 Subject: [PATCH 6/7] - stammdaten editierbar --- .../system/infocenter/InfoCenter.php | 44 +++++- .../views/system/infocenter/stammdaten.php | 76 ++++++++--- public/js/infocenter/stammdaten.js | 128 +++++++++++++++++- 3 files changed, 225 insertions(+), 23 deletions(-) diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index deaee0e10..187a006bd 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -175,6 +175,7 @@ class InfoCenter extends Auth_Controller $this->load->model('codex/Nation_model', 'NationModel'); $this->load->model('person/Kontakt_model', 'KontaktModel'); $this->load->model('person/Geschlecht_model', 'GeschlechtModel'); + $this->load->model('person/adresse_model', 'AdresseModel'); // Loads libraries $this->load->library('PersonLogLib'); @@ -1367,7 +1368,7 @@ class InfoCenter extends Auth_Controller $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); $kontakte = $this->input->post('kontakt'); - foreach($kontakte as $kontakt) + foreach ($kontakte as $kontakt) { $kontaktExists = $this->KontaktModel->loadWhere(array( 'kontakt_id' => $kontakt['id'], @@ -1398,6 +1399,47 @@ class InfoCenter extends Auth_Controller $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); } } + + $adressen = $this->input->post('adresse'); + + foreach ($adressen as $adresse) + { + $adresseExists = $this->AdresseModel->loadWhere(array( + 'adresse_id' => $adresse['id'], + 'person_id' => $person_id, + )); + + if (hasData($adresseExists)) + { + $adresse = $adresse['value']; + $adresseExists = getData($adresseExists)[0]; + if ($adresseExists->strasse !== $adresse['strasse'] || + $adresseExists->plz !== $adresse['plz'] || + $adresseExists->ort !== $adresse['ort'] || + $adresseExists->nation !== $adresse['nation']) + { + $update = $this->AdresseModel->update( + array + ( + 'adresse_id' => $adresseExists->adresse_id + ), + array + ( + 'strasse' => isEmptyString($adresse['strasse']) ? null : $adresse['strasse'], + 'plz' => isEmptyString($adresse['plz']) ? null : $adresse['plz'], + 'ort' => isEmptyString($adresse['ort']) ? null : $adresse['ort'], + 'nation' => isEmptyString($adresse['nation']) ? null : $adresse['nation'], + 'updateamum' => date('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + + if (isError($update)) + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + } + + } + } $this->outputJsonSuccess('Success'); } diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index ac8f6347c..47cf7b253 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -3,36 +3,52 @@ - + + - + +
nachname ?>
+ + - + +
gebdatum), 'd.m.Y') ?>
+ + +
svnr ?>
+ + - +
p->t('person','titelpre')) ?> +
titelpre ?>
+
p->t('person','vorname')) ?> +
vorname ?>
+ + +
p->t('person','nachname')) ?> -
p->t('person','titelpost')) ?> +
titelpost ?>
+ +
p->t('person','geburtsdatum')) ?> -
p->t('person','svnr')) ?> -
p->t('person','staatsbuergerschaft')) ?> - - p->t('person','geburtsnation')) ?> -
p->t('person','geburtsort')) ?> +
gebort ?>
+ +
@@ -111,14 +130,14 @@
kontakttyp) ?> - kontakttyp.'" data-value="'. $kontakt->kontakt .'">';?> + kontakttyp.'" data-id="'. $kontakt->kontakt_id .'" data-value="' . $kontakt->kontakt .'">';?> kontakttyp === 'email'): ?> kontakt; endif; - if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) - echo ''; - else + /*if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) + echo ''; + else*/ echo $kontakt->kontakt; if ($kontakt->kontakttyp === 'email'): ?> @@ -135,8 +154,33 @@ p->t('person','adresse')) ?> - strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?> - nationkurztext) ? '
'.$adresse->nationkurztext : '' ?> + +
+
strasse ?>
+ + +
plz ?>
+ + +
ort ?>
+ + + nationkurztext)): ?> + +
+
+ +
heimatadresse === true ? 'Heimatadresse' : ''). diff --git a/public/js/infocenter/stammdaten.js b/public/js/infocenter/stammdaten.js index d63df7b2f..a8a15b23b 100644 --- a/public/js/infocenter/stammdaten.js +++ b/public/js/infocenter/stammdaten.js @@ -15,13 +15,27 @@ $(document).ready(function () $('.saveStammdaten').click(function() { var kontakt = []; - $('.kontakt_nummer').each(function(){ + $('.kontakt_input').each(function(){ kontakt.push({ - id: $(this).data('value'), + id: $(this).data('id'), value: $(this).val() }); }); + var adresse = []; + $('.adresse').each(function(){ + var id = $(this).data('value'); + adresse.push({ + id: id, + value: { + 'strasse': $('#input_strasse_' + id).val(), + 'plz': $('#input_plz_' + id).val(), + 'ort': $('#input_ort_' + id).val(), + 'nation': $('#nation_' + id).val(), + } + }); + }); + var data = { "personid" : personid, "titelpre" : $('#titelpre').val(), @@ -34,8 +48,8 @@ $(document).ready(function () "geschlecht" : $('#geschlecht').val(), "gebnation" : $('#gebnation').val(), "gebort" : $('#gebort').val(), - "kontakt" : kontakt - + "kontakt" : kontakt, + "adresse" : adresse, }; Stammdaten.update(personid, data); }); @@ -52,6 +66,8 @@ var Stammdaten = { if (FHC_AjaxClient.isSuccess(data)) { FHC_DialogLib.alertSuccess("Done!"); + Stammdaten._showKontakt(); + Stammdaten._showAdresse(); Stammdaten._hide(); } else @@ -66,9 +82,62 @@ var Stammdaten = { ); }, + _showKontakt: function() + { + $('.kontakt_input').each(function() { + var span = $(this).parent('td').children('span'); + var value = $(this).val(); + + var oldSpanValue = span.data('value'); + span.data('value', value); + var newhtml = span.html().replace(oldSpanValue, value); + span.html(newhtml); + if (span.hasClass('email')) + span.find('a').attr('href', 'mailto:' + value); + + span.show(); + $(this).remove(); + }); + }, + + _showAdresse: function() + { + $('.adresse').each(function() { + var adressenID = $(this).data('value'); + $(this).children('input').each(function() { + $(this).attr('id'); + var div = $(this).attr('id').replace('input_', ''); + $('#' + div).html($(this).val()) + $('#' + div).show(); + $(this).remove(); + }); + }); + + }, + _hide: function() { - $('.stammdaten_form').find('input, select').attr('readonly', true); + var stammdatenform = $('.stammdaten_form'); + stammdatenform.find('select').attr('disabled', true); + + $('.stammdaten').each(function(){ + var id = $(this).attr('id'); + var div = $('
'); + div.attr('id', id); + div.addClass('stammdaten'); + div.html($(this).val()); + $(this).parent('td').html(div); + }); + + $('.kontakt_input').each(function(){ + $(this).parent('td').children('span').show(); + $(this).remove(); + }); + + $('.adresse_input').each(function(){ + $(this).parent('div').children('div').show(); + $(this).remove(); + }); $('.editActionStammdaten').hide(); $('.editStammdaten').show(); @@ -76,9 +145,56 @@ var Stammdaten = { _show: function() { - $('.stammdaten_form').find('input, select').attr('readonly', false); + $('.stammdaten').each(function() { + var id = $(this).attr('id'); + var input = $(''); + input.attr('id', id); + input.addClass('form-control stammdaten'); + input.val($(this).html()); + $(this).parent('td').html(input); + }); + $('.kontakt').each(function() { + var id = $(this).data('id'); + var value = $(this).data('value'); + + $(this).hide(); + + var input = $(''); + input.attr('data-id', id); + input.attr('value', value); + input.addClass('form-control kontakt_input'); + input.val(value); + $(this).parent('td').append(input); + }); + + $('.adresse').each(function() { + var adressenID = $(this).data('value'); + $($(this).children('div').get().reverse()).each(function() { + $(this).hide(); + var id = $(this).attr('id'); + + var input = $(''); + var value = $(this).html(); + + input.attr('id', 'input_' + Stammdaten._getPlaceholder(id) + "_" + adressenID); + input.attr('value', value); + input.attr('placeholder', Stammdaten._getPlaceholder(id).toUpperCase()); + input.addClass('form-control adresse_input'); + input.val(value); + $(this).parent().prepend(input); + }); + }); + + var stammdatenform = $('.stammdaten_form'); + + stammdatenform.find('select').attr('disabled', false); $('.editActionStammdaten').show(); $('.editStammdaten').hide(); + }, + + _getPlaceholder(elementid) + { + return elementid.substr(0, elementid.indexOf("_")); } } \ No newline at end of file From ffec6a5422230a7fc8dde995f45e37dec19db966 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 3 Nov 2022 09:55:38 +0100 Subject: [PATCH 7/7] - stammdaten editierbar --- .../views/system/infocenter/stammdaten.php | 26 +--- public/js/infocenter/stammdaten.js | 139 +++++++++--------- 2 files changed, 73 insertions(+), 92 deletions(-) diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index 47cf7b253..f143c9c03 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -6,43 +6,36 @@
titelpre ?>
p->t('person','vorname')) ?>
vorname ?>
- -
p->t('person','nachname')) ?>
nachname ?>
-
p->t('person','titelpost')) ?>
titelpost ?>
-
p->t('person','geburtsdatum')) ?>
gebdatum), 'd.m.Y') ?>
-
p->t('person','svnr')) ?>
svnr ?>
-
p->t('person','geburtsort')) ?>
gebort ?>
-
@@ -135,10 +127,7 @@ kontakt; endif; - /*if (($kontakt->kontakttyp === 'telefon' || $kontakt->kontakttyp === 'mobil')) - echo ''; - else*/ - echo $kontakt->kontakt; + echo $kontakt->kontakt; if ($kontakt->kontakttyp === 'email'): ?> @@ -155,16 +144,13 @@ -
-
strasse ?>
- +
+
strasse ?>
-
plz ?>
- +
plz ?>
-
ort ?>
- - +
ort ?>
+ nationkurztext)): ?> '); - input.attr('id', id); - input.addClass('form-control stammdaten'); + input.attr('id', id + '_input'); + input.addClass('form-control stammdaten_input'); input.val($(this).html()); - $(this).parent('td').html(input); + $(this).hide(); + $(this).parent('td').append(input); }); $('.kontakt').each(function() { @@ -169,17 +125,17 @@ var Stammdaten = { }); $('.adresse').each(function() { - var adressenID = $(this).data('value'); + var adressenID = $(this).data('id'); $($(this).children('div').get().reverse()).each(function() { $(this).hide(); - var id = $(this).attr('id'); - + var type = $(this).data('type'); + var value = $(this).data('value'); var input = $(''); - var value = $(this).html(); - input.attr('id', 'input_' + Stammdaten._getPlaceholder(id) + "_" + adressenID); + input.attr('data-type', type); + input.attr('id', type + '_' + adressenID); input.attr('value', value); - input.attr('placeholder', Stammdaten._getPlaceholder(id).toUpperCase()); + input.attr('placeholder', type.toUpperCase()); input.addClass('form-control adresse_input'); input.val(value); $(this).parent().prepend(input); @@ -193,8 +149,47 @@ var Stammdaten = { $('.editStammdaten').hide(); }, - _getPlaceholder(elementid) + _updated: function() { - return elementid.substr(0, elementid.indexOf("_")); - } + $('.kontakt_input').each(function() { + var span = $(this).parent('td').children('span'); + var value = $(this).val(); + + var oldSpanValue = span.data('value'); + span.data('value', value); + var newhtml = span.html().replace(oldSpanValue, value); + span.html(newhtml); + if (span.hasClass('email')) + span.find('a').attr('href', 'mailto:' + value); + + span.show(); + $(this).remove(); + }); + + $('.adresse').each(function() { + $(this).children('input').each(function() { + var value = $(this).val(); + var type = $(this).data('type'); + var div = $('div[data-type="' + type + '"]'); + div.data('value', value); + div.html(value); + div.show(); + $(this).remove(); + }); + }); + + $('.stammdaten_input').each(function() { + var div = $(this).parent('td').children('div'); + var value = $(this).val(); + div.html(value); + div.show(); + $(this).remove(); + }); + + var stammdatenform = $('.stammdaten_form'); + stammdatenform.find('select').attr('disabled', true); + + $('.editActionStammdaten').hide(); + $('.editStammdaten').show(); + }, } \ No newline at end of file