|
@@ -33,34 +33,67 @@ var P5UI_AddItemToReport = createReactClass({
|
|
|
},
|
|
|
_handleSearch: function (query) {
|
|
|
this.setState({ isSearching: true });
|
|
|
+ var options= [];
|
|
|
//Baza= this.state.baza;
|
|
|
- setTimeout(function () {
|
|
|
- var options = [];
|
|
|
- options.push({
|
|
|
- ID: 601900,
|
|
|
- nazwa: "ADEGROUP SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ SPÓŁKA KOMANDYTOWA",
|
|
|
- krs: "0000721712", nip: "5862328735", regon: "369609850",
|
|
|
- S_kraj: "POLSKA", S_miejscowosc: "GDYNIA", A_kod: "81-310", A_ulica: "ŚLĄSKA", A_nrDomu: "35/37",
|
|
|
- searchLabel: "ADEGROUP SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ SPÓŁKA KOMANDYTOWA, ŚLĄSKA 35/37, 81-310 GDYNIA, krs: 0000721712, nip: 5862328735, regon: 369609850",
|
|
|
- label: "ADEGROUP SPÓŁKA ..., ŚLĄSKA 35/37, 81-310 GDYNIA"
|
|
|
- })
|
|
|
- options.push({
|
|
|
- ID: 601900,
|
|
|
- nazwa: "BIZNESLIMIT.PL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ",
|
|
|
- krs: "0000721708", nip: "9452218050", regon: "369608402",
|
|
|
- S_kraj: "POLSKA", S_miejscowosc: "KRAKÓW", A_kod: "31-315", A_ulica: "ELIASZA RADZIKOWSKIEGO", A_nrLokalu: "16", A_nrDomu: "74",
|
|
|
- searchLabel: "BIZNESLIMIT.PL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ ELIASZA RADZIKOWSKIEGO 74/16, 31-315 KRAKÓW 0000721708 9452218050 369608402",
|
|
|
- label: "BIZNESLIMIT.PL ..., ELIASZA RADZIKOWSKIEGO 74/16, 31-315 KRAKÓW"
|
|
|
- })
|
|
|
- this.setState({ isSearching: false, options: options });
|
|
|
- }.bind(this), 1000);
|
|
|
- // makeAndHandleRequest(query)
|
|
|
- // .then(({ options }) => {
|
|
|
- // this.setState({
|
|
|
- // isLoading: false,
|
|
|
- // options,
|
|
|
- // });
|
|
|
- // });
|
|
|
+ window.fetch(URL_FETCH_FROM_BAZA, {
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'contentType': 'applications/json'
|
|
|
+ },
|
|
|
+ credentials: 'same-origin',
|
|
|
+ body: JSON.stringify({
|
|
|
+ 'baza': this.state.baza,
|
|
|
+
|
|
|
+ })
|
|
|
+ .then(function(responseText) {
|
|
|
+
|
|
|
+ try {
|
|
|
+ return JSON.parse(responseText);
|
|
|
+ } catch (e) {
|
|
|
+ throw responseText;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(function(result) {
|
|
|
+
|
|
|
+ if (result.type == 'success') {
|
|
|
+
|
|
|
+ p5UI__notifyAjaxCallback(result);
|
|
|
+ resolve(result.body);
|
|
|
+ options=result.body.items;
|
|
|
+ this.setState({ isSearching: false, options: options });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(function(error) {
|
|
|
+ if(DBG) console.log('request failed', error);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // setTimeout(function () {
|
|
|
+ // var options = [];
|
|
|
+ // options.push({
|
|
|
+ // ID: 601900,
|
|
|
+ // nazwa: "ADEGROUP SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ SPÓŁKA KOMANDYTOWA",
|
|
|
+ // krs: "0000721712", nip: "5862328735", regon: "369609850",
|
|
|
+ // S_kraj: "POLSKA", S_miejscowosc: "GDYNIA", A_kod: "81-310", A_ulica: "ŚLĄSKA", A_nrDomu: "35/37",
|
|
|
+ // searchLabel: "ADEGROUP SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ SPÓŁKA KOMANDYTOWA, ŚLĄSKA 35/37, 81-310 GDYNIA, krs: 0000721712, nip: 5862328735, regon: 369609850",
|
|
|
+ // label: "ADEGROUP SPÓŁKA ..., ŚLĄSKA 35/37, 81-310 GDYNIA"
|
|
|
+ // })
|
|
|
+ // options.push({
|
|
|
+ // ID: 601900,
|
|
|
+ // nazwa: "BIZNESLIMIT.PL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ",
|
|
|
+ // krs: "0000721708", nip: "9452218050", regon: "369608402",
|
|
|
+ // S_kraj: "POLSKA", S_miejscowosc: "KRAKÓW", A_kod: "31-315", A_ulica: "ELIASZA RADZIKOWSKIEGO", A_nrLokalu: "16", A_nrDomu: "74",
|
|
|
+ // searchLabel: "BIZNESLIMIT.PL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ ELIASZA RADZIKOWSKIEGO 74/16, 31-315 KRAKÓW 0000721708 9452218050 369608402",
|
|
|
+ // label: "BIZNESLIMIT.PL ..., ELIASZA RADZIKOWSKIEGO 74/16, 31-315 KRAKÓW"
|
|
|
+ // })
|
|
|
+ // this.setState({ isSearching: false, options: options });
|
|
|
+ // }.bind(this), 1000);
|
|
|
+ makeAndHandleRequest(query)
|
|
|
+ .then(({ options }) => {
|
|
|
+ this.setState({
|
|
|
+ isLoading: false,
|
|
|
+ options,
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
componentWillUnmount: function () {
|
|
|
DBG && console.log("DBG: conponentDidUnmount...");
|
|
@@ -159,12 +192,41 @@ var P5UI_AddItemToReport = createReactClass({
|
|
|
}
|
|
|
}),
|
|
|
selectedNewItem && h('p', {}, "Dodaj nowy ... " + selectedNewItem),
|
|
|
+ //TODO dlaczego to nie działa
|
|
|
+ // selectedNewItem && h('div', {className='form-group'},[
|
|
|
+ // h('input',{
|
|
|
+ // className:'form-control required',
|
|
|
+ // id:'personName',
|
|
|
+ // placeholder:'Imię'
|
|
|
+ // }),
|
|
|
+ // h('input',{
|
|
|
+ // className:'form-control required',
|
|
|
+ // id:'personSurname',
|
|
|
+ // placeholder:'Nazwisko'
|
|
|
+ // },[]),
|
|
|
+ // h('input',{
|
|
|
+ // className:'form-control required',
|
|
|
+ // id:'personNip',
|
|
|
+ // placeholder:'NIP'
|
|
|
+ // },[]),
|
|
|
+ // h('input',{
|
|
|
+ // className:'form-control required',
|
|
|
+ // id:'personPesel',
|
|
|
+ // placeholder:'personPesel'
|
|
|
+ // },[]),
|
|
|
+ // h('input',{
|
|
|
+ // className:'form-control required',
|
|
|
+ // id:'personRegon',
|
|
|
+ // placeholder:'REGON'
|
|
|
+ // },[])
|
|
|
+ // ]
|
|
|
+ // ),
|
|
|
// '' === selectedNewItem && h
|
|
|
(selectedBaza && this.state.selected) && h('div', { style: { marginTop: '22px' } }, [
|
|
|
h('button', {
|
|
|
className: "btn btn-success active",
|
|
|
onClick: function () {
|
|
|
- //this.props.onSelect(this.state.baza, this.state.selected)
|
|
|
+ this.props.onSelect(this.state.baza, this.state.selected);
|
|
|
ReactDOM.unmountComponentAtNode(document.getElementById('createPracownikAjax__searchBaza'));
|
|
|
swal.close()
|
|
|
}
|