finishing list of orders, create orders, wip update and delete

This commit is contained in:
Tiavina 2025-02-06 14:18:07 +03:00
parent ff724d60b1
commit 7b088618d3
34 changed files with 138 additions and 48 deletions

View File

@ -15,7 +15,7 @@ return [
['name' => 'page#isConfig', 'url' => '/isconfig', 'verb' => 'GET'],
['name' => 'page#statistique', 'url' => '/statistique', 'verb' => 'GET'],
['name' => 'page#legalnotice', 'url' => '/legalnotice', 'verb' => 'GET'],
['name' => 'order#orders', 'url' => '/orders', 'verb' => 'GET'],
['name' => 'order#order', 'url' => '/order', 'verb' => 'GET'],
['name' => 'page#france', 'url' => '/legalnotice/france', 'verb' => 'GET'],
@ -151,6 +151,7 @@ return [
['name' => 'page#getUsersNotLinkedToThanato','url' => '/user/getUsersNotLinkedToThanato', 'verb' => 'PROPFIND'],
//order
['name' => 'order#getOrdersWithDetails','url' => '/order/list', 'verb' => 'GET'],
['name' => 'order#getOrdersWithDetails','url' => '/order/list', 'verb' => 'PROPFIND'],
['name' => 'order#createDefaultOrder','url' => '/order/createDefaultOrder', 'verb' => 'POST'],
]
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
gestion/js/order.app.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,46 @@
/*!
* Sizzle CSS Selector Engine v2.3.9
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2022-12-19
*/
/*!
* Toastify js 1.12.0
* https://github.com/apvarun/toastify-js
* @license MIT licensed
*
* Copyright (C) 2018 Varun A P
*/
/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/
/*!
* jQuery JavaScript Library v3.6.3
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2022-12-20T21:28Z
*/
/*! @license DOMPurify 2.4.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.4/LICENSE */
/*! DataTables 1.13.2
* ©2008-2023 SpryMedia Ltd - datatables.net/license
*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -94,8 +94,8 @@ class OrderController extends Controller {
* @NoAdminRequired
* @NoCSRFRequired
*/
public function orders() {
return new TemplateResponse('gestion', 'orders', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, 'url' => $this->navigationService->getNavigationLink()));
public function order() {
return new TemplateResponse('gestion', 'order', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, 'url' => $this->navigationService->getNavigationLink()));
}
/**
@ -106,4 +106,18 @@ class OrderController extends Controller {
$orders = $this->orderService->getOrdersWithDetailsAsArray();
return json_encode($orders);
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function createDefaultOrder() {
try{
$this->orderService->createDefaultOrder($this->idNextcloud);
return true;
}
catch(Exception $e){
return null;
}
}
}

View File

@ -386,6 +386,7 @@ class PageController extends Controller {
"statistique" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.statistique"),
"legalnotice" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.legalnotice"),
"france" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.france"),
"orders" => $this->urlGenerator->linkToRouteAbsolute("gestion.order.order"),
);
}
@ -2803,20 +2804,4 @@ class PageController extends Controller {
return json_encode([]);
}
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function orders() {
return new TemplateResponse('gestion', 'orders', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, 'url' => $this->getNavigationLink()));
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getOrders() {
return $this->myDb->getOrdersWithDetails();
}
}

View File

@ -181,9 +181,35 @@ class OrderBdd {
LEFT JOIN ".$this->orderTablePrefix."defunt as defunt on orders.fk_defunt_id = defunt.id
LEFT JOIN ".$this->orderTablePrefix."lieu as lieu on orders.fk_lieu_id = lieu.id
LEFT JOIN ".$this->orderTablePrefix."order_status as order_status on orders.fk_order_status_key = order_status.status_key
ORDER BY orders.id DESC;
"
;
return $this->execSQLNoJsonReturn($sql,[]);
}
public function createDefaultOrder($idNextCloud){
$currentDatetime = new Datetime();
$currentDate = $currentDatetime->format('Y-m-d');
$lastOrderNumber = $this->getLastOrderNumber();
$currentOrderNumber = $lastOrderNumber + 1;
$currentOrderFullNumber = OrderHelpers::GetFullOrderNumberByDateAndOrderNumber($currentDatetime,$currentOrderNumber);
$sql = "INSERT INTO `".$this->orderTablePrefix."orders` (
`order_date`,
`order_number`,
`order_full_number`,
`fk_order_status_key`,
`id_nextcloud`
)
VALUES (?,?,?,?,?);";
$this->execSQLNoData($sql, array(
$currentDate,
$currentOrderNumber,
$currentOrderFullNumber,
OrderStatusConstant::NEW_KEY,
$idNextCloud
)
);
}
}

View File

@ -53,6 +53,7 @@ class NavigationService {
"statistique" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.statistique"),
"legalnotice" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.legalnotice"),
"france" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.france"),
"orders" => $this->urlGenerator->linkToRouteAbsolute("gestion.order.order"),
);
}

View File

@ -59,4 +59,8 @@ class OrderService {
}
return $orders;
}
public function createDefaultOrder($idNextcloud){
$this->orderBdd->createDefaultOrder($idNextcloud);
}
}

View File

@ -14,6 +14,7 @@ import { Thanatopracteur } from "../objects/thanatopracteur.mjs";
import { Article } from "../objects/article.mjs";
import { Defunt } from "../objects/defunt.mjs";
import { Bibliotheque } from "../objects/bibliotheque.mjs";
import { Order } from "../objects/order.mjs";
var choose_folder = t('gestion', 'Choose work folder');
@ -115,6 +116,9 @@ document.body.addEventListener('click', e => {
} else if("genererDefunt" == e.target.id) {
genererDefunts();
}
else if("createDefaultOrder" === e.target.id){
Order.createDefaultOrder(new DataTable('.tabledt'));
}
});
document.body.addEventListener('keydown', e => {

View File

@ -1,7 +1,7 @@
import { showError } from "@nextcloud/dialogs";
import { baseUrl, checkSelectPurJs, LoadDT, showDone } from "../modules/mainFunction.mjs";
import { updateDB } from "../modules/ajaxRequest.mjs";
import { OrderStatusOrdered,OrderStatusNew,OrderStatusCanceled } from "../constants/orderConstant";
import { OrderStatusOrdered,OrderStatusNew,OrderStatusCanceled } from "../constants/orderConstant.js";
export class Order {
/**
@ -45,6 +45,7 @@ export class Order {
*/
getDTRow() {
let orderRow = [
'<input class="orderToExport" data-id= '+ this.id + ' type="checkbox" name="orderToExport" value="' + this.id + '"/>',
'<div>' + this.id + '</div>',
'<input style="margin:0;padding:0;" class="inputDate" type="date" value=' + this.orderDate + ' data-table="orders" data-column="order_date" data-id="' + this.id + '"/>',
'<div>' + this.orderFullNumber + '</div>',
@ -86,10 +87,15 @@ export class Order {
oReq.open('POST', baseUrl + '/order/createDefaultOrder', true);
oReq.onload = function(e){
if (this.status == 200) {
showDone()
Order.loadOrderDatatable(dt);
if(this.response != null){
showDone()
Order.loadOrderDatatable(dt);
}
else{
showError("Erreur dans la création de la commande");
}
}else{
showError(this.response);
showError("Erreur dans la création de la commande");
}
};
oReq.send();

View File

@ -8,7 +8,7 @@
<span>Commandes</span>
</div>
<div class="crumb svg crumbhome">
<button style="margin-left:3px;" type="button" id="newOrder">Ajouter une commande</button>
<button style="margin-left:3px;" type="button" id="createDefaultOrder">Ajouter une commande</button>
</div>
</div>
<table id="tableOrderList" class="display tabledt">

View File

@ -187,7 +187,7 @@
</li>
<li class="app-navigation-entry-submenu">
<span class="navmarg icon-category-integration"></span>
<a class="a-entry-submenu" href="<?php echo($_['url']['index']); ?>">
<a class="a-entry-submenu" href="<?php echo($_['url']['orders']); ?>">
<?php p($l->t('Commandes'));?>
</a>
<div class="app-navigation-entry-utils-submenu">

View File

@ -1,6 +1,6 @@
<?php
style('gestion', array('style'));
// script('gestion', array('clientGroup.app', '814.app', '856.app'));
script('gestion', array('order.app', '814.app', '856.app'));
?>
<div id="app">
<div id="app-navigation">
@ -11,7 +11,7 @@
<div id="app-content">
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('content/changelog')); ?>
<?php print_unescaped($this->inc('content/orders')); ?>
<?php print_unescaped($this->inc('content/order')); ?>
</div>
</div>
</div>

View File

@ -28,6 +28,7 @@ module.exports =
adminSection: './src/js/adminSection.js',
configuration: './src/js/configuration.js',
pdf: './src/js/pdf.js',
order: './src/js/order.js'
},
output: {
filename: '../js/[name].app.js',