modification 30082025
This commit is contained in:
parent
c31429558a
commit
09ffc99c0f
@ -284,7 +284,9 @@ $routes->group('', ['filter' => 'auth'], function ($routes) {
|
||||
$routes->group('/avances', function ($routes) {
|
||||
$routes->get('/', [AvanceController::class, 'index']);
|
||||
$routes->get('fetchAvanceData', [AvanceController::class, 'fetchAvanceData']);
|
||||
$routes->get('fetchAvanceBecameOrder', [AvanceController::class, 'fetchAvanceBecameOrder']);
|
||||
$routes->get('fetchCompletedAvances', [AvanceController::class, 'fetchCompletedAvances']);
|
||||
$routes->get('fetchIncompleteAvances', [AvanceController::class, 'fetchIncompleteAvances']);
|
||||
$routes->get('fetchAvanceBecameOrder', 'AvanceController::fetchAvanceBecameOrder');
|
||||
$routes->get('fetchExpiredAvance', [AvanceController::class, 'fetcheExpiredAvance']);
|
||||
$routes->get('fetchSingleAvance/(:num)', [AvanceController::class, 'fetchSingleAvance']);
|
||||
$routes->post('createAvance', [AvanceController::class, 'createAvance']);
|
||||
|
||||
@ -128,13 +128,16 @@ class AvanceController extends AdminController
|
||||
|
||||
public function fetchAvanceData()
|
||||
{
|
||||
return $this->fetchAvanceDataGeneric('getAllAvanceData');
|
||||
// Avances incomplètes (reste à payer > 0)
|
||||
return $this->fetchAvanceDataGeneric('getIncompleteAvances');
|
||||
}
|
||||
|
||||
|
||||
public function fetchAvanceBecameOrder()
|
||||
{
|
||||
return $this->fetchAvanceDataGeneric('getAllAvanceData1');
|
||||
// Avances complètes (reste à payer = 0)
|
||||
return $this->fetchAvanceDataGeneric('getCompletedAvances');
|
||||
}
|
||||
|
||||
|
||||
public function fetcheExpiredAvance()
|
||||
{
|
||||
@ -399,6 +402,7 @@ class AvanceController extends AdminController
|
||||
|
||||
$data = [
|
||||
'type_avance' => $type_avance,
|
||||
'type_payment' => $this->request->getPost('type_payment'),
|
||||
'customer_name' => $this->request->getPost('customer_name_avance'),
|
||||
'customer_address' => $this->request->getPost('customer_address_avance'),
|
||||
'customer_phone' => $this->request->getPost('customer_phone_avance'),
|
||||
@ -444,30 +448,29 @@ class AvanceController extends AdminController
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateAvance(int $id)
|
||||
public function updateAvance()
|
||||
{
|
||||
$this->verifyRole('updateAvance');
|
||||
|
||||
|
||||
if ($this->request->getMethod() !== 'post') {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Méthode non autorisée'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$session = session();
|
||||
$users = $session->get('user');
|
||||
|
||||
$Avance = new Avance();
|
||||
$Products = new Products();
|
||||
$Orders = new Orders();
|
||||
$Company = new Company();
|
||||
$Notification = new NotificationController();
|
||||
|
||||
|
||||
// Validation des données (avec les vrais noms des champs du formulaire)
|
||||
$validation = \Config\Services::validation();
|
||||
$validation->setRules([
|
||||
'id' => 'required|numeric',
|
||||
'customer_name_avance_edit' => 'required|min_length[2]',
|
||||
'customer_phone_avance_edit' => 'required',
|
||||
'customer_address_avance_edit' => 'required',
|
||||
@ -476,121 +479,106 @@ class AvanceController extends AdminController
|
||||
'avance_amount_edit' => 'required|numeric|greater_than[0]',
|
||||
'type_avance_edit' => 'required|in_list[terre,mere]'
|
||||
]);
|
||||
|
||||
|
||||
if (!$validation->withRequest($this->request)->run()) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Données invalides: ' . implode(', ', $validation->getErrors())
|
||||
]);
|
||||
}
|
||||
|
||||
// Récupérer la date de création actuelle de l'avance pour recalculer deadline
|
||||
$currentAvance = $Avance->find($id);
|
||||
if (!$currentAvance) {
|
||||
|
||||
$avance_id = $this->request->getPost('id'); // Changement ici
|
||||
|
||||
// Vérifier si l'avance existe
|
||||
$existingAvance = $Avance->fetchSingleAvance($avance_id);
|
||||
if (!$existingAvance) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Avance introuvable.'
|
||||
'messages' => 'Avance non trouvée'
|
||||
]);
|
||||
}
|
||||
$avance_date = $currentAvance['avance_date'];
|
||||
|
||||
// Calcul automatique deadline selon le type d'avance
|
||||
$type_avance = $this->request->getPost('type_avance_edit');
|
||||
if ($type_avance === 'terre') {
|
||||
$deadline = date('Y-m-d', strtotime($avance_date . ' +15 days'));
|
||||
} elseif ($type_avance === 'mere') {
|
||||
$deadline = date('Y-m-d', strtotime($avance_date . ' +2 months'));
|
||||
} else {
|
||||
$deadline = null;
|
||||
|
||||
// Vérifier les permissions (admin ou propriétaire)
|
||||
$isAdmin = $this->isAdmin($users);
|
||||
$isOwner = $users['id'] === $existingAvance['user_id'];
|
||||
|
||||
if (!$isAdmin && !$isOwner) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Vous n\'avez pas les droits pour modifier cette avance'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
// Recalculer la deadline si le type d'avance a changé
|
||||
$type_avance = $this->request->getPost('type_avance_edit'); // Changement ici
|
||||
$current_deadline = $existingAvance['deadline'];
|
||||
|
||||
// Si le type a changé, recalculer la deadline
|
||||
if ($type_avance !== $existingAvance['type_avance']) {
|
||||
if ($type_avance === 'terre') {
|
||||
$current_deadline = date('Y-m-d', strtotime($existingAvance['avance_date'] . ' +15 days'));
|
||||
} elseif ($type_avance === 'mere') {
|
||||
$current_deadline = date('Y-m-d', strtotime($existingAvance['avance_date'] . ' +2 months'));
|
||||
}
|
||||
}
|
||||
|
||||
$old_product_id = $existingAvance['product_id'];
|
||||
$new_product_id = (int)$this->request->getPost('id_product_edit'); // Changement ici
|
||||
|
||||
$data = [
|
||||
'type_avance' => $type_avance,
|
||||
'customer_name' => $this->request->getPost('customer_name_avance_edit'),
|
||||
'customer_address' => $this->request->getPost('customer_address_avance_edit'),
|
||||
'customer_phone' => $this->request->getPost('customer_phone_avance_edit'),
|
||||
'customer_cin' => $this->request->getPost('customer_cin_avance_edit'),
|
||||
'gross_amount' => (float)$this->request->getPost('gross_amount_edit'),
|
||||
'avance_amount' => (float)$this->request->getPost('avance_amount_edit'),
|
||||
'amount_due' => (float)$this->request->getPost('amount_due_edit'),
|
||||
'product_id' => (int)$this->request->getPost('id_product_edit'),
|
||||
'deadline' => $deadline,
|
||||
'type_payment' => $this->request->getPost('type_payment_edit'), // Changement ici
|
||||
'customer_name' => $this->request->getPost('customer_name_avance_edit'), // Changement ici
|
||||
'customer_address' => $this->request->getPost('customer_address_avance_edit'), // Changement ici
|
||||
'customer_phone' => $this->request->getPost('customer_phone_avance_edit'), // Changement ici
|
||||
'customer_cin' => $this->request->getPost('customer_cin_avance_edit'), // Changement ici
|
||||
'deadline' => $current_deadline,
|
||||
'product_id' => $new_product_id,
|
||||
'gross_amount' => (float)$this->request->getPost('gross_amount_edit'), // Changement ici
|
||||
'avance_amount' => (float)$this->request->getPost('avance_amount_edit'), // Changement ici
|
||||
'amount_due' => (float)$this->request->getPost('amount_due_edit'), // Changement ici
|
||||
];
|
||||
|
||||
$amount_due = $data['amount_due'];
|
||||
|
||||
if ($amount_due <= 0) {
|
||||
$bill_no = 'BILPR-' . strtoupper(substr(md5(uniqid(mt_rand(), true)), 0, 4));
|
||||
$company = $Company->getCompanyData(1);
|
||||
|
||||
// Mettre à jour l'avance
|
||||
if ($Avance->updateAvance($avance_id, $data)) {
|
||||
|
||||
$service_charge_rate = $company['service_charge_value'] ?? 0;
|
||||
$vat_charge_rate = $company['vat_charge_value'] ?? 0;
|
||||
$gross_amount = $data['gross_amount'];
|
||||
$vat_charge = ($gross_amount / 100) * $vat_charge_rate;
|
||||
|
||||
$order_data = [
|
||||
'bill_no' => $bill_no,
|
||||
'customer_name' => $data['customer_name'],
|
||||
'customer_address' => $data['customer_address'],
|
||||
'customer_phone' => $data['customer_phone'],
|
||||
'customer_cin' => $data['customer_cin'],
|
||||
'gross_amount' => $gross_amount,
|
||||
'net_amount' => $gross_amount,
|
||||
'date_time' => date('Y-m-d H:i:s'),
|
||||
'service_charge_rate' => $service_charge_rate,
|
||||
'vat_charge_rate' => $vat_charge_rate,
|
||||
'vat_charge' => $vat_charge,
|
||||
'discount' => 0,
|
||||
'paid_status' => 1,
|
||||
'user_id' => $users['id'],
|
||||
'store_id' => $users['store_id'],
|
||||
'amount_value' => $gross_amount,
|
||||
'rate_value' => $gross_amount,
|
||||
];
|
||||
|
||||
$product_id = [$data['product_id']];
|
||||
|
||||
if ($Orders->create($order_data, $product_id)) {
|
||||
$Avance->updateAvance($id, ['is_order' => 1]);
|
||||
$Notification->createNotification(
|
||||
'Une avance a été convertie en commande',
|
||||
"Conseil",
|
||||
(int)$users['store_id'],
|
||||
'orders'
|
||||
);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'success' => true,
|
||||
'messages' => 'Avance convertie en commande avec succès.'
|
||||
]);
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Erreur lors de la conversion de l\'avance en commande'
|
||||
]);
|
||||
// Gérer le changement de produit si nécessaire
|
||||
if ($old_product_id !== $new_product_id) {
|
||||
// Libérer l'ancien produit
|
||||
$Products->update($old_product_id, ['product_sold' => 0]);
|
||||
// Marquer le nouveau produit comme vendu
|
||||
$Products->update($new_product_id, ['product_sold' => 1]);
|
||||
}
|
||||
|
||||
// Créer une notification
|
||||
$Notification->createNotification(
|
||||
'Une avance a été modifiée',
|
||||
"Conseil",
|
||||
(int)$users['store_id'],
|
||||
'avances'
|
||||
);
|
||||
|
||||
return $this->response->setJSON([
|
||||
'success' => true,
|
||||
'messages' => 'Avance modifiée avec succès !'
|
||||
]);
|
||||
|
||||
} else {
|
||||
if ($Avance->updateAvance($id, $data)) {
|
||||
return $this->response->setJSON([
|
||||
'success' => true,
|
||||
'messages' => 'Avance mise à jour avec succès.'
|
||||
]);
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Erreur lors de la mise à jour de l\'avance.'
|
||||
]);
|
||||
}
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Erreur lors de la modification de l\'avance'
|
||||
]);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
log_message('error', "Erreur mise à jour avance: " . $e->getMessage());
|
||||
log_message('error', "Erreur modification avance: " . $e->getMessage());
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'messages' => 'Une erreur interne est survenue'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeAvance()
|
||||
{
|
||||
$this->verifyRole('deleteAvance');
|
||||
@ -659,4 +647,7 @@ class AvanceController extends AdminController
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -197,5 +197,113 @@ class AvanceController extends AdminController
|
||||
->setJSON(['error' => 'Une erreur interne est survenue. Lors de la création d\'une avance']);
|
||||
}
|
||||
}
|
||||
// Avances complètes (reste = 0)
|
||||
public function fetchAvanceComplete()
|
||||
{
|
||||
$this->verifyRole('viewAvance');
|
||||
$Avance = new Avance();
|
||||
$data = $Avance->getAvanceComplete(); // méthode à créer dans le modèle
|
||||
|
||||
$result = ['data' => []];
|
||||
$session = session();
|
||||
$users = $session->get('user');
|
||||
$isAdmin = in_array($users['group_name'], ['Conseil', 'Direction']);
|
||||
$isCommerciale = in_array($users['group_name'], ['COMMERCIALE']);
|
||||
$isCaissier = in_array($users['group_name'], ['Caissier']);
|
||||
|
||||
foreach($data as $value) {
|
||||
$buttons = '';
|
||||
$isOwner = $users['id'] === $value['user_id'];
|
||||
|
||||
if (in_array('updateAvance', $this->permission) && ($isAdmin || $isOwner))
|
||||
$buttons .= '<button type="button" class="btn btn-default" onclick="editFunc('. $value['avance_id'] .')"><i class="fa fa-pencil"></i></button>';
|
||||
if (in_array('deleteAvance', $this->permission) && ($isAdmin || $isOwner))
|
||||
$buttons .= ' <button type="button" class="btn btn-danger" onclick="removeFunc('.$value['avance_id'].')"><i class="fa fa-trash"></i></button>';
|
||||
|
||||
$date_time = date('d-m-Y h:i a', strtotime($value['avance_date']));
|
||||
|
||||
if ($isAdmin) {
|
||||
$row = [
|
||||
$value['customer_name'],
|
||||
$value['customer_phone'],
|
||||
$value['customer_address'],
|
||||
number_format((int)$value['gross_amount'],0,',',' '),
|
||||
number_format((int)$value['avance_amount'],0,',',' '),
|
||||
number_format((int)$value['amount_due'],0,',',' '),
|
||||
$date_time,
|
||||
$buttons
|
||||
];
|
||||
$result['data'][] = $row;
|
||||
}
|
||||
|
||||
if ($isCommerciale || $isCaissier) {
|
||||
$row = [
|
||||
$value['avance_id'],
|
||||
number_format((int)$value['avance_amount'],0,',',' '),
|
||||
number_format((int)$value['amount_due'],0,',',' '),
|
||||
$date_time,
|
||||
$buttons
|
||||
];
|
||||
$result['data'][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
|
||||
// Avances expirées (deadline dépassée)
|
||||
public function fetchExpiredAvance()
|
||||
{
|
||||
$this->verifyRole('viewAvance');
|
||||
$Avance = new Avance();
|
||||
$data = $Avance->getAvanceExpired(); // méthode à créer dans le modèle
|
||||
|
||||
$result = ['data' => []];
|
||||
$session = session();
|
||||
$users = $session->get('user');
|
||||
$isAdmin = in_array($users['group_name'], ['Conseil', 'Direction']);
|
||||
$isCommerciale = in_array($users['group_name'], ['COMMERCIALE']);
|
||||
$isCaissier = in_array($users['group_name'], ['Caissier']);
|
||||
|
||||
foreach($data as $value) {
|
||||
$buttons = '';
|
||||
$isOwner = $users['id'] === $value['user_id'];
|
||||
|
||||
if (in_array('updateAvance', $this->permission) && ($isAdmin || $isOwner))
|
||||
$buttons .= '<button type="button" class="btn btn-default" onclick="editFunc('. $value['avance_id'] .')"><i class="fa fa-pencil"></i></button>';
|
||||
if (in_array('deleteAvance', $this->permission) && ($isAdmin || $isOwner))
|
||||
$buttons .= ' <button type="button" class="btn btn-danger" onclick="removeFunc('.$value['avance_id'].')"><i class="fa fa-trash"></i></button>';
|
||||
|
||||
$date_time = date('d-m-Y h:i a', strtotime($value['avance_date']));
|
||||
|
||||
if ($isAdmin) {
|
||||
$row = [
|
||||
$value['customer_name'],
|
||||
$value['customer_phone'],
|
||||
$value['customer_address'],
|
||||
number_format((int)$value['gross_amount'],0,',',' '),
|
||||
number_format((int)$value['avance_amount'],0,',',' '),
|
||||
number_format((int)$value['amount_due'],0,',',' '),
|
||||
$date_time,
|
||||
$buttons
|
||||
];
|
||||
$result['data'][] = $row;
|
||||
}
|
||||
|
||||
if ($isCommerciale || $isCaissier) {
|
||||
$row = [
|
||||
$value['avance_id'],
|
||||
number_format((int)$value['avance_amount'],0,',',' '),
|
||||
number_format((int)$value['amount_due'],0,',',' '),
|
||||
$date_time,
|
||||
$buttons
|
||||
];
|
||||
$result['data'][] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -33,43 +33,68 @@ class Dashboard extends AdminController
|
||||
$sortieCaisse = new SortieCaisse();
|
||||
$total_sortie_caisse = $sortieCaisse->getTotalSortieCaisse();
|
||||
$total_sortie_caisse1= $total_sortie_caisse->mr;
|
||||
// dd($totalRecouvrement);
|
||||
|
||||
// Recouvrements
|
||||
$total_recouvrement_me = $totalRecouvrement->me;
|
||||
$total_recouvrement_bm = $totalRecouvrement->bm;
|
||||
$total_recouvrement_be = $totalRecouvrement->be;
|
||||
$total_recouvrement_mb = $totalRecouvrement->mb;
|
||||
// total avance
|
||||
$Avance = new Avance();
|
||||
$totalAvance = $Avance->getTotalAvance();
|
||||
$total_avance = $totalAvance->ta;
|
||||
// Initialisation des totaux avec 0 au cas où il n'y aurait pas de données
|
||||
$total = isset($paymentData->total) ? $paymentData->total : 0;
|
||||
$total_mvola1 = isset($paymentData->total_mvola1) ? $paymentData->total_mvola1 : 0;
|
||||
$total_mvola2 = isset($paymentData->total_mvola2) ? $paymentData->total_mvola2 : 0;
|
||||
$total_espece1 = isset($paymentData->total_espece1) ? $paymentData->total_espece1 : 0;
|
||||
$total_espece2 = isset($paymentData->total_espece2) ? $paymentData->total_espece2 : 0;
|
||||
$total_virement_bancaire1 = isset($paymentData->total_virement_bancaire1) ? $paymentData->total_virement_bancaire1 : 0;
|
||||
$total_virement_bancaire2 = isset($paymentData->total_virement_bancaire2) ? $paymentData->total_virement_bancaire2 : 0;
|
||||
|
||||
$total_mvola = $total_mvola1 + $total_mvola2;
|
||||
$total_mvola1 = $total_mvola - $total_recouvrement_me - $total_recouvrement_mb + $total_recouvrement_bm;
|
||||
|
||||
$total_espece = $total_espece1 + $total_espece2;
|
||||
$total_espece1 = $total_espece + $total_recouvrement_me + $total_recouvrement_be - $total_sortie_caisse1 + $total_avance;
|
||||
|
||||
//die("Test Stephane " . $total_recouvrement_me);
|
||||
$total_virement_bancaire = $total_virement_bancaire1 + $total_virement_bancaire2;
|
||||
$total_virement_bancaire1 = $total_virement_bancaire - $total_recouvrement_be -$total_recouvrement_bm + $total_recouvrement_mb;
|
||||
|
||||
// Avances
|
||||
$Avance = new Avance();
|
||||
$totalAvance = $Avance->getTotalAvance();
|
||||
$paymentDataAvance = $Avance->getPaymentModesAvance();
|
||||
|
||||
// Initialisation des totaux Orders (en utilisant les bonnes propriétés)
|
||||
$total_orders = isset($paymentData->total) ? $paymentData->total : 0;
|
||||
$total_mvola1_orders = isset($paymentData->total_mvola1) ? $paymentData->total_mvola1 : 0;
|
||||
$total_mvola2_orders = isset($paymentData->total_mvola2) ? $paymentData->total_mvola2 : 0;
|
||||
$total_espece1_orders = isset($paymentData->total_espece1) ? $paymentData->total_espece1 : 0;
|
||||
$total_espece2_orders = isset($paymentData->total_espece2) ? $paymentData->total_espece2 : 0;
|
||||
$total_virement_bancaire1_orders = isset($paymentData->total_virement_bancaire1) ? $paymentData->total_virement_bancaire1 : 0;
|
||||
$total_virement_bancaire2_orders = isset($paymentData->total_virement_bancaire2) ? $paymentData->total_virement_bancaire2 : 0;
|
||||
|
||||
// Initialisation des totaux Avances (utiliser les bonnes propriétés de getPaymentModesAvance)
|
||||
$total_avances = isset($paymentDataAvance->total) ? $paymentDataAvance->total : 0;
|
||||
$total_mvola_avances = isset($paymentDataAvance->total_mvola) ? $paymentDataAvance->total_mvola : 0;
|
||||
$total_espece_avances = isset($paymentDataAvance->total_espece) ? $paymentDataAvance->total_espece : 0;
|
||||
$total_virement_bancaire_avances = isset($paymentDataAvance->total_virement_bancaire) ? $paymentDataAvance->total_virement_bancaire : 0;
|
||||
|
||||
// Addition Orders + Avances
|
||||
$total = $total_orders + $total_avances;
|
||||
|
||||
// Combiner les totaux par type de paiement
|
||||
$total_mvola1 = $total_mvola1_orders;
|
||||
$total_mvola2 = $total_mvola2_orders;
|
||||
$total_espece1 = $total_espece1_orders;
|
||||
$total_espece2 = $total_espece2_orders;
|
||||
$total_virement_bancaire1 = $total_virement_bancaire1_orders;
|
||||
$total_virement_bancaire2 = $total_virement_bancaire2_orders;
|
||||
|
||||
// Totaux combinés Orders
|
||||
$total_mvola_orders_combined = $total_mvola1 + $total_mvola2;
|
||||
$total_espece_orders_combined = $total_espece1 + $total_espece2;
|
||||
$total_virement_bancaire_orders_combined = $total_virement_bancaire1 + $total_virement_bancaire2;
|
||||
|
||||
// Totaux finaux (Orders + Avances)
|
||||
$total_mvola = $total_mvola_orders_combined + $total_mvola_avances;
|
||||
$total_espece = $total_espece_orders_combined + $total_espece_avances;
|
||||
$total_virement_bancaire = $total_virement_bancaire_orders_combined + $total_virement_bancaire_avances;
|
||||
|
||||
// Ajustements avec les recouvrements et sorties caisse
|
||||
$total_mvola_final = $total_mvola - $total_recouvrement_me - $total_recouvrement_mb + $total_recouvrement_bm;
|
||||
$total_espece_final = $total_espece + $total_recouvrement_me + $total_recouvrement_be - $total_sortie_caisse1;
|
||||
$total_virement_bancaire_final = $total_virement_bancaire - $total_recouvrement_be - $total_recouvrement_bm + $total_recouvrement_mb;
|
||||
|
||||
// check avance expired
|
||||
$avance = new Avance();
|
||||
$avance->checkExpiredAvance();
|
||||
|
||||
$data = [
|
||||
'total' => $total,
|
||||
'total_mvola' => $total_mvola1,
|
||||
'total_espece' => $total_espece1,
|
||||
'total_virement_bancaire' => $total_virement_bancaire1,
|
||||
'total_mvola' => $total_mvola_final,
|
||||
'total_espece' => $total_espece_final,
|
||||
'total_virement_bancaire' => $total_virement_bancaire_final,
|
||||
'user_permission' => $this->permission,
|
||||
|
||||
];
|
||||
|
||||
@ -41,54 +41,62 @@ class RecouvrementController extends AdminController
|
||||
return $this->response->setJSON($data);
|
||||
}
|
||||
|
||||
private function getTotalsArray(): array
|
||||
private function getTotalsArray(): array
|
||||
{
|
||||
$orders = new Orders();
|
||||
$recouvrement = new Recouvrement();
|
||||
$sortieCaisse = new SortieCaisse();
|
||||
$avance = new Avance();
|
||||
|
||||
|
||||
// Récupère les données brutes
|
||||
$paymentData = $orders->getPaymentModes();
|
||||
$total_sortie_caisse = $sortieCaisse->getTotalSortieCaisse()->mr ?? 0;
|
||||
$totalRecouvrement = $recouvrement->getTotalRecouvrements();
|
||||
|
||||
$paymentDataOrders = $orders->getPaymentModes();
|
||||
$paymentDataAvance = $avance->getPaymentModesAvance();
|
||||
$total_sortie_caisse = $sortieCaisse->getTotalSortieCaisse()->mr ?? 0;
|
||||
$totalRecouvrement = $recouvrement->getTotalRecouvrements();
|
||||
|
||||
// Totaux recouvrement
|
||||
$me = $totalRecouvrement->me ?? 0;
|
||||
$bm = $totalRecouvrement->bm ?? 0;
|
||||
$be = $totalRecouvrement->be ?? 0;
|
||||
$mb = $totalRecouvrement->mb ?? 0;
|
||||
$ta = $avance->getTotalAvance()->ta ?? 0;
|
||||
|
||||
// Totaux paiements initiaux
|
||||
$t = $paymentData->total ?? 0;
|
||||
$mv1 = $paymentData->total_mvola1 ?? 0;
|
||||
$mv2 = $paymentData->total_mvola2 ?? 0;
|
||||
$es1 = $paymentData->total_espece1 ?? 0;
|
||||
$es2 = $paymentData->total_espece2 ?? 0;
|
||||
$vb1 = $paymentData->total_virement_bancaire1 ?? 0;
|
||||
$vb2 = $paymentData->total_virement_bancaire2 ?? 0;
|
||||
|
||||
// Calculs
|
||||
$total_mvola = $mv1 + $mv2;
|
||||
$mv_calc = $total_mvola - $me - $mb + $bm;
|
||||
|
||||
$total_espece = $es1 + $es2;
|
||||
$es_calc = $total_espece + $me + $be - $total_sortie_caisse + $ta;
|
||||
|
||||
$total_vb = $vb1 + $vb2;
|
||||
$vb_calc = $total_vb - $be - $bm + $mb;
|
||||
|
||||
// Retourne le tableau à utiliser
|
||||
|
||||
// Totaux paiements Orders
|
||||
$total_orders = $paymentDataOrders->total ?? 0;
|
||||
$mv1_orders = $paymentDataOrders->total_mvola1 ?? 0;
|
||||
$mv2_orders = $paymentDataOrders->total_mvola2 ?? 0;
|
||||
$es1_orders = $paymentDataOrders->total_espece1 ?? 0;
|
||||
$es2_orders = $paymentDataOrders->total_espece2 ?? 0;
|
||||
$vb1_orders = $paymentDataOrders->total_virement_bancaire1 ?? 0;
|
||||
$vb2_orders = $paymentDataOrders->total_virement_bancaire2 ?? 0;
|
||||
|
||||
// Totaux paiements Avances
|
||||
$total_avances = $paymentDataAvance->total ?? 0;
|
||||
$mv_avances = $paymentDataAvance->total_mvola ?? 0;
|
||||
$es_avances = $paymentDataAvance->total_espece ?? 0;
|
||||
$vb_avances = $paymentDataAvance->total_virement_bancaire ?? 0;
|
||||
$ta = $avance->getTotalAvance()->ta ?? 0;
|
||||
|
||||
// Combinaison Orders + Avances
|
||||
$total_mvola = $mv1_orders + $mv2_orders + $mv_avances;
|
||||
$total_espece = $es1_orders + $es2_orders + $es_avances;
|
||||
$total_vb = $vb1_orders + $vb2_orders + $vb_avances;
|
||||
$total = $total_orders + $total_avances;
|
||||
|
||||
// Ajustements avec recouvrements et sorties caisse
|
||||
$total_mvola_final = $total_mvola - $me - $mb + $bm;
|
||||
$total_espece_final = $es1_orders + $es2_orders + $es_avances - $total_sortie_caisse;
|
||||
$total_virement_bancaire_final = $total_vb - $be - $bm + $mb;
|
||||
|
||||
return [
|
||||
'total' => $t,
|
||||
'total_mvola' => $mv_calc,
|
||||
'total_espece' => $es_calc,
|
||||
'total_virement_bancaire' => $vb_calc,
|
||||
'total' => $total,
|
||||
'total_mvola' => $total_mvola_final,
|
||||
'total_espece' => $total_espece_final,
|
||||
'total_virement_bancaire'=> $total_virement_bancaire_final,
|
||||
'page_title' => $this->pageTitle,
|
||||
'permission' => $this->permission
|
||||
'permission' => $this->permission
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function fetchRecouvrementData()
|
||||
{
|
||||
|
||||
@ -11,7 +11,7 @@ class Avance extends Model {
|
||||
'avance_amount', 'avance_date','user_id',
|
||||
'customer_name', 'customer_address', 'customer_phone', 'customer_cin',
|
||||
'gross_amount','amount_due','product_id','is_order','active','store_id',
|
||||
'type_avance', 'deadline' // Ajout du champ type et deadline
|
||||
'type_avance','type_payment', 'deadline' // Ajout du champ type et deadline
|
||||
];
|
||||
|
||||
public function createAvance(array $data) {
|
||||
@ -149,6 +149,34 @@ class Avance extends Model {
|
||||
}
|
||||
}
|
||||
}
|
||||
public function getPaymentModesAvance()
|
||||
{
|
||||
$session = session();
|
||||
$users = $session->get('user');
|
||||
$isAdmin = in_array($users['group_name'], ['Conseil', 'Direction']);
|
||||
|
||||
if ($isAdmin) {
|
||||
return $this->db->table('avances')
|
||||
->select('
|
||||
SUM(avance_amount) AS total,
|
||||
SUM(CASE WHEN LOWER(type_payment) = "mvola" THEN avance_amount ELSE 0 END) AS total_mvola,
|
||||
SUM(CASE WHEN LOWER(type_payment) = "en espèce" THEN avance_amount ELSE 0 END) AS total_espece,
|
||||
SUM(CASE WHEN LOWER(type_payment) = "virement bancaire" THEN avance_amount ELSE 0 END) AS total_virement_bancaire
|
||||
')
|
||||
->where('active', 1)
|
||||
->get()
|
||||
->getRowObject();
|
||||
} else {
|
||||
return (object) [
|
||||
'total' => 0,
|
||||
'total_mvola' => 0,
|
||||
'total_espece' => 0,
|
||||
'total_virement_bancaire' => 0
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getAllAvanceData1(int $id=null) {
|
||||
$session = session();
|
||||
@ -288,5 +316,51 @@ public function getAvancesNearDeadline($days = 3)
|
||||
->where('DATE(avances.deadline)', $alertDate)
|
||||
->findAll();
|
||||
}
|
||||
// Avances incomplètes (reste à payer > 0 et non transformées en commande)
|
||||
public function getIncompleteAvances(int $id = null)
|
||||
{
|
||||
$session = session();
|
||||
$users = $session->get('user');
|
||||
$isAdmin = in_array($users['group_name'], ['Conseil', 'Direction']);
|
||||
|
||||
$builder = $this->where('is_order', 0)
|
||||
->where('active', 1)
|
||||
->where('amount_due >', 0);
|
||||
|
||||
if (!$isAdmin) {
|
||||
$builder->where('store_id', $users['store_id']);
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$builder->where('user_id', $id);
|
||||
}
|
||||
|
||||
return $builder->orderBy('avance_date', 'DESC')->findAll();
|
||||
}
|
||||
|
||||
// Avances complètes (reste à payer = 0 et non transformées en commande)
|
||||
public function getCompletedAvances(int $id = null)
|
||||
{
|
||||
$session = session();
|
||||
$users = $session->get('user');
|
||||
$isAdmin = in_array($users['group_name'], ['Conseil', 'Direction']);
|
||||
|
||||
$builder = $this->where('is_order', 0)
|
||||
->where('active', 1)
|
||||
->where('amount_due', 0);
|
||||
|
||||
if (!$isAdmin) {
|
||||
$builder->where('store_id', $users['store_id']);
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$builder->where('user_id', $id);
|
||||
}
|
||||
|
||||
return $builder->orderBy('avance_date', 'DESC')->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -62,16 +62,33 @@ class Products extends Model
|
||||
return $this->where('is_piece', 0)->where('product_sold', 0)->where('store_id', $id)->orderBy('id', 'DESC')->findAll();
|
||||
}
|
||||
|
||||
public function getProductDataStore(int $id)
|
||||
public function getProductDataStore(int $store_id, bool $excludeAvance = true, int $currentProductId = null)
|
||||
{
|
||||
return $this->where('is_piece', 0)
|
||||
->where('product_sold', 0)
|
||||
->where('availability', 1) // ✅ filtre ajouté
|
||||
->where("store_id", $id)
|
||||
->orderBy('id', 'DESC')
|
||||
->findAll();
|
||||
$builder = $this->where('is_piece', 0)
|
||||
->where('product_sold', 0)
|
||||
->where('availability', 1)
|
||||
->where('store_id', $store_id);
|
||||
|
||||
if ($excludeAvance) {
|
||||
$db = \Config\Database::connect();
|
||||
$subQuery = $db->table('avances')
|
||||
->select('product_id')
|
||||
->where('active', 1)
|
||||
->where('is_order', 0)
|
||||
->getCompiledSelect();
|
||||
|
||||
$builder->where("id NOT IN ($subQuery)", null, false);
|
||||
}
|
||||
|
||||
// Si on modifie et qu'on veut inclure le produit actuel dans la liste
|
||||
if ($currentProductId) {
|
||||
$builder->orWhere('id', $currentProductId);
|
||||
}
|
||||
|
||||
return $builder->orderBy('id', 'DESC')->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get active products (availability = 1)
|
||||
|
||||
@ -119,6 +119,15 @@
|
||||
<option value="mere">Avance sur mère</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="type_avance" class="form-label">Moyen de payment</label>
|
||||
<select class="form-control" id="type_payment" name="type_payment">
|
||||
<option value="" disabled selected>Sélectionnez un moyen de payement</option>
|
||||
<option value="MVOLA">MVOLA</option>
|
||||
<option value="Virement Bancaire">Virement Bancaire</option>
|
||||
<option value="En espèce">En espèce</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Nom client -->
|
||||
<div class="form-group col-md-6">
|
||||
<label>Nom du client</label>
|
||||
@ -152,7 +161,7 @@
|
||||
<option value="">Sélectionnez un produit</option>
|
||||
<?php foreach($products as $p): ?>
|
||||
<option value="<?= $p['id'] ?>" <?= $p['product_sold'] ? 'disabled' : '' ?>>
|
||||
<?= esc($p['name']) ?> <?= $p['product_sold'] ? '(Rupture)' : '' ?>
|
||||
<?= esc($p['name']) ?>|<?= esc($p['sku']) ?> <?= $p['product_sold'] ? '(Rupture)' : '' ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@ -187,7 +196,7 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Modal Modification -->
|
||||
<!-- Modal Modification CORRIGÉ -->
|
||||
<?php if (in_array('updateAvance', $user_permission)): ?>
|
||||
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
@ -210,6 +219,17 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- CORRECTION: ID cohérent pour le type de paiement -->
|
||||
<div class="form-group col-md-6">
|
||||
<label for="type_payment_edit" class="form-label">Moyen de paiement</label>
|
||||
<select class="form-control" id="type_payment_edit" name="type_payment_edit">
|
||||
<option value="" disabled>Sélectionnez un moyen de paiement</option>
|
||||
<option value="MVOLA">MVOLA</option>
|
||||
<option value="Virement Bancaire">Virement Bancaire</option>
|
||||
<option value="En espèce">En espèce</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Nom client -->
|
||||
<div class="form-group col-md-6">
|
||||
<label>Nom du client</label>
|
||||
@ -241,12 +261,14 @@
|
||||
<option value="">Sélectionnez un produit</option>
|
||||
<?php foreach($products as $p): ?>
|
||||
<option value="<?= $p['id'] ?>" <?= $p['product_sold'] ? 'disabled' : '' ?>>
|
||||
<?= esc($p['name']) ?> <?= $p['product_sold'] ? '(Rupture)' : '' ?>
|
||||
<?= esc($p['sku']) ?> | <?= esc($p['name']) ?> | <?= esc($p['numero_de_moteur']) ?> | <?= esc($p['puissance']) ?>
|
||||
<?= $p['product_sold'] ? ' (Rupture)' : '' ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Prix du produit -->
|
||||
<div class="form-group col-md-6">
|
||||
<label>Prix du produit</label>
|
||||
@ -277,7 +299,6 @@
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
|
||||
<?php if (in_array('deleteAvance', $user_permission)): ?>
|
||||
<!-- remove brand modal -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="removeModal">
|
||||
@ -440,7 +461,9 @@ $(document).ready(function() {
|
||||
$form[0].reset(); // Reset le formulaire
|
||||
|
||||
// 🔄 MISE À JOUR DYNAMIQUE après ajout
|
||||
refreshDataTable();
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
}, 500); // petit délai pour voir le message
|
||||
|
||||
// Auto-masquer le message après 3 secondes
|
||||
setTimeout(function() {
|
||||
@ -503,6 +526,7 @@ $(document).ready(function() {
|
||||
// Auto-masquer le message après 3 secondes
|
||||
setTimeout(function() {
|
||||
$("#messages .alert").fadeOut();
|
||||
location.reload();
|
||||
}, 3000);
|
||||
|
||||
} else {
|
||||
@ -556,10 +580,10 @@ function getProductDataCreate() {
|
||||
}
|
||||
$.post(base_url + 'orders/getProductValueById', { product_id: id }, function(r) {
|
||||
brutCreate = parseFloat(r.prix_vente) || 0;
|
||||
$('#gross_amount').val(brutCreate.toFixed(2));
|
||||
$('#gross_amount').val(brutCreate.toFixed(0));
|
||||
var avance25 = brutCreate * 0.25;
|
||||
$('#avance_amount').val(avance25.toFixed(2));
|
||||
$('#amount_due').val((brutCreate - avance25).toFixed(2));
|
||||
$('#avance_amount').val(avance25.toFixed(0));
|
||||
$('#amount_due').val((brutCreate - avance25).toFixed(0));
|
||||
updateDueCreate();
|
||||
}, 'json');
|
||||
}
|
||||
@ -589,10 +613,10 @@ function getProductDataUpdate() {
|
||||
console.log('Données produit reçues:', r); // Pour déboguer
|
||||
|
||||
brutEdit = parseFloat(r.prix_vente) || 0;
|
||||
$('#gross_amount_edit').val(brutEdit.toFixed(2));
|
||||
$('#gross_amount_edit').val(brutEdit.toFixed(0));
|
||||
var avance25 = brutEdit * 0.25;
|
||||
$('#avance_amount_edit').val(avance25.toFixed(2));
|
||||
$('#amount_due_edit').val((brutEdit - avance25).toFixed(2));
|
||||
$('#avance_amount_edit').val(avance25.toFixed(0));
|
||||
$('#amount_due_edit').val((brutEdit - avance25).toFixed(0));
|
||||
updateDueEdit();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -607,163 +631,188 @@ function updateDueEdit() {
|
||||
}
|
||||
|
||||
// ✅ MODIFICATION avec mise à jour dynamique - CORRIGÉ
|
||||
// ✅ MODIFICATION avec mise à jour dynamique - VERSION CORRIGÉE
|
||||
function editFunc(id) {
|
||||
console.log('editFunc appelée avec ID:', id);
|
||||
|
||||
// Réinitialiser d'abord le formulaire
|
||||
$('#update_avance_form')[0].reset();
|
||||
|
||||
$.getJSON(base_url + 'avances/fetchSingleAvance/' + id, function(r) {
|
||||
console.log('Données récupérées:', r); // Pour déboguer
|
||||
|
||||
// Pré-remplir le formulaire de modification avec les BONS IDs
|
||||
$('#avance_id_edit').val(r.id || id); // Le champ caché pour l'ID
|
||||
$('#customer_name_avance_edit').val(r.customer_name || '');
|
||||
$('#customer_phone_avance_edit').val(r.customer_phone || '');
|
||||
$('#customer_address_avance_edit').val(r.customer_address || r.customer_adress || '');
|
||||
$('#customer_cin_avance_edit').val(r.customer_cin || '');
|
||||
$('#type_avance_edit').val(r.type_avance || '');
|
||||
$('#gross_amount_edit').val(r.gross_amount || '');
|
||||
$('#avance_amount_edit').val(r.avance_amount || '');
|
||||
$('#amount_due_edit').val(r.amount_due || '');
|
||||
|
||||
// 🔥 CORRECTION PRINCIPALE - Sélection du produit avec toutes les variantes possibles
|
||||
var productId = r.product_id || r.id_product || r.productId || r.idProduct;
|
||||
console.log('Product ID trouvé:', productId);
|
||||
console.log('Options disponibles:', $('#id_product_edit option').length);
|
||||
|
||||
brutEdit = parseFloat(r.gross_amount || 0); // Utiliser gross_amount directement
|
||||
|
||||
// Réinitialiser le bouton
|
||||
$('#update_avance_form button[type="submit"]').prop('disabled', false).text('Modifier');
|
||||
|
||||
// Ouvrir le modal
|
||||
$('#updateModal').modal('show');
|
||||
|
||||
// 🔥 SÉLECTION DU PRODUIT après ouverture complète du modal
|
||||
$('#updateModal').on('shown.bs.modal', function() {
|
||||
if (productId) {
|
||||
console.log('Tentative de sélection du produit ID:', productId);
|
||||
|
||||
// Méthode 1: Sélection standard
|
||||
$('#id_product_edit').val(productId);
|
||||
console.log('Après sélection standard:', $('#id_product_edit').val());
|
||||
|
||||
// Méthode 2: Si la sélection standard ne marche pas
|
||||
if ($('#id_product_edit').val() != productId) {
|
||||
$('#id_product_edit option').each(function() {
|
||||
if ($(this).val() == productId) {
|
||||
$(this).prop('selected', true);
|
||||
console.log('Produit sélectionné via boucle:', $(this).val(), $(this).text());
|
||||
$.ajax({
|
||||
url: base_url + 'avances/fetchSingleAvance/' + id,
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function(r) {
|
||||
console.log('Données récupérées:', r);
|
||||
|
||||
// Pré-remplir le formulaire de modification avec les BONS IDs
|
||||
$('#avance_id_edit').val(r.id || id);
|
||||
$('#customer_name_avance_edit').val(r.customer_name || '');
|
||||
$('#customer_phone_avance_edit').val(r.customer_phone || '');
|
||||
$('#customer_address_avance_edit').val(r.customer_address || r.customer_adress || '');
|
||||
$('#customer_cin_avance_edit').val(r.customer_cin || '');
|
||||
$('#type_avance_edit').val(r.type_avance || '');
|
||||
$('#gross_amount_edit').val(r.gross_amount || '');
|
||||
$('#avance_amount_edit').val(r.avance_amount || '');
|
||||
$('#amount_due_edit').val(r.amount_due || '');
|
||||
|
||||
// CORRECTION 1: ID correct pour le type de paiement
|
||||
$('#type_payment_edit').val(r.type_payment || '');
|
||||
|
||||
// Récupérer l'ID du produit avec toutes les variantes possibles
|
||||
var productId = r.product_id || r.id_product || r.productId || r.idProduct;
|
||||
console.log('Product ID trouvé:', productId);
|
||||
|
||||
brutEdit = parseFloat(r.gross_amount || 0);
|
||||
|
||||
// Réinitialiser le bouton
|
||||
$('#update_avance_form button[type="submit"]').prop('disabled', false).text('Modifier');
|
||||
|
||||
// Ouvrir le modal
|
||||
$('#updateModal').modal('show');
|
||||
|
||||
// CORRECTION 2: Sélection du produit après ouverture complète du modal
|
||||
$('#updateModal').on('shown.bs.modal', function(e) {
|
||||
if (productId) {
|
||||
console.log('Tentative de sélection du produit ID:', productId);
|
||||
|
||||
// Méthode robuste de sélection
|
||||
setTimeout(function() {
|
||||
// Vérifier d'abord si l'option existe
|
||||
var optionExists = $('#id_product_edit option[value="' + productId + '"]').length > 0;
|
||||
console.log('Option produit existe:', optionExists);
|
||||
|
||||
if (optionExists) {
|
||||
$('#id_product_edit').val(productId);
|
||||
console.log('Produit sélectionné:', $('#id_product_edit').val());
|
||||
|
||||
// Déclencher l'événement change pour mettre à jour les prix si nécessaire
|
||||
$('#id_product_edit').trigger('change');
|
||||
} else {
|
||||
console.log('Attention: Produit ID ' + productId + ' non trouvé dans les options');
|
||||
}
|
||||
});
|
||||
}, 100); // Petit délai pour s'assurer que le modal est complètement chargé
|
||||
}
|
||||
|
||||
// Déclencher l'événement change pour mettre à jour le prix
|
||||
$('#id_product_edit').trigger('change');
|
||||
console.log('Valeur finale du select:', $('#id_product_edit').val());
|
||||
}
|
||||
|
||||
// Détacher l'événement pour éviter les appels multiples
|
||||
$('#updateModal').off('shown.bs.modal');
|
||||
});
|
||||
// Détacher l'événement pour éviter les appels multiples
|
||||
$(this).off('shown.bs.modal');
|
||||
});
|
||||
|
||||
// 🔥 Détacher tous les anciens événements et attacher le nouveau
|
||||
$('#update_avance_form').off('submit').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
var $submitBtn = $form.find('button[type="submit"]');
|
||||
var avance = parseFloat($('#avance_amount_edit').val()) || 0;
|
||||
var minAvance = brutEdit * 0.25;
|
||||
// CORRECTION 3: Gestion du formulaire de soumission améliorée
|
||||
$('#update_avance_form').off('submit').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
var $submitBtn = $form.find('button[type="submit"]');
|
||||
var avance = parseFloat($('#avance_amount_edit').val()) || 0;
|
||||
var minAvance = brutEdit * 0.25;
|
||||
|
||||
// Validation 25%
|
||||
if (avance < minAvance) {
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong>
|
||||
L'avance doit être au minimum de 25% du prix du produit (${minAvance.toFixed(2)} Ar).
|
||||
</div>
|
||||
`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Désactiver le bouton pendant l'opération
|
||||
$submitBtn.prop('disabled', true).text('Modification...');
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'avances/updateAvance/' + id,
|
||||
type: 'POST',
|
||||
data: $form.serialize(),
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
if (res.success === true) {
|
||||
// Fermer le modal
|
||||
$('#updateModal').modal('hide');
|
||||
|
||||
// Message de succès
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-ok-sign"></span></strong> ${res.messages}
|
||||
</div>
|
||||
`);
|
||||
|
||||
// 🔄 MISE À JOUR IMMÉDIATE de la DataTable
|
||||
refreshDataTable();
|
||||
|
||||
// Auto-masquer le message
|
||||
setTimeout(function() {
|
||||
$("#messages .alert").fadeOut();
|
||||
}, 3000);
|
||||
|
||||
} else {
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong> ${res.messages}
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Erreur lors de la modification:', error);
|
||||
// Validation 25%
|
||||
if (avance < minAvance) {
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong> Erreur lors de la modification.
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong>
|
||||
L'avance doit être au minimum de 25% du prix du produit (${minAvance.toFixed(2)} Ar).
|
||||
</div>
|
||||
`);
|
||||
},
|
||||
complete: function() {
|
||||
// Réactiver le bouton dans tous les cas
|
||||
$submitBtn.prop('disabled', false).text('Modifier');
|
||||
return;
|
||||
}
|
||||
|
||||
// Désactiver le bouton pendant l'opération
|
||||
$submitBtn.prop('disabled', true).text('Modification...');
|
||||
|
||||
// CORRECTION 4: Données du formulaire avec vérifications
|
||||
var formData = $form.serialize();
|
||||
console.log('Données envoyées:', formData);
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'avances/updateAvance/' + id,
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
console.log('Réponse serveur:', res);
|
||||
|
||||
if (res.success === true) {
|
||||
// Fermer le modal
|
||||
$('#updateModal').modal('hide');
|
||||
|
||||
// Message de succès
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-success alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-ok-sign"></span></strong> ${res.messages}
|
||||
</div>
|
||||
`);
|
||||
|
||||
// Mise à jour de la DataTable
|
||||
if (typeof manageTable !== 'undefined' && manageTable) {
|
||||
manageTable.ajax.reload(null, false);
|
||||
}
|
||||
|
||||
// Auto-masquer le message
|
||||
setTimeout(function() {
|
||||
location.reload();
|
||||
$("#messages .alert").fadeOut();
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong> ${res.messages}
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Erreur AJAX:', error);
|
||||
console.log('Réponse complète:', xhr.responseText);
|
||||
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong> Erreur lors de la modification.
|
||||
</div>
|
||||
`);
|
||||
},
|
||||
complete: function() {
|
||||
// Réactiver le bouton dans tous les cas
|
||||
$submitBtn.prop('disabled', false).text('Modifier');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}).fail(function() {
|
||||
console.log('Erreur lors du chargement des données');
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong> Erreur lors du chargement des données.
|
||||
</div>
|
||||
`);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('Erreur lors du chargement des données:', error);
|
||||
console.log('Réponse:', xhr.responseText);
|
||||
|
||||
$("#messages").html(`
|
||||
<div class="alert alert-danger alert-dismissible" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<strong><span class="glyphicon glyphicon-exclamation-sign"></span></strong> Erreur lors du chargement des données.
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
});
|
||||
|
||||
// Réinitialiser le modal à la fermeture
|
||||
$('#updateModal').on('hidden.bs.modal', function() {
|
||||
$('#update_avance_form')[0].reset();
|
||||
$('#update_avance_form button[type="submit"]').prop('disabled', false).text('Modifier');
|
||||
// Détacher les événements pour éviter les conflits
|
||||
$('#update_avance_form').off('submit');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@ -731,7 +731,7 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box" style="background-color: #A9A9A9;">
|
||||
<div class="inner">
|
||||
<h2><?php echo number_format($total_mvola, 0, '.', ' '); ?>Ar</h2>
|
||||
<h2><?php echo number_format($total_mvola_final, 0, '.', ' '); ?>Ar</h2>
|
||||
<p>Totale MVOLA</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
@ -744,7 +744,7 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box" style="background-color: #A9A9A9;">
|
||||
<div class="inner">
|
||||
<h2><?php echo number_format($total_espece, 0, '.', ' '); ?>Ar</h2>
|
||||
<h2><?php echo number_format($total_espece_final, 0, '.', ' '); ?>Ar</h2>
|
||||
<p>Totale en espece</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
@ -757,7 +757,7 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box" style="background-color: #A9A9A9;">
|
||||
<div class="inner">
|
||||
<h2><?php echo number_format($total_virement_bancaire, 0, '.', ' '); ?>Ar</h2>
|
||||
<h2><?php echo number_format($total_virement_bancaire_final, 0, '.', ' '); ?>Ar</h2>
|
||||
<p>Totale en banque</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
|
||||
@ -62,6 +62,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<?php if (in_array('createMecanicien', $user_permission)): ?>
|
||||
<!-- create brand modal -->
|
||||
@ -249,7 +250,7 @@
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
<!-- Main content -->
|
||||
<section class="content">
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xs-12">
|
||||
@ -33,11 +34,11 @@
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if (in_array('createRecouvrement', $user_permission)): ?>
|
||||
<button class="btn btn-primary" data-toggle="modal" data-target="#createModal">RECOUVREMENT</button>
|
||||
<br /> <br />
|
||||
<br /><br />
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">Gérer les recouvrements</h3>
|
||||
@ -69,201 +70,167 @@
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<!-- totaliter mvola = somme tranche 1 izay type mvola tranche 1 + somme tranche 2
|
||||
totaliter mvola dia - recouvrement izay sortie ùmvola plus recouvremnt entrer mvola
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Totaux -->
|
||||
<div class="row">
|
||||
<div class="col-lg-3 col-6" bis_skin_checked="1">
|
||||
<!-- small box -->
|
||||
<div class="small-box " style="background-color: #A9A9A9;" bis_skin_checked="1">
|
||||
<div class="inner" bis_skin_checked="1">
|
||||
<div class="col-lg-3 col-6">
|
||||
<div class="small-box" style="background-color:#A9A9A9;">
|
||||
<div class="inner">
|
||||
<h3 id="total"><?php echo number_format($total, 0, '', ' '); ?></h3>
|
||||
<p>Total</p>
|
||||
<p>Total en caisse </p>
|
||||
</div>
|
||||
<div class="icon" bis_skin_checked="1">
|
||||
<div class="icon">
|
||||
<i class="ion ion-cash"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-6" bis_skin_checked="1">
|
||||
<!-- small box -->
|
||||
<div class="small-box " style="background-color: #A9A9A9;" bis_skin_checked="1">
|
||||
<div class="inner" bis_skin_checked="1">
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
<div class="small-box" style="background-color:#A9A9A9;">
|
||||
<div class="inner">
|
||||
<h3 id="total_mvola"><?php echo number_format($total_mvola, 0, '.', ' '); ?></h3>
|
||||
<p>Total en MVOLA</p>
|
||||
</div>
|
||||
<div class="icon" bis_skin_checked="1">
|
||||
<div class="icon">
|
||||
<i class="ion ion-android-phone-portrait"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- -->
|
||||
<div class="col-lg-3 col-6" bis_skin_checked="1">
|
||||
<!-- small box -->
|
||||
<div class="small-box " style="background-color: #A9A9A9;" bis_skin_checked="1">
|
||||
<div class="inner" bis_skin_checked="1">
|
||||
<h3 id="total_caisse"><?php echo number_format($total_espece, 0, '.', ' '); ?></h3>
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
<div class="small-box" style="background-color:#A9A9A9;">
|
||||
<div class="inner">
|
||||
<h3 id="total_espece"><?php echo number_format($total_espece, 0, '.', ' '); ?></h3>
|
||||
<p>Total en Caisse</p>
|
||||
</div>
|
||||
<div class="icon" bis_skin_checked="1">
|
||||
<div class="icon">
|
||||
<i class="ion ion-cash"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-6" bis_skin_checked="1">
|
||||
<!-- small box -->
|
||||
<div class="small-box " style="background-color: #A9A9A9;" bis_skin_checked="1">
|
||||
<div class="inner" bis_skin_checked="1">
|
||||
|
||||
<div class="col-lg-3 col-6">
|
||||
<div class="small-box" style="background-color:#A9A9A9;">
|
||||
<div class="inner">
|
||||
<h3 id="total_banque"><?php echo number_format($total_virement_bancaire, 0, '.', ' '); ?></h3>
|
||||
<p>Total en Banque</p>
|
||||
</div>
|
||||
<div class="icon" bis_skin_checked="1">
|
||||
<div class="icon">
|
||||
<i class="ion ion-bank"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- Modal pour la Création -->
|
||||
<?php if (in_array('createRecouvrement', $user_permission)): ?>
|
||||
<!-- remove brand modal -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="createModal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">Ajouter un recouvrement</h4>
|
||||
</div> <!-- /.content-wrapper -->
|
||||
|
||||
<!-- ======================== -->
|
||||
<!-- ⚡ MODALS EN DEHORS DU WRAPPER -->
|
||||
<!-- ======================== -->
|
||||
|
||||
<?php if (in_array('createRecouvrement', $user_permission)): ?>
|
||||
<div class="modal fade" id="createModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Ajouter un recouvrement</h4>
|
||||
</div>
|
||||
<form action="<?php echo base_url('recouvrement/create') ?>" method="post" id="create_form">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="sendmode">Type de Montant à recouvrer</label>
|
||||
<select name="send_mode" id="sendmode" class="form-control">
|
||||
<option value="MVOLA">MVOLA</option>
|
||||
<option value="Virement Bancaire">Virement Bancaire</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<form role="form" action="<?php echo base_url('recouvrement/create') ?>" method="post" id="create_form">
|
||||
<div class="modal-body">
|
||||
|
||||
<!-- Montant du recouvrement -->
|
||||
<div class="form-group">
|
||||
<label for="sendmode" class="control-label">Type de Montant à recouvrer</label>
|
||||
<select name="send_mode" id="sendmode" class="form-control">
|
||||
<option value="MVOLA">MVOLA</option>
|
||||
|
||||
<option value="Virement Bancaire">Virement Bancaire</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="getmode" class="control-label">Destination du Montant à recouvrer</label>
|
||||
<select name="get_mode" id="getmode" class="form-control">
|
||||
<option value="MVOLA">MVOLA</option>
|
||||
<option value="En espèce">En espèce</option>
|
||||
<option value="Virement Bancaire">Virement Bancaire</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Montant du recouvrement -->
|
||||
<div class="form-group">
|
||||
<label for="recouvrement_montant" class="control-label">Montant du recouvrement</label>
|
||||
<input type="text" class="form-control" id="recouvrement_montant" name="recouvrement_montant" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<!-- Date du recouvrement -->
|
||||
<div class="form-group">
|
||||
<label for="recouvrement_date" class="control-label">Date du recouvrement</label>
|
||||
<input type="date" class="form-control" id="recouvrement_date" name="recouvrement_date" autocomplete="off">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Boutons avec espacement -->
|
||||
<div class="modal-footer text-right" style="margin-top: 15px;">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Modal for updatting a recouvrement -->
|
||||
<?php if (in_array('updateRecouvrement', $user_permission)): ?>
|
||||
<!-- update brand modal -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="updateModal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Modifier un recouvrement</h4>
|
||||
<div class="form-group">
|
||||
<label for="getmode">Destination du Montant à recouvrer</label>
|
||||
<select name="get_mode" id="getmode" class="form-control">
|
||||
<option value="MVOLA">MVOLA</option>
|
||||
<option value="En espèce">En espèce</option>
|
||||
<option value="Virement Bancaire">Virement Bancaire</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<form role="form" action="<?php echo base_url('recouvrement/update') ?>" method="post" id="update_form">
|
||||
<div class="modal-body"> <!-- Correction ici -->
|
||||
<div class="row form-group">
|
||||
<div class="col-lg-6">
|
||||
<label for="recouvrement_montant" class="control-label">Montant du recouvrement</label>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
<input type="text" class="form-control" id="recouvrement_montant_edit" name="recouvrement_montant_edit" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-group">
|
||||
<div class="col-lg-6">
|
||||
<label for="gross_amount" class="control-label">Date du recouvrement</label>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<input type="date" class="form-control" id="recouvrement_date_edit" name="recouvrement_date_edit" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="form-group">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if (in_array('deleteRecouvrement', $user_permission)): ?>
|
||||
<!-- remove brand modal -->
|
||||
<div class="modal fade" tabindex="-1" role="dialog" id="removeModal">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Supprimer le recrouvement</h4>
|
||||
<div class="form-group">
|
||||
<label for="recouvrement_montant">Montant du recouvrement</label>
|
||||
<input type="text" class="form-control" id="recouvrement_montant" name="recouvrement_montant" autocomplete="off">
|
||||
</div>
|
||||
<form role="form" action="<?php echo base_url('recouvrement/delete') ?>" method="post" id="removeForm">
|
||||
<div class="modal-body">
|
||||
<p>Voulez-vous vraiment supprimer ?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
|
||||
<button type="submit" class="btn btn-primary">Oui</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
<?php endif; ?>
|
||||
<div class="form-group">
|
||||
<label for="recouvrement_date">Date du recouvrement</label>
|
||||
<input type="date" class="form-control" id="recouvrement_date" name="recouvrement_date" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array('updateRecouvrement', $user_permission)): ?>
|
||||
<div class="modal fade" id="updateModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Modifier un recouvrement</h4>
|
||||
</div>
|
||||
<form action="<?php echo base_url('recouvrement/update') ?>" method="post" id="update_form">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="recouvrement_montant_edit">Montant du recouvrement</label>
|
||||
<input type="text" class="form-control" id="recouvrement_montant_edit" name="recouvrement_montant_edit" autocomplete="off">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="recouvrement_date_edit">Date du recouvrement</label>
|
||||
<input type="date" class="form-control" id="recouvrement_date_edit" name="recouvrement_date_edit" autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Annuler</button>
|
||||
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (in_array('deleteRecouvrement', $user_permission)): ?>
|
||||
<div class="modal fade" id="removeModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Supprimer le recouvrement</h4>
|
||||
</div>
|
||||
<form action="<?php echo base_url('recouvrement/delete') ?>" method="post" id="removeForm">
|
||||
<div class="modal-body">
|
||||
<p>Voulez-vous vraiment supprimer ?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>
|
||||
<button type="submit" class="btn btn-primary">Oui</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -104,6 +104,8 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="hold-transition skin-blue sidebar-mini">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user