Liste dynamique triable des clients + export CSV/ODS

This commit is contained in:
bohwaz 2021-12-17 13:01:05 +01:00
parent 6db516f5b2
commit 440b2e3e66
3 changed files with 70 additions and 59 deletions

View file

@ -3,6 +3,7 @@
namespace Garradin\Plugin\Facturation;
use Garradin\DB;
use Garradin\DynamicList;
use Garradin\Plugin;
use Garradin\UserException;
use Garradin\Utils;
@ -103,6 +104,44 @@ class Client
return DB::getInstance()->get('SELECT *, strftime(\'%s\', date_creation) AS date_creation FROM plugin_facturation_clients');
}
public function list(): DynamicList
{
$columns = [
'id' => [
'label' => 'Numéro',
],
'nom' => [
'label' => 'Nom',
],
'adresse' => [
'label' => 'Adresse',
],
'code_postal' => [
'label' => 'Code postal',
],
'ville' => [
'label' => 'Ville',
],
'telephone' => [
'label' => 'Téléphone',
],
'email' => [
'label' => 'E-Mail',
],
'nb_documents' => [
'label' => 'Nombre de documents',
'select' => '(SELECT COUNT(*) FROM plugin_facturation_factures WHERE receveur_id = c.id)',
],
];
$tables = 'plugin_facturation_clients AS c';
$list = new DynamicList($columns, $tables);
$list->orderBy('id', false);
$list->setPageSize(1000);
return $list;
}
public function edit($id, $data = [])
{
$db = DB::getInstance();