finish crud of command provider

This commit is contained in:
Tiavina 2025-02-13 17:10:10 +03:00
parent 18687ce020
commit 7f61f9bdbf
41 changed files with 354 additions and 46 deletions

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

File diff suppressed because one or more lines are too long

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

@ -2,6 +2,7 @@
namespace OCA\Gestion\Controller;
use Exception;
use OCA\Gestion\Service\MenuStatisticService;
use OCA\Gestion\Service\NavigationService;
use OCA\Gestion\Service\Order\OrderService;
defined("TAB1") or define("TAB1", "\t");
@ -67,6 +68,8 @@ class PageController extends Controller {
/** @var \OCA\Gestion\Service\Order\OrderService */
private $orderService;
private $menuStatisticService;
/**
* Constructor
*/
@ -86,7 +89,8 @@ class PageController extends Controller {
DevisPdfService $devisPdfService,
CertificateService $certificateService,
NavigationService $navigationService,
OrderService $orderService){
OrderService $orderService,
MenuStatisticService $menuStatisticService){
parent::__construct($AppName, $request);
@ -102,6 +106,7 @@ class PageController extends Controller {
$this->certificateService = $certificateService;
$this->navigationService = $navigationService;
$this->orderService = $orderService;
$this->menuStatisticService = $menuStatisticService;
//$this->fpdf = $fpdf;
if ($userSession->isLoggedIn()) {
@ -1968,23 +1973,8 @@ class PageController extends Controller {
* @NoCSRFRequired
*/
public function getStats(){
$res = array();
$res['client'] = json_decode($this->myDb->numberClient($this->idNextcloud))[0]->c;
$res['defunt'] = json_decode($this->myDb->numberDefunt($this->idNextcloud))[0]->c;
$res['thanato'] = json_decode($this->myDb->numberThanato($this->idNextcloud))[0]->c;
$res['devis'] = json_decode($this->myDb->numberDevis($this->idNextcloud))[0]->c;
$res['lieu'] = json_decode($this->myDb->numberLieu($this->idNextcloud))[0]->c;
$res['trajet'] = json_decode($this->myDb->numberTrajet($this->idNextcloud))[0]->c;
$res['facture'] = json_decode($this->myDb->numberFacture($this->idNextcloud))[0]->c;
$res['produit'] = json_decode($this->myDb->numberProduit($this->idNextcloud))[0]->c;
$res['article'] = json_decode($this->myDb->numberArticle($this->idNextcloud))[0]->c;
$res['bibliotheque'] = json_decode($this->myDb->numberBibliotheque($this->idNextcloud))[0]->c;
$res['order'] = $this->orderService->getOrderCount();
$res['thanatoProductFee'] = $this->orderService->getThanatoProductFeeCount();
$res['clientGroup'] = json_decode($this->myDb->getClientGroupCount())[0]->c;
$res['clientGroupDiscount'] = json_decode($this->myDb->getClientGroupDiscountCount())[0]->c;
$res['clientGroupFacturation'] = json_decode($this->myDb->getClientGroupFacturationCount())[0]->c;
return json_encode($res);
$result = $this->menuStatisticService->getStats($this->idNextcloud);
return json_encode($result);
}
/**

View File

@ -39,12 +39,13 @@ class Bdd {
"fk_thanato_type_key","thanato_email","fk_user_uuid",
"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");
"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");
$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");
"client_group_discount","client_group","provider");
$this->tableprefix = '*PREFIX*' ."gestion_";
$this->pdo = $db;
$this->l = $l;

View File

@ -59,4 +59,16 @@ class ProviderRepository {
);
}
public function getProviderCount(){
$count = 0;
$sql = "SELECT COUNT(provider.id) as provider_count
FROM ".$this->gestionTablePrefix."provider as provider;";
$result = $this->execSQLNoJsonReturn($sql,[]);
if(!empty($result)){
$count = $result[0]["provider_count"];
}
return $count;
}
}

View File

@ -0,0 +1,78 @@
<?php
declare(strict_types=1);
/**
* Calendar App
*
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
*
* @author Anna Larch <anna.larch@gmx.net>
* @author Richard Steinmetz <richard@steinmetz.cloud>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Gestion\Service;
use OCA\Gestion\Constants\BddConstant;
use OCA\Gestion\Db\Bdd;
use OCA\Gestion\Db\OrderBdd;
use OCA\Gestion\Db\ProviderRepository;
use OCA\Gestion\Service\Order\OrderService;
use OCP\IURLGenerator;
use Psr\Log\LoggerInterface;
class MenuStatisticService {
private $gestionBdd;
private $orderBdd;
private $providerRepository;
public function __construct(
Bdd $gestionBdd,
OrderBdd $orderBdd,
ProviderRepository $providerRepository
) {
$this->gestionBdd = $gestionBdd;
$this->orderBdd = $orderBdd;
$this->providerRepository = $providerRepository;
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function getStats($idNextCloud){
$res = array();
$res['client'] = json_decode($this->gestionBdd->numberClient($idNextCloud))[0]->c;
$res['defunt'] = json_decode($this->gestionBdd->numberDefunt($idNextCloud))[0]->c;
$res['thanato'] = json_decode($this->gestionBdd->numberThanato($idNextCloud))[0]->c;
$res['devis'] = json_decode($this->gestionBdd->numberDevis($idNextCloud))[0]->c;
$res['lieu'] = json_decode($this->gestionBdd->numberLieu($idNextCloud))[0]->c;
$res['trajet'] = json_decode($this->gestionBdd->numberTrajet($idNextCloud))[0]->c;
$res['facture'] = json_decode($this->gestionBdd->numberFacture($idNextCloud))[0]->c;
$res['produit'] = json_decode($this->gestionBdd->numberProduit($idNextCloud))[0]->c;
$res['article'] = json_decode($this->gestionBdd->numberArticle($idNextCloud))[0]->c;
$res['bibliotheque'] = json_decode($this->gestionBdd->numberBibliotheque($idNextCloud))[0]->c;
$res['order'] = $this->orderBdd->getOrderCount();
$res['provider'] = $this->providerRepository->getProviderCount();
$res['thanatoProductFee'] = $this->orderBdd->getThanatoProductFeeCount();
$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;
return $res;
}
}

View File

@ -58,6 +58,7 @@ class NavigationService {
"clientGroups" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroups"),
"clientGroupDiscount" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroupDiscount"),
"clientGroupFacturation" => $this->urlGenerator->linkToRouteAbsolute("gestion.page.clientGroupFacturation"),
"provider" => $this->urlGenerator->linkToRouteAbsolute("gestion.provider.provider"),
);
}

View File

@ -20,6 +20,7 @@ import { ThanatoProductFee } from "../objects/thanatoProductFee.mjs";
import { ClientGroup } from '../objects/clientGroup.mjs';
import { ClientGroupDiscount } from "../objects/clientGroupDiscount.mjs";
import { ClientGroupFacturation } from "../objects/clientGroupFacturation.mjs";
import { Provider } from "../objects/provider.mjs";
var choose_folder = t('gestion', 'Choose work folder');
$('body').on('click', '#theFolder', function () {
@ -258,6 +259,7 @@ $('body').on('click', '.deleteItem', function () {
if (modifier === "clientGroup") { ClientGroup.loadClientGroupDatatable(dt); }
if (modifier === "clientGroupDiscount") { ClientGroupDiscount.loadClientGroupDiscountDatatable(dt); }
if (modifier === "clientGroupFacturation") { ClientGroupFacturation.loadClientGroupFacturationDatatable(dt); }
if (modifier === "provider") { Provider.loadProviderDatatable(dt); }
});
$('body').on('change', '.listClient,.listDevis', function () {

View File

@ -0,0 +1,11 @@
import DataTable from "datatables.net";
import { Provider } from "../objects/provider.mjs";
import { hideLoader, showLoader,baseUrl } from "../modules/mainFunction.mjs";
import { showError, showSuccess } from "@nextcloud/dialogs";
document.body.addEventListener('click', e => {
if("createDefaultProvider"=== e.target.id){
Provider.createDefaultProvider(new DataTable('.tabledt'));
return;
}
});

View File

@ -84,6 +84,7 @@ export function getStats() {
$("#clientGroupStat").text(res.clientGroup);
$("#clientGroupDiscountStat").text(res.clientGroupDiscount);
$("#clientGroupFacturationStat").text(res.clientGroupFacturation);
$("#providerStat").text(res.provider);
}).fail(function (response, code) {
showError(response);
});

View File

@ -0,0 +1,86 @@
import { showError } from "@nextcloud/dialogs";
import { updateDB } from "../modules/ajaxRequest.mjs";
import { baseUrl, checkSelectPurJs, hideLoader, LoadDT, removeOptions, showDone, showLoader } from "../modules/mainFunction.mjs";
export class Provider {
/**
*
* @param myresp instantiate client object
*/
constructor(myresp) {
this.id = myresp.id;
this.providerName = ((myresp.provider_name.length === 0) ? '-' : myresp.provider_name);
this.providerLastName = ((myresp.provider_last_name.length === 0) ? '-' : myresp.provider_last_name);
this.providerCompanyName = ((myresp.provider_company_name.length === 0) ? '-' : myresp.provider_company_name);
this.providerSiretNumber = ((myresp.provider_siret_number.length === 0) ? '-' : myresp.provider_siret_number);
this.providerPhone = ((myresp.provider_phone.length === 0) ? '-' : myresp.provider_phone);
this.providerEmail = ((myresp.provider_email.length === 0) ? '-' : myresp.provider_email);
this.providerAddress = ((myresp.provider_address.length === 0) ? '-' : myresp.provider_address);
this.providerCity = ((myresp.provider_city.length === 0) ? '-' : myresp.provider_city);
}
/**
* Get datatable row for a client
*/
getDTRow() {
let myrow = [
'<div>' + this.id + '</div>',
'<div class="editable" data-table="provider" data-column="provider_name" data-id="' + this.id + '">' + this.providerName + '</div>',
'<div class="editable" data-table="provider" data-column="provider_last_name" data-id="' + this.id + '">' + this.providerLastName + '</div>',
'<div class="editable" data-table="provider" data-column="provider_company_name" data-id="' + this.id + '">' + this.providerCompanyName + '</div>',
'<div class="editable" data-table="provider" data-column="provider_siret_number" data-id="' + this.id + '">' + this.providerSiretNumber + '</div>',
'<div class="editable" data-table="provider" data-column="provider_phone" data-id="' + this.id + '">' + this.providerPhone + '</div>',
'<div class="editable" data-table="provider" data-column="provider_email" data-id="' + this.id + '">' + this.providerEmail + '</div>',
'<div class="editable" data-table="provider" data-column="provider_address" data-id="' + this.id + '">' + this.providerAddress + '</div>',
'<div class="editable" data-table="provider" data-column="provider_city" data-id="' + this.id + '">' + this.providerCity + '</div>',
'<center><div data-modifier="provider" data-id=' + this.id + ' data-table="provider" style="display:inline-block;margin-right:0px;" class="deleteItem icon-delete"></div></center>'
];
return myrow;
}
/**
*
* @param {*} providerDatatable
*/
static loadProviderDatatable(providerDatatable) {
var oReq = new XMLHttpRequest();
oReq.open('PROPFIND', baseUrl + '/provider/list', true);
oReq.setRequestHeader("Content-Type", "application/json");
oReq.onload = function(e){
if (this.status == 200) {
LoadDT(providerDatatable, JSON.parse(this.response), Provider);
}else{
showError(this.response);
}
};
oReq.send();
}
/**
*
* @param {*} dt
*/
static createDefaultProvider(dt) {
var oReq = new XMLHttpRequest();
showLoader();
oReq.open('POST', baseUrl + '/provider/createDefaultProvider', true);
oReq.onload = function(e){
if (this.status == 200) {
if(this.response != null){
showDone()
Provider.loadProviderDatatable(dt);
}
else{
showError("Erreur dans la création d'un fournisseur");
}
}else{
showError("Erreur dans la création d'un fournisseur");
}
hideLoader();
};
oReq.send();
}
}

View 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 "./listener/providerListener";
import { Provider } from "./objects/provider.mjs";
window.addEventListener("DOMContentLoaded", function () {
globalConfiguration();
Provider.loadProviderDatatable(new DataTable(".tabledt",optionDatatable));
});

View File

@ -0,0 +1,32 @@
<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>Fournisseur</span>
</div>
<div class="crumb svg crumbhome">
<button style="margin-left:3px;" type="button" id="createDefaultProvider">Ajouter un fournisseur</button>
</div>
</div>
<table id="tableProviderList" class="display tabledt">
<thead>
<tr>
<th><?php p($l->t('ID'));?></th>
<th><?php p($l->t('Nom'));?></th>
<th><?php p($l->t('Prénom'));?></th>
<th><?php p($l->t('Entreprise'));?></th>
<th><?php p($l->t('Siret'));?></th>
<th><?php p($l->t('Téléphone'));?></th>
<th><?php p($l->t('Email'));?></th>
<th><?php p($l->t('Adresse'));?></th>
<th><?php p($l->t('Ville'));?></th>
<th><?php p($l->t('Actions'));?></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>

View File

@ -159,6 +159,19 @@
<span class="navmarg icon-contacts-dark"></span>
<a class="a-entry">Achats</a>
<ul class="app-navigation-submenu">
<li class="app-navigation-entry-submenu">
<span class="navmarg icon-category-integration"></span>
<a class="a-entry-submenu" href="<?php echo($_['url']['provider']); ?>">
<?php p($l->t('Fournisseur'));?>
</a>
<div class="app-navigation-entry-utils-submenu">
<ul>
<li class="app-navigation-entry-utils-counter">
<span id="providerStat"><div class="loader"></div></span>
</li>
</ul>
</div>
</li>
<li class="app-navigation-entry-submenu">
<span class="navmarg icon-category-integration"></span>
<a class="a-entry-submenu" href="<?php echo($_['url']['index']); ?>">

View File

@ -0,0 +1,19 @@
<?php
style('gestion', array('style'));
script('gestion', array('provider.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/provider')); ?>
<?php print_unescaped($this->inc('loader')); ?>
</div>
</div>
</div>

View File

@ -33,7 +33,8 @@ module.exports =
clientGroupDiscount: './src/js/clientGroupDiscount.js',
clientGroup: './src/js/clientGroup.js',
clientGroupFacturation : './src/js/clientGroupFacturation.js',
orderDetails : './src/js/orderDetails.js'
orderDetails : './src/js/orderDetails.js',
provider : './src/js/provider.js'
},
output: {
filename: '../js/[name].app.js',