|
@@ -147,7 +147,6 @@ var P5UI__BocianHeader = createReactClass({
|
|
|
if (result.type == 'success') {
|
|
|
p5UI__notifyAjaxCallback(result);
|
|
|
self_store.dispatch({ type: 'CLEAR_ALL' })
|
|
|
- // defaultBIAuditLocalStorage();
|
|
|
updateTopCounters();
|
|
|
$('#smad-table-PRACOWNICY form').find(':checkbox').prop('checked', false);
|
|
|
$('#smad-table-KONTRAHENCI form').find(':checkbox').prop('checked', false);
|
|
@@ -177,6 +176,31 @@ var P5UI__BocianHeader = createReactClass({
|
|
|
if(DBG) console.log('request failed', error);
|
|
|
});
|
|
|
},
|
|
|
+ handleAddByLastReportClick: function (event) {
|
|
|
+ swal({
|
|
|
+ title: "dodaj do analizy wg raportu",
|
|
|
+ input: 'radio',
|
|
|
+ inputOptions: {
|
|
|
+ 'pracownicy' : "Pracownicy",
|
|
|
+ 'kontrahenci' : "Kontrahenci",
|
|
|
+ // 'pracownicy_pozostale' : "Pracownicy (pozostałe)",
|
|
|
+ // 'kontrahenci_pozostale' : "Kontrahenci (pozostałe)",
|
|
|
+ },
|
|
|
+ inputValidator: function (value) {
|
|
|
+ return !value && 'Proszę wybrać typ danych';
|
|
|
+ }
|
|
|
+ }).then(function (data) {
|
|
|
+ DBG1 && console.log('DBG: selected', data);
|
|
|
+ handleAddToReportByPreviousReport(data.value);
|
|
|
+ })
|
|
|
+
|
|
|
+ // TODO: like addToReportByPreviousReport but after select report, show counters for pracow., kontr., pozostale od and do with checkbox
|
|
|
+ // swal({
|
|
|
+ // title: "TODO: dodaj do analizy wg raportu",
|
|
|
+ // })
|
|
|
+ // TODO: https://github.com/sweetalert2/sweetalert2-react-content
|
|
|
+ // - just pass React element to 'html' ?
|
|
|
+ },
|
|
|
|
|
|
renderClearPozostaleOdBtn: function () {
|
|
|
return h('i', {
|
|
@@ -206,12 +230,12 @@ var P5UI__BocianHeader = createReactClass({
|
|
|
h('span', { className: "badge", style: totalOd > 0 ? { 'background-color': "#d7142d" } : {} }, totalOd),
|
|
|
" : ",
|
|
|
]),
|
|
|
- h('a', { className: "btn btn-link", style: { padding: "6px" }, href: "#PRACOWNICY" }, [ // .bi-btn-primary
|
|
|
+ h('a', { className: "btn btn-primary btn-xs", href: "#PRACOWNICY" }, [ // .bi-btn-primary
|
|
|
" pracownicy ",
|
|
|
h('span', { className: "badge" }, this.state.totalOdPracownicy),
|
|
|
]),
|
|
|
h('i', { className: "glyphicon glyphicon-plus", style: { 'font-size': "14px", margin: "0 12px" } }),
|
|
|
- h('button', { className: "btn btn-link", style: { padding: "6px" }, onClick: this.addOdPozostale }, [ // .bi-btn-primary
|
|
|
+ h('button', { className: "btn btn-primary btn-xs", onClick: this.addOdPozostale }, [ // .bi-btn-primary
|
|
|
" pozostałe ",
|
|
|
h('span', { className: "badge" }, this.state.totalOdPozostale),
|
|
|
]),
|
|
@@ -225,12 +249,12 @@ var P5UI__BocianHeader = createReactClass({
|
|
|
h('span', { className: "badge", style: totalDo > 0 ? { 'background-color': "#d7142d" } : {} }, totalDo),
|
|
|
" : ",
|
|
|
]),
|
|
|
- h('a', { className: "btn btn-link", style: { padding: "6px" }, href: "#KONTRAHENCI" }, [ // .bi-btn-primary
|
|
|
+ h('a', { className: "btn btn-primary btn-xs", href: "#KONTRAHENCI" }, [ // .bi-btn-primary
|
|
|
" kontrahenci ",
|
|
|
h('span', { className: "badge" }, this.state.totalDoKontrahenci),
|
|
|
]),
|
|
|
h('i', { className: "glyphicon glyphicon-plus", style: { 'font-size': "14px", margin: "0 12px" } }),
|
|
|
- h('button', { className: "btn btn-link", style: { padding: "6px" }, onClick: this.addOdPozostale }, [ // .bi-btn-primary
|
|
|
+ h('button', { className: "btn btn-primary btn-xs", onClick: this.addOdPozostale }, [ // .bi-btn-primary
|
|
|
" pozostałe ",
|
|
|
h('span', { className: "badge" }, this.state.totalDoPozostale),
|
|
|
]),
|
|
@@ -287,6 +311,13 @@ var P5UI__BocianHeader = createReactClass({
|
|
|
]),
|
|
|
]);
|
|
|
},
|
|
|
+ renderAddMoreBtns: function () {
|
|
|
+ return h('div', {
|
|
|
+ style: { 'padding-top': 6, 'padding-bottom': 20 }
|
|
|
+ }, [
|
|
|
+ h('button', { className: "btn btn-success btn-xs", onClick: this.handleAddByLastReportClick }, "dodaj do analizy wg raportu"),
|
|
|
+ ]);
|
|
|
+ },
|
|
|
render: function () {
|
|
|
DBG && console.log('DBG::P5UI__BocianHeader::render ', { state: this.state });
|
|
|
var totalOd = this.state.totalOdPracownicy + this.state.totalOdPozostale;
|
|
@@ -312,6 +343,7 @@ var P5UI__BocianHeader = createReactClass({
|
|
|
]),
|
|
|
"Wybrano:",
|
|
|
this.renderSummaryList(),
|
|
|
+ this.renderAddMoreBtns(),
|
|
|
]),
|
|
|
h('div', { className: "col-md-6", style: { 'padding-top': "20px", 'padding-bottom': "20px" } }, [
|
|
|
this.renderRaportParamsForm(),
|
|
@@ -1620,11 +1652,11 @@ function urlFetchKontrahenci(page) {
|
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>');
|
|
|
btnAddAll.on('click', { type: 'kontrahenci', pagination: data.body.pagination }, addAllMatchesToReport);
|
|
|
|
|
|
- var btnAddByReport = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ DO ANALIZY WG RAPORTU</button>');
|
|
|
- btnAddByReport.on('click', { type: 'kontrahenci', pagination: data.body.pagination }, addToReportByPreviousReport);
|
|
|
+ // var btnAddByReport = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ DO ANALIZY WG RAPORTU</button>');
|
|
|
+ // btnAddByReport.on('click', { type: 'kontrahenci', pagination: data.body.pagination }, addToReportByPreviousReport);
|
|
|
|
|
|
$('#smad-filter-desc-kontrahenci').append(btnAddAll);
|
|
|
- $('#smad-filter-desc-kontrahenci').append(btnAddByReport);
|
|
|
+ // $('#smad-filter-desc-kontrahenci').append(btnAddByReport);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1766,11 +1798,11 @@ function urlFetchPracownicy(page) {
|
|
|
var btnAddAll = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ WSZYSTKIE DO ANALIZY</button>')
|
|
|
btnAddAll.on('click', { type: 'pracownicy', pagination: data.body.pagination }, addAllMatchesToReport);
|
|
|
|
|
|
- var btnAddByReport = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ DO ANALIZY WG RAPORTU</button>');
|
|
|
- btnAddByReport.on('click', { type: 'pracownicy', pagination: data.body.pagination }, addToReportByPreviousReport);
|
|
|
+ // var btnAddByReport = $('<button class="btn btn-primary" style="padding:1px 5px; margin-left:12px">DODAJ DO ANALIZY WG RAPORTU</button>');
|
|
|
+ // btnAddByReport.on('click', { type: 'pracownicy', pagination: data.body.pagination }, addToReportByPreviousReport);
|
|
|
|
|
|
$('#smad-filter-desc-pracownicy').append(btnAddAll);
|
|
|
- $('#smad-filter-desc-pracownicy').append(btnAddByReport);
|
|
|
+ // $('#smad-filter-desc-pracownicy').append(btnAddByReport);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2772,6 +2804,9 @@ function fetchKontrahenciIdsByReport(id) {
|
|
|
|
|
|
function addToReportByPreviousReport(event) {
|
|
|
var pageType = (event.data.type) ? event.data.type : '';
|
|
|
+ handleAddToReportByPreviousReport(pageType);
|
|
|
+}
|
|
|
+function handleAddToReportByPreviousReport(pageType) {
|
|
|
switch (pageType) {
|
|
|
case 'pracownicy': break; // OK
|
|
|
case 'kontrahenci': break; // OK
|