|
|
@@ -1505,7 +1505,7 @@ SQL_FUN;
|
|
|
<td
|
|
|
<?php if ($priceEditJs) : ?>
|
|
|
<?php
|
|
|
- $updateProjektyOferta = Request::getPathUri() . "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=updateProjektyOfertaAjax&idProject={$idProject}&idType={$idType}&unitType=zasob";
|
|
|
+ $updateProjektyOferta = Request::getPathUri() . "index.php?_route=UrlAction_ProjektyKosztorys&_task=updateProjektyOfertaAjax&idProject={$idProject}&idType={$idType}&unitType=zasob";
|
|
|
$onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Kosztorys:updateProjektyOferta', { href: '{$updateProjektyOferta}' })";
|
|
|
?>
|
|
|
onClick="<?= $onClick; ?>"
|
|
|
@@ -1521,7 +1521,7 @@ SQL_FUN;
|
|
|
<td
|
|
|
<?php if ($priceEditJs) : ?>
|
|
|
<?php
|
|
|
- $updateProjektyOferta = Request::getPathUri() . "index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=updateProjektyOfertaAjax&idProject={$idProject}&idType={$idType}&unitType=robocizna";
|
|
|
+ $updateProjektyOferta = Request::getPathUri() . "index.php?_route=UrlAction_ProjektyKosztorys&_task=updateProjektyOfertaAjax&idProject={$idProject}&idType={$idType}&unitType=robocizna";
|
|
|
$onClick = "return p5UI__ButtonAjax(this, 'p5UIBtnAjax:Kosztorys:updateProjektyOferta', { href: '{$updateProjektyOferta}' })";
|
|
|
?>
|
|
|
onClick="<?= $onClick; ?>"
|
|
|
@@ -1718,7 +1718,7 @@ SQL_FUN;
|
|
|
<script src="static/sweetalert2.min.js"></script>
|
|
|
<script>
|
|
|
(function(){
|
|
|
- var _updateProjektyOfertaSaveLink = '<?= Request::getPathUri(); ?>index.php?_route=UrlAction_ProjektyKosztyWstepnychRobot&_task=updateProjektyOfertaAjax&idProject=<?= $idProject; ?>';
|
|
|
+ var _updateProjektyOfertaSaveLink = '<?= Request::getPathUri(); ?>index.php?_route=UrlAction_ProjektyKosztorys&_task=updateProjektyOfertaAjax&idProject=<?= $idProject; ?>';
|
|
|
|
|
|
jQuery(document).on('p5UIBtnAjax:Kosztorys:updateProjektyOferta:click', function(e, n, payload) {
|
|
|
<?php if (DBG::isActive()) : ?>console.log('event p5UIBtnAjax:Kosztorys:updateProjektyOferta:click', n, payload);<?php endif; ?>
|
|
|
@@ -1802,49 +1802,6 @@ SQL_FUN;
|
|
|
<?php
|
|
|
}
|
|
|
|
|
|
- public function updateProjektyOfertaAjaxAction() {
|
|
|
- $args = array();
|
|
|
- $args['idProject'] = V::get('idProject', 0, $_GET, 'int');
|
|
|
- $args['idType'] = V::get('idType', 0, $_GET, 'int');
|
|
|
- $args['unitType'] = V::get('unitType', '', $_GET, 'word');
|
|
|
- Response::sendTryCatchJson(array($this, 'updateProjektyOfertaAjax'), $args);
|
|
|
- }
|
|
|
- public function updateProjektyOfertaAjax($args) {
|
|
|
- $idProject = V::get('idProject', 0, $args, 'int');
|
|
|
- $idType = V::get('idType', 0, $args, 'int');
|
|
|
- $unitType = V::get('unitType', '', $args, 'word');
|
|
|
- if (empty($idProject) || $idProject <= 0) throw new Exception("Wrong param idProject");
|
|
|
- if (empty($idType) || $idType <= 0) throw new Exception("Wrong param idType");
|
|
|
- if (empty($unitType) || !in_array($unitType, array('zasob', 'robocizna'))) throw new Exception("Wrong param unitType");
|
|
|
- $response = array();
|
|
|
- if (DBG::isActive()) $response['_idProject'] = $idProject;
|
|
|
- if (DBG::isActive()) $response['_idType'] = $idType;
|
|
|
- $jednostka = '';
|
|
|
- if ('robocizna' == $unitType) $jednostka = 'ROBOCIZNA';
|
|
|
- else if ('zasob' == $unitType) {
|
|
|
- $schema = ProjectKosztorysSchema::getSchema();
|
|
|
- foreach ($schema['config']['layer'] as $idLayer => $layData) {
|
|
|
- if (array_key_exists($idType, $layData['type'])) $jednostka = $layData['jednostka'];
|
|
|
- }
|
|
|
- }
|
|
|
- if (DBG::isActive()) $response['_unit'] = $jednostka;
|
|
|
-
|
|
|
- $reqJson = Request::getRequestJson();
|
|
|
- if (!empty($reqJson)) {
|
|
|
- if (!array_key_exists('price', $reqJson)) throw new Exception("Missing param price");
|
|
|
- $price = V::get('price', 0, $reqJson, 'float');
|
|
|
- ProjectKosztorysCennik::updatePriceProjectCennik($idType, $idProject, $price, $jednostka);
|
|
|
- }
|
|
|
- $response['id'] = $idType;
|
|
|
- $response['unitType'] = $unitType;
|
|
|
- $response['label'] = ProjectKosztorysCennik::getTypeLabel($idType);
|
|
|
- if ('robocizna' != $unitType) $response['defaultPrice'] = ProjectKosztorysCennik::getPriceDefaultCennik($idType);
|
|
|
- $response['price'] = ProjectKosztorysCennik::getPrice($idType, $idProject, $idCompany = 0, $jednostka);
|
|
|
- $response['msg'] = "";
|
|
|
- $response['type'] = "success";
|
|
|
- return $response;
|
|
|
- }
|
|
|
-
|
|
|
public function checkGeomDuplicate() {
|
|
|
// TODO: for every schema.layer
|
|
|
$sqlTblName = 'Rozdzielcza_Kabel_Swiatlowodowy_wsg84';
|