Files
crm-ms1/application/views/clients/form.php
2026-05-27 11:44:10 -04:00

711 lines
31 KiB
PHP

<?php
$page='form';
?>
<div id="content">
<div class="row">
<div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
<h1 class="page-title txt-color-blueDark">
<?php echo $input['com_compagnie']['value'] .'<br>'?>
<?php echo $input['com_num_client']['value']?>
</h1>
</div>
<div class="col-xs-12 col-sm-5 col-md-5 col-lg-8">
<ul id="sparks" class="">
<li class="sparks-info">
<h5> Clients actif <span class="txt-color-blue" id="Clients_actif"> </span></h5>
</li>
<li class="sparks-info">
</li>
<li class="sparks-info">
</li>
</ul>
</div>
</div><div >
<a data-toggle="modal" data-section="Clients" data-id="0" data-section_id="<?php echo $mem_id;?> " class="btn btn-info btn-circle glyphicon glyphicon-calendar popup"></a>
<?php $this->Tache_model->mod_listtache_btn('Clients',$mem_id);
?> <br> </div>
<section id="widget-grid" class="">
<!-- row -->
<div class="row">
<!-- NEW COL START -->
<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<!-- Widget ID (each widget will need unique ID)-->
<div class="jarviswidget jarviswidget-color-orange" id="wid-id-1" data-widget-editbutton="false" data-widget-colorbutton="true" data-widget-deletebutton="false">
<!-- widget options:
usage: <div class="jarviswidget" id="wid-id-0" data-widget-editbutton="false">
data-widget-colorbutton="false"
data-widget-editbutton="false"
data-widget-togglebutton="false"
data-widget-deletebutton="false"
data-widget-fullscreenbutton="false"
data-widget-custombutton="false"
data-widget-collapsed="true"
data-widget-sortable="false"
-->
<header>
<span class="widget-icon"> <i class="fa fa-edit"></i> </span>
<h2>Client</h2>
</header>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<!-- This area used as dropdown edit box -->
</div>
<!-- end widget edit box -->
<!-- widget content -->
<div class="widget-body no-padding">
<?php echo form_open('clients/saveRecord/'.$mem_id,'class="smart-form" id="saveRecord"');
?>
<footer>
<button id="submit_btn" type="submit" class="btn btn-primary">
Sauvegarde
</button>
</footer>
<fieldset>
<div class="row">
<section class="col col-3">
<label class="input">
<?php
$mem_champ='com_compagnie';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="input">
<?php
echo $icon[$mem_champ];
echo form_input($input[$mem_champ]);
?>
</label>
</section>
<section class="col col-2">
<label class="input">
<?php
$mem_champ='com_num_client';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="input">
<?php
echo $icon[$mem_champ];
echo form_input($input[$mem_champ]);
?>
</label>
</section>
<section class="col col-2">
<label class="input">
<?php
$mem_champ='com_gen_id';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="select">
<?php
echo $icon[$mem_champ];
echo form_dropdown($mem_champ,$select[$mem_champ]['choix'],$select[$mem_champ]['value']);
?>
<i>
</i>
</label>
</section>
<section class="col col-2">
<label class="input">
<?php
$mem_champ='com_representant_id';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="select">
<?php
echo $icon[$mem_champ];
echo form_dropdown($mem_champ,$select[$mem_champ]['choix'],$select[$mem_champ]['value']);
?>
<i>
</i>
</label>
</section>
<section class="col col-1">
<?php
$mem_champ='com_actif';
echo form_label($label[$mem_champ],'',array('class' => 'input',
'style' => 'text-align: right'));
?>
<label class="toggle">
<?php
echo form_checkbox($checkbox[$mem_champ]);
?> <i data-swchon-text="Oui" data-swchoff-text="Non"></i>
</label>
</section>
<section class="col col-2">
<label class="input">
<?php
$mem_champ='com_langue';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="select">
<?php
echo $icon[$mem_champ];
echo form_dropdown($mem_champ,$select[$mem_champ]['choix'],$select[$mem_champ]['value']);
?>
<i>
</i>
</label>
</section>
</div>
</fieldset>
<fieldset>
<div class="row">
<section class="col col-10">
<label class="input">
<?php
$mem_champ='com_adresse';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="input">
<label class="input">
<?php
echo $icon[$mem_champ];
echo form_input($input[$mem_champ]);
?>
</label>
</label>
</section>
</div>
<div class="row">
<section class="col col-3">
<label class="input">
<?php
$mem_champ='com_ville';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="input">
<label class="input">
<?php
echo $icon[$mem_champ];
echo form_input($input[$mem_champ]);
?>
</label>
</label>
</section>
<section class="col col-3">
<label class="input">
<?php
$mem_champ='com_pro_id';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="select">
<?php
echo $icon[$mem_champ];
echo form_dropdown($mem_champ,$select[$mem_champ]['choix'],$select[$mem_champ]['value']);
?>
<i>
</i>
</label>
</section>
<section class="col col-3">
<label class="input">
<?php
$mem_champ='com_pay_id';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="select">
<?php
echo $icon[$mem_champ];
echo form_dropdown($mem_champ,$select[$mem_champ]['choix'],$select[$mem_champ]['value']);
?>
<i>
</i>
</label>
</section>
<section class="col col-3">
<label class="input">
<?php
$mem_champ='com_codepostal';
echo form_label($label[$mem_champ]);
?>
</label>
<label class="input">
<label class="input">
<?php
echo $icon[$mem_champ];
echo form_input($input[$mem_champ]);
?>
</label>
</label>
</section>
</div>
</fieldset>
<fieldset>
<section>
<label class="textarea">
<?php
$mem_champ='com_notes';
echo $icon[$mem_champ];
echo form_textarea($input[$mem_champ]);
?>
</label>
</section>
</fieldset>
<footer>
<button id="submit_btn" type="submit" class="btn btn-primary">
Sauvegarde
</button>
</footer>
<?php
echo form_close();
?>
</div>
<!-- end widget content -->
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
</article>
<!-- END COL -->
</div>
<div class="row">
<!-- NEW COL START -->
<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="jarviswidget jarviswidget-color-orange" id="wid-id-2" data-widget-editbutton="false" data-widget-colorbutton="true" data-widget-deletebutton="false">
<header>
<span class="widget-icon"> <i class="fa fa-edit"></i> </span>
<h2>Projets</h2>
</header>
<a name="sectionprojets"></a>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<!-- This area used as dropdown edit box -->
</div>
<!-- end widget edit box -->
<!-- widget content -->
<?php echo form_open('clients/saveRecordcontact/'.$mem_id,'class="smart-form" id="saveRecordcontact"');
?>
<div class="widget-body no-padding">
<?php
if ($mem_id!=0)
echo $projets;
?>
</div>
<?php
echo form_close();
?>
</div>
</div>
</article>
<!-- END COL -->
</div>
<!-- end row -->
<?php
if ($this->config->item('pw_client') == "ms1") {?>
<div class="row">
<!-- NEW COL START -->
<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="jarviswidget jarviswidget-color-orange" id="wid-id-99" data-widget-editbutton="false" data-widget-colorbutton="true" data-widget-deletebutton="false">
<header>
<span class="widget-icon">Soutient<i class="fa fa-edit"></i> </span>
</header>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<!-- This area used as dropdown edit box -->
</div>
<!-- end widget edit box -->
<!-- widget content -->
<div class="widget-body no-padding">
<?php
$this->load->model('Clients_model');
$this->load->model('Clients_model');
$contacts2 = $this->Clients_model->mod_getRecords_contacts($mem_id);
foreach ($contacts2 as $c):
$nomComplet = $c['con_prenom'] . ' ' . $c['con_nom'];
$email = $c['con_courriel'];
$tickets = jira_get_tickets_by_email($email);
?>
<div class="card mb-3">
<div class="card-header bg-primary text-white">
<strong><?= htmlspecialchars($nomComplet) ?></strong>
<?php if (!empty($email)): ?>
<span class="text-white-50 ml-2">&lt;<?= htmlspecialchars($email) ?>&gt;</span>
<?php endif; ?>
</div>
<div class="card-body" style="background-color: #f8f9fa;">
<style>
/* Réduction du blanc dans les cellules */
.table-condensed td,
.table-condensed th {
padding-top: 4px !important;
padding-bottom: 4px !important;
}
</style>
<?php if ($tickets['success']): ?>
<?php if (!empty($tickets['ouverts'])): ?>
<h6 class="text-danger mb-2">🔴 Tickets ouverts</h6>
<div class="table-responsive">
<table class="table table-striped table-condensed align-middle"
style="width:80%; margin:auto; border-collapse:collapse;">
<thead class="table-warning">
<tr>
<th style="width: 120px;">No. support</th>
<th>Titre</th>
<th style="width: 160px;">Ouvert le</th>
<th style="width: 160px;">Fermé le</th>
</tr>
</thead>
<tbody>
<?php foreach ($tickets['ouverts'] as $t): ?>
<?php
try { $opened = $t['created'] ? (new DateTime($t['created']))->format('Y-m-d H:i') : '-'; } catch (Exception $e) { $opened = '-'; }
$closed = '-';
?>
<tr>
<td><a href="<?= $t['url'] ?>" target="_blank"><?= htmlspecialchars($t['key']) ?></a></td>
<td><?= htmlspecialchars($t['summary']) ?> <span class="text-muted">(<?= htmlspecialchars($t['status']) ?>)</span></td>
<td><?= $opened ?></td>
<td><?= $closed ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if (!empty($tickets['resolus'])): ?>
<h6 class="text-success mt-3 mb-2">✅ Tickets résolus</h6>
<div class="table-responsive">
<table class="table table-striped table-condensed align-middle"
style="width:80%; margin:auto; border-collapse:collapse;">
<thead class="table-warning">
<tr>
<th style="width: 120px;">No. support</th>
<th>Titre</th>
<th style="width: 160px;">Ouvert le</th>
<th style="width: 160px;">Fermé le</th>
</tr>
</thead>
<tbody>
<?php foreach ($tickets['resolus'] as $t): ?>
<?php
try { $opened = $t['created'] ? (new DateTime($t['created']))->format('Y-m-d H:i') : '-'; } catch (Exception $e) { $opened = '-'; }
try { $closed = $t['resolved'] ? (new DateTime($t['resolved']))->format('Y-m-d H:i') : '-'; } catch (Exception $e) { $closed = '-'; }
?>
<tr>
<td><a href="<?= $t['url'] ?>" target="_blank"><?= htmlspecialchars($t['key']) ?></a></td>
<td><?= htmlspecialchars($t['summary']) ?></td>
<td><?= $opened ?></td>
<td><?= $closed ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php if (empty($tickets['ouverts']) && empty($tickets['resolus'])): ?>
<p>Aucun ticket trouvé pour cet utilisateur.</p>
<?php endif; ?>
<?php else: ?>
<p class="text-muted">Erreur API Jira : <?= htmlspecialchars($tickets['message']) ?></p>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php
?>
</div>
</div>
</article>
<!-- END COL -->
</div>
<?php } ?>
<div class="row">
<!-- NEW COL START -->
<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="jarviswidget jarviswidget-color-orange" id="wid-id-3" data-widget-editbutton="false" data-widget-colorbutton="true" data-widget-deletebutton="false">
<header>
<span class="widget-icon"> <i class="fa fa-edit"></i> </span>
<h2>Contacts</h2>
</header>
<a name="sectioncontacts"></a>
<!-- widget div-->
<div>
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<!-- This area used as dropdown edit box -->
</div>
<!-- end widget edit box -->
<!-- widget content -->
<?php echo form_open('clients/saveRecordcontact/'.$mem_id,'class="smart-form" id="saveRecordcontact"');
?>
<div class="widget-body no-padding">
<?php
if ($mem_id!=0)
echo $contacts;
?>
</div>
<?php
echo form_close();
?>
</div>
</div>
</article>
<!-- END COL -->
</div>
<!-- end row -->
</section>
<!-- end widget grid -->
</div>
<?php
include('inc/popupevent.php');
?>
<!-- ==========================CONTENT ENDS HERE ========================== -->
<script>
(function () {
window.ms1SubmitEtapeUnique = function (el, url) {
var f = document.createElement('form');
f.method = 'POST';
f.action = url;
f.style.display = 'none';
var i = document.createElement('input');
i.type = 'hidden';
i.name = el.name;
i.value = el.value;
f.appendChild(i);
document.body.appendChild(f);
f.submit();
};
})();
function choix_evenement(id){
$("#produit_affiche").show();
$.ajax({
url: '<?=base_url()?>index.php/Projets/choix_produit/'+id ,
type: 'get',
dataType: 'json',
success: function(responseData){
// console.log(responseData.des_ref_type);
$("#produit_affiche").html(responseData.details_produit);
// $('#pagination_fournisseur').html(responseData.choix_fournisseurs.pagination_produits);
}
});
}
choix_evenement(1);
<?php
include('inc/popupevent_script.php');
?>
$(document).ready(function() {
var errorClass = 'invalid';
var errorElement = 'em';
var $checkoutForm = $('#saveRecord').validate({
errorClass : errorClass,
errorElement : errorElement,
highlight: function(element) {
$(element).parent().removeClass('state-success').addClass("state-error");
$(element).removeClass('valid');
},
unhighlight: function(element) {
$(element).parent().removeClass("state-error").addClass('state-success');
$(element).addClass('valid');
},
// Rules for form validation
<?php
echo($validation['rules']);
?>
// Messages for form validation
<?php
echo($validation['messages']);
?>
// Do not change code below
errorPlacement : function(error, element) {
error.insertAfter(element.parent());
}
});
});
</script>
<?php
if (isset($pageSection)){
?>
<script>
$(document).ready(function(){
var aTag = $("a[name='<?php echo $pageSection;?>']");
$('html,body').animate({scrollTop: aTag.offset().top},'fast');
});
</script>
<?php
}