Commit 268748c6 authored by okhin's avatar okhin 🚴

Merge branch 'preprod' into 'master'

Modification front

See merge request !54
parents 6f5fff2e 151faf24
Pipeline #2239 passed with stages
in 1 minute and 32 seconds
......@@ -15,6 +15,10 @@ class Admin extends Controller
public function beforeRoute($f3, $args)
{
parent::beforeRoute($f3, $args);
// Template de base par défaut
$this->template = "backend/base.html";
// URL de base à utiliser sur le site
$f3->set('DONS_STATUTS', array(
0 => "Ponctuel non validé",
......@@ -41,19 +45,6 @@ class Admin extends Controller
100 => "non applicable",
));
$f3->set('TAILLES', array(
1 => _('Coupe Homme, Taille') . ' S',
2 => _('Coupe Homme, Taille') . ' M',
3 => _('Coupe Homme, Taille') . ' L',
4 => _('Coupe Homme, Taille') . ' XL',
5 => _('Coupe Femme, Taille') . ' S',
6 => _('Coupe Femme, Taille') . ' M',
7 => _('Coupe Femme, Taille') . ' L',
8 => _('Coupe Femme, Taille') . ' XL',
9 => _('Coupe Homme, Taille') . ' XXL',
10 => _('Coupe Femme, Taille') . ' XXL',
));
if (!$f3->get('SESSION.admin')) {
$mapper = new\DB\SQL\Mapper($f3->get('DB'), 'admins');
$auth = new \Auth($mapper, array('id'=>'user_id', 'pw'=>'password'));
......@@ -109,6 +100,102 @@ class Admin extends Controller
$f3->set('block_content', 'backend/dons.html');
}
public function validate($f3, $args)
{
$id = '';
$error = '';
$db = $f3->get('DB');
if ($f3->get('VERB')=='GET') {
if ($f3->exists('PARAMS.id')) {
$id = $f3->get('PARAMS.id');
} else {
$error= 'Pas d\'id associé à ce don';
}
if ($id != '') {
$result = $db->query("SELECT status,
somme,
adresse_id,
user_id
FROM dons
WHERE id = ".\Utils::asl($id));
$result = $result->fetch(\PDO::FETCH_ASSOC);
$user_amount = $db->query("SELECT total, cumul FROM users
WHERE id = ".\Utils::asl($result['user_id']));
$user_amount = $user_amount->fetch(\PDO::FETCH_ASSOC);
}
if ($result['status'] >= 100) {
$status = 101;
} else {
$status = 1;
}
$total = $user_amount['total'] + $result['somme'];
$cumul = $user_amount['total'] + $result['somme'];
}
if ($error != '') {
} else {
$db->query(
"UPDATE dons
SET status = $status
WHERE id = ".\Utils::asl($id)
);
$db->query("UPDATE users
SET total = $total,
cumul = $cumul
WHERE id = ".\Utils::asl($result['user_id']));
}
$f3->reroute("/admin/users/".$result['user_id']);
}
public function invalidate($f3, $args)
{
$id = '';
$error = '';
$db = $f3->get('DB');
if ($f3->get('VERB')=='GET') {
if ($f3->exists('PARAMS.id')) {
$id = $f3->get('PARAMS.id');
} else {
$error= 'Pas d\'id associé à ce don';
}
if ($id != '') {
$result = $db->query("SELECT status,
somme,
adresse_id,
user_id
FROM dons
WHERE id = ".\Utils::asl($id));
$result = $result->fetch(\PDO::FETCH_ASSOC);
$user_amount = $db->query("SELECT total, cumul FROM users
WHERE id = ".\Utils::asl($result['user_id']));
$user_amount = $user_amount->fetch(\PDO::FETCH_ASSOC);
}
if ($result['status'] >= 100) {
$status = 100;
} else {
$status = 0;
}
$total = $user_amount['total'] - $result['somme'];
$cumul = $user_amount['total'] - $result['somme'];
if ($cumul < 0) {
$error = "Impossible d'invalider, une contrepartie a été demandée";
}
}
if ($error != '') {
} else {
$db->query(
"UPDATE dons
SET status = $status
WHERE id = ".\Utils::asl($id)
);
$db->query("UPDATE users
SET total = $total,
cumul = $cumul
WHERE id = ".\Utils::asl($result['user_id']));
}
$f3->reroute("/admin/users/".$result['user_id']);
}
public function support($f3, $args)
{
$id = '';
......@@ -126,6 +213,7 @@ class Admin extends Controller
if ($f3->exists('PARAMS.id')) {
$id = $f3->get('PARAMS.id');
}
$f3->set('block_content', 'backend/don.html');
} else {
$id = $f3->get('POST.id');
$pseudo = $f3->get('POST.pseudo');
......@@ -184,11 +272,6 @@ class Admin extends Controller
1)");
// Récupération de l'id pour passage en mode édition
$id = $db->lastInsertId();
if ($adresse_id != '') {
$db->query("UPDATE dons
SET adresse_id = $adresse_id
WHERE id = $id");
}
} else {
// We will get the ids associated to the gift first
$result = $db->query("SELECT adresse_id,
......@@ -197,26 +280,6 @@ class Admin extends Controller
WHERE id = ".\Utils::asl($f3->get('POST.id')));
$result = $result->fetch(\PDO::FETCH_ASSOC);
// Let's update the adresse first or create the adress
if ($result['adresse_id'] == '0') {
$db->query("INSERT INTO adresses
(nom, adresse, adresse2, codepostal, ville, pays)
VALUES ('".\Utils::asl($nom)."',
'".\Utils::asl($adresse)."',
'".\Utils::asl($adresse2)."',
'".\Utils::asl($codepostal)."',
'".\Utils::asl($ville)."',
'".\Utils::asl($pays)."')");
$result['adresse_id'] = $db->lastInsertId();
} else {
$db->query("UPDATE adresses
SET nom='".\Utils::asl($nom)."',
adresse='".\Utils::asl($adresse)."',
adresse2='".\Utils::asl($adresse2)."',
codepostal='".\Utils::asl($codepostal)."',
ville='".\Utils::asl($ville)."',
pays='".\Utils::asl($pays)."'
WHERE id={$result['adresse_id']}");
}
$db->query("UPDATE users
SET email='".\Utils::asl($email)."',
pseudo='".\Utils::asl($pseudo)."'
......@@ -580,17 +643,17 @@ class Admin extends Controller
ville='".\Utils::asl($ville)."',
pays='".\Utils::asl($pays)."')");
$adresse_id = $db->lastInsertId();
}
// Updating the adresses first
$db->query("UPDATE adresses
SET nom='".\Utils::asl($nom)."',
adresse='".\Utils::asl($adresse)."',
adresse2='".\Utils::asl($adresse2)."',
codepostal='".\Utils::asl($codepostal)."',
ville='".\Utils::asl($ville)."',
pays='".\Utils::asl($pays)."'
WHERE id = $adresse_id");
} else {
// Updating the adresses first
$db->query("UPDATE adresses
SET nom='".\Utils::asl($nom)."',
adresse='".\Utils::asl($adresse)."',
adresse2='".\Utils::asl($adresse2)."',
codepostal='".\Utils::asl($codepostal)."',
ville='".\Utils::asl($ville)."',
pays='".\Utils::asl($pays)."'
WHERE id = $adresse_id");
};
$db->query("UPDATE contreparties
SET quoi='".\Utils::asl($quoi)."',
taille='".\Utils::asl($taille)."',
......@@ -601,27 +664,8 @@ class Admin extends Controller
}
}
$contrepartie = array();
if ($id!='') {
// Récupération de la contrepartie
$result = $db->query("SELECT c.id AS id,
c.user_id AS user_id,
c.quoi AS quoi,
c.taille AS taille,
c.status AS status,
a.nom AS nom,
a.adresse AS adresse,
a.codepostal AS codepostal,
a.ville AS ville,
a.pays AS pays,
u.commentaire AS commentaire
FROM contreparties c
JOIN users u ON c.user_id = u.id
LEFT JOIN adresses a ON c.adresse_id = a.id
WHERE c.id=".$id);
if ($result->fetch(\PDO::FETCH_ASSOC)) {
$contrepartie = $result->fetch(\PDO::FETCH_ASSOC);
}
$contrepartie = $f3->get('container')['counterpart_finder']->findById((int) $id);
} else {
$contrepartie = array(
'id'=>$id,
......@@ -663,6 +707,52 @@ class Admin extends Controller
$f3->set('block_content', 'backend/contrepartie.html');
}
public function adresse($f3, $args)
{
$id = '';
$form_name = '';
$user_id = '';
$db = $f3->get('DB');
if ($f3->get('VERB') == 'POST') {
$id = \Utils::asl($f3->get('POST.id'));
$form_name = $f3->get('POST.action');
}
if ($form_name == 'delete') {
$result = $db->query("SELECT user_id FROM adresses WHERE id = $id");
$result = $result->fetch(\PDO::FETCH_ASSOC);
$user_id = \Utils::asl($result["user_id"]);
$db->query("UPDATE dons SET adresse_id = NULL
WHERE user_id = $user_id");
$db->query("UPDATE contreparties SET adresse_id = NULL
WHERE user_id = $user_id");
$db->query(
"DELETE FROM adresses
WHERE id = $id"
);
} else {
$result = $db->query("SELECT user_id FROM adresses WHERE id = $id");
$result = $result->fetch(\PDO::FETCH_ASSOC);
$user_id = \Utils::asl($result["user_id"]);
$nom = \Utils::asl($f3->get('POST.nom'));
$adresse = \Utils::asl($f3->get('POST.adresse'));
$adresse2 = \Utils::asl($f3->get('POST.adresse2'));
$codepostal = \Utils::asl($f3->get('POST.codepostal'));
$ville = \Utils::asl($f3->get('POST.ville'));
$pays = \Utils::asl($f3->get('POST.pays'));
$db->query(
"UPDATE adresses SET
nom = '".$nom."',
adresse = '".$adresse."',
adresse2 = '".$adresse2."',
codepostal = '".$codepostal."',
ville = '".$ville."',
pays = '".$pays."'
WHERE id = $id"
);
}
$f3->reroute("/admin/users/$user_id");
}
public function user($f3, $args)
{
$id = array_key_exists('id', $args) ? \Utils::asl($args['id']) : '';
......@@ -689,7 +779,7 @@ class Admin extends Controller
// Let's get everything we have related to our user
$user = $f3->get('container')['user_finder']->findById($id);
$user['adresses'] = $f3->get('container')['address_finder']->findByUserId($user['id']);
$user['adresse'] = $f3->get('container')['address_finder']->findByUserId($user['id']);
$user['dons'] = $f3->get('container')['donation_finder']->findByUserId($user['id']);
$user['contreparties'] = $f3->get('container')['counterpart_finder']->findByUserId($user['id']);
......
<?php
namespace Controller;
use LQDN\Command\UserUpdateCumulCommand;
use LQDN\Command\UserUpdateTotalCommand;
class Bank extends Controller
{
/* We want to ignore the sanitizing on this page */
......@@ -150,13 +153,13 @@ class Bank extends Controller
$status = $res->fetch(\PDO::FETCH_ASSOC);
$status = $status['status'];
$res = $db->query("SELECT * FROM users WHERE id='".$don['user_id']."';");
$user = $res->fetch(\PDO::FETCH_ASSOC);
$user = $f3->get('container')['user_finder']->findById($don['user_id']);
$cb_log->write("Utilisation d'un utilisateur existant");
// Ajout du nouveau don au cumul actuel
if ($status!=101) {
$cb_log->write("Ajout de ".$don['somme']);
$db->query("UPDATE users set cumul = cumul + " . $don['somme'] . ", total = total + " . $don['somme'] . " WHERE id='".$don['user_id']."'");
$f3->get('container')['command_handler']->handle(new UpdateUserTotalCommand($user['id'], (int) $user['total'] + $don['somme']));
$f3->get('container')['command_handler']->handle(new UpdateUserCumulCommand($user['id'], (int) $user['cumul'] + $don['cumul']));
}
$result = $db->query("SELECT cumul FROM users WHERE id='".$don['user_id']."'");
$cumul = $result->fetch(\PDO::FETCH_ASSOC);
......@@ -199,7 +202,7 @@ Toute l'équipe de La Quadrature du Net
")."\n\n";
// Création de l'url d'administration
$admin_url = "https://support.laquadrature.net/perso";
$admin_url = "https://don.laquadrature.net/perso";
foreach ($f3->get('languages') as $key => $language) {
if ($lang==$language[1]) {
$admin_url = "https://".$language[0].$f3->get('dev').".laquadrature.net/perso";
......
<?php
namespace Controller;
use LQDN\Command\UserUpdateTotalCommand;
use LQDN\Command\UserCreateCommand;
use LQDN\Command\DonationCreateCommand;
class Campaign extends Controller
{
/*
......@@ -93,8 +97,7 @@ class Campaign extends Controller
$db = $f3->get('DB');
// Si l'utilisateur est déjà connecté, on le récupère
if ($f3->get('SESSION.user', true)) {
$user = $db->query("SELECT * FROM users WHERE id = ".$f3->get('SESSION.id'));
$user = $user->fetch(\PDO::FETCH_ASSOC);
$user = $f3->get('container')['user_finder']->findById($f3->get('SESSION.id'));
$email = $user['email'];
$user_id = $user['id'];
$cumul_id = $user['cumul'];
......@@ -103,10 +106,9 @@ class Campaign extends Controller
$email = \Utils::asl($f3->get('email'));
$hash = hash('sha256', $f3->get('password'));
$sql = "SELECT id FROM users WHERE email = '".\Utils::asl($email)."';";
$result = $db->query($sql);
$user = $f3->get('container')['user_finder']->findByEmail(\Utils::asl($email));
if ($result->fetchColumn() > 0) {
if (len($user) > 0) {
// We have an existing user, we should try to login with the provided password
// or 403.
$mapper = new \DB\SQL\Mapper($f3->get('DB'), 'users');
......@@ -114,11 +116,6 @@ class Campaign extends Controller
$login = $auth->login($email, $hash);
if (!$login) {
$f3->error(403);
} else {
$result = $db->query("SELECT id, cumul FROM users WHERE email = '".\Utils::asl($email)."'");
$user = $result->fetch(\PDO::FETCH_ASSOC);
$user_id = $user['id'];
$cumul_id = $user['cumul'];
}
} else {
// The user does not exist, so let's create it
......
......@@ -4,6 +4,11 @@ namespace Controller;
use LQDN\Command\AddressCreateCommand;
use LQDN\Command\AddressDeleteCommand;
use LQDN\Command\AddressUpdateCommand;
use LQDN\Command\CounterpartCreateCommand;
use LQDN\Command\CounterpartDeleteCommand;
use LQDN\Command\UserUpdateCumulCommand;
use LQDN\Command\UserUpdateTotalCommand;
use LQDN\Command\UserCreateCommand;
class Perso extends Controller
{
......@@ -38,41 +43,14 @@ class Perso extends Controller
{
// Chargement des informations de l'utilisateur
$db = $f3->get('DB');
// Let's update the total first
$total = 0;
$total_res = $db->query("SELECT SUM(somme) as total FROM dons WHERE status in (1, 4, 101, 102) AND user_id='".$f3->get('SESSION.id')."'");
$total_res = $total_res->fetch(\PDO::FETCH_ASSOC);
$total = $total_res['total'];
// While we're at it, let's remove the price of each asked contreparties
// printed piplome is 30, pibag is 50, pishirt is 100 and hoodie is 250
// We first need to have the number of each counterpart claimed by the
// user
$cumul_counterpart = $db->query("SELECT sum(if(quoi='piplome', 1, 0)) as piplomes,
sum(if(quoi='pibag', 1, 0)) as pibags,
sum(if(quoi='pishirt', 1, 0)) as pishirts,
sum(if(quoi='hoodie', 1, 0)) as hoodies
FROM contreparties
WHERE user_id = '".$f3->get('SESSION.id')."';");
$cumul_counterpart = $cumul_counterpart->fetch(\PDO::FETCH_ASSOC);
foreach (['hoodies', 'pishirts', 'pibags', 'piplomes'] as $key) {
if (!array_key_exists($key, $cumul_counterpart)) {
$cumul_counterpart[$key] = 0;
}
}
$cumul = $cumul_counterpart['hoodies'] * 250 + max(($cumul_counterpart['pishirts'] - $cumul_counterpart['hoodies']), 0) * 100 + max(($cumul_counterpart['pibags'] - $cumul_counterpart['pishirts'] - $cumul_counterpart['hoodies']), 0) * 50 + max(($cumul_counterpart['piplomes'] - $cumul_counterpart['pibags'] - $cumul_counterpart['pishirts'] - $cumul_counterpart['hoodies']), 0) * 30;
$cumul = $total - $cumul;
$db->query("UPDATE users SET total = '".$total."', cumul = '".$cumul."' WHERE id = '".$f3->get('SESSION.id')."'");
$result = $db->query("SELECT id, pseudo, email, total, cumul FROM users WHERE id='".$f3->get('SESSION.id')."' ");
$data = $result->fetch(\PDO::FETCH_ASSOC);
$f3->set('infos', $data);
$result = $db->query("SELECT id, pdf, decimale FROM dons WHERE user_id='".$data['id']."' and pdf!='' ");
$user = $f3->get('container')['user_finder']->findById($f3->get('SESSION.id'));
$f3->set('infos', $user);
$result = $db->query("SELECT id, pdf, decimale FROM dons WHERE user_id='".$user['id']."' and pdf!='' ");
$pdfs = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$pdfs[$row['pdf']] = $row;
}
$addresse = $f3->get('container')['address_finder']->findByUserId((int) $data['id']);
$addresse = $f3->get('container')['address_finder']->findByUserId((int) $user['id']);
$f3->set('adresse', $addresse);
$f3->set('pdfs', $pdfs);
}
......@@ -80,25 +58,19 @@ class Perso extends Controller
public function get_contreparties($f3)
{
// Chargement des contreparties de l'utilisateur
$db = $f3->get('DB');
$result =$db->query("SELECT datec, status, quoi, taille, adresse_id FROM contreparties WHERE user_id='".$f3->get('SESSION.id')."' ORDER BY datec DESC");
$data = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$data[] = $row;
}
$f3->set('contreparties', $data);
$contreparties = $f3->get('container')['counterpart_finder']->findByUserId((int) $f3->get('SESSION.id'));
$f3->set('contreparties', $contreparties);
}
public function get_dons($f3)
{
// Chargement des dons de l'utilisateur
$db = $f3->get('DB');
$result = $db->query("SELECT datec, somme, id, pdf, status FROM dons WHERE user_id='".$f3->get('infos.id')."' AND status IN (1,4,102) ORDER BY datec DESC");
$data = array();
foreach ($result->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$data[] = $row;
}
$f3->set('dons', $data);
$dons = $f3->get('container')['donation_finder']->findByUserId((int) $f3->get('SESSION.id'));
$dons = array_filter($dons, function ($id) {
return in_array((int) $id, [1, 4, 102]);
});
$f3->set('dons', $dons);
}
public function get_recurrents($f3)
......@@ -115,8 +87,6 @@ class Perso extends Controller
public function login($f3, $args)
{
$f3->clear('SESSION.error');
$f3->clear('SESSION.message');
$f3->set('form_visible', 'login');
if ($f3->get('action')=='renew_password') {
......@@ -240,8 +210,7 @@ class Perso extends Controller
if ($f3->get('email')!='') {
// On vérifie que l'adresse mail n'existe pas
$db = $f3->get('DB');
$query = $db->query("SELECT email FROM users WHERE email='".$f3->get('email')."';");
$result = $query->fetch(\PDO::FETCH_ASSOC);
$user = $f3->get('container')['user_finder']->findByEmail($f3->get('email'));
$cumul = 0;
if ($result['email']!=$f3->get('email')) {
$hash = hash('sha256', $f3->get('password'));
......@@ -337,11 +306,8 @@ class Perso extends Controller
if (!$f3->exists('SESSION.user')) {
$f3->error('401');
}
// Récupération du cumul actuel de l'utilisateur
$db = $f3->get('DB');
$result = $db->query("SELECT cumul FROM users WHERE id='".$f3->get('SESSION.id')."' ");
$me = $result->fetch(\PDO::FETCH_ASSOC);
$cumul = $me['cumul'];
$user = $f3->get('container')['user_finder']->findById($f3->get('SESSION.id'));
// Récupération des valeurs du formulaire
$adresse_id = $f3->get('adresse_id');
......@@ -351,7 +317,6 @@ class Perso extends Controller
$piplome_id = intval(substr($f3->get('piplome_id'), 0, strpos($f3->get('piplome_id'), '_')));
$taille = intval($f3->get('taille'));
$taille_h = intval($f3->get('taille_h'));
$f3->clear('SESSION.error');
switch ($quoi) {
case 'piplome':
$valeur = 30;
......@@ -368,24 +333,28 @@ class Perso extends Controller
}
// Ajout d'une demande de contrepartie pour chaque contrepartie
if ($cumul >= $valeur) {
if ((int) $user['cumul'] >= $valeur) {
switch ($quoi) {
case 'piplome':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'piplome','".\Utils::asl($piplome_id)."','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'piplome', \Utils::asl($piplome_id), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
case 'pibag':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'pibag','','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'pibag', '', 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
case 'pishirt':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'pishirt','".\Utils::asl($taille)."','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'pishirt', \Utils::asl($taille), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
case 'hoopie':
$db->query("INSERT INTO contreparties (user_id,datec,quoi,taille,adresse_id,status,commentaire) VALUES ('".$f3->get('SESSION.id')."',NOW(),'hoodie','".\Utils::asl($taille_h)."','".\Utils::asl($adresse_id)."',1, '".\Utils::asl($commentaire)."')");
$f3->get('container')['command_handler']->handle(new CounterpartCreateCommand(\Utils::asl($adresse_id), $f3->get('SESSION.id'), 'hoopie', \Utils::asl($taille_h), 1, date("Y-m-d H:i:s"), \Utils::asl($commentaire)));
break;
}
// Puis diminution du cumul de la valeur des contreparties
$f3->get('container')['command_handler']->handle(new UserUpdateCumulCommand($user['id'], $user['cumul'] - $valeur));
$f3->set('SESSION.message', _("Merci, vos contreparties seront envoyées dès que possible !".$valeur));
} else {
$f3->set('SESSION.error', _("Désolé, mais vous n'avez pas cumulé suffisament de dons pour avoir un ").$quoi);
$f3->clear('SESSION.message');
}
// Puis diminution du cumul de la valeur des contreparties
$db->query("UPDATE users SET cumul = cumul - ".$valeur." WHERE id='".$f3->get('SESSION.id')."'");
$f3->set('SESSION.message', _("Merci, vos contreparties seront envoyées dès que possible !"));
$f3->reroute('/perso');
}
......
......@@ -27,6 +27,8 @@ GET|POST @admin:/admin=Controller\Admin->show
GET @add_support:/admin/support/add=Controller\Admin->support
GET @edit_support:/admin/support/edit/@id=Controller\Admin->support
POST @modify_support:/admin/support/edit=Controller\Admin->support
GET @invalidate_support:/admin/support/invalidate/@id=Controller\Admin->invalidate
GET @validate_support:/admin/support/validate/@id=Controller\Admin->validate
GET|POST @admin_accounts:/admin/accounts=Controller\Admin->accounts
......
<include href="backend/header.html" />
<include href="backend/toolbar.html" />
<include href="{{ @block_content }}" />
<include href="backend/footer.html" />
<!-- <include href="backend/footer.html" /> <!-- No need for scripts right now -->
......@@ -7,13 +7,13 @@
<h2>Ajout d'une contrepartie</h2>
</false>
</check>
<form name="f" method="POST" action="{{ 'edit_counterpart', 'id='+@id | alias }}">
<form name="f" method="POST" action="{{ 'edit_counterpart', 'id='.@id | alias }}">
<input type="hidden" name="taille" id="taille" value="{{ @contrepartie.taille }}" />
<input type="hidden" name="user_id" id="user_id" value="{{ @contrepartie.user_id }}" />
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<label for="quoi">Quoi</label>
<select id="quoi" name="quoi" onchange="select_span()">
<select id="quoi" name="quoi">
<option value="piplome" <check if="{{ @contrepartie.quoi=='piplome' }}">selected</check> >piplome</option>
<option value="pishirt" <check if="{{ @contrepartie.quoi=='pishirt' }}">selected</check> >pishirt</option>
<option value="hoodie" <check if="{{ @contrepartie.quoi=='hoodie' }}">selected</check> >hoodie</option>
......@@ -22,15 +22,15 @@
<span id="quoi_taille">
<label for="size">Taille</label>
<select id="size" name="size" onchange="select_taille()">
<repeat group="{{ @TAILLES }}" key="{{ @key }}" value="{{ @value }}">
<select id="size" name="size">
<repeat group="{{ @atailles }}" key="{{ @key }}" value="{{ @value }}">
<option value="{{ @key }}" <check if="{{ @contrepartie.taille==@key }}">selected</check> >{{ @value }}</option>
</repeat>
</select>
</span>
<span id="quoi_pdf">
<label for="url">Pdf</label>
<select id="url" name="url" onchange="select_taille()">
<select id="url" name="url">
<repeat group="{{ @pdfs }}" value="{{ @pdf }}">
<option value="{{ @pdf.id }}" <check if="{{ @contrepartie.taille==@pdf.id }}">selected</check> >{{ @pdf.pdf }} / {{ @pdf.nom }}</option>
</repeat>
......@@ -43,7 +43,11 @@
<br />
<label for="adresse">Adresse</label>
<textarea id="adresse" name="adresse" cols="30" rows="2">{{ @contrepartie.adresse }}</textarea>
<input type="text" id="adresse" name="adresse" size="60" value="{{ @contrepartie.adresse }}">
<br />
<label for="adresse">Complément d'adresse</label>
<input type="text" id="adresse2" name="adresse2" size="60" value="{{ @contrepartie.adresse2 }}">
<br />
<label for="codepostal">Code postal</label>
......@@ -65,7 +69,7 @@
</select>
<br />
<label for=commentaire">Commentaire</label>
<label for="commentaire">Commentaire</label>
<textarea type="textarea" id="commentaire" name="commentaire" cols="30" rows="2">{{ @contrepartie.commentaire }}</textarea>
<br />
......
......@@ -71,14 +71,14 @@
&nbsp;
</true>
<false>
{{ @TAILLES[@row.taille] }}
{{ @atailles[@row.taille] }}
</false>
</check>
</false>
</check>
</td>
<td>
{{ @row.nom }}<br />
{{ @row.pseudo }}<br />
{{ @row.adresse }}<br />
{{ @row.adresse2 }}<br />
{{ @row.codepostal }} {{ @row.ville }}<br />
......
......@@ -55,8 +55,8 @@
<tr>
<td>{{ @row.id }}</td>
<td class="inline">{{ @row.datec }}</td>
<td>{{ @row.nom }}</td>
<td><a href="{{ 'user_info','id='.@row.user_id | alias }}">{{ @row.email }}</a></td>
<td>{{ @row.pseudo }}</td>
<td><a href="{{ 'user_info','id='.@row.user_id | alias }}">{{ @row.email }}</a></td>
<td>{{ @row.somme }}</td>
<td>
{{ @row.adresse }}<br />
......@@ -71,12 +71,12 @@
-
<check if="{{ @row.status==0 || @row.status==100 }}" >
<true>
<span class="lien" onclick="valid({{ @row.id }})">Valider</span>
<a href="{{ 'validate_support', 'id='.@row.id | alias }}">Valider</a>
</true>
<false>
<span class="lien" onclick="invalid({{ @row.id }})">Invalider</span>
<a href="{{ 'invalidate_support', 'id='.@row.id | alias }}">Invalider</a>
-
<span class="lien" onclick="pdf({{ @row.id }})">PDF</span>
<a href="{{ 'validate_support', 'id='.@row.id | alias }}">PDF</a>
</false>
</check>
</td>
......
......@@ -35,52 +35,50 @@
<br />
</section>
<section id="adresses">
<h2>Adresses associées à cet utilisateur</h2>
<repeat group="{{ @user.adresses }}" value="{{ @adresse }}" counter="{{ @i }}">
<h3>{{ @i }}&nbsp:{{ @adresse.alias }}</h3>
<form name="addr_{{@id }}" method="POST" action="{{ 'adresse' |alias }}">
<input type="hidden" id="csrf" name="csrf" value="{{ @CSRF }}" />
<input type="hidden" name="id" id="id" value="{{ @adresse.id }}" />
<input type="hidden" name="action" id="action" value="modify" />
<label for="nom">Nom</label>
<input type="text" id="nom" name="nom" size="30" value="{{ @adresse.nom }}" />
<br />
<label for="adresse">Adresse</label>
<input type="text" id="adresse" name="adresse" size="100" value="{{ @adresse.adresse }}" />
<br />
<label for="adresse2">Adresse (compl.)</label>
<input type="text" id="adresse2" name="adresse2" size="100" value="{{ @adresse.adresse2 }}" />
<br />
<label for="codepostal">Code Postal</label>
<input type="text" id="codepostal" name="codepostal" size="10" value="{{ @adresse.codepostal }}" />