rename models and associates, isolate botanic with shop
44
build/Admin/Auth/permissions.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var elements = {
|
||||
handle: "permissions",
|
||||
model: "permission",
|
||||
route: "Stack.Admin.Permission",
|
||||
route_api: "Stack.Admin.API.Permission",
|
||||
table_selector: "#permissions_datatable",
|
||||
exist: "the_permission_already_exists",
|
||||
added: "permission_has_been_added",
|
||||
modified: "permission_has_been_modified",
|
||||
deleted: "permission_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
];
|
||||
|
||||
var columns = [
|
||||
{
|
||||
data: "display_name",
|
||||
render: function (data) {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row ) {
|
||||
var name = eval('client_translate.getText.' + row.translated);
|
||||
return '<div class="text-center" data-id="' + data + '" data-name="' + name + '">'+
|
||||
'<button class="btn btn-border btn-yellow btn-xs edit-btn" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>'+
|
||||
'<button class="btn btn-border btn-danger btn-xs delete-btn" title="'+translate.getText.delete+'"><i class="glyph-icon icon-trash"></i></button>'+
|
||||
'<input type="hidden" class="id" value="'+data+'" />'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
];
|
||||
console.log(columnsdef);
|
||||
var permissions = handleAdmin;
|
||||
|
||||
$(document).ready(function() {
|
||||
permissions.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
} );
|
||||
} );
|
||||
|
||||
50
build/Admin/Auth/roles.js
Normal file
@@ -0,0 +1,50 @@
|
||||
var elements = {
|
||||
handle: "roles",
|
||||
model: "role",
|
||||
route: "Stack.Admin.Role",
|
||||
route_api: "Stack.Admin.API.Role",
|
||||
table_selector: "#roles_datatable",
|
||||
exist: "the_role_already_exists",
|
||||
added: "role_has_been_added",
|
||||
modified: "role_has_been_modified",
|
||||
deleted: "role_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
];
|
||||
|
||||
|
||||
var columns = [
|
||||
{
|
||||
"data": "translated",
|
||||
"render": function ( data, type, full, meta ) {
|
||||
if (data)
|
||||
{
|
||||
return admin_content.get_translated_names(data);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row, meta ) {
|
||||
var name = eval('client_translate.getText.' + row.translated);
|
||||
return '<div class="text-center" data-id="' + data + '" data-name="' + name + '">'+
|
||||
'<button class="btn btn-border btn-yellow border-yellow btn-xs update-btn margin-right-10" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>'+
|
||||
'<button class="btn btn-border btn-danger border-danger btn-xs delete-btn" title="'+translate.getText.delete+'"><i class="glyph-icon icon-trash"></i></button>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var roles = handleAdmin;
|
||||
|
||||
$(document).ready(function() {
|
||||
roles.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
initIcheck();
|
||||
} );
|
||||
} );
|
||||
|
||||
51
build/Admin/Auth/teams.js
Normal file
@@ -0,0 +1,51 @@
|
||||
var elements = {
|
||||
handle: "teams",
|
||||
model: "team",
|
||||
route: "Stack.Admin.Team",
|
||||
route_api: "Stack.Admin.API.Team",
|
||||
table_selector: "#teams_datatable",
|
||||
exist: "the_team_already_exists",
|
||||
added: "team_has_been_added",
|
||||
modified: "team_has_been_modified",
|
||||
deleted: "team_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
];
|
||||
|
||||
var columns = [
|
||||
{
|
||||
data: "active",
|
||||
className: 'text-center',
|
||||
"render": function ( data, type, row, meta ) {
|
||||
var checked = data ? "checked" : "";
|
||||
tpl = '<div class="text-center"><input type="checkbox"' + checked + ' data-id="' + row.id + '" class="active-checkbox" data-toggle="toggle" data-size="mini" data-width="50" data-height="25" data-onstyle="success" data-offstyle="danger"></div>';
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "translated",
|
||||
render: function ( data, type, full, meta ) {
|
||||
return admin_content.get_translated_names(data);
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row ) {
|
||||
var name = eval('client_translate.getText.' + row.translated);
|
||||
return '<div class="text-center" data-id="' + data + '" data-name="' + name + '">'+
|
||||
'<button class="btn btn-border btn-yellow border-yellow btn-xs update-btn margin-right-10" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>'+
|
||||
'<button class="btn btn-border btn-danger border-danger btn-xs delete-btn" title="'+translate.getText.delete+'"><i class="glyph-icon icon-trash"></i></button>'+
|
||||
'</div>';
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var teams = handleAdmin;
|
||||
|
||||
$(document).ready(function() {
|
||||
teams.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
} );
|
||||
} );
|
||||
347
build/Admin/Auth/users.js
Normal file
@@ -0,0 +1,347 @@
|
||||
var elements = {
|
||||
handle: "users",
|
||||
model: "user",
|
||||
route: "Stack.Admin.User",
|
||||
route_api: "Stack.Admin.API.User",
|
||||
table_selector: "#users_datatable",
|
||||
exist: "the_user_type_already_exists",
|
||||
added: "user_has_been_added",
|
||||
modified: "user_has_been_modified",
|
||||
deleted: "user_has_been_deleted"
|
||||
};
|
||||
|
||||
var columnsdef = [
|
||||
{ orderable: false, targets: [0, 6] },
|
||||
{ responsivePriority: 1, targets: [0, 1, 6] }
|
||||
];
|
||||
|
||||
var columns = [
|
||||
{
|
||||
data: "active",
|
||||
searchable: false,
|
||||
className: 'text-center',
|
||||
render: function ( data, type, row, meta ) {
|
||||
var checked = data ? "checked" : "";
|
||||
tpl = '<div class="text-center"><input type="checkbox"' + checked + ' data-id="' + row.id + '" class="active-checkbox" data-size="mini" data-width="50" data-height="25" data-onstyle="success" data-offstyle="danger"></div>';
|
||||
return tpl;
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "name",
|
||||
render: function ( data, type, row, meta ) {
|
||||
return '<button type="button" class="btn btn-round btn-border btn-info btn-xs avatar-user-btn" title="'+translate.getText.avatar+'"><i class="glyph-icon icon-elusive-camera"></i></button> ' + data;
|
||||
}
|
||||
},
|
||||
{ data: "username" },
|
||||
{ data: "email" },
|
||||
{ data: "phone" },
|
||||
{
|
||||
data: "roles",
|
||||
searchable: false,
|
||||
render: function ( data, type, row, meta ) {
|
||||
if (data) {
|
||||
tpl = '';
|
||||
for (var k in data){
|
||||
if (data.hasOwnProperty(k)) {
|
||||
tpl += data[k]['name'] + ' ';
|
||||
}
|
||||
}
|
||||
return tpl;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
data: "id",
|
||||
render: function ( data, type, row ) {
|
||||
var name = row.name;
|
||||
tpl = '<div class="text-center" data-id="' + data + '" data-name="' + name + '">';
|
||||
tpl += '<button class="btn btn-border btn-gray btn-xs password-btn margin-right-10" title="'+translate.getText.change_password+'"><i class="glyph-icon fa fa-key"></i></button>';
|
||||
if (hasPermission('users_client')) {
|
||||
tpl += '<button class="btn btn-border btn-default border-default btn-xs manage-btn margin-right-10" title="'+translate.getText.manage+'"><i class="glyph-icon icon-file-text-o"></i></button>';
|
||||
}
|
||||
if (hasPermission('users_update')) {
|
||||
tpl += '<button class="btn btn-border btn-yellow btn-xs update-btn margin-right-10" title="'+translate.getText.modify+'"><i class="glyph-icon icon-typicons-pencil"></i></button>';
|
||||
}
|
||||
if (hasPermission('users_delete')) {
|
||||
tpl += '<button class="btn btn-border btn-danger btn-xs delete-btn margin-right-10" title="'+translate.getText.delete+'"><i class="glyph-icon fa fa-trash"></i></button>';
|
||||
}
|
||||
tpl += '</div>';
|
||||
return tpl;
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
var users = handleAdmin;
|
||||
|
||||
var users_addon = {
|
||||
avatar: null,
|
||||
upload_avatar: false,
|
||||
upload_input: null,
|
||||
passwordButtonsClick: function() {
|
||||
$('.password-btn').off('click').on('click', function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var name = $(this).parent().data('name');
|
||||
users.passwordUser(id, name);
|
||||
});
|
||||
},
|
||||
avatarButtonsClick: function() {
|
||||
$('#users_datatable .avatar-user-btn').off('click').on('click', function() {
|
||||
var id = $(this).parent().data('id');
|
||||
var name = $(this).parent().data('name');
|
||||
users.avatarUser(id, name);
|
||||
});
|
||||
},
|
||||
generatePassword: function(elt) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.generateUserPassword"),
|
||||
success: function(response) {
|
||||
elt.val(response.pwd);
|
||||
},
|
||||
error: function() {
|
||||
admin_content.alertError();
|
||||
}
|
||||
});
|
||||
},
|
||||
initAvatarUploader: function() {
|
||||
users.upload_input = $("#avatar_file").filer({
|
||||
showThumbs: true,
|
||||
addMore: true,
|
||||
allowDuplicates: false,
|
||||
limit: 1,
|
||||
maxSize: 5,
|
||||
extensions: [ 'jpg' ],
|
||||
uploadFile: {
|
||||
url: laroute.route("Stack.Admin.API.User.uploadAvatar"),
|
||||
data: { "extension": 'jpg' },
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
synchron: true,
|
||||
success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id){
|
||||
var parent = itemEl.find(".jFiler-jProgressBar").parent(),
|
||||
new_file_name = JSON.parse(data),
|
||||
filerKit = inputEl.prop("jFiler");
|
||||
|
||||
filerKit.files_list[id].name = new_file_name;
|
||||
|
||||
itemEl.find(".jFiler-jProgressBar").fadeOut("slow", function(){
|
||||
$("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow");
|
||||
});
|
||||
|
||||
$("#avatar_file_hidden").val(new_file_name);
|
||||
},
|
||||
error: function(el){
|
||||
var parent = el.find(".jFiler-jProgressBar").parent();
|
||||
el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
|
||||
$("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow");
|
||||
});
|
||||
},
|
||||
statusCode: null,
|
||||
onProgress: null,
|
||||
onComplete: null
|
||||
},
|
||||
files: null,
|
||||
clipBoardPaste: true,
|
||||
excludeName: null,
|
||||
beforeRender: null,
|
||||
afterRender: null,
|
||||
beforeShow: null,
|
||||
beforeSelect: null,
|
||||
onSelect: null,
|
||||
afterShow: null,
|
||||
onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){
|
||||
var filerKit = inputEl.prop("jFiler"),
|
||||
file_name = filerKit.files_list[id].name;
|
||||
|
||||
$.post(laroute.route('Stack.Admin.API.User.removeAvatar'), {file: file_name});
|
||||
},
|
||||
onEmpty: null,
|
||||
options: null,
|
||||
dialogs: {
|
||||
alert: function(text) {
|
||||
$.alert({
|
||||
title: translate.getText.informations,
|
||||
type: 'red',
|
||||
content: text,
|
||||
});
|
||||
},
|
||||
confirm: function (text, callback) {
|
||||
$.confirm({
|
||||
title: translate.getText.informations,
|
||||
type: 'red',
|
||||
content: text,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.confirm,
|
||||
btnClass: 'btn-danger',
|
||||
action: function(){
|
||||
callback()
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
captions: {
|
||||
button: translate.getText.choose_file,
|
||||
feedback: "",
|
||||
feedback2: translate.getText.selected_files,
|
||||
removeConfirmation: translate.getText.are_you_sure_you_want_to_remove_this_file,
|
||||
errors: {
|
||||
filesLimit: translate.getText.file_number_authorized + ": {{fi-limit}}",
|
||||
filesType: translate.getText.file_extension_authorized + ": .{{fi-extensions}}",
|
||||
filesSize: translate.getText.file_max_size_authorized + ": {{fi-maxSize}} MB."
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
avatarUser: function(id, name) {
|
||||
$.confirm({
|
||||
title: translate.getText.avatar,
|
||||
columnClass: 'small',
|
||||
content: function () {
|
||||
var self = this;
|
||||
return $.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.getAvatar"),
|
||||
data: { 'id': id },
|
||||
}).done(function (response) {
|
||||
|
||||
if (response.error == -1) {
|
||||
header.logout();
|
||||
} else if (response.avatar == "") {
|
||||
self.setContent('<div><i class="glyph-icon fa fa-caret-right margin-left-15 margin-right-5"></i><i class="text-blue">'+name+'</i></div><hr class="margin-top-10 margin-bottom-10"><div class="text-center padding-top-10" id="avatar_upload"><input type="file" name="files[]" id="avatar_file" /><input type="hidden" id="avatar_file_hidden" name="avatar_file" value="NULL" class="form-control" /></div>');
|
||||
users.upload_avatar = true;
|
||||
} else {
|
||||
self.setContent('<div><i class="glyph-icon fa fa-caret-right margin-left-15 margin-right-5"></i><i class="text-blue">'+name+'</i></div><hr class="margin-top-10 margin-bottom-10"><div class="text-center padding-top-10" id="avatar_upload"><img src="'+response.avatar+'" /><br><button type="button" id="delete_avatar" class="btn btn-danger margin-top-10">'+translate.getText.delete+'</button></div>');
|
||||
users.upload_avatar = false;
|
||||
}
|
||||
|
||||
}).fail(function(){
|
||||
self.setContent(translate.getText.an_error_occured);
|
||||
});
|
||||
},
|
||||
typeAnimated: true,
|
||||
onContentReady: function() {
|
||||
$("#delete_avatar").off('click').on('click', function(){
|
||||
$("#avatar_upload").html('<input type="file" name="files[]" id="avatar_file" /><input type="hidden" id="avatar_file_hidden" name="avatar_file" class="form-control" />');
|
||||
users.upload_avatar = true;
|
||||
users.initAvatarUploader();
|
||||
});
|
||||
|
||||
if (users.upload_avatar) {
|
||||
users.initAvatarUploader();
|
||||
}
|
||||
},
|
||||
type: 'blue',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.validate,
|
||||
btnClass: 'btn-blue',
|
||||
action: function(){
|
||||
if($('#novation_select').val() == '') {
|
||||
admin_content.alertCustomError('please_select_third_party');
|
||||
} else {
|
||||
var datas = {};
|
||||
datas['ujcaid'] = id;
|
||||
datas["ujcafile"] = $('#avatar_file_hidden').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.updateAvatar"),
|
||||
data: datas,
|
||||
success: function(response) {
|
||||
if (response.error == -1) {
|
||||
header.logout();
|
||||
} else if(response.error == -6) {
|
||||
admin_content.alertNotFound();
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
admin_content.alertError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
passwordUser: function(id, name) {
|
||||
|
||||
$.confirm({
|
||||
title: translate.getText.change_password,
|
||||
columnClass: 'small',
|
||||
content: '<div class="margin-top-3"><i class="glyph-icon fa-caret-right margin-left-10 margin-right-5"></i><i class="">'+name+'</i><div><div class="input-group"><input type="text" name="password" id="update_password" maxlength="32" class="form-control"><span class="input-group-addon pointer" id="user_password_regenerate"><i class="glyph-icon fa fa-lock"></i></span></div></div></div>',
|
||||
typeAnimated: true,
|
||||
type: 'dark',
|
||||
animation: 'RotateXR',
|
||||
onContentReady: function() {
|
||||
$("#user_password_regenerate").off('click').on('click', function(){
|
||||
event.preventDefault();
|
||||
users.generatePassword($("#update_password"));
|
||||
});
|
||||
},
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.confirm,
|
||||
btnClass: 'btn-dark',
|
||||
action: function() {
|
||||
if ($("#update_password").val() == "") {
|
||||
return false;
|
||||
} else {
|
||||
var datas = {};
|
||||
datas['id'] = id;
|
||||
datas['password'] = $("#update_password").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.Admin.API.User.updatePassword"),
|
||||
data: datas,
|
||||
success: function(response) {
|
||||
if (response.error == -1) {
|
||||
header.logout();
|
||||
} else if(response.error == -6) {
|
||||
admin_content.alertNotFound();
|
||||
} else if(response.error == -7) {
|
||||
admin_content.alertCustomError('the_password_must_have_at_least_six_characters');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
admin_content.alertError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
users = {...users, ...users_addon };
|
||||
|
||||
$(document).ready(function() {
|
||||
users.selectAll();
|
||||
$(elements.table_selector).on('draw.dt', function () {
|
||||
handleTable();
|
||||
initIcheck();
|
||||
users.passwordButtonsClick();
|
||||
users.avatarButtonsClick();
|
||||
} );
|
||||
} );
|
||||
105
build/Shop/admin/customer.js
Normal file
@@ -0,0 +1,105 @@
|
||||
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);
|
||||
|
||||
});
|
||||
187
build/css/shadow.css
Normal file
@@ -0,0 +1,187 @@
|
||||
|
||||
.drop-shadow {
|
||||
position:relative;
|
||||
float:left;
|
||||
width:100%;
|
||||
background:#fff;
|
||||
-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
|
||||
.drop-shadow:before,
|
||||
.drop-shadow:after {
|
||||
content:"";
|
||||
position:absolute;
|
||||
z-index:-2;
|
||||
}
|
||||
|
||||
/* Lifted corners */
|
||||
|
||||
.lifted {
|
||||
-moz-border-radius:4px;
|
||||
border-radius:4px;
|
||||
}
|
||||
|
||||
.lifted:before,
|
||||
.lifted:after {
|
||||
bottom:15px;
|
||||
left:10px;
|
||||
width:50%;
|
||||
height:20%;
|
||||
max-width:300px;
|
||||
max-height:100px;
|
||||
-webkit-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
|
||||
-moz-box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
|
||||
box-shadow:0 15px 10px rgba(0, 0, 0, 0.7);
|
||||
-webkit-transform:rotate(-3deg);
|
||||
-moz-transform:rotate(-3deg);
|
||||
-ms-transform:rotate(-3deg);
|
||||
-o-transform:rotate(-3deg);
|
||||
transform:rotate(-3deg);
|
||||
}
|
||||
|
||||
.lifted:after {
|
||||
right:10px;
|
||||
left:auto;
|
||||
-webkit-transform:rotate(3deg);
|
||||
-moz-transform:rotate(3deg);
|
||||
-ms-transform:rotate(3deg);
|
||||
-o-transform:rotate(3deg);
|
||||
transform:rotate(3deg);
|
||||
}
|
||||
|
||||
/* Curled corners */
|
||||
|
||||
.curled {
|
||||
border:1px solid #efefef;
|
||||
-moz-border-radius:0 0 120px 120px / 0 0 6px 6px;
|
||||
border-radius:0 0 120px 120px / 0 0 6px 6px;
|
||||
}
|
||||
|
||||
.curled:before,
|
||||
.curled:after {
|
||||
bottom:12px;
|
||||
left:10px;
|
||||
width:50%;
|
||||
height:55%;
|
||||
max-width:200px;
|
||||
max-height:100px;
|
||||
-webkit-box-shadow:0 8px 12px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow:0 8px 12px rgba(0, 0, 0, 0.5);
|
||||
box-shadow:0 8px 12px rgba(0, 0, 0, 0.5);
|
||||
-webkit-transform:skew(-8deg) rotate(-3deg);
|
||||
-moz-transform:skew(-8deg) rotate(-3deg);
|
||||
-ms-transform:skew(-8deg) rotate(-3deg);
|
||||
-o-transform:skew(-8deg) rotate(-3deg);
|
||||
transform:skew(-8deg) rotate(-3deg);
|
||||
}
|
||||
|
||||
.curled:after {
|
||||
right:10px;
|
||||
left:auto;
|
||||
-webkit-transform:skew(8deg) rotate(3deg);
|
||||
-moz-transform:skew(8deg) rotate(3deg);
|
||||
-ms-transform:skew(8deg) rotate(3deg);
|
||||
-o-transform:skew(8deg) rotate(3deg);
|
||||
transform:skew(8deg) rotate(3deg);
|
||||
}
|
||||
|
||||
/* Perspective */
|
||||
|
||||
.perspective:before {
|
||||
left:80px;
|
||||
bottom:5px;
|
||||
width:50%;
|
||||
height:35%;
|
||||
max-width:200px;
|
||||
max-height:50px;
|
||||
-webkit-box-shadow:-80px 0 8px rgba(0, 0, 0, 0.4);
|
||||
-moz-box-shadow:-80px 0 8px rgba(0, 0, 0, 0.4);
|
||||
box-shadow:-80px 0 8px rgba(0, 0, 0, 0.4);
|
||||
-webkit-transform:skew(50deg);
|
||||
-moz-transform:skew(50deg);
|
||||
-ms-transform:skew(50deg);
|
||||
-o-transform:skew(50deg);
|
||||
transform:skew(50deg);
|
||||
-webkit-transform-origin:0 100%;
|
||||
-moz-transform-origin:0 100%;
|
||||
-ms-transform-origin:0 100%;
|
||||
-o-transform-origin:0 100%;
|
||||
transform-origin:0 100%;
|
||||
}
|
||||
|
||||
.perspective:after {
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* Raised shadow - no pseudo-elements needed */
|
||||
|
||||
.raised {
|
||||
-webkit-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
-moz-box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
box-shadow: 0 15px 10px -10px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
|
||||
/* Curved shadows */
|
||||
|
||||
.curved:before {
|
||||
top:10px;
|
||||
bottom:10px;
|
||||
left:0;
|
||||
right:50%;
|
||||
-webkit-box-shadow:0 0 15px rgba(0,0,0,0.6);
|
||||
-moz-box-shadow:0 0 15px rgba(0,0,0,0.6);
|
||||
box-shadow:0 0 15px rgba(0,0,0,0.6);
|
||||
-moz-border-radius:10px / 100px;
|
||||
border-radius:10px / 100px;
|
||||
}
|
||||
|
||||
.curved-vt-2:before {
|
||||
right:0;
|
||||
}
|
||||
|
||||
.curved-hz-1:before {
|
||||
top:50%;
|
||||
bottom:0;
|
||||
left:10px;
|
||||
right:10px;
|
||||
-moz-border-radius:100px / 10px;
|
||||
border-radius:100px / 10px;
|
||||
}
|
||||
|
||||
.curved-hz-2:before {
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:10px;
|
||||
right:10px;
|
||||
-moz-border-radius:100px / 10px;
|
||||
border-radius:100px / 10px;
|
||||
}
|
||||
|
||||
/* Rotated box */
|
||||
|
||||
.rotated {
|
||||
-webkit-box-shadow:none;
|
||||
-moz-box-shadow:none;
|
||||
box-shadow:none;
|
||||
-webkit-transform:rotate(-3deg);
|
||||
-moz-transform:rotate(-3deg);
|
||||
-ms-transform:rotate(-3deg);
|
||||
-o-transform:rotate(-3deg);
|
||||
transform:rotate(-3deg);
|
||||
}
|
||||
|
||||
.rotated > :first-child:before {
|
||||
content:"";
|
||||
position:absolute;
|
||||
z-index:-1;
|
||||
top:0;
|
||||
bottom:0;
|
||||
left:0;
|
||||
right:0;
|
||||
background:#fff;
|
||||
-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
box-shadow:0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
|
||||
}
|
||||
19
build/css/theme.css
Normal file
BIN
build/img/logo.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
build/img/payments/americanexpress.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
build/img/payments/discover.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
build/img/payments/jcb.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
build/img/payments/mastercard.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
build/img/payments/paypal.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
build/img/payments/visa.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
15
build/js/include/animate.js
Normal file
@@ -0,0 +1,15 @@
|
||||
function initAnimate()
|
||||
{
|
||||
/*
|
||||
var wew = new Wew({
|
||||
target: '.wow',
|
||||
keyword: 'wow',
|
||||
});
|
||||
|
||||
wew.init();
|
||||
*/
|
||||
wow = new WOW({animateClass: 'animated', live: true});
|
||||
wow.init();
|
||||
|
||||
}
|
||||
|
||||
77
build/js/include/app.js
Normal file
@@ -0,0 +1,77 @@
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
(function($) {
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
// Toggle the side navigation
|
||||
$("#sidebarToggle, #sidebarToggleTop").on('click', function(e) {
|
||||
$("body").toggleClass("sidebar-toggled");
|
||||
$(".sidebar").toggleClass("toggled");
|
||||
if ($(".sidebar").hasClass("toggled")) {
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
});
|
||||
|
||||
// Close any open menu accordions when window is resized below 768px
|
||||
$(window).resize(function() {
|
||||
if ($(window).width() < 768) {
|
||||
$('.sidebar .collapse').collapse('hide');
|
||||
};
|
||||
});
|
||||
|
||||
// Prevent the content wrapper from scrolling when the fixed side navigation hovered over
|
||||
$('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) {
|
||||
if ($(window).width() > 768) {
|
||||
var e0 = e.originalEvent,
|
||||
delta = e0.wheelDelta || -e0.detail;
|
||||
this.scrollTop += (delta < 0 ? 1 : -1) * 30;
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Scroll to top button appear
|
||||
$(document).on('scroll', function() {
|
||||
var scrollDistance = $(this).scrollTop();
|
||||
if (scrollDistance > 100) {
|
||||
$('.scroll-to-top').fadeIn();
|
||||
} else {
|
||||
$('.scroll-to-top').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// Smooth scrolling using jQuery easing
|
||||
$(document).on('click', 'a.scroll-to-top', function(e) {
|
||||
var $anchor = $(this);
|
||||
$('html, body').stop().animate({
|
||||
scrollTop: ($($anchor.attr('href')).offset().top)
|
||||
}, 1000, 'easeInOutExpo');
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('#changePassword-submit').click(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
url: '/changePassword',
|
||||
data: $('#password-form-data').serialize(),
|
||||
method : 'POST',
|
||||
success: function(resp){
|
||||
if (resp.success) {
|
||||
$('#changePasswordMessage').html(resp.message);
|
||||
// await sleep(1000);
|
||||
$('#changepasswordModal').modal('hide');
|
||||
$('#password-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
} else {
|
||||
$('#changePasswordMessage').html(resp.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
numeral.locale('fr');
|
||||
|
||||
})(jQuery); // End of use strict
|
||||
75
build/js/include/appender.js
Normal file
@@ -0,0 +1,75 @@
|
||||
(function ($) {
|
||||
$.fn.appender = function (settings) {
|
||||
let appendArea = this;
|
||||
let rowHtml = $(settings.rowSection)[0].outerHTML;
|
||||
|
||||
settings.hideSection ? $(settings.rowSection).remove() : "";
|
||||
|
||||
let rowCounter = 1;
|
||||
|
||||
if (settings.rowNumberStart) {
|
||||
rowCounter = Number(settings.rowNumberStart);
|
||||
}
|
||||
|
||||
$(document).on('click', settings.addBtn, function (event) {
|
||||
|
||||
$(appendArea).append(rowHtml);
|
||||
|
||||
if (settings.appendEffect === 'fade') {
|
||||
$(settings.rowSection).last().hide().fadeIn();
|
||||
} else if (settings.appendEffect === 'slide') {
|
||||
$(settings.rowSection).last().hide().slideDown(200);
|
||||
}
|
||||
|
||||
$(settings.rowSection).last().addClass(settings.addClass);
|
||||
|
||||
$(settings.rowNumber).last().text(rowCounter);
|
||||
|
||||
if (settings.type) {
|
||||
type = settings.type;
|
||||
} else {
|
||||
type = settings.rowSection;
|
||||
}
|
||||
|
||||
$(type).each(function(rowIndex) {
|
||||
$(this).find('input[name]').each(function(){
|
||||
var name;
|
||||
name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('select[name]').each(function(){
|
||||
var name;
|
||||
name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
$(this).find('textarea[name]').each(function(){
|
||||
var name;
|
||||
name = $(this).attr('name');
|
||||
name = name.replace(/\[[0-9]?\]/g, '['+rowIndex+']');
|
||||
$(this).attr('name',name);
|
||||
});
|
||||
});
|
||||
|
||||
rowCounter++;
|
||||
|
||||
if (settings.callback) {
|
||||
settings.callback();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
if(settings.deleteBtn) {
|
||||
$(document).on('click', settings.deleteBtn, function (e) {
|
||||
$(e.target).closest(settings.rowSection).remove();
|
||||
if (settings.callback) {
|
||||
settings.callback();
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
5
build/js/include/cache.js
Normal file
@@ -0,0 +1,5 @@
|
||||
function loadCache(file, callback) {
|
||||
file += '?v=' + cache_versions[file];
|
||||
loadScript(file, callback);
|
||||
}
|
||||
|
||||
27
build/js/include/check_fields.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function checkCollapsedFields(selector)
|
||||
{
|
||||
var selector = selector + ' input,textarea,select';
|
||||
var nb_fields = $(selector).length();
|
||||
var nb_required = $(selector).filter('[required]').length();
|
||||
var nb_filled = 0;
|
||||
var nb_necessary = 0;
|
||||
|
||||
$(selector).each(function(i, Field){
|
||||
if ($(Field).val() != '')
|
||||
{
|
||||
nb_filled++;
|
||||
}
|
||||
});
|
||||
|
||||
$(selector).filter('[required]').each(function(i, required){
|
||||
if ($(required).val() != '')
|
||||
{
|
||||
nb_necessary++;
|
||||
}
|
||||
});
|
||||
|
||||
result = nb_filled + " / " + nb_fields;
|
||||
result + " | " + nb_necessary + " / " + nb_required;
|
||||
|
||||
$(selector + ' .check').html(result);
|
||||
}
|
||||
14
build/js/include/chosen.js
Normal file
@@ -0,0 +1,14 @@
|
||||
function initChosen()
|
||||
{
|
||||
$(".chosen-select").chosen({ no_results_text: translate.getText.no_result });
|
||||
$(".chosen-search").append('<i class="glyph-icon icon-search"></i>');
|
||||
$(".chosen-single div").html('<i class="glyph-icon icon-caret-down"></i>');
|
||||
$(".chosen-container-single").addClass('styled');
|
||||
}
|
||||
|
||||
function resetChosen()
|
||||
{
|
||||
$('.chosen-select').each(function() {
|
||||
$(this).val("").trigger("chosen:updated");
|
||||
});
|
||||
}
|
||||
75
build/js/include/confirm.js
Normal file
@@ -0,0 +1,75 @@
|
||||
var confirm_delete_options = {
|
||||
title: "Etes-vous sur ?",
|
||||
text: "Cet enregistrement sera effacé.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
confirmButtonText: "Oui !",
|
||||
cancelButtonText: "Annuler"
|
||||
};
|
||||
|
||||
function confirm_delete(id, route,callback) {
|
||||
console.log(route);
|
||||
Swal.fire(confirm_delete_options).then(function(result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url : route,
|
||||
method : 'DELETE',
|
||||
data: {id:id},
|
||||
success : function(resp){
|
||||
if (resp.success) {
|
||||
console.log(resp);
|
||||
callback();
|
||||
Swal.fire("Supprimé !", "L'enregistrement a été supprimé.", "success");
|
||||
} else {
|
||||
Swal.fire("Erreur!", "L'enregistrement n'a pu être supprimé pour les raisons suivantes : "+resp.message, "danger");
|
||||
if(resp.code == 401){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function confirm(route,options,callback) {
|
||||
var confirm_options = {
|
||||
title: options.title,
|
||||
text: options.text,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
confirmButtonText: "Oui !",
|
||||
cancelButtonText: "Annuler",
|
||||
success: options.success ? options.success : "L'enregistrement a été supprimé.",
|
||||
notsuccess: options.notsuccess ? options.notsuccess : "L'enregistrement n'a pu être supprimé pour les raisons suivantes : "
|
||||
};
|
||||
|
||||
console.log(route);
|
||||
Swal.fire(confirm_options).then(function(result) {
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
url : route,
|
||||
method : 'GET',
|
||||
success : function(resp){
|
||||
if (resp.success) {
|
||||
console.log(resp);
|
||||
callback();
|
||||
Swal.fire("Supprimé !", confirm_options.success, "success");
|
||||
} else {
|
||||
Swal.fire("Erreur!", confirm_options.notsuccess + resp.message, "danger");
|
||||
if(resp.code == 401){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
147
build/js/include/datatable.js
Normal file
@@ -0,0 +1,147 @@
|
||||
function getDatatablesSelector(module) {
|
||||
return '#' + module + '-table';
|
||||
}
|
||||
|
||||
function getDataTables(options,route,module, nobuttons) {
|
||||
|
||||
var params = {
|
||||
ajax: {
|
||||
url: route,
|
||||
data: function ( d ) {
|
||||
d.where = $('#where').val();
|
||||
}
|
||||
},
|
||||
buttons: (!nobuttons) ? getDatatablesButtons() : [],
|
||||
responsive: false,
|
||||
keys: false,
|
||||
autoWidth: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
lengthChange: true,
|
||||
lengthMenu: [
|
||||
[ 10, 25, 50, 100, -1],
|
||||
[ '10 lignes', '25 lignes', '50 lignes', '100 lignes', 'Tous']
|
||||
],
|
||||
deferRender: true,
|
||||
stateSave: false,
|
||||
sDom: options['dom'] ? options['dom'] : getDatatablesDomDefault(),
|
||||
fixedHeader: false,
|
||||
fixedColumns: options['fixedColumns'],
|
||||
colReorder: false,
|
||||
scrollX: true,
|
||||
scrollY: "70vh",
|
||||
scrollCollapse: true,
|
||||
searchDelay: 300,
|
||||
select: false,
|
||||
columns: options['columns'],
|
||||
language: datatables_lang,
|
||||
rowId: 'id',
|
||||
};
|
||||
|
||||
/* // DOM Position key index //
|
||||
|
||||
l - Length changing (dropdown)
|
||||
f - Filtering input (search)
|
||||
t - The Table! (datatable)
|
||||
i - Information (records)
|
||||
p - Pagination (paging)
|
||||
r - pRocessing
|
||||
< and > - div elements
|
||||
<"#id" and > - div with an id
|
||||
<"class" and > - div with a class
|
||||
<"#id.class" and > - div with an id and class
|
||||
|
||||
Also see: http://legacy.datatables.net/usage/features
|
||||
*/
|
||||
|
||||
if (options['order']) {
|
||||
params.order = options['order'];
|
||||
}
|
||||
|
||||
// console.log(params);
|
||||
|
||||
var Table = $('#'+module+'-table').DataTable(params);
|
||||
|
||||
handleDataTablesFilter(Table,module);
|
||||
|
||||
// Table.buttons().container().appendTo( $('.col-sm-6:eq(0)'));
|
||||
|
||||
return Table;
|
||||
}
|
||||
|
||||
function handleDataTablesFilter(Table) {
|
||||
$(Table.table().container()).on('change keyup', 'thead input', function() {
|
||||
Table.column( $(this).parent().index()+':visible' ).search( this.value ).draw();
|
||||
});
|
||||
|
||||
$(Table.table().container()).on('change', 'thead select', function() {
|
||||
Table.column( $(this).parent().index()+':visible' ).search( this.value ).draw();
|
||||
});
|
||||
|
||||
$('[data-toggle="popover"]').popover({html: true});
|
||||
};
|
||||
|
||||
function getDatatablesButtons() {
|
||||
return ['pageLength',
|
||||
{
|
||||
extend: 'copyHtml5',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
},
|
||||
text: '<i class="fa fa-files-o fa-lg"></i>',
|
||||
titleAttr: 'Copier',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'excelHtml5',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
},
|
||||
text: '<i class="fa fa-file-excel-o fa-lg"></i>',
|
||||
titleAttr: 'Excel',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'pdfHtml5',
|
||||
orientation: 'landscape',
|
||||
pageSize: 'A4',
|
||||
exportOptions: {
|
||||
columns: ':visible'
|
||||
},
|
||||
text: '<i class="fa fa-file-pdf-o fa-lg"></i>',
|
||||
titleAttr: 'PDF',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
text: '<i class="fa fa-print fa-lg"></i>',
|
||||
titleAttr: 'Imprimer',
|
||||
className: 'hidden-xs',
|
||||
},
|
||||
{
|
||||
extend: 'colvis',
|
||||
text: '<i class="fa fa-columns fa-lg"></i>',
|
||||
titleAttr: 'Colonnes',
|
||||
columns: ':not(.fixed)'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
function getDatatablesDomDefault(nobuttons) {
|
||||
dom = (!nobuttons) ? getDatatablesHeaderDefault() : '';
|
||||
dom += "t";
|
||||
dom += getDatatablesFooterDefault();
|
||||
return dom;
|
||||
}
|
||||
|
||||
function getDatatablesHeaderDefault() {
|
||||
return "<' row dt-toolbar-header'<'col-md-4 tool'B><'col-md-4'<'toolbar'>><'col-md-4 text-right add'>r>";
|
||||
}
|
||||
|
||||
function getDatatablesFooterDefault() {
|
||||
return "<'row dt-toolbar-footer'<'col-md-6'i><'col-md-6'p>>";
|
||||
}
|
||||
|
||||
function getDatatableLang() {
|
||||
return "/assets/plugins/datatables_lang/" + getLang() + '.json';
|
||||
}
|
||||
67
build/js/include/datetime.js
Normal file
@@ -0,0 +1,67 @@
|
||||
function initDatepicker() {
|
||||
var lang = getLang();
|
||||
loadScript('assets/plugins/datepicker/bootstrap-datepicker.' + lang + '.min.js', function() {
|
||||
$(".datepicker").datepicker({
|
||||
language: lang
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initDaterangePicker() {
|
||||
var lang = getLang();
|
||||
loadScript('assets/plugins/daterangepicker/' + lang + '.js');
|
||||
}
|
||||
|
||||
function initMomentLang() {
|
||||
var lang = getLang();
|
||||
loadScript('assets/plugins/moment/' + lang + '.js');
|
||||
}
|
||||
|
||||
function getDaterangePicker(selector, startDate, parentEl, endDate) {
|
||||
// console.log('getDaterangePicker');
|
||||
if (typeof(parentEL) == 'undefined') {
|
||||
parentEl = 'file_effect_date_selection';
|
||||
}
|
||||
if (typeof(startDate) == 'undefined') {
|
||||
startDate = moment().format(dateRangePickerLanguage.format);
|
||||
}
|
||||
// console.log("selector : ", selector);
|
||||
// console.log("StartDate : ", startDate);
|
||||
var options = {
|
||||
autoUpdateInput: false,
|
||||
autoApply: true,
|
||||
singleDatePicker: true,
|
||||
format: dateRangePickerLanguage.format,
|
||||
opens: 'left',
|
||||
showDropdowns: true,
|
||||
showWeekNumbers: true,
|
||||
alwaysShowCalendars: true,
|
||||
startDate: startDate,
|
||||
separator: dateRangePickerLanguage.separator,
|
||||
locale: dateRangePickerLanguage.locale,
|
||||
buttonClasses: 'btn btn-light uppercase weight-900',
|
||||
parentEl: '.' +parentEl
|
||||
};
|
||||
|
||||
if (typeof(endDate) != 'undefined') {
|
||||
options.endDate = endDate;
|
||||
options.ranges = dateRangePickerLanguage.ranges;
|
||||
};
|
||||
|
||||
$('#files_selection').parent().parent().parent().parent().parent().parent().parent().parent().parent().removeClass(parentEl).addClass(parentEl);
|
||||
var picker = $(selector).daterangepicker(options, function(start, end, label) {
|
||||
//console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
|
||||
});
|
||||
|
||||
$(selector + ' .daterangepicker').removeClass('light').addClass('light');
|
||||
|
||||
$(selector).next('span.add-on').off('click').on('click', function() {
|
||||
$(selector).trigger('click');
|
||||
});
|
||||
|
||||
$(selector).on('apply.daterangepicker', function(ev, picker) {
|
||||
$(this).val(picker.startDate.format(dateRangePickerLanguage.format));
|
||||
});
|
||||
|
||||
return picker;
|
||||
}
|
||||
27
build/js/include/geo_autocomplete.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function initializeAutocomplete(id) {
|
||||
var element = document.getElementById(id);
|
||||
if (element) {
|
||||
var autocomplete = new google.maps.places.Autocomplete(element, { types: ['geocode'] });
|
||||
google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaceChanged() {
|
||||
var place = this.getPlace();
|
||||
|
||||
// console.log(place); // Uncomment this line to view the full object returned by Google API.
|
||||
|
||||
for (var i in place.address_components) {
|
||||
var component = place.address_components[i];
|
||||
for (var j in component.types) { // Some types are ["country", "political"]
|
||||
var type_element = document.getElementById(component.types[j]);
|
||||
if (type_element) {
|
||||
type_element.value = component.long_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
google.maps.event.addDomListener(window, 'load', function() {
|
||||
initializeAutocomplete('adresse');
|
||||
});
|
||||
67
build/js/include/handlebars.js
Normal file
@@ -0,0 +1,67 @@
|
||||
function renderContractDriveTPL(filename, data, selector) {
|
||||
data.translate = translate;
|
||||
var path = '/assets/apps/ContractDrive/templates/';
|
||||
var content = getTemplate(path + filename, data);
|
||||
if (typeof(selector) == 'undefined')
|
||||
{
|
||||
return content;
|
||||
} else {
|
||||
$(selector).html(content);
|
||||
}
|
||||
}
|
||||
|
||||
function getTemplate(file, data) {
|
||||
var source = getSource(file);
|
||||
var template = Handlebars.compile(source);
|
||||
return template(data);
|
||||
}
|
||||
|
||||
function getSource(file) {
|
||||
var source = null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'html',
|
||||
type: 'GET',
|
||||
url: file + '?' + Date.now(),
|
||||
success: function(data) {
|
||||
source = data;
|
||||
}
|
||||
});
|
||||
return source;
|
||||
}
|
||||
|
||||
function view(template_id, data) {
|
||||
// console.log(template_id);
|
||||
// console.log(data);
|
||||
var source = document.getElementById(template_id).innerHTML;
|
||||
var template = Handlebars.compile(source);
|
||||
return template(data);
|
||||
}
|
||||
|
||||
function helperSelect(name, items, selected, options) {
|
||||
|
||||
// If the selected value is an array, then convert the
|
||||
// select to a multiple select
|
||||
if (selected instanceof Array) {
|
||||
options.hash.multiple = 'multiple';
|
||||
}
|
||||
|
||||
// Generate the list of options
|
||||
var optionsHtml = '';
|
||||
for (var i = 0, j = items.length; i < j; i++) {
|
||||
|
||||
// <option> attributes
|
||||
var attr = {
|
||||
value: items[i].value
|
||||
};
|
||||
|
||||
// We can specify which options are selected by using either:
|
||||
// * an array of selected values or
|
||||
// * a single selected value
|
||||
if ((selected instanceof Array && indexOf(selected, items[i].value) !== -1) || (selected === items[i].value)) {
|
||||
attr.selected = 'selected';
|
||||
}
|
||||
|
||||
optionsHtml += createElement('option', true, attr, items[i].text);
|
||||
}
|
||||
}
|
||||
167
build/js/include/modal.js
Normal file
@@ -0,0 +1,167 @@
|
||||
var modal_confirm_delete_options = {
|
||||
title: "Etes-vous sur ?",
|
||||
text: "Cet enregistrement sera effacé.",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonClass: "btn-danger",
|
||||
confirmButtonText: "Oui !",
|
||||
cancelButtonText: "Annuler"
|
||||
};
|
||||
|
||||
|
||||
function modal_confirm_delete(id,module,route,callback) {
|
||||
// console.log(id);
|
||||
var $loader = $('#loader');
|
||||
Swal.fire(modal_confirm_delete_options).then(function(result) {
|
||||
if (result.value) {
|
||||
$.ajaxSetup({
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
}
|
||||
});
|
||||
// console.log('/' + route +'/'+ id);
|
||||
$.ajax({
|
||||
url : '/' + route +'/'+ id,
|
||||
method : 'DELETE',
|
||||
success : function(resp){
|
||||
if (resp.success) {
|
||||
Swal.fire("Supprimé !", "L'enregistrement a été supprimé.", "success");
|
||||
$('#'+module+'-modal').modal('hide');
|
||||
callback();
|
||||
} else {
|
||||
Swal.fire("Erreur!", "L'enregistrement n'a pu être supprimé pour les raisons suivantes : "+resp.message, "danger");
|
||||
if(resp.code == 401){
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
$loader.hide();
|
||||
}
|
||||
});
|
||||
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function modal_save(id,route,module,callback,$button) {
|
||||
var $loader = $('#loader');
|
||||
var $data = $('#'+module+'-form-data').serialize();
|
||||
var $method = $button.attr('data-method');
|
||||
var $url = ($method == 'POST') ? '/' + route : '/' + route +'/'+ id;
|
||||
|
||||
$button.prop('disabled', true);
|
||||
$button.html('en cours...');
|
||||
$loader.show();
|
||||
|
||||
$.ajax({
|
||||
url: $url,
|
||||
data: $data,
|
||||
method : $method,
|
||||
success: function(resp){
|
||||
|
||||
$button.prop('disabled', false);
|
||||
$button.html('Enregistrer');
|
||||
$loader.hide();
|
||||
|
||||
if (resp.success) {
|
||||
$('#'+module+'-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
$('#btn-'+module+'-delete').hide();
|
||||
$('#'+module+'-modal').modal('hide');
|
||||
callback();
|
||||
} else {
|
||||
swal(resp.message);
|
||||
if (resp.code == 401) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function modal_add(module, callback) {
|
||||
/*
|
||||
$('#'+module+'-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
*/
|
||||
$('#btn-'+module+'-save').attr('data-method', 'POST');
|
||||
$('#btn-'+module+'-delete').hide();
|
||||
$('#'+module+'-modal').modal('show');
|
||||
callback();
|
||||
}
|
||||
|
||||
function modal_edit(id,route,module,callback) {
|
||||
var $loader = $('#loader');
|
||||
$loader.show();
|
||||
$('#btn-'+module+'-delete').show();
|
||||
|
||||
$.get('/'+route+'/'+id, function(resp){
|
||||
if (resp.success) {
|
||||
/*
|
||||
$('#'+module+'-form-data').each(function(){
|
||||
this.reset();
|
||||
});
|
||||
*/
|
||||
callback(resp.data);
|
||||
|
||||
$('#btn-'+module+'-save').attr('data-method', 'PUT');
|
||||
$('#btn-'+module+'-delete').show();
|
||||
$('#'+module+'-modal').modal('show');
|
||||
} else {
|
||||
if (resp.code == 401) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
$loader.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function initModalAdmin(route,module,callback,populate,Table) {
|
||||
|
||||
var selector = getDatatablesSelector(model);
|
||||
/*
|
||||
$( selector + ' tbody').on( 'click', 'tr', function (e) {
|
||||
e.preventDefault();
|
||||
// $(this).toggleClass('selected');
|
||||
id = Table.row(this).id();
|
||||
modal_edit(id,route,module,populate);
|
||||
} );
|
||||
*/
|
||||
/*
|
||||
$('#btn-'+module+'-add').click(function(e){
|
||||
e.preventDefault();
|
||||
modal_add(module, populate);
|
||||
});
|
||||
*/
|
||||
/*
|
||||
$('#'+module+'-table').on('click', '.btn-'+module+'-edit', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('data-id');
|
||||
modal_edit(id,route,module,populate);
|
||||
});
|
||||
*/
|
||||
/*
|
||||
$('#'+module+'-table').on('click', '.btn-'+module+'-delete', function(e){
|
||||
e.preventDefault();
|
||||
var id = $(this).attr('data-id');
|
||||
modal_confirm_delete(id,route,callback);
|
||||
});
|
||||
*/
|
||||
|
||||
$('#btn-'+module+'-delete').click(function(e){
|
||||
e.preventDefault();
|
||||
var id = $('#id').val();
|
||||
modal_confirm_delete(id,module,route,callback);
|
||||
});
|
||||
|
||||
/*
|
||||
$('#btn-'+module+'-save').click(function(e){
|
||||
e.preventDefault();
|
||||
var id = $('#id').val();
|
||||
modal_save(id,route,module,callback,$(this));
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Google Place Autocomplete
|
||||
|
||||
This sample code show you how to quickly use the Places Autocomplete javascript
|
||||
API from Google.
|
||||
|
||||
[See demo right now](http://lewagon.github.io/google-place-autocomplete)
|
||||
|
||||
## Code
|
||||
|
||||
Look at the [index.html](index.html) file, you'll see a very standard form.
|
||||
The input with id `user_input_autocomplete_address` is very important as it
|
||||
is bound to an `autocomplete` object in the `autocomplete.js` code.
|
||||
|
||||
The code you see is not dependent on jQuery, also the `initializeAutocomplete`
|
||||
method has to be called when `google` is ready, not just when the DOM is ready.
|
||||
|
||||
## API Key
|
||||
|
||||
In order to get a lot of requests for free to the API, you need to create a
|
||||
new project under the [Google API Console](https://code.google.com/apis/console).
|
||||
For this project, enable the Google Maps Javascript API v3:
|
||||
|
||||

|
||||
|
||||
Then, for this project, create a new "Browser Key", the one you'll put in the
|
||||
`index.html` file when calling the `https://maps.googleapis.com/maps/api/js` script.
|
||||
|
||||

|
||||
|
||||
Make sure to specify referers so that **only you** can use this key! Remember,
|
||||
you API calls are limited per day.
|
||||
|
||||

|
||||
|
||||
## Documentation
|
||||
|
||||
[Full Reference](https://developers.google.com/maps/documentation/javascript/places-autocomplete)
|
||||
@@ -0,0 +1,27 @@
|
||||
function initializeAutocomplete(id) {
|
||||
var element = document.getElementById(id);
|
||||
if (element) {
|
||||
var autocomplete = new google.maps.places.Autocomplete(element, { types: ['geocode'] });
|
||||
google.maps.event.addListener(autocomplete, 'place_changed', onPlaceChanged);
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaceChanged() {
|
||||
var place = this.getPlace();
|
||||
|
||||
// console.log(place); // Uncomment this line to view the full object returned by Google API.
|
||||
|
||||
for (var i in place.address_components) {
|
||||
var component = place.address_components[i];
|
||||
for (var j in component.types) { // Some types are ["country", "political"]
|
||||
var type_element = document.getElementById(component.types[j]);
|
||||
if (type_element) {
|
||||
type_element.value = component.long_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
google.maps.event.addDomListener(window, 'load', function() {
|
||||
initializeAutocomplete('user_input_autocomplete_address');
|
||||
});
|
||||
@@ -0,0 +1,83 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Google Place Autocomplete</title>
|
||||
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-8 col-sm-offset-2">
|
||||
<h1>Google Place Autocomplete exemple</h1>
|
||||
|
||||
<a href="https://github.com/lewagon/google-place-autocomplete">Source</a>
|
||||
<hr>
|
||||
|
||||
<form role="form" class="form-horizontal">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">Address</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="user_input_autocomplete_address" name="user_input_autocomplete_address"
|
||||
class="form-control" placeholder="Start typing your address...">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="disabled">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>street_number</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="street_number" name="street_number" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>route</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="route" name="route" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>locality</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="locality" name="locality" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>administrative_area_level_1</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="administrative_area_level_1" name="administrative_area_level_1" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>postal_code</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="postal_code" name="postal_code" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label"><code>country</code></label>
|
||||
<div class="col-sm-8">
|
||||
<input id="country" name="country" disabled="true" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Include Google Maps JS API -->
|
||||
<script type="text/javascript"
|
||||
src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyDANjx3bosEtIyzJaoWs50Wnt6nt_1rmxU "></script>
|
||||
|
||||
<!-- Custom JS code to bind to Autocomplete API -->
|
||||
<script type="text/javascript" src="autocomplete.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 61 KiB |
20
build/js/include/rights.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function hasRole(str) {
|
||||
return checkRole('admin') ? true : checkRole(str);
|
||||
}
|
||||
|
||||
function checkRole(str) {
|
||||
return (global.roles.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
|
||||
function isAdmin() {
|
||||
return hasRole('admin');
|
||||
}
|
||||
|
||||
function hasPermission(str) {
|
||||
if (isAdmin()) {
|
||||
return true;
|
||||
} else {
|
||||
return (global.permissions.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
18
build/js/include/set_options.js
Normal file
@@ -0,0 +1,18 @@
|
||||
function setOptions(selector,data,selected,all) {
|
||||
// console.log(data);
|
||||
var $el = $(selector);
|
||||
$el.empty(); // remove old options
|
||||
if (all) {
|
||||
$el.append($("<option></option>").attr("value",'').text('Tous'));
|
||||
}
|
||||
$.each(data, function(key, name) {
|
||||
// console.log(name);
|
||||
if (key != null) {
|
||||
if (key == selected) {
|
||||
$el.append($("<option selected='selected'></option>").attr("value", key).text(name));
|
||||
} else {
|
||||
$el.append($("<option></option>").attr("value", key).text(name));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
11
build/js/include/url_on_tab.js
Normal file
@@ -0,0 +1,11 @@
|
||||
// Javascript to enable link to tab
|
||||
var url = document.location.toString();
|
||||
if (url.match('#')) {
|
||||
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
|
||||
}
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-tabs a').on('shown.bs.tab', function (e) {
|
||||
window.location.hash = e.target.hash;
|
||||
$(window).scrollTop(0);
|
||||
})
|
||||
29
build/js/include/user.js
Normal file
@@ -0,0 +1,29 @@
|
||||
function getCurrentUser() {
|
||||
var user = $('#current_user').html();
|
||||
return (typeof(user) != 'undefined') ? user : false;
|
||||
}
|
||||
|
||||
function isConnected() {
|
||||
return getCurrentUser() ? true : false;
|
||||
}
|
||||
|
||||
function hasRole(str) {
|
||||
return checkRole('admin') ? true : checkRole(str);
|
||||
}
|
||||
|
||||
function checkRole(str) {
|
||||
return (global.roles.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
|
||||
function isAdmin() {
|
||||
return hasRole('admin');
|
||||
}
|
||||
|
||||
function hasPermission(str) {
|
||||
if (isAdmin()) {
|
||||
return true;
|
||||
} else {
|
||||
return (global.permissions.indexOf(str) == -1 ) ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
17
build/js/include/validator.js
Normal file
@@ -0,0 +1,17 @@
|
||||
function initValidator()
|
||||
{
|
||||
window.addEventListener('load', function() {
|
||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
||||
var forms = document.getElementsByClassName('needs-validation');
|
||||
// Loop over them and prevent submission
|
||||
var validation = Array.prototype.filter.call(forms, function(form) {
|
||||
form.addEventListener('submit', function(event) {
|
||||
if (form.checkValidity() === false) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
form.classList.add('was-validated');
|
||||
}, false);
|
||||
});
|
||||
}, false);
|
||||
}
|
||||