Browse Source

updated add Osoba / Podmiot form

Piotr Labudda 7 years ago
parent
commit
070ef75d40
1 changed files with 26 additions and 11 deletions
  1. 26 11
      tools/Bocian.php.addItemToRaport.js

+ 26 - 11
tools/Bocian.php.addItemToRaport.js

@@ -210,7 +210,7 @@ var P5UI_AddItemToReport = createReactClass({
         var handleSelectBaza = this._handleSelectBaza.bind(this);
         var handleSelectNewItem = this._handleSelectNewItem.bind(this);
         var selectedBaza = this.state.baza;
-        var selectedNewItem = this.state.newItemBaza;
+        var selectedNewItemBaza = this.state.newItemBaza;
         var selectedItem = this.state.selected;
         var selectedLabel = '';
         if (selectedBaza) {
@@ -235,7 +235,7 @@ var P5UI_AddItemToReport = createReactClass({
                     newItemBtns.map(function (btn) {
                         return generateNewItemBtn(btn, {
                             onClick: handleSelectNewItem,
-                            selected: (selectedNewItem === btn.baza),
+                            selected: (selectedNewItemBaza === btn.baza),
                         });
                     })
                 )
@@ -268,7 +268,7 @@ var P5UI_AddItemToReport = createReactClass({
                     return h(P5UI_AddItemToReport_BazaMenuItem, { key: option.ID, baza: selectedBaza, data: option });
                 }
             }),
-            (selectedNewItem==="default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY") && h('div', { className: 'form-group' }, [
+            (selectedNewItemBaza === "default_db/BI_audit_ENERGA_PRACOWNICY/BI_audit_ENERGA_PRACOWNICY") && h('div', { className: 'form-group' }, [
               h('input',{
                 className:'form-control required',
                 id:'personName',
@@ -285,12 +285,20 @@ var P5UI_AddItemToReport = createReactClass({
                 placeholder:'Pesel'
               }),
               h('input',{
-                className:'form-control required',
+                className:'form-control',
                 id:'personNip',
                 placeholder:'NIP'
-              })
+              }),
+              h('button', { className: "btn btn-primary", onClick: function () {
+                _onSelect(selectedNewItemBaza, {
+                  personName: document.getElementById('personName').value,
+                  personSurname: document.getElementById('personSurname').value,
+                  personPesel: document.getElementById('personPesel').value,
+                  personNip: document.getElementById('personNip').value,
+                })
+              }.bind(this) }, "Dodaj osobę")
             ]),
-            (selectedNewItem==="default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI") && h('div', { className: 'form-group' }, [
+            (selectedNewItemBaza === "default_db/BI_audit_ENERGA_RUM_KONTRAHENCI/BI_audit_ENERGA_RUM_KONTRAHENCI") && h('div', { className: 'form-group' }, [
               h('input',{
                 className:'form-control required',
                 id:'companyName',
@@ -298,14 +306,21 @@ var P5UI_AddItemToReport = createReactClass({
               }),
               h('input',{
                 className:'form-control required',
+                id:'companyNip',
+                placeholder:'NIP'
+              }),
+              h('input',{
+                className:'form-control',
                 id:'comapanyRegon',
                 placeholder:'REGON'
               }),
-              h('input',{
-                className:'form-control required',
-                id:'companyNip',
-                placeholder:'NIP'
-              })
+              h('button', { className: "btn btn-primary", onClick: function () {
+                _onSelect(selectedNewItemBaza, {
+                  companyName: document.getElementById('companyName').value,
+                  companyNip: document.getElementById('companyNip').value,
+                  comapanyRegon: document.getElementById('comapanyRegon').value,
+                })
+              }.bind(this) }, "Dodaj podmiot")
             ]),
             (selectedBaza && selectedItem) && h('div', { style: { margin: '22px' } }, [
                 h('button', {