Dodaj nowe akcje API do zarządzania kategoriami finansów i operacjami finansowymi

This commit is contained in:
2026-01-21 01:07:02 +01:00
parent ac04805906
commit dc8c428f5a
2 changed files with 46 additions and 544 deletions

View File

@@ -13,163 +13,7 @@
"lmtime": 0,
"modified": false
},
"autoload": {
"class.Cache.php": {
"type": "-",
"size": 1006,
"lmtime": 0,
"modified": false
},
"class.Chunk.php": {
"type": "-",
"size": 7304,
"lmtime": 0,
"modified": false
},
"class.Cron.php": {
"type": "-",
"size": 9186,
"lmtime": 1745880791356,
"modified": false
},
"class.DbModel.php": {
"type": "-",
"size": 1392,
"lmtime": 0,
"modified": false
},
"class.Excel.php": {
"type": "-",
"size": 4319,
"lmtime": 0,
"modified": false
},
"class.Html.php": {
"type": "-",
"size": 2105,
"lmtime": 0,
"modified": false
},
"class.S.php": {
"type": "-",
"size": 7575,
"lmtime": 0,
"modified": false
},
"class.Tpl.php": {
"type": "-",
"size": 1746,
"lmtime": 0,
"modified": false
},
"controls": {
"class.BackendSites.php": {
"type": "-",
"size": 2940,
"lmtime": 1747510381779,
"modified": false
},
"class.Crm.php": {
"type": "-",
"size": 1824,
"lmtime": 0,
"modified": false
},
"class.Cron.php": {
"type": "-",
"size": 131,
"lmtime": 0,
"modified": false
},
"class.Finances.php": {
"type": "-",
"size": 6614,
"lmtime": 0,
"modified": false
},
"class.Projects.php": {
"type": "-",
"size": 9521,
"lmtime": 1764104901603,
"modified": false
},
"class.Site.php": {
"type": "-",
"size": 575,
"lmtime": 0,
"modified": false
},
"class.Tasks.php": {
"type": "-",
"size": 18207,
"lmtime": 1764203726003,
"modified": false
},
"class.Users.php": {
"type": "-",
"size": 3681,
"lmtime": 1746370508373,
"modified": false
},
"class.Wiki.php": {
"type": "-",
"size": 1825,
"lmtime": 0,
"modified": false
}
},
"factory": {
"class.BackendSites.php": {
"type": "-",
"size": 2962,
"lmtime": 1747510397975,
"modified": false
},
"class.Crm.php": {
"type": "-",
"size": 1863,
"lmtime": 0,
"modified": false
},
"class.Cron.php": {
"type": "-",
"size": 26120,
"lmtime": 0,
"modified": false
},
"class.Finances.php": {
"type": "-",
"size": 16159,
"lmtime": 0,
"modified": false
},
"class.Projects.php": {
"type": "-",
"size": 27334,
"lmtime": 1764203265163,
"modified": false
},
"class.Tasks.php": {
"type": "-",
"size": 21638,
"lmtime": 1764203740414,
"modified": false
},
"class.Users.php": {
"type": "-",
"size": 2075,
"lmtime": 1745259639804,
"modified": false
},
"class.Wiki.php": {
"type": "-",
"size": 1911,
"lmtime": 0,
"modified": false
}
},
"view": {}
},
"autoload": {},
"ceidg.php": {
"type": "-",
"size": 3862,
@@ -179,7 +23,7 @@
"config.php": {
"type": "-",
"size": 355,
"lmtime": 1745877418166,
"lmtime": 0,
"modified": false
},
"cron.php": {
@@ -191,7 +35,7 @@
".htaccess": {
"type": "-",
"size": 1024,
"lmtime": 1740507692824,
"lmtime": 0,
"modified": false
},
"index.php": {
@@ -200,236 +44,8 @@
"lmtime": 0,
"modified": false
},
"layout": {
"style.css": {
"type": "-",
<<<<<<< HEAD
"size": 22693,
"lmtime": 1765311863239,
=======
"size": 22678,
<<<<<<< HEAD
"lmtime": 1764150215841,
=======
"lmtime": 1764183540355,
>>>>>>> adab4009ea3d5c884248109e64208485f9841267
>>>>>>> 8879b273f5ab44239eb02fd30e324c23f0b30ae8
"modified": false
},
"style.css.map": {
"type": "-",
<<<<<<< HEAD
"size": 40598,
"lmtime": 1765311863239,
=======
"size": 40575,
<<<<<<< HEAD
"lmtime": 1764150215841,
=======
"lmtime": 1764183540367,
>>>>>>> adab4009ea3d5c884248109e64208485f9841267
>>>>>>> 8879b273f5ab44239eb02fd30e324c23f0b30ae8
"modified": false
},
"style.scss": {
"type": "-",
<<<<<<< HEAD
"size": 28215,
"lmtime": 1765311862998,
=======
"size": 28194,
<<<<<<< HEAD
"lmtime": 1764150215424,
=======
"lmtime": 1764183540380,
>>>>>>> adab4009ea3d5c884248109e64208485f9841267
>>>>>>> 8879b273f5ab44239eb02fd30e324c23f0b30ae8
"modified": false
}
},
"libraries": {
"JS-Gantt-Chart-master": {
"gantt.css": {
"type": "-",
"size": 2007,
"lmtime": 1744320380208,
"modified": false
},
"gantt.js": {
"type": "-",
"size": 16093,
"lmtime": 1744320529415,
"modified": false
},
"gantt.min.css": {
"type": "-",
"size": 1696,
"lmtime": 0,
"modified": false
},
"gantt.min.js": {
"type": "-",
"size": 9935,
"lmtime": 0,
"modified": false
},
".gitattributes": {
"type": "-",
"size": 66,
"lmtime": 0,
"modified": false
},
"LICENSE": {
"type": "-",
"size": 1067,
"lmtime": 0,
"modified": false
},
"README.md": {
"type": "-",
"size": 2501,
"lmtime": 0,
"modified": false
},
"sample-chart": {}
},
"jquery-gantt": {
"img": {
"grid.png": {
"type": "-",
"size": 96,
"lmtime": 0,
"modified": false
},
"icon_sprite.png": {
"type": "-",
"size": 808,
"lmtime": 0,
"modified": false
},
"slider_handle.png": {
"type": "-",
"size": 817,
"lmtime": 0,
"modified": false
}
},
"jquery-gantt.css": {
"type": "-",
"size": 9801,
"lmtime": 1744323885612,
"modified": false
},
"jquery-gantt.css.map": {
"type": "-",
"size": 2942,
"lmtime": 0,
"modified": false
},
"jquery-gantt.js": {
"type": "-",
"size": 86598,
"lmtime": 1744323096250,
"modified": false
}
},
"Simple-Gant-master": {
"frappe-gantt.css": {
"type": "-",
"size": 6562,
"lmtime": 1745265437709,
"modified": false
},
"frappe-gantt.js": {
"type": "-",
"size": 79101,
"lmtime": 1744498213646,
"modified": false
},
"frappe-gantt.js.map": {
"type": "-",
"size": 101071,
"lmtime": 0,
"modified": false
},
"frappe-gantt.min.js": {
"type": "-",
"size": 26394,
"lmtime": 0,
"modified": false
},
"frappe-gantt.min.js.map": {
"type": "-",
"size": 324375,
"lmtime": 0,
"modified": false
},
"index.html": {
"type": "-",
"size": 2027,
"lmtime": 0,
"modified": false
},
"LICENSE": {
"type": "-",
"size": 1128,
"lmtime": 0,
"modified": false
},
"names.txt": {
"type": "-",
"size": 341,
"lmtime": 0,
"modified": false
},
"README.md": {
"type": "-",
"size": 32,
"lmtime": 0,
"modified": false
}
},
"grid": {
"templates": {
"container.php": {
"type": "-",
"size": 16603,
"lmtime": 1746371511458,
"modified": false
},
"edit.php": {
"type": "-",
"size": 6041,
"lmtime": 0,
"modified": false
},
"edit-simple.php": {
"type": "-",
"size": 10753,
"lmtime": 0,
"modified": false
},
"print.php": {
"type": "-",
"size": 5140,
"lmtime": 0,
"modified": false
},
"results.php": {
"type": "-",
"size": 20382,
"lmtime": 0,
"modified": false
},
"upload.php": {
"type": "-",
"size": 6498,
"lmtime": 0,
"modified": false
}
}
}
},
"layout": {},
"libraries": {},
"robots.txt": {
"type": "-",
"size": 25,
@@ -437,161 +53,7 @@
"modified": false
},
"temp": {},
"templates": {
"backpro": {},
"crm": {},
"cron": {},
"finances": {},
"html": {},
"projects": {
"closed-tasks.php": {
"type": "-",
"size": 5365,
"lmtime": 0,
"modified": false
},
"inprogress-tasks.php": {
"type": "-",
"size": 6860,
"lmtime": 0,
"modified": false
},
"main_view.php": {
"type": "-",
"size": 2500,
"lmtime": 0,
"modified": false
},
"project_edit.php": {
"type": "-",
"size": 2429,
"lmtime": 0,
"modified": false
},
"task-details.php": {
"type": "-",
"size": 5602,
"lmtime": 0,
"modified": false
},
"task-edit.php": {
"type": "-",
"size": 7707,
"lmtime": 0,
"modified": false
},
"tasks.php": {
"type": "-",
"size": 27718,
"lmtime": 1764104901602,
"modified": false
},
"toreview-tasks.php": {
"type": "-",
"size": 6399,
"lmtime": 0,
"modified": false
},
"unassigned-tasks.php": {
"type": "-",
"size": 6002,
"lmtime": 0,
"modified": false
}
},
"site": {
"layout-cron.php": {
"type": "-",
"size": 5804,
"lmtime": 0,
"modified": false
},
"layout-logged.php": {
"type": "-",
"size": 6197,
"lmtime": 1746647209174,
"modified": false
},
"layout-unlogged.php": {
"type": "-",
"size": 986,
"lmtime": 0,
"modified": false
}
},
"tasks": {
"filtr_save_form.php": {
"type": "-",
"size": 775,
"lmtime": 0,
"modified": false
},
"main_view_by_ajax.php": {
"type": "-",
"size": 284,
"lmtime": 0,
"modified": false
},
"main_view.php": {
"type": "-",
"size": 34861,
"lmtime": 1764203691866,
"modified": false
},
"task_edit.php": {
"type": "-",
"size": 9314,
"lmtime": 1746733898990,
"modified": false
},
"task_popup.php": {
"type": "-",
"size": 7349,
"lmtime": 1764108641205,
"modified": false
},
"task_single.php": {
"type": "-",
"size": 2893,
"lmtime": 0,
"modified": false
},
"work-time.php": {
"type": "-",
"size": 6998,
"lmtime": 0,
"modified": false
}
},
"users": {},
"wiki": {},
"backend_sites": {
"collective_topic_edit.php": {
"type": "-",
"size": 1859,
"lmtime": 1746372498433,
"modified": false
},
"collective_topics.php": {
"type": "-",
"size": 1801,
"lmtime": 1746373172486,
"modified": false
},
"topic_edit.php": {
"type": "-",
"size": 2290,
"lmtime": 1747510265311,
"modified": false
},
"topics.php": {
"type": "-",
"size": 2806,
"lmtime": 1747513597952,
"modified": false
}
}
},
"templates": {},
"upload": {}
}
},

40
api.php
View File

@@ -82,5 +82,45 @@ if ( \S::get( 'action' ) == 'domain_opr_save' )
] );
echo json_encode( ['result' => 'ok'] );
exit;
}
if ( \S::get( 'action' ) == 'get_finances_categories' )
{
$rows = $mdb -> select( 'finance_categories', '*', [ 'parent_id' => null, 'ORDER' => [ 'name' => 'ASC' ] ] );
foreach ( $rows as $row )
{
$categories[] = [
'id' => $row['id'],
'name' => $row['name'],
'subcategories' => $mdb -> select( 'finance_categories', '*', [ 'parent_id' => $row['id'], 'ORDER' => [ 'name' => 'ASC' ] ] )
];
}
echo json_encode( $categories );
exit;
}
echo 'a';
if ( \S::get( 'action' ) == 'add_finance_operation' )
{
if ( !\S::get( 'operation_date' ) || !\S::get( 'net_value' ) || !\S::get( 'product_name' ) || !\S::get( 'category_id' ) )
{
echo json_encode( [ 'result' => 'error' ] );
exit;
}
$data = [
'date' => \S::get( 'operation_date' ),
'amount' => str_replace( ',', '.', \S::get( 'net_value' ) ),
'description' => \S::get( 'product_name' ),
'category_id' => \S::get( 'category_id' ),
];
if ( $mdb -> insert( 'finance_operations', $data ) ) {
$operation_id = $mdb -> id();
echo json_encode( [ 'result' => 'ok', 'operation_id' => $operation_id ] );
} else {
echo json_encode( [ 'result' => 'error' ] );
}
exit;
}