finish order product list, wip create order from order
This commit is contained in:
parent
b92bd79946
commit
15373665dd
@ -180,5 +180,10 @@ return [
|
||||
['name' => 'provider#provider', 'url' => '/provider', 'verb' => 'GET'],
|
||||
['name' => 'provider#getProviders','url' => '/provider/list', 'verb' => 'PROPFIND'],
|
||||
['name' => 'provider#createDefaultProvider','url' => '/provider/createDefaultProvider', 'verb' => 'POST'],
|
||||
|
||||
//orderProduct
|
||||
['name' => 'order#orderProduct', 'url' => '/orderProduct', 'verb' => 'GET'],
|
||||
['name' => 'order#getOrderProducts','url' => '/orderProduct/list', 'verb' => 'PROPFIND'],
|
||||
['name' => 'order#createDefaultOrderProduct','url' => '/orderProduct/createDefaultOrderProduct', '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
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/orderProduct.app.js
Normal file
2
gestion/js/orderProduct.app.js
Normal file
File diff suppressed because one or more lines are too long
46
gestion/js/orderProduct.app.js.LICENSE.txt
Normal file
46
gestion/js/orderProduct.app.js.LICENSE.txt
Normal 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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -248,4 +248,37 @@ class OrderController extends Controller {
|
||||
}
|
||||
catch(\OCP\Files\NotFoundException $e) { }
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function orderProduct() {
|
||||
return new TemplateResponse('gestion', 'orderProduct', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, 'url' => $this->navigationService->getNavigationLink()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function getOrderProducts() {
|
||||
$orderProducts = $this->orderService->getOrderProducts();
|
||||
return $orderProducts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function createDefaultOrderProduct() {
|
||||
try{
|
||||
$this->orderService->createDefaultOrderProduct($this->idNextcloud);
|
||||
return true;
|
||||
}
|
||||
catch(Exception $e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -40,12 +40,15 @@ class Bdd {
|
||||
"fk_defunt_id","fk_lieu_id","fk_client_id","fk_thanato_id",
|
||||
"fk_product_id","ht_price",
|
||||
"fk_client_group_id","fk_produit_id","ht_amount","client_group_name",
|
||||
"provider_name","provider_last_name","provider_company_name","provider_siret_number","provider_phone","provider_email","provider_address","provider_city","fk_provider_id");
|
||||
"provider_name","provider_last_name","provider_company_name","provider_siret_number","provider_phone","provider_email",
|
||||
"provider_address","provider_city","fk_provider_id",
|
||||
"label");
|
||||
$this->whiteTable = array("client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit",
|
||||
"configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis",
|
||||
"bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt",
|
||||
"orders","thanato_product_discount",
|
||||
"client_group_discount","client_group","provider");
|
||||
"client_group_discount","client_group","provider",
|
||||
"order_product");
|
||||
$this->tableprefix = '*PREFIX*' ."gestion_";
|
||||
$this->pdo = $db;
|
||||
$this->l = $l;
|
||||
|
||||
@ -463,4 +463,27 @@ class OrderBdd {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function getOrderProducts(){
|
||||
$sql = "SELECT * FROM ".$this->orderTablePrefix."order_product as order_product;";
|
||||
return $this->execSQL($sql,[]);
|
||||
}
|
||||
|
||||
public function createDefaultOrderProduct($idNextCloud){
|
||||
$sql = "INSERT INTO `".$this->orderTablePrefix."order_product` (`reference`,`label`,`ht_amount`,`id_nextcloud`)
|
||||
VALUES ('','',0,?);";
|
||||
$this->execSQLNoData($sql, [$idNextCloud]);
|
||||
}
|
||||
|
||||
public function getOrderProductCount(){
|
||||
$count = 0;
|
||||
$sql = "SELECT COUNT(order_product.id) as order_product_count
|
||||
FROM ".$this->orderTablePrefix."order_product as order_product;";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[]);
|
||||
if(!empty($result)){
|
||||
$count = $result[0]["order_product_count"];
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
@ -72,6 +72,7 @@ class MenuStatisticService {
|
||||
$res['clientGroup'] = json_decode($this->gestionBdd->getClientGroupCount())[0]->c;
|
||||
$res['clientGroupDiscount'] = json_decode($this->gestionBdd->getClientGroupDiscountCount())[0]->c;
|
||||
$res['clientGroupFacturation'] = json_decode($this->gestionBdd->getClientGroupFacturationCount())[0]->c;
|
||||
$res['orderProduct'] = $this->orderBdd->getOrderProductCount();
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@ -59,6 +59,7 @@ class NavigationService {
|
||||
"clientGroupDiscount" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroupDiscount"),
|
||||
"clientGroupFacturation" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroupFacturation"),
|
||||
"provider" => $this->urlGenerator->linkToRouteAbsolute("gestion.provider.provider"),
|
||||
"orderProduct" => $this->urlGenerator->linkToRouteAbsolute("gestion.order.orderProduct"),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -127,4 +127,12 @@ class OrderService {
|
||||
public function createOrderFromDevisIdAndDate(int $devisId,Datetime $devisDate,string $idNextCloud = BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD ){
|
||||
$this->orderBdd->createOrderFromDevisIdAndDate($devisId,$devisDate,$idNextCloud);
|
||||
}
|
||||
|
||||
public function getOrderProducts(){
|
||||
return $this->orderBdd->getOrderProducts();
|
||||
}
|
||||
|
||||
public function createDefaultOrderProduct($idNextCloud){
|
||||
$this->orderBdd->createDefaultOrderProduct($idNextCloud);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ import { ClientGroup } from '../objects/clientGroup.mjs';
|
||||
import { ClientGroupDiscount } from "../objects/clientGroupDiscount.mjs";
|
||||
import { ClientGroupFacturation } from "../objects/clientGroupFacturation.mjs";
|
||||
import { Provider } from "../objects/provider.mjs";
|
||||
import { OrderProduct } from "../objects/orderProduct.mjs";
|
||||
var choose_folder = t('gestion', 'Choose work folder');
|
||||
|
||||
$('body').on('click', '#theFolder', function () {
|
||||
@ -260,6 +261,8 @@ $('body').on('click', '.deleteItem', function () {
|
||||
if (modifier === "clientGroupDiscount") { ClientGroupDiscount.loadClientGroupDiscountDatatable(dt); }
|
||||
if (modifier === "clientGroupFacturation") { ClientGroupFacturation.loadClientGroupFacturationDatatable(dt); }
|
||||
if (modifier === "provider") { Provider.loadProviderDatatable(dt); }
|
||||
if (modifier === "orderProduct") { OrderProduct.loadOrderProductDatatable(dt); }
|
||||
|
||||
});
|
||||
|
||||
$('body').on('change', '.listClient,.listDevis', function () {
|
||||
|
||||
@ -5,6 +5,7 @@ import { Thanatopracteur } from "../objects/thanatopracteur.mjs";
|
||||
import { ThanatoSubcontractorTypeKey } from "../constants/thanatoTypeConstant";
|
||||
import { hideLoader, showLoader,baseUrl } from "../modules/mainFunction.mjs";
|
||||
import { showError, showSuccess } from "@nextcloud/dialogs";
|
||||
import { OrderProduct } from "../objects/orderProduct.mjs";
|
||||
|
||||
$('body').on('change', '.orderInputDate', function () {
|
||||
var dt = new DataTable('.tabledt');
|
||||
@ -23,6 +24,10 @@ document.body.addEventListener('click', e => {
|
||||
Order.createDefaultOrder(new DataTable('.tabledt'));
|
||||
return;
|
||||
}
|
||||
if("createDefaultOrderProduct"=== e.target.id){
|
||||
OrderProduct.createDefaultOrderProduct(new DataTable('.tabledt'));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '#exportOrderToPdf', function () {
|
||||
|
||||
@ -85,6 +85,7 @@ export function getStats() {
|
||||
$("#clientGroupDiscountStat").text(res.clientGroupDiscount);
|
||||
$("#clientGroupFacturationStat").text(res.clientGroupFacturation);
|
||||
$("#providerStat").text(res.provider);
|
||||
$("#orerProductStat").text(res.orderProduct);
|
||||
}).fail(function (response, code) {
|
||||
showError(response);
|
||||
});
|
||||
|
||||
132
gestion/src/js/objects/orderProduct.mjs
Normal file
132
gestion/src/js/objects/orderProduct.mjs
Normal file
@ -0,0 +1,132 @@
|
||||
import { showError } from "@nextcloud/dialogs";
|
||||
import { baseUrl, cur, LoadDT, showDone,checkSelectPurJs} from "../modules/mainFunction.mjs";
|
||||
import { updateDB } from "../modules/ajaxRequest.mjs";
|
||||
export class OrderProduct {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param myresp instantiate orderProduct object
|
||||
*/
|
||||
constructor(myresp) {
|
||||
this.id = myresp.id;
|
||||
this.reference = ((myresp.reference.length === 0) ? '-' : myresp.reference);
|
||||
this.label = ((myresp.label.length === 0) ? '-' : myresp.label);
|
||||
this.ht_amount = ((myresp.ht_amount.length === 0) ? '-' : myresp.ht_amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get datatable row for a orderProduct
|
||||
*/
|
||||
getDTRow() {
|
||||
let myrow = [
|
||||
'<div>' + this.id + '</div>',
|
||||
'<div class="editable" data-table="order_product" data-column="reference" data-id="' + this.id + '">' + this.reference + '</div>',
|
||||
'<div class="editable" data-table="order_product" data-column="label" data-id="' + this.id + '">' + this.label + '</div>',
|
||||
'<div class="editableNumeric" data-table="order_product" data-column="ht_amount" data-id="' + this.id + '">' + cur.format(this.ht_amount) + '</div>',
|
||||
'<div data-modifier="orderProduct" data-id=' + this.id + ' data-table="order_product" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
];
|
||||
return myrow;
|
||||
}
|
||||
|
||||
static getOrderProductsList(callback){
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/orderProduct/list', true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
callback(JSON.parse(this.response));
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} orderProductDatatable
|
||||
*/
|
||||
static loadOrderProductDatatable(orderProductDatatable) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/orderProduct/list', true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
LoadDT(orderProductDatatable, JSON.parse(this.response), OrderProduct);
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} dt
|
||||
*/
|
||||
static createDefaultOrderProduct(dt) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('POST', baseUrl + '/orderProduct/createDefaultOrderProduct', true);
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
showDone()
|
||||
OrderProduct.loadOrderProductDatatable(dt);
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} lid
|
||||
*/
|
||||
static loadOrderProductListToSelect(e){
|
||||
OrderProduct.getOrderProductsList(response => {
|
||||
|
||||
var selectElement = document.createElement("select");
|
||||
selectElement.dataset.current = e.target.dataset.current;
|
||||
selectElement.dataset.id = e.target.dataset.id;
|
||||
selectElement.dataset.old = e.target.innerHTML;
|
||||
|
||||
selectElement.addEventListener("change", el=>{
|
||||
if(el.target.value != 0){
|
||||
updateDB(el.target.parentElement.dataset.table,
|
||||
el.target.parentElement.dataset.column,
|
||||
el.target.value,
|
||||
el.target.parentElement.dataset.id
|
||||
);
|
||||
|
||||
// location.reload();
|
||||
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.options[el.target.selectedIndex].text;
|
||||
parentElement.dataset.current = el.target.value;
|
||||
}else{
|
||||
var parentElement = el.target.parentElement
|
||||
parentElement.innerHTML = el.target.dataset.old
|
||||
}
|
||||
});
|
||||
|
||||
var option = document.createElement("option");
|
||||
option.value = 0;
|
||||
option.text = t('gestion', 'Cancel');
|
||||
selectElement.appendChild(option);
|
||||
|
||||
JSON.parse(response).forEach(myresp => {
|
||||
var txt = document.createElement("textarea");
|
||||
txt.innerHTML = myresp.reference;
|
||||
var option = document.createElement("option");
|
||||
option.value = myresp.id;
|
||||
option.text = txt.value;
|
||||
selectElement.appendChild(option);
|
||||
});
|
||||
|
||||
checkSelectPurJs(selectElement);
|
||||
|
||||
e.target.innerHTML = ''
|
||||
e.target.appendChild(selectElement);
|
||||
});
|
||||
}
|
||||
}
|
||||
14
gestion/src/js/orderProduct.js
Normal file
14
gestion/src/js/orderProduct.js
Normal file
@ -0,0 +1,14 @@
|
||||
import "@nextcloud/dialogs/dist/index.css";
|
||||
import "datatables.net-dt/css/jquery.dataTables.css";
|
||||
import "../css/mycss.css";
|
||||
|
||||
import DataTable from "datatables.net";
|
||||
import { globalConfiguration, optionDatatable } from "./modules/mainFunction.mjs";
|
||||
import "./listener/main_listener";
|
||||
import "./listener/orderListener";
|
||||
import { OrderProduct } from "./objects/orderProduct.mjs";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
globalConfiguration();
|
||||
OrderProduct.loadOrderProductDatatable(new DataTable(".tabledt",optionDatatable));
|
||||
});
|
||||
27
gestion/templates/content/orderProduct.php
Normal file
27
gestion/templates/content/orderProduct.php
Normal file
@ -0,0 +1,27 @@
|
||||
<div id="contentTable">
|
||||
<div class="breadcrumb" data-html2canvas-ignore>
|
||||
<div class="crumb svg crumbhome">
|
||||
<a href="<?php echo($_['url']['orderProduct']); ?>" class="icon-home"></a>
|
||||
<span style="display: none;"></span>
|
||||
</div>
|
||||
<div class="crumb svg crumbhome">
|
||||
<span>Article</span>
|
||||
</div>
|
||||
<div class="crumb svg crumbhome">
|
||||
<button style="margin-left:3px;" type="button" id="createDefaultOrderProduct">Ajout article</button>
|
||||
</div>
|
||||
</div>
|
||||
<table id="orderProductTable" class="display tabledt">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php p($l->t('ID'));?></th>
|
||||
<th><?php p($l->t('Reference'));?></th>
|
||||
<th><?php p($l->t('Designation'));?></th>
|
||||
<th><?php p($l->t('Unit price without VAT'));?></th>
|
||||
<th><?php p($l->t('Actions'));?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -174,13 +174,13 @@
|
||||
</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']['orderProduct']); ?>">
|
||||
<?php p($l->t('Articles'));?>
|
||||
</a>
|
||||
<div class="app-navigation-entry-utils-submenu">
|
||||
<ul>
|
||||
<li class="app-navigation-entry-utils-counter">
|
||||
<span>5</span>
|
||||
<span id="orerProductStat"><div class="loader"></div></span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
19
gestion/templates/orderProduct.php
Normal file
19
gestion/templates/orderProduct.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
style('gestion', array('style'));
|
||||
script('gestion', array('orderProduct.app', '814.app', '856.app'));
|
||||
?>
|
||||
<div id="app">
|
||||
<div id="app-navigation">
|
||||
<?php print_unescaped($this->inc('navigation/index')); ?>
|
||||
<?php print_unescaped($this->inc('settings/index')); ?>
|
||||
</div>
|
||||
|
||||
<div id="app-content">
|
||||
<div id="app-content-wrapper">
|
||||
<?php print_unescaped($this->inc('content/changelog')); ?>
|
||||
<?php print_unescaped($this->inc('content/orderProduct')); ?>
|
||||
<?php print_unescaped($this->inc('loader')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -34,7 +34,8 @@ module.exports =
|
||||
clientGroup: './src/js/clientGroup.js',
|
||||
clientGroupFacturation : './src/js/clientGroupFacturation.js',
|
||||
orderDetails : './src/js/orderDetails.js',
|
||||
provider : './src/js/provider.js'
|
||||
provider : './src/js/provider.js',
|
||||
orderProduct : './src/js/orderProduct.js'
|
||||
},
|
||||
output: {
|
||||
filename: '../js/[name].app.js',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user