|
|
@@ -152,11 +152,11 @@ if (isset($document["id"])) {
|
|
|
<?php } ?>
|
|
|
|
|
|
<?php document::printAttachement($files); ?>
|
|
|
-
|
|
|
+ <div id="error-type-file" class="alert alert-danger" style="display:none;"></div>
|
|
|
<div class="file-drop-area">
|
|
|
<span class="choose-file-button">Ajouter une pièce jointe</span>
|
|
|
<span class="file-message">ou drag & drop</span>
|
|
|
- <input id="attachement-document" class="import-excel" name="attachement-document" type="file" onchange="dargAndDropAttachment()">
|
|
|
+ <input id="attachement-document" class="import-excel" name="attachement-document" type="file" onchange="dargAndDropAttachment()" accept="image/jpeg,image/png,application/pdf">
|
|
|
</div>
|
|
|
</div>
|
|
|
<br />
|
|
|
@@ -166,10 +166,11 @@ if (isset($document["id"])) {
|
|
|
|
|
|
<div class="col">
|
|
|
<?php if (empty($files[0]["id"])) { ?>
|
|
|
+ <div id="error-type-file" class="alert alert-danger" style="display:none;"></div>
|
|
|
<div class="file-drop-area" style="margin-top:22px;" id="file-document-import">
|
|
|
<span class="choose-file-button">Choisissez votre document</span>
|
|
|
<span class="file-message">ou drag & drop</span>
|
|
|
- <input id="document-import" class="import-excel" name="document-import" type="file" onchange="dargAndDrop()" required>
|
|
|
+ <input id="document-import" class="import-excel" name="document-import" type="file" onchange="dargAndDrop()" accept="image/jpeg,image/png,application/pdf" required>
|
|
|
</div>
|
|
|
<br />
|
|
|
<?php } else {
|
|
|
@@ -217,12 +218,32 @@ if (isset($document["id"])) {
|
|
|
|
|
|
function dargAndDrop() {
|
|
|
var fileName = $("#document-import").val().split('\\').pop();
|
|
|
- $(".file-message").text($(".file-message").text().replace("ou drag & drop", fileName));
|
|
|
+ var ext = fileName.split('.').pop();
|
|
|
+ if(ext!=="pdf" && ext!=="png" && ext!=="jpg"){
|
|
|
+ $("#error-type-file").html("Seuls les fichiers PDF, JPG et PNG sont acceptés").fadeIn(400, function() {
|
|
|
+ setTimeout(function() {
|
|
|
+ $("#error-type-file").fadeOut(1000);
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
+ $('#document-import').val("");
|
|
|
+ } else {
|
|
|
+ $(".file-message").text($(".file-message").text().replace("ou drag & drop", fileName));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function dargAndDropAttachment() {
|
|
|
var fileName = $("#attachement-document").val().split('\\').pop();
|
|
|
- $(".file-message").text($(".file-message").text().replace("ou drag & drop", fileName));
|
|
|
+ var ext = fileName.split('.').pop();
|
|
|
+ if(ext!=="pdf" && ext!=="png" && ext!=="jpg"){
|
|
|
+ $("#error-type-file").html("Seuls les fichiers PDF, JPG et PNG sont acceptés").fadeIn(400, function() {
|
|
|
+ setTimeout(function() {
|
|
|
+ $("#error-type-file").fadeOut(1000);
|
|
|
+ }, 2000);
|
|
|
+ });
|
|
|
+ $('#attachement-document').val("");
|
|
|
+ } else {
|
|
|
+ $(".file-message").text($(".file-message").text().replace("ou drag & drop", fileName));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function deleteAttachment(id){
|