105 lines
2.1 KiB
JavaScript
105 lines
2.1 KiB
JavaScript
var columns = [
|
|
{
|
|
data: "type_contact_statut_id",
|
|
render: function (data, type, row) {
|
|
if (row.type_contact_statut_id) {
|
|
tpl = row.type_contact_statut.nom;
|
|
} else {
|
|
tpl = '';
|
|
}
|
|
return tpl;
|
|
}
|
|
},
|
|
{
|
|
data: "name",
|
|
},
|
|
{
|
|
data: "firstname",
|
|
},
|
|
{
|
|
data: "mobile",
|
|
render: function (data, type, row) {
|
|
tpl = '';
|
|
if (row.mobile) {
|
|
tpl += 'Mobile : ' + row.mobile + '<br/>';
|
|
}
|
|
if (row.tel_perso) {
|
|
tpl += 'Domicile : ' + row.phone + '<br/>';
|
|
}
|
|
if (row.tel_pro) {
|
|
tpl += 'Pro : ' + row.phone_pro;
|
|
}
|
|
return tpl;
|
|
}
|
|
},
|
|
{
|
|
data: "email",
|
|
render: function (data) {
|
|
return data;
|
|
}
|
|
},
|
|
{
|
|
data: "zipcode",
|
|
render: function (data, type, row) {
|
|
return data;
|
|
}
|
|
},
|
|
{
|
|
data: "city",
|
|
render: function (data) {
|
|
return data;
|
|
}
|
|
},
|
|
{
|
|
data: "id",
|
|
orderable: false,
|
|
render: function (data, type, row) {
|
|
tpl = " <a data-id=" + data + " class='btn btn-xs btn-primary' href='" + laroute.route('Shop.Customers.Admin.edit', { id : data }) + "'><i class='fa fa-edit fa-fw'></i></a>";
|
|
tpl += " <a data-id=" + data + " class='btn btn-xs btn-danger btn-delete' href='#''><i class='fa fa-times fa-fw'></i></a>";
|
|
return tpl;
|
|
}
|
|
},
|
|
];
|
|
|
|
var model = "contact";
|
|
var route = "Contacts";
|
|
|
|
var options = {
|
|
// order: [[ 2, 'asc' ]],
|
|
fixedColumns: { leftColumns: 1, rightColumns: 1 },
|
|
// fixedColumns: false,
|
|
// columnDefs: columnDefs,
|
|
columns: columns,
|
|
}
|
|
|
|
var globals = [];
|
|
globals['handlers'] = [];
|
|
|
|
|
|
function populate() {
|
|
|
|
}
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
var Table = getDataTables(options,route,model);
|
|
|
|
$(".search-input-text").off().on("change keyup", function(e) {
|
|
Table.column( $(this).parent().index()+':visible' ).search( this.value ).draw();
|
|
})
|
|
|
|
|
|
$.ajaxSetup({
|
|
headers: {
|
|
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
|
}
|
|
});
|
|
|
|
tpl = '<a href="'+laroute.route('CRM.Contacts.create')+'" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> Création d\'un contact</a>';
|
|
$('div.col-md-4.add').html(tpl);
|
|
|
|
|
|
initModalAdmin(route,model,Table.ajax.reload,populate,Table);
|
|
|
|
}); |