Просмотр исходного кода

added kwota to form add Zaliczka

Piotr Labudda 9 лет назад
Родитель
Сommit
9c5ae49bf9
1 измененных файлов с 14 добавлено и 6 удалено
  1. 14 6
      SE/se-lib/Route/UrlAction/UserProNetMediaZaliczka.php

+ 14 - 6
SE/se-lib/Route/UrlAction/UserProNetMediaZaliczka.php

@@ -148,20 +148,22 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
 		if (!$user) throw new Exception("Nie znaleziono pracownika o nr '{$idUser}'");
 
 		$acl = Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
-		$schema = $acl->getSimpleSchemaTree();
-		$zaliczkaData = $this->fetchDataBySchema($schema, $idUser);
 
 		UI::startContainer(['style' => "padding-top:20px"]);
 		UI::setTitle("Zaliczka");
 
 		UI::table([
-			'caption' => "Zaliczki pracownika {$user['name']} " . UI::hButtonPost("Dodaj nową zaliczkę", [
+			'caption' => "Zaliczki pracownika {$user['name']} " . '<br>' . UI::hButtonPost("Dodaj nową zaliczkę", [
 				'data' => [
 					'_route' => "UrlAction_UserProNetMediaZaliczka",
 					'_task' => "add",
 					'idUser' => $idUser,
 				],
-				'class' => 'btn-xs btn-primary'
+				'fields' => [
+					[ 'name' => "kwota", 'type' => 'text', 'class' => 'form-control input-sm', 'style' => "width:200px", 'placeholder' => "kwota" ]
+				],
+				'class' => 'btn-sm btn-primary',
+				'form.style' => 'display:block; margin-top:4px'
 			]),
 			'rows' => array_map(
 				function ($row) use ($idUser) {
@@ -206,9 +208,11 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
 
 	public function addAction() {
 		$idUser = V::get('idUser', User::getID(), $_REQUEST);
+		$kwota = V::get('kwota', 0, $_REQUEST, 'price');
 		try {
 			$acl = Core_AclHelper::getAclByNamespace("default_db/ZALICZKA/Zaliczka");
 			$id = $acl->addItem([
+				'kwota' => $kwota,
 				'worker' => [
 					'id' => $idUser
 				]
@@ -216,9 +220,13 @@ class Route_UrlAction_UserProNetMediaZaliczka extends RouteBase {// TODO: UrlAct
 			if (!$id) throw new Exception("Nie udało się utworzyć zaliczki");
 		} catch (Exception $e) {
 			UI::gora();
-			// UI::menu();// TODO: show menu
 			UI::startContainer();
-				UI::alert('danger', $e->getMessage());
+				UI::alert('danger', $e->getMessage() . UI::h('p', [], [
+					UI::h('a', [ 'href' => "index.php?_route=UrlAction_UserProNetMediaZaliczka&idUser={$idUser}" ], [
+						'<i class="glyphicon glyphicon-arrow-left"></i>',
+						" wróć",
+					])
+				]));
 			UI::endContainer();
 			UI::dol();
 			exit;