finish get clientGroupDiscount list
This commit is contained in:
parent
508d13f630
commit
cd94ada9bd
@ -15,6 +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' => 'page#clientGroupDiscount', 'url' => '/clientGroupDiscount', 'verb' => 'GET'],
|
||||
|
||||
['name' => 'page#france', 'url' => '/legalnotice/france', 'verb' => 'GET'],
|
||||
|
||||
@ -125,5 +126,7 @@ return [
|
||||
['name' => 'page#addDevisNumberColumn', 'url' => '/addDevisNumberColumn', 'verb' => 'POST'],
|
||||
['name' => 'page#addFactureNumberColumn', 'url' => '/addFactureNumberColumn', 'verb' => 'POST'],
|
||||
|
||||
//clients discount
|
||||
['name' => 'page#getClientGroupDiscounts', 'url' => '/getClientGroupDiscounts', 'verb' => 'PROPFIND'],
|
||||
]
|
||||
];
|
||||
|
||||
2
gestion/js/clientGroupDiscount.app.js
Normal file
2
gestion/js/clientGroupDiscount.app.js
Normal file
File diff suppressed because one or more lines are too long
46
gestion/js/clientGroupDiscount.app.js.LICENSE.txt
Normal file
46
gestion/js/clientGroupDiscount.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
|
||||
*/
|
||||
@ -379,6 +379,8 @@ class PageController extends Controller {
|
||||
public function getNavigationLink(){
|
||||
return array(
|
||||
"index" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.index"),
|
||||
"groups" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.groups"),
|
||||
"clientGroups" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroups"),
|
||||
"defunt" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.defunt"),
|
||||
"devis" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.devis"),
|
||||
"thanatopracteur" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.thanatopracteur"),
|
||||
@ -386,6 +388,7 @@ class PageController extends Controller {
|
||||
"lieu" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.lieu"),
|
||||
"facture" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.facture"),
|
||||
"produit" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.produit"),
|
||||
"clientGroupDiscount" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroupDiscount"),
|
||||
"article" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.article"),
|
||||
"bibliotheque" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.bibliotheque"),
|
||||
"config" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.config"),
|
||||
@ -2824,4 +2827,20 @@ class PageController extends Controller {
|
||||
catch(\OCP\Files\NotFoundException $e) { }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function getClientGroupDiscounts() {
|
||||
return $this->myDb->getClientGroupDiscounts();
|
||||
}
|
||||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function clientGroupDiscount() {
|
||||
return new TemplateResponse('gestion', 'clientGroupDiscount', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud, 'url' => $this->getNavigationLink())); // templates/thanatopracteur.php
|
||||
}
|
||||
}
|
||||
|
||||
@ -2516,5 +2516,34 @@ class Bdd {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getClientsGroupedByEntreprise(){
|
||||
$sql = "SELECT * FROM ".$this->tableprefix."client as client GROUP BY client.entreprise;";
|
||||
$clients = $this->execSQL($sql,[]);
|
||||
return $clients;
|
||||
}
|
||||
|
||||
public function getClientGroupDiscounts(){
|
||||
|
||||
$sql = "SELECT
|
||||
client_group_discount.id as id,
|
||||
client_group_discount.fk_client_group_id as fk_client_group_id,
|
||||
client_group_discount.fk_produit_id as fk_produit_id,
|
||||
client_group_discount.ht_amount as ht_amount,
|
||||
client_group.client_group_name as client_group_name,
|
||||
produit.id as produit_id,
|
||||
produit.reference as produit_reference,
|
||||
produit.prix_unitaire as prix_unitaire
|
||||
FROM ".$this->tableprefix."client_group_discount as client_group_discount
|
||||
LEFT JOIN ".$this->tableprefix."client_group as client_group on client_group_discount.fk_client_group_id = client_group.id
|
||||
LEFT JOIN ".$this->tableprefix."produit as produit on client_group_discount.fk_produit_id = produit.id
|
||||
";
|
||||
|
||||
$clientGroupDiscounts = $this->execSQL(
|
||||
$sql,
|
||||
[]);
|
||||
|
||||
return $clientGroupDiscounts;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
13
gestion/src/js/clientGroupDiscount.js
Normal file
13
gestion/src/js/clientGroupDiscount.js
Normal file
@ -0,0 +1,13 @@
|
||||
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 { ClientGroupDiscount} from "./objects/clientGroupDiscount.mjs"
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
globalConfiguration();
|
||||
ClientGroupDiscount.loadClientGroupDiscountDatatable(new DataTable(".tabledt",optionDatatable));
|
||||
});
|
||||
74
gestion/src/js/objects/clientGroupDiscount.mjs
Normal file
74
gestion/src/js/objects/clientGroupDiscount.mjs
Normal file
@ -0,0 +1,74 @@
|
||||
import { showError } from "@nextcloud/dialogs";
|
||||
import { baseUrl, cur, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
|
||||
export class ClientGroupDiscount {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param myresp instantiate product object
|
||||
*/
|
||||
constructor(myresp) {
|
||||
this.id = myresp.id;
|
||||
this.clientGroupName = ((myresp.client_group_name.length === 0) ? '-' : myresp.client_group_name);
|
||||
this.productReference = ((myresp.produit_reference.length === 0) ? '-' : myresp.produit_reference);
|
||||
this.htAmount = ((myresp.ht_amount.length === 0) ? '-' : myresp.ht_amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get datatable row for a product
|
||||
*/
|
||||
getDTRow() {
|
||||
let clientGroupDiscountRow = [
|
||||
'<div>' + this.id + '</div>',
|
||||
'<div data-id="' + this.id + '">' + this.clientGroupName + '</div>',
|
||||
'<div data-id="' + this.id + '">' + this.productReference + '</div>',
|
||||
'<div data-id="' + this.id + '">' + this.htAmount + '</div>',
|
||||
'<div data-id=' + this.id + ' data-table="clientGroupDiscount" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
];
|
||||
|
||||
// let myrow = [
|
||||
// '<div>' + this.id + '</div>',
|
||||
// '<div class="editable" data-table="produit" data-column="reference" data-id="' + this.id + '">' + this.reference + '</div>',
|
||||
// '<div class="editable" data-table="produit" data-column="description" data-id="' + this.id + '">' + this.description + '</div>',
|
||||
// '<div class="editableNumeric" data-table="produit" data-column="prix_unitaire" data-id="' + this.id + '">' + cur.format(this.prix_unitaire) + '</div>',
|
||||
// '<div data-modifier="produit" data-id=' + this.id + ' data-table="produit" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div>'
|
||||
// ];
|
||||
return clientGroupDiscountRow;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} clientGroupDiscountDatatable
|
||||
*/
|
||||
static loadClientGroupDiscountDatatable(clientGroupDiscountDatatable) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('PROPFIND', baseUrl + '/getClientGroupDiscounts', true);
|
||||
oReq.setRequestHeader("Content-Type", "application/json");
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
LoadDT(clientGroupDiscountDatatable, JSON.parse(this.response), ClientGroupDiscount);
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} dt
|
||||
*/
|
||||
static newProduct(dt) {
|
||||
var oReq = new XMLHttpRequest();
|
||||
oReq.open('POST', baseUrl + '/produit/insert', true);
|
||||
oReq.onload = function(e){
|
||||
if (this.status == 200) {
|
||||
showDone()
|
||||
Produit.loadProduitDT(dt);
|
||||
}else{
|
||||
showError(this.response);
|
||||
}
|
||||
};
|
||||
oReq.send();
|
||||
}
|
||||
}
|
||||
18
gestion/templates/clientGroupDiscount.php
Normal file
18
gestion/templates/clientGroupDiscount.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
style('gestion', array('style'));
|
||||
script('gestion', array('clientGroupDiscount.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/clientGroupDiscount')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
27
gestion/templates/content/clientGroupDiscount.php
Normal file
27
gestion/templates/content/clientGroupDiscount.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']['index']); ?>" class="icon-home"></a>
|
||||
<span style="display: none;"></span>
|
||||
</div>
|
||||
<div class="crumb svg crumbhome">
|
||||
<span>Client remise</span>
|
||||
</div>
|
||||
<div class="crumb svg crumbhome">
|
||||
<button style="margin-left:3px;" type="button" id="addClientGroupDiscount">Ajouter une ligne</button>
|
||||
</div>
|
||||
</div>
|
||||
<table id="clientGroupDiscount" class="display tabledt">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php p($l->t('ID'));?></th>
|
||||
<th><?php p($l->t('Client'));?></th>
|
||||
<th><?php p($l->t('Articles'));?></th>
|
||||
<th><?php p($l->t('Unit price without VAT'));?></th>
|
||||
<th><?php p($l->t('Actions'));?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -88,6 +88,13 @@
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="app-navigation-entry"><span class="navmarg icon-category-integration"></span><a href="<?php echo($_['url']['clientGroupDiscount']); ?>">Remise clients</a>
|
||||
<div class="app-navigation-entry-utils">
|
||||
<ul>
|
||||
<li class="app-navigation-entry-utils-counter"><span id="statsclientgroupdiscount"><div class="loader"></div></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="app-navigation-entry"><span class="navmarg icon-category-integration"></span><a href="<?php echo($_['url']['article']); ?>">Produits</a>
|
||||
<div class="app-navigation-entry-utils">
|
||||
<ul>
|
||||
|
||||
@ -27,6 +27,7 @@ module.exports =
|
||||
legalnotice: './src/js/legalnotice.js',
|
||||
adminSection: './src/js/adminSection.js',
|
||||
configuration: './src/js/configuration.js',
|
||||
clientGroupDiscount: './src/js/clientGroupDiscount.js',
|
||||
pdf: './src/js/pdf.js',
|
||||
},
|
||||
output: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user