|
@@ -155,6 +155,7 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
$editLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&idZaliczka={$row['ID']}";
|
|
$editLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}&idZaliczka={$row['ID']}";
|
|
|
$editLabel = ($isFirst) ? "Rozlicz / Podgląd" : "Podgląd";
|
|
$editLabel = ($isFirst) ? "Rozlicz / Podgląd" : "Podgląd";
|
|
|
if ($isFirst) $isFirst = false;
|
|
if ($isFirst) $isFirst = false;
|
|
|
|
|
+ $histLink = Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=hist&idUser={$idUser}&idZaliczka={$row['ID']}";
|
|
|
return [
|
|
return [
|
|
|
'Nr' => $row['ID'],
|
|
'Nr' => $row['ID'],
|
|
|
'Status' => $row['A_STATUS'],
|
|
'Status' => $row['A_STATUS'],
|
|
@@ -162,7 +163,8 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
|
|
|
'L_APPOITMENT_USER' => $row['L_APPOITMENT_USER'],
|
|
'L_APPOITMENT_USER' => $row['L_APPOITMENT_USER'],
|
|
|
'KWOTA' => $row['KWOTA'],
|
|
'KWOTA' => $row['KWOTA'],
|
|
|
'NIEROZLICZONA_KWOTA' => $row['NIEROZLICZONA_KWOTA'],
|
|
'NIEROZLICZONA_KWOTA' => $row['NIEROZLICZONA_KWOTA'],
|
|
|
- '#' => '<a href="' . $editLink . '">' . $editLabel . '</a>'
|
|
|
|
|
|
|
+ '#' => '<a href="' . $editLink . '">' . $editLabel . '</a>',
|
|
|
|
|
+ 'DBG' => '<a href="' . $histLink . '">' . "DBG HIST" . '</a>'
|
|
|
];
|
|
];
|
|
|
},
|
|
},
|
|
|
DB::getPDO()->fetchAll("
|
|
DB::getPDO()->fetchAll("
|
|
@@ -321,77 +323,14 @@ window.location.href='{$redirectUrl}';
|
|
|
|
|
|
|
|
DBG::nicePrint($zaliczkaData, '$zaliczkaData');// TODO: DBG
|
|
DBG::nicePrint($zaliczkaData, '$zaliczkaData');// TODO: DBG
|
|
|
|
|
|
|
|
- ?>
|
|
|
|
|
-<script>
|
|
|
|
|
-function zaliczkaFetchData(query, fieldType, resultCallback) {
|
|
|
|
|
- console.warn('TODO: zaliczkaFetchData(query, fieldType, resultCallback) query('+query+') fieldType:', fieldType);
|
|
|
|
|
-
|
|
|
|
|
- // fieldType: Object {"@baseTypeName": "default_db:IN7_DZIENNIK_KORESP", id: "xsd:integer", title: "xsd:string", kategoriaKosztu: "xsd:string"}
|
|
|
|
|
- if ('object' === typeof fieldType) {
|
|
|
|
|
- if (!fieldType['@namespace']) {
|
|
|
|
|
- // TODO: log error
|
|
|
|
|
- console.error("BUG: Missing typeName in fieldType");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- switch (fieldType['@namespace']) {
|
|
|
|
|
- case 'default_db/IN7_MK_BAZA_DYSTRYBUCJI':
|
|
|
|
|
- case 'default_db/IN7_DZIENNIK_KORESP':
|
|
|
|
|
- {
|
|
|
|
|
- superagent
|
|
|
|
|
- .post('<?= Request::getPathUri(); ?>/index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=fetchDataAjax&idUser=<?= $idUser; ?>&idZaliczka=<?= $idZaliczka; ?>')
|
|
|
|
|
- .type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
|
|
|
|
|
- .send({
|
|
|
|
|
- schema: fieldType,
|
|
|
|
|
- query: query
|
|
|
|
|
- })
|
|
|
|
|
- .set('Accept', 'application/json')
|
|
|
|
|
- .end(function(err, res) {
|
|
|
|
|
- var payload = (err || !res.ok || 'application/json' !== res.type)
|
|
|
|
|
- ? {type: 'warning', msg: (res.body && res.body.msg) ? res.body.msg : 'Request error', body: res.body}
|
|
|
|
|
- : {type: 'success', msg: res.body.msg || '', body: res.body}
|
|
|
|
|
- jQuery(document).trigger('DBG:notify', payload)
|
|
|
|
|
- console.log('F.fetchDataAjax res.body', res.body)
|
|
|
|
|
- console.log('F.fetchDataAjax payload', payload)
|
|
|
|
|
- jQuery.notify(payload.msg, payload.type)
|
|
|
|
|
- resultCallback(payload.body)
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- break;
|
|
|
|
|
- default: {
|
|
|
|
|
- console.log("BUG: Unsupported type namespace '" + fieldType['@baseTypeName'] + "'");
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log("BUG: Unsupported type '" + fieldType + "'");
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function syncZaliczkaState(state, updates, stateSyncSyccessCallback, stateSyncErrorCallback) {
|
|
|
|
|
- // TODO: if ajax success then stateSyncSyccessCallback(Response.data)
|
|
|
|
|
- // TODO: if ajax fail then stateSyncErrorCallback(Response.data)
|
|
|
|
|
- console.log('====== TODO: syncZaliczkaState updates:', updates, 'state:', state);
|
|
|
|
|
- superagent
|
|
|
|
|
- .post('<?= Request::getPathUri(); ?>/index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=syncStataAjax&idUser=<?= $idUser; ?>&idZaliczka=<?= $idZaliczka; ?>') // TODO: add idUser & idZaliczka
|
|
|
|
|
- .type('json') // header ĺapplication/x-www-form-urlencoded' requires type('form');
|
|
|
|
|
- .send({
|
|
|
|
|
- updates: updates,
|
|
|
|
|
- })
|
|
|
|
|
- .set('Accept', 'application/json')
|
|
|
|
|
- .end(function(err, res) {
|
|
|
|
|
- var payload = (err || !res.ok || 'application/json' !== res.type)
|
|
|
|
|
- ? {type: 'warning', msg: (res.body && res.body.msg) ? res.body.msg : 'Request error', body: res.body}
|
|
|
|
|
- : {type: 'success', msg: res.body.msg || '', body: res.body}
|
|
|
|
|
- jQuery(document).trigger('DBG:notify', payload)
|
|
|
|
|
- console.log('F.syncZaliczkaState res.body', res.body)
|
|
|
|
|
- console.log('F.syncZaliczkaState payload', payload)
|
|
|
|
|
- jQuery.notify(payload.msg, payload.type)
|
|
|
|
|
- stateSyncSyccessCallback({data: payload.body})
|
|
|
|
|
- });
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-</script>
|
|
|
|
|
-<?php
|
|
|
|
|
|
|
+ UI::inlineJS(__FILE__ . '.fetchData.js', [
|
|
|
|
|
+ '_initData' => $initData,
|
|
|
|
|
+ 'syncUrl' => Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=fetchDataAjax&idUser={$idUser}&idZaliczka={$idZaliczka}"
|
|
|
|
|
+ ]);
|
|
|
|
|
+ UI::inlineJS(__FILE__ . '.syncState.js', [
|
|
|
|
|
+ '_initData' => $initData,
|
|
|
|
|
+ 'syncUrl' => Request::getPathUri() . "index.php?_route=UrlAction_UserProNetMediaZaliczka&_task=syncStataAjax&idUser={$idUser}&idZaliczka={$idZaliczka}"
|
|
|
|
|
+ ]);
|
|
|
UI::tag('script', ['src'=>'static/vendor.js' . (V::get('DBG', '', $_GET) ? '?_ts=' . time() : ''), 'type'=>'text/javascript']);
|
|
UI::tag('script', ['src'=>'static/vendor.js' . (V::get('DBG', '', $_GET) ? '?_ts=' . time() : ''), 'type'=>'text/javascript']);
|
|
|
UI::tag('script', ['src'=>'static/zaliczka/main.js' . (V::get('DBG', '', $_GET) ? '?_ts=' . time() : ''), 'type'=>'text/javascript']);
|
|
UI::tag('script', ['src'=>'static/zaliczka/main.js' . (V::get('DBG', '', $_GET) ? '?_ts=' . time() : ''), 'type'=>'text/javascript']);
|
|
|
}
|
|
}
|