Add new version in repository
This commit is contained in:
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