Add new version in repository
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
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();
|
||||
} );
|
||||
} );
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
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();
|
||||
} );
|
||||
} );
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
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();
|
||||
} );
|
||||
} );
|
||||
@@ -1,347 +0,0 @@
|
||||
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();
|
||||
} );
|
||||
} );
|
||||
@@ -1,105 +0,0 @@
|
||||
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);
|
||||
|
||||
});
|
||||
@@ -1,4 +1,55 @@
|
||||
ul .jqtree_common {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.select2 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.select2-selection__choice, .select2-selection__choice__remove {
|
||||
background-color: rgba(0,163,203, 1)!important;
|
||||
color: #FFF!important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single {
|
||||
border: 1px solid #ced4da;
|
||||
padding: .46875rem .75rem;
|
||||
height: calc(2.25rem + 2px);
|
||||
}
|
||||
|
||||
|
||||
.select2-container--default .select2-selection--single {
|
||||
border: 1px solid #ced4da;
|
||||
padding: .46875rem .75rem;
|
||||
height: calc(2.25rem + 2px);
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 31px!important;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.navbar-green, .bg-green {
|
||||
background-color: #527C39!important;
|
||||
}
|
||||
|
||||
.green {
|
||||
color: #527C39!important;
|
||||
}
|
||||
|
||||
.sidebar-dark-green, .bg-dark-green {
|
||||
background-color: #344F16!important;
|
||||
}
|
||||
|
||||
.dark-green {
|
||||
color: #344F16!important;
|
||||
}
|
||||
|
||||
.bg-yellow {
|
||||
background-color: #F2B90F!important;
|
||||
}
|
||||
|
||||
.yellow {
|
||||
color: #F2B90F!important;
|
||||
}
|
||||
49
build/js/include/boilerplate.js
Normal file
49
build/js/include/boilerplate.js
Normal file
@@ -0,0 +1,49 @@
|
||||
$('.sidebar-toggle').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
if (Boolean(sessionStorage.getItem('sidebar-toggle-collapsed'))) {
|
||||
sessionStorage.setItem('sidebar-toggle-collapsed', '');
|
||||
} else {
|
||||
sessionStorage.setItem('sidebar-toggle-collapsed', '1');
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
||||
$(document).tooltip({
|
||||
container: 'body',
|
||||
selector: '[data-toggle="tooltip"]',
|
||||
delay: { "show": 500, "hide": 100 },
|
||||
html: true,
|
||||
trigger: 'hover',
|
||||
})
|
||||
|
||||
setInterval(function () {
|
||||
var timestamp = Math.round(+new Date() / 1000);
|
||||
if (Math.round(+new Date() / 1000) === (session.expire - 10)) {
|
||||
session.expire = timestamp + session.lifetime;
|
||||
$.ajax({
|
||||
url: session.keepalive,
|
||||
type: 'post',
|
||||
data: {id: session.id}
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
});
|
||||
|
||||
$('.logout').click(function (e) {
|
||||
e.preventDefault();
|
||||
if (bootbox.confirm($(this).attr('data-question'), function (e) {
|
||||
if (e === false) {
|
||||
return;
|
||||
}
|
||||
$('#logout-form').submit();
|
||||
})) {
|
||||
}
|
||||
});
|
||||
|
||||
(function () {
|
||||
if (Boolean(sessionStorage.getItem('sidebar-toggle-collapsed'))) {
|
||||
var body = document.getElementsByTagName('body')[0];
|
||||
body.className = body.className + ' sidebar-collapse';
|
||||
}
|
||||
})();
|
||||
21
build/js/include/core/helpers.js
Normal file
21
build/js/include/core/helpers.js
Normal file
@@ -0,0 +1,21 @@
|
||||
// Array Helpers
|
||||
const countOccurrences = arr => arr.reduce((prev, curr) => (prev[curr] = ++prev[curr] || 1, prev), {});
|
||||
const isEmpty = arr => !(Array.isArray(arr) && arr.length > 0 && arr.filter(el => el === undefined).length > 0)
|
||||
const isEqual = (a, b) => JSON.stringify(a.sort()) === JSON.stringify(b.sort());
|
||||
const countBy = (arr, prop) => arr.reduce((prev, curr) => (prev[curr[prop]] = ++prev[curr[prop]] || 1, prev), {});
|
||||
const transpose = matrix => matrix[0].map((col, i) => matrix.map(row => row[i]));
|
||||
|
||||
// Dom Helpers
|
||||
const insertAfter = (ele, anotherEle) => anotherEle.parentNode.insertBefore(ele, anotherEle.nextSibling);
|
||||
const insertBefore = (ele, anotherEle) => anotherEle.parentNode.insertBefore(ele, anotherEle);
|
||||
const insertHtmlAfter = (html, ele) => ele.insertAdjacentHTML('afterend', html);
|
||||
const insertHtmlBefore = (html, ele) => ele.insertAdjacentHTML('beforebegin', html);
|
||||
|
||||
const goTo = url => location.href = url;
|
||||
const replace = (ele, newEle) => ele.parentNode.replaceChild(newEle, ele);
|
||||
const toNumbers = arr => arr.map(Number);
|
||||
const wait = async (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
||||
|
||||
const capitalize = str => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
|
||||
const slugify = string => string.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]+/g, '');
|
||||
const isNumeric = str => !/[^0-9]/.test(str);
|
||||
94
build/js/include/fancytree.js
Normal file
94
build/js/include/fancytree.js
Normal file
@@ -0,0 +1,94 @@
|
||||
var glyph_opts = {
|
||||
preset: "bootstrap3",
|
||||
map: {
|
||||
}
|
||||
};
|
||||
|
||||
function initFancyTree(selector) {
|
||||
$(selector).fancytree({
|
||||
extensions: ["dnd5", "edit", "glyph", "wide"],
|
||||
checkbox: true,
|
||||
selectMode: 3,
|
||||
dnd5: {
|
||||
dragStart: function(node, data) {
|
||||
return true;
|
||||
},
|
||||
dragEnter: function(node, data) {
|
||||
return true;
|
||||
},
|
||||
dragDrop: function(node, data) {
|
||||
data.otherNode.copyTo(node, data.hitMode);
|
||||
}
|
||||
},
|
||||
glyph: glyph_opts,
|
||||
// source: {url: "ajax-tree-taxonomy.json", debugDelay: 1000},
|
||||
source: {
|
||||
url: "ajax-tree-products.json",
|
||||
debugDelay: 1000
|
||||
},
|
||||
// toggleEffect: { effect: "drop", options: {direction: "left"}, duration: 400 },
|
||||
wide: {
|
||||
iconWidth: "1em", // Adjust this if @fancy-icon-width != "16px"
|
||||
iconSpacing: "0.5em", // Adjust this if @fancy-icon-spacing != "3px"
|
||||
labelSpacing: "0.1em", // Adjust this if padding between icon and label != "3px"
|
||||
levelOfs: "1.5em" // Adjust this if ul padding != "16px"
|
||||
},
|
||||
|
||||
icon: function(event, data) {
|
||||
// if( data.node.isFolder() ) {
|
||||
// return "glyphicon glyphicon-book";
|
||||
// }
|
||||
},
|
||||
lazyLoad: function(event, data) {
|
||||
data.result = {
|
||||
url: "ajax-sub2.json",
|
||||
debugDelay: 1000
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initFancyTreeTable(selector) {
|
||||
$(selector).fancytree({
|
||||
extensions: ["dnd5", "edit", "glyph", "table"],
|
||||
checkbox: true,
|
||||
dnd5: {
|
||||
dragStart: function(node, data) {
|
||||
return true;
|
||||
},
|
||||
dragEnter: function(node, data) {
|
||||
return true;
|
||||
},
|
||||
dragDrop: function(node, data) {
|
||||
data.otherNode.copyTo(node, data.hitMode);
|
||||
}
|
||||
},
|
||||
glyph: glyph_opts,
|
||||
source: {
|
||||
url: "ajax-tree-taxonomy.json",
|
||||
debugDelay: 1000
|
||||
},
|
||||
table: {
|
||||
checkboxColumnIdx: 1,
|
||||
nodeColumnIdx: 2
|
||||
},
|
||||
activate: function(event, data) {
|
||||
},
|
||||
lazyLoad: function(event, data) {
|
||||
data.result = {
|
||||
url: "ajax-sub2.json",
|
||||
debugDelay: 1000
|
||||
};
|
||||
},
|
||||
renderColumns: function(event, data) {
|
||||
var node = data.node,
|
||||
$tdList = $(node.tr).find(">td");
|
||||
$tdList.eq(0).text(node.getIndexHier());
|
||||
$tdList.eq(3).text(!!node.folder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
});
|
||||
409
build/js/include/file.js
Normal file
409
build/js/include/file.js
Normal file
@@ -0,0 +1,409 @@
|
||||
var fileManager = {
|
||||
selected: [], // stocke les fichiers déjà enregistrés
|
||||
currentSelected: [], // stocke les fichiers en cours
|
||||
toRemove: [],
|
||||
callback: null, // indique la fonction à exécuter pour le renvoi des fichiers sélectionnées à la validation de la sélection
|
||||
subFolder: '0', // indique le sous-répertoire dans lequel les fichiers seront uploadés
|
||||
forSubcontract: false, // indique si on upload des fichiers pour les contrats ou sous-contrats
|
||||
js_confirm: null, // la jquery confirm
|
||||
parent: null,
|
||||
|
||||
init: function(title, chosen, category, callback, forSubcontract, parent, novation) {
|
||||
this.selected = ( typeof(chosen) != 'undefined' ) ? chosen : [];
|
||||
this.currentSelected = [];
|
||||
this.callback = ( typeof(callback) != 'undefined' ) ? callback : null;
|
||||
this.forSubcontract = ( typeof(forSubcontract) != 'undefined' ) ? forSubcontract : null;
|
||||
this.category = category; // stocke le sous-répertoire d'upload
|
||||
this.subFolder = category; // stocke le sous-répertoire d'upload
|
||||
this.parent = parent;
|
||||
this.novation = ( typeof(novation) != 'undefined' ) ? true : false;
|
||||
this.js_confirm = this.renderModal(title);
|
||||
},
|
||||
initAddFile: function() {
|
||||
var that = this;
|
||||
$('#add_files').off('click').on('click', function() {
|
||||
var index = objectLength(that.currentSelected);
|
||||
console.log('add_files');
|
||||
console.log(index);
|
||||
if (index > 1) {
|
||||
var isValid = that.checkValidity(index - 1);
|
||||
} else {
|
||||
var isValid = true;
|
||||
}
|
||||
|
||||
if (isValid) {
|
||||
var infos = {
|
||||
pdfFile: {},
|
||||
docFile: {},
|
||||
title: '',
|
||||
effective_date: '',
|
||||
};
|
||||
that.newFile(infos);
|
||||
that.updateImportedFilesMessage(objectLength(that.currentSelected));
|
||||
}
|
||||
});
|
||||
},
|
||||
checkValidity: function(index) {
|
||||
// console.log('checkValidity');
|
||||
// console.log(index);
|
||||
|
||||
var selector = '#uploader_files_' + index + ' form';
|
||||
// console.log(selector);
|
||||
var form = $(selector);
|
||||
// console.log(form);
|
||||
var fields = selector + ' input,' + selector + ' textarea,' + selector + ' select';
|
||||
// console.log(selector);
|
||||
var validity = true;
|
||||
|
||||
var pdfFile = this.currentSelected[index].pdfFile;
|
||||
// console.log(typeof(pdfFile));
|
||||
|
||||
if (typeof(pdfFile.name) == 'undefined') {
|
||||
console.log("Pas de fichier");
|
||||
$(selector + '[name="import_pdf_form"] .contract-file-upload').addClass('error');
|
||||
validity = false;
|
||||
} else {
|
||||
$(selector + '[name="import_pdf_form"] .contract-file-upload').removeClass('error');
|
||||
}
|
||||
|
||||
$(fields).filter('[required]').each(function(i, required){
|
||||
// console.log(required);
|
||||
if ($(required).val() == '') {
|
||||
if ($(required).hasClass('chosen-select')) {
|
||||
$(required).siblings('.chosen-container').addClass('form-control error pt-0');
|
||||
} else {
|
||||
$(required).addClass('error');
|
||||
}
|
||||
// console.log('validity false');
|
||||
// console.log(required);
|
||||
validity = false;
|
||||
} else {
|
||||
if ($(required).hasClass('chosen-select')) {
|
||||
$(required).siblings('.chosen-container').removeClass('form-control error pt-0');
|
||||
} else {
|
||||
$(required).removeClass('error');
|
||||
}
|
||||
}
|
||||
});
|
||||
return validity;
|
||||
|
||||
},
|
||||
initDeleteRow: function(selector) {
|
||||
var that = this;
|
||||
$(selector + ' button.contract-del-btn').off('click').on('click', function() {
|
||||
var index = $(this).data('index');
|
||||
// TODO effacer currenselect[index] et mettre dans elements à deleter
|
||||
that.removeRow(index);
|
||||
that.updateImportedFilesMessage(objectLength(currentSelected));
|
||||
});
|
||||
},
|
||||
initDeleteFile: function(selector, selector2) {
|
||||
// console.log(this, selector, selector2);
|
||||
var that = this;
|
||||
$(selector2 + ' .imported_files ul.jFiler-items-list li a.file-del-btn').off('click').on('click', function() {
|
||||
that.removeFile(this, selector, selector2);
|
||||
});
|
||||
},
|
||||
renderModal: function(title) {
|
||||
var that = this;
|
||||
var confirm = $.confirm({
|
||||
title: title,
|
||||
columnClass: 'col-md-9',
|
||||
content: function() {
|
||||
var content = '\
|
||||
<div class="row">\
|
||||
<div class="col-12" id="files_selection"></div>\
|
||||
<div class="col-12 text-center text-white mb-2" id="no_imported_files">'+translate.getText.no_imported_files+'</div>\
|
||||
<div class="col-12 text-center mb-0"><button class="btn btn-xs btn-success uppercase weight-700" id="add_files"><i class="glyph-icon icon-plus"></i> '+translate.getText.new_file+'</button></div>\
|
||||
</div>\
|
||||
';
|
||||
return content;
|
||||
},
|
||||
onContentReady: function() {
|
||||
if ( objectLength(that.selected) > 0 ) {
|
||||
$.each(that.selected, function(i, elem) {
|
||||
that.newFile(that.selected[i]);
|
||||
});
|
||||
}
|
||||
that.initAddFile();
|
||||
that.updateImportedFilesMessage(objectLength(that.currentSelected));
|
||||
|
||||
},
|
||||
type: 'orange',
|
||||
theme: 'theme2',
|
||||
typeAnimated: true,
|
||||
buttons: {
|
||||
validate: {
|
||||
text: '<i class="glyph-icon icon-elusive-ok"></i>' + translate.getText.validate,
|
||||
btnClass: 'btn-green',
|
||||
action: function() {
|
||||
var isValid = true;
|
||||
$.each(that.currentSelected, function(i, elem) {
|
||||
var selector = '#uploader_files_' + i;
|
||||
isValid = isValid && that.checkValidity(i);
|
||||
// vérifie qu'il y ait bien un fichier PDF d'uploadé
|
||||
/*
|
||||
$(selector + ' .contract-file-upload').removeClass('error');
|
||||
if ( typeof(that.currentSelected[i].pdfFile.name) === 'undefined' ) {
|
||||
$(selector + ' .contract-file-upload').addClass('error');
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
return false;
|
||||
} else {
|
||||
// retourne les fichiers sélectionnés en appelant la fonction de retour des paramètres
|
||||
that.returnSelection();
|
||||
}
|
||||
}
|
||||
},
|
||||
close: {
|
||||
text: '<i class="glyph-icon icon-elusive-cancel"></i>'+translate.getText.cancel,
|
||||
btnClass: 'btn-red',
|
||||
action: function() { }
|
||||
}
|
||||
}
|
||||
});
|
||||
return confirm;
|
||||
},
|
||||
renderUploader: function(index, file, selector, uploadRoute, extensions, chooseText) {
|
||||
console.log("renderUploader");
|
||||
console.log(selector);
|
||||
var that = this;
|
||||
console.log(that);
|
||||
renderUploaderFiler(index, file, selector, uploadRoute, extensions, chooseText, that);
|
||||
},
|
||||
newFile: function(file) {
|
||||
console.log('newFile');
|
||||
console.log(file);
|
||||
// empile les contrats sélectionnés
|
||||
this.currentSelected.push(file);
|
||||
// charge le contrat sélectionné
|
||||
this.newUploader(file);
|
||||
initChosen();
|
||||
initValidator();
|
||||
},
|
||||
newUploader: function(file) {
|
||||
console.log('new uploader');
|
||||
console.log(file);
|
||||
var that = this;
|
||||
console.log(that.novation);
|
||||
// var index = getIndexOf(this.currentSelected, file.id);
|
||||
var count = objectLength(this.currentSelected);
|
||||
var index = count - 1;
|
||||
var path = '/assets/apps/ContractDrive/templates/';
|
||||
if (that.novation) {
|
||||
var third_parties = null;
|
||||
$.ajax({
|
||||
async: false,
|
||||
method: "POST",
|
||||
dataType: "json",
|
||||
url: laroute.route("Stack.API.ThirdParty.getThirdParties"),
|
||||
data: { third_party_type: 'counterpart' }
|
||||
}).done(function(response) {
|
||||
third_parties = response.listing;
|
||||
});
|
||||
} else {
|
||||
var third_parties = null;
|
||||
}
|
||||
// console.log(third_parties);
|
||||
var extra = ((that.category == 3) && (count == 1)) ? false : true;
|
||||
var data = {
|
||||
index: index,
|
||||
count: count,
|
||||
id: (typeof(file.id) !== 'undefined') ? file.id : null,
|
||||
translate: translate,
|
||||
novation: that.novation,
|
||||
extra: extra,
|
||||
category: that.category,
|
||||
third_parties: third_parties
|
||||
};
|
||||
var content = getTemplate(path + 'files-uploader.html', data);
|
||||
|
||||
$('#files_selection').append(content);
|
||||
var selector = '#uploader_files_' + index;
|
||||
|
||||
this.initDeleteRow(selector);
|
||||
|
||||
// initialise les file uploader
|
||||
this.parent.initFilesUploader(file, index);
|
||||
this.renderFiles(file, selector);
|
||||
|
||||
// désaffiche le titre et la date de signature pour le 1er fichier de catégorie "contrat" à upload
|
||||
if ( that.subFolder == '3' && index == 0 && !(that.forSubcontract) ) {
|
||||
$(selector + ' form[name="import_file_infos_form"]').hide();
|
||||
}
|
||||
|
||||
var picker = getDaterangePicker(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]');
|
||||
|
||||
$(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]').next('span.add-on').off('click').on('click', function() {
|
||||
$(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]').trigger('click');
|
||||
});
|
||||
|
||||
// sur changement de date
|
||||
/*
|
||||
$(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]').on('apply.daterangepicker', function(ev, picker) {
|
||||
$(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_effective_date"]').val(picker.startDate.format(dateRangePickerLanguage.format));
|
||||
});
|
||||
*/
|
||||
},
|
||||
createFile: function(item, index, file) {
|
||||
//console.log(that.currentSelected);
|
||||
if (file.extension == 'pdf') {
|
||||
this.currentSelected[index].pdfFile = file;
|
||||
this.currentSelected[index].pdfFile.isNew = true;
|
||||
} else {
|
||||
this.currentSelected[index].docFile = file;
|
||||
this.currentSelected[index].docFile.isNew = true;
|
||||
}
|
||||
// enregistre le fichier dans les fichiers uploadés en cours
|
||||
$(item).find('.jFiler-item-others').html('\
|
||||
<span><i class="glyph-icon icon-file"></i> <b>'+translate.getText.type+':</b> '+strtoupper(file.extension)+'</span>\
|
||||
<div class="current-status text-success"><i class="icon-jfi-check-circle"></i></div>\
|
||||
');
|
||||
$(item).find('.jFiler-item-icon i').removeClass('icon-jfi-file-o').removeClass('jfi-file-ext-docx').addClass('icon-file-uploaded '+strtolower(file.extension));
|
||||
this.addFileInfo(index);
|
||||
},
|
||||
addFileInfo: function(index) {
|
||||
console.log('addFileInfo');
|
||||
console.log(index);
|
||||
if (typeof(index) != 'undefined') {
|
||||
var selector = '#uploader_files_' + index;
|
||||
this.currentSelected[index].title = $(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_title"]').val();
|
||||
var effective_date = $(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]').val();
|
||||
console.log('effective_date');
|
||||
console.log(effective_date);
|
||||
this.currentSelected[index].effective_date = effective_date;
|
||||
var third_party_id = $(selector + ' form[name="import_file_infos_form"] select[name="third_party_out"]').val();
|
||||
if (typeof(third_party_id) != 'undefined') {
|
||||
this.currentSelected[index].novation = {};
|
||||
this.currentSelected[index].novation.third_party_id = third_party_id;
|
||||
this.currentSelected[index].novation.name = $(selector + ' form[name="import_file_infos_form"] select[name="third_party_out"] option:selected').text();
|
||||
}
|
||||
console.log(this.currentSelected[index]);
|
||||
}
|
||||
},
|
||||
removeRow: function(index) {
|
||||
console.log('remove row');
|
||||
console.log(index);
|
||||
$('#uploader_files_' + index).remove();
|
||||
this.toRemove.push(this.currentSelected[index]);
|
||||
this.currentSelected.splice(index, 1);
|
||||
console.log(this.currentSelected);
|
||||
console.log(this.toRemove);
|
||||
this.reIndex();
|
||||
},
|
||||
removeFile: function(item, selector, selector2) {
|
||||
var id = $(item).data('id');
|
||||
console.log(id);
|
||||
console.log(item);
|
||||
console.log(selector);
|
||||
console.log(selector2);
|
||||
// $(item).parent().parent().parent().parent().parent().parent().parent().remove();
|
||||
// file.docFile = {};
|
||||
//console.log(filesEdit.currentSelected);
|
||||
$(selector + ' .contract-file-upload').show();
|
||||
$(selector2).hide();
|
||||
},
|
||||
reIndex: function() {
|
||||
console.log("reindex");
|
||||
// refixe les numéros des tableaux
|
||||
var that = this;
|
||||
$.each(that.currentSelected, function(i, elem) {
|
||||
// var sel = '#uploader_files_' + i;
|
||||
var sel = '.files-list:eq( '+i+' )';
|
||||
console.log(sel);
|
||||
$(sel + ' .file-count').html(parseInt(i+1));
|
||||
$(sel).attr('id', '#uploader_files_' + i);
|
||||
// désaffiche la titre et la date de signature pour le 1er fichier de catégorie "contrat" à upload
|
||||
if ( that.subFolder == '3' && i == 0 && that.forSubcontract == false ) {
|
||||
$(sel + ' form[name="import_file_infos_form"]').hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
renderFiles: function(file, selector) {
|
||||
console.log('renderFiles');
|
||||
console.log(file, selector);
|
||||
var that = this;
|
||||
// restaure le fichier PDF
|
||||
if ( typeof(file.pdfFile) !== 'undefined' ) {
|
||||
this.renderFile(file.pdfFile, 'pdf', selector + ' form[name="import_pdf_form"]', selector + ' form[name="already_imported_pdf_form"]');
|
||||
}
|
||||
|
||||
// restaure le fichier DOC/DOCX
|
||||
if (typeof(file.docFile) !== 'undefined') {
|
||||
this.renderFile(file.docFile, 'doc', selector + ' form[name="import_doc_form"]', selector + ' form[name="already_imported_doc_form"]');
|
||||
}
|
||||
|
||||
// restaure la date
|
||||
if (( typeof(file.effective_date) !== 'undefined' ) && (file.effective_date != '')) {
|
||||
$(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]').val(file.effective_date);
|
||||
// var date_range_start = moment(file.effectiveDate, dateRangePickerLanguage.format).format(translate.getText.date_format_moment);
|
||||
// var date_range_start = file.effective_date;
|
||||
// $(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_date"]').data('daterangepicker').setStartDate(date_range_start);
|
||||
}
|
||||
|
||||
// restaure le titre
|
||||
if ( typeof(file.title) !== 'undefined' ) {
|
||||
$(selector + ' form[name="import_file_infos_form"] input[name="import_file_infos_title"]').val(file.title);
|
||||
}
|
||||
|
||||
if ( (typeof(file.novation) !== 'undefined') && (file.novation != null) ) {
|
||||
console.log(file.novation.third_party_id);
|
||||
$(selector + ' form[name="import_file_infos_form"] select[name="third_party_out"]').val(file.novation.third_party_id).trigger("chosen:updated");
|
||||
}
|
||||
|
||||
$(selector + ' form[name="import_file_infos_form"] input').change(function() {
|
||||
index = $(this).data('index');
|
||||
that.addFileInfo(index);
|
||||
});
|
||||
|
||||
$(selector + ' form[name="import_file_infos_form"] select').change(function() {
|
||||
index = $(this).data('index');
|
||||
that.addFileInfo(index);
|
||||
});
|
||||
|
||||
},
|
||||
renderFile: function(file, type, selector, selector2) {
|
||||
// console.log('renderFile');
|
||||
// console.log(file, selector, selector2);
|
||||
var that = this;
|
||||
var path = '/assets/apps/ContractDrive/templates/';
|
||||
if (typeof(file.name) !== 'undefined') {
|
||||
console.log('deja uploadé');
|
||||
$(selector + ' .contract-file-upload').hide();
|
||||
var data = {'file' : file, 'translate' : translate};
|
||||
var content = getTemplate(path + 'files-row.html', data);
|
||||
$(selector2 + ' .imported_files ul.jFiler-items-list').append(content);
|
||||
$(selector2).show();
|
||||
}
|
||||
|
||||
this.initDeleteFile(selector, selector2);
|
||||
},
|
||||
activeJConfirmButtons: function(inOut) {
|
||||
if ( inOut ) {
|
||||
this.js_confirm.buttons.close.enable();
|
||||
this.js_confirm.buttons.validate.enable();
|
||||
} else {
|
||||
this.js_confirm.buttons.close.disable();
|
||||
this.js_confirm.buttons.validate.disable();
|
||||
}
|
||||
},
|
||||
updateImportedFilesMessage: function(tot) {
|
||||
if ( tot > 0 ) {
|
||||
$('#no_imported_files').hide();
|
||||
} else {
|
||||
$('#no_imported_files').show();
|
||||
}
|
||||
},
|
||||
returnSelection: function() {
|
||||
this.parent.selected = this.currentSelected;
|
||||
this.parent.toRemove = this.toRemove;
|
||||
if ( this.callback != null ) {
|
||||
console.log(this.callback);
|
||||
eval(this.callback);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
41
build/js/include/plugins/datatables_lang/de.json
Normal file
41
build/js/include/plugins/datatables_lang/de.json
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"sEmptyTable": "Keine Daten in der Tabelle vorhanden",
|
||||
"sInfo": "_START_ bis _END_ von _TOTAL_ Einträgen",
|
||||
"sInfoEmpty": "Keine Daten vorhanden",
|
||||
"sInfoFiltered": "(gefiltert von _MAX_ Einträgen)",
|
||||
"sInfoPostFix": "",
|
||||
"sInfoThousands": ".",
|
||||
"sLengthMenu": "_MENU_ Einträge anzeigen",
|
||||
"sLoadingRecords": "Wird geladen ..",
|
||||
"sProcessing": "Bitte warten ..",
|
||||
"sSearch": "Suchen",
|
||||
"sZeroRecords": "Keine Einträge vorhanden",
|
||||
"oPaginate": {
|
||||
"sFirst": "Erste",
|
||||
"sPrevious": "Zurück",
|
||||
"sNext": "Nächste",
|
||||
"sLast": "Letzte"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
|
||||
"sSortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
|
||||
},
|
||||
"select": {
|
||||
"rows": {
|
||||
"_": "%d Zeilen ausgewählt",
|
||||
"0": "",
|
||||
"1": "1 Zeile ausgewählt"
|
||||
}
|
||||
},
|
||||
"buttons": {
|
||||
"print": "Drucken",
|
||||
"colvis": "Spalten",
|
||||
"copy": "Kopieren",
|
||||
"copyTitle": "In Zwischenablage kopieren",
|
||||
"copyKeys": "Taste <i>ctrl</i> oder <i>\u2318</i> + <i>C</i> um Tabelle<br>in Zwischenspeicher zu kopieren.<br><br>Um abzubrechen die Nachricht anklicken oder Escape drücken.",
|
||||
"copySuccess": {
|
||||
"_": "%d Zeilen kopiert",
|
||||
"1": "1 Zeile kopiert"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
build/js/include/plugins/datatables_lang/en.json
Normal file
23
build/js/include/plugins/datatables_lang/en.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"sEmptyTable": "No data available in table",
|
||||
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
|
||||
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
|
||||
"sInfoFiltered": "(filtered from _MAX_ total entries)",
|
||||
"sInfoPostFix": "",
|
||||
"sInfoThousands": ",",
|
||||
"sLengthMenu": "Show _MENU_ entries",
|
||||
"sLoadingRecords": "Loading...",
|
||||
"sProcessing": "Processing...",
|
||||
"sSearch": "Search:",
|
||||
"sZeroRecords": "No matching records found",
|
||||
"oPaginate": {
|
||||
"sFirst": "First",
|
||||
"sLast": "Last",
|
||||
"sNext": "Next",
|
||||
"sPrevious": "Previous"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": activate to sort column ascending",
|
||||
"sSortDescending": ": activate to sort column descending"
|
||||
}
|
||||
}
|
||||
29
build/js/include/plugins/datatables_lang/fr.json
Normal file
29
build/js/include/plugins/datatables_lang/fr.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"sProcessing": "Traitement en cours...",
|
||||
"sSearch": "Rechercher :",
|
||||
"sLengthMenu": "Afficher _MENU_ éléments",
|
||||
"sInfo": "Affichage de l'élément _START_ à _END_ sur _TOTAL_ éléments",
|
||||
"sInfoEmpty": "Affichage de l'élément 0 à 0 sur 0 élément",
|
||||
"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
|
||||
"sInfoPostFix": "",
|
||||
"sLoadingRecords": "Chargement en cours...",
|
||||
"sZeroRecords": "Aucun élément à afficher",
|
||||
"sEmptyTable": "Aucune donnée disponible dans le tableau",
|
||||
"oPaginate": {
|
||||
"sFirst": "Premier",
|
||||
"sPrevious": "Précédent",
|
||||
"sNext": "Suivant",
|
||||
"sLast": "Dernier"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
|
||||
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
|
||||
},
|
||||
"select": {
|
||||
"rows": {
|
||||
"_": "%d lignes sélectionnées",
|
||||
"0": "Aucune ligne sélectionnée",
|
||||
"1": "1 ligne sélectionnée"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
build/js/include/plugins/datatables_lang/it.json
Normal file
23
build/js/include/plugins/datatables_lang/it.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"sEmptyTable": "Nessun dato presente nella tabella",
|
||||
"sInfo": "Vista da _START_ a _END_ di _TOTAL_ elementi",
|
||||
"sInfoEmpty": "Vista da 0 a 0 di 0 elementi",
|
||||
"sInfoFiltered": "(filtrati da _MAX_ elementi totali)",
|
||||
"sInfoPostFix": "",
|
||||
"sInfoThousands": ".",
|
||||
"sLengthMenu": "Visualizza _MENU_ elementi",
|
||||
"sLoadingRecords": "Caricamento...",
|
||||
"sProcessing": "Elaborazione...",
|
||||
"sSearch": "Cerca:",
|
||||
"sZeroRecords": "La ricerca non ha portato alcun risultato.",
|
||||
"oPaginate": {
|
||||
"sFirst": "Inizio",
|
||||
"sPrevious": "Precedente",
|
||||
"sNext": "Successivo",
|
||||
"sLast": "Fine"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": attiva per ordinare la colonna in ordine crescente",
|
||||
"sSortDescending": ": attiva per ordinare la colonna in ordine decrescente"
|
||||
}
|
||||
}
|
||||
23
build/js/include/plugins/datatables_lang/jp.json
Normal file
23
build/js/include/plugins/datatables_lang/jp.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"sEmptyTable": "テーブルにデータがありません",
|
||||
"sInfo": " _TOTAL_ 件中 _START_ から _END_ まで表示",
|
||||
"sInfoEmpty": " 0 件中 0 から 0 まで表示",
|
||||
"sInfoFiltered": "(全 _MAX_ 件より抽出)",
|
||||
"sInfoPostFix": "",
|
||||
"sInfoThousands": ",",
|
||||
"sLengthMenu": "_MENU_ 件表示",
|
||||
"sLoadingRecords": "読み込み中...",
|
||||
"sProcessing": "処理中...",
|
||||
"sSearch": "検索:",
|
||||
"sZeroRecords": "一致するレコードがありません",
|
||||
"oPaginate": {
|
||||
"sFirst": "先頭",
|
||||
"sLast": "最終",
|
||||
"sNext": "次",
|
||||
"sPrevious": "前"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 列を昇順に並べ替えるにはアクティブにする",
|
||||
"sSortDescending": ": 列を降順に並べ替えるにはアクティブにする"
|
||||
}
|
||||
}
|
||||
28
build/js/include/plugins/datatables_lang/sp.json
Normal file
28
build/js/include/plugins/datatables_lang/sp.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"sProcessing": "Procesando...",
|
||||
"sLengthMenu": "Mostrar _MENU_ registros",
|
||||
"sZeroRecords": "No se encontraron resultados",
|
||||
"sEmptyTable": "Ningún dato disponible en esta tabla =(",
|
||||
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
|
||||
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
|
||||
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "Buscar:",
|
||||
"sUrl": "",
|
||||
"sInfoThousands": ",",
|
||||
"sLoadingRecords": "Cargando...",
|
||||
"oPaginate": {
|
||||
"sFirst": "Primero",
|
||||
"sLast": "Último",
|
||||
"sNext": "Siguiente",
|
||||
"sPrevious": "Anterior"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
|
||||
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
|
||||
},
|
||||
"buttons": {
|
||||
"copy": "Copiar",
|
||||
"colvis": "Visibilidad"
|
||||
}
|
||||
}
|
||||
109
build/js/include/uploader.js
Normal file
109
build/js/include/uploader.js
Normal file
@@ -0,0 +1,109 @@
|
||||
function renderUploaderFiler(index, the_file, selector, uploadRoute, extensions, chooseText, that) {
|
||||
$(selector + ' input[name="files[]"]').filer({
|
||||
showThumbs: true,
|
||||
addMore: true,
|
||||
allowDuplicates: false,
|
||||
limit: 1,
|
||||
maxSize: null,
|
||||
changeInput: '<div class="jFiler-input-dragDrop nomargin-bottom contract-file-upload required pointer p-2 w-100">\
|
||||
<div class="jFiler-input-inner">\
|
||||
<div class="jFiler-input-icon">\
|
||||
<i class="icon-jfi-folder"></i>\
|
||||
</div>\
|
||||
<div class="jFiler-input-text">\
|
||||
<h3>'+chooseText+'</h3>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>',
|
||||
extensions: extensions,
|
||||
uploadFile: {
|
||||
url: laroute.route(uploadRoute),
|
||||
data: {
|
||||
action: 'upload',
|
||||
extensions: extensions,
|
||||
sub_folder: that.subFolder
|
||||
},
|
||||
type: 'POST',
|
||||
enctype: 'multipart/form-data',
|
||||
synchron: true,
|
||||
beforeSend: function() {
|
||||
that.activeJConfirmButtons(false);
|
||||
$(selector + ' .contract-file-upload').hide();
|
||||
},
|
||||
success: function(data, itemEl, listEl, boxEl, newInputEl, inputEl, id) {
|
||||
// console.log('upload');
|
||||
// console.log(data);
|
||||
// console.log(id);
|
||||
// var index = getIndexOf(that.currentSelected, the_file.id);
|
||||
// var parent = itemEl.find(".jFiler-jProgressBar").parent();
|
||||
var new_file_name = JSON.parse(data);
|
||||
var filerKit = inputEl.prop("jFiler");
|
||||
filerKit.files_list[id].name = new_file_name;
|
||||
itemEl.find(".jFiler-jProgressBar").fadeOut("slow");
|
||||
that.createFile(itemEl, index, new_file_name);
|
||||
},
|
||||
error: function(el) {
|
||||
el.find(".jFiler-jProgressBar").fadeOut("slow");
|
||||
el.find('.jFiler-item-others').html('\
|
||||
<span><i class="glyph-icon icon-file"></i> <b>'+translate.getText.type+':</b> '+strtoupper(new_file_name.extension)+'</span>\
|
||||
<div class="current-status text-error"><i class="icon-jfi-minus-circle"></i></div>\
|
||||
');
|
||||
},
|
||||
statusCode: null,
|
||||
onProgress: null,
|
||||
onComplete: function() {
|
||||
that.activeJConfirmButtons(true);
|
||||
}
|
||||
},
|
||||
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 index = getIndexOf(that.currentSelected, the_file.id);
|
||||
that.currentSelected[index].pdfFile = {};
|
||||
$(selector + ' .contract-file-upload').show();
|
||||
},
|
||||
onEmpty: null,
|
||||
options: null,
|
||||
dialogs: {
|
||||
alert: function(text) {
|
||||
$.dialog({ title: translate.getText.warning, content: text });
|
||||
},
|
||||
confirm: function (text, callback) {
|
||||
$.confirm({
|
||||
title: translate.getText.warning,
|
||||
content: text,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: translate.getText.confirm,
|
||||
btnClass: 'btn-danger',
|
||||
action: function() {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: translate.getText.cancel
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
captions: {
|
||||
button: translate.getText.choose_files,
|
||||
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+": <b>{{fi-limit}}</b>",
|
||||
filesType: translate.getText.file_extension_authorized+": <b>.{{fi-extensions}}</b>",
|
||||
filesSize: translate.getText.file_max_size_authorized+": <b>{{fi-maxSize}} MB.</b>"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user