|
|
@@ -14,7 +14,7 @@ if (core::getGet("id") == NULL) {
|
|
|
$document = $datas["document"];
|
|
|
$files = $datas["files"];
|
|
|
|
|
|
- if (empty($document["id"]) OR access::ifLimitAccessException("salaire") AND isset($document["id_type"]) AND $document["id_type"] == 3) {
|
|
|
+ if (empty($document["id"]) or access::ifLimitAccessException("salaire") and isset($document["id_type"]) and $document["id_type"] == 3) {
|
|
|
get::page("unknow");
|
|
|
exit();
|
|
|
}
|
|
|
@@ -56,7 +56,7 @@ echo core::filAriane(array(
|
|
|
)
|
|
|
));
|
|
|
|
|
|
-if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
+if (isset($document["id"]) and access::ifAccesss("add-document")) {
|
|
|
?>
|
|
|
<div style="float:right; margin-top: -60px;">
|
|
|
<a href="/submit.php?from=document-delete&id=<?php echo $document["id"] ?>" style="color: #dc3545; text-decoration:none;" onclick="return confirm('Voulez-vous supprimer ce document ?')"><button type="submit" class="btn btn-outline-danger btn-sm"><?php icon::getFont(["icon" => "bi-trash-fill"]) ?></i> Supprimer</button></a>
|
|
|
@@ -67,8 +67,8 @@ if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
|
|
|
<link rel="stylesheet" href="css/dragAndDrop.css">
|
|
|
<?php if (access::ifAccesss("add-document")) { ?>
|
|
|
-<form id="form-document" method="post" action="/submit.php" enctype="multipart/form-data" onsubmit="return(false);">
|
|
|
-<?php } ?>
|
|
|
+ <form id="form-document" method="post" action="/submit.php" enctype="multipart/form-data" onsubmit="return(false);">
|
|
|
+ <?php } ?>
|
|
|
<div class="row">
|
|
|
<div class="col">
|
|
|
<input type="hidden" name="from" value="document">
|
|
|
@@ -79,17 +79,21 @@ if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
<?php $_titre = (isset($document["titre"])) ? $document["titre"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Titre</label>
|
|
|
- <input type="text" class="form-control" value="<?php core::printFormValue($_titre) ?>" name="titre" placeholder="" required <?php if (!access::ifAccesss("add-document")) { echo "readonly"; } ?>>
|
|
|
+ <input type="text" class="form-control" value="<?php core::printFormValue($_titre) ?>" name="titre" placeholder="" required <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "readonly";
|
|
|
+ } ?>>
|
|
|
</div>
|
|
|
-
|
|
|
<br />
|
|
|
+
|
|
|
<?php
|
|
|
$_type_document = (isset($document["id_type"])) ? $document["id_type"] : NULL;
|
|
|
$_label_type_document = document::getTypes();
|
|
|
?>
|
|
|
<div class="form-group">
|
|
|
<label>Type de document</label>
|
|
|
- <select name="id_type" class="form-select" <?php if (!access::ifAccesss("add-document")) { echo "disabled"; } ?>>
|
|
|
+ <select id="id_type" name="id_type" class="form-select" <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "disabled";
|
|
|
+ } ?> required>
|
|
|
<option value=""></option>
|
|
|
<option value="1" <?php core::printFormSelectOption($_type_document, 1) ?>><?php echo $_label_type_document[1] ?></option>
|
|
|
<option value="2" <?php core::printFormSelectOption($_type_document, 2) ?>><?php echo $_label_type_document[2] ?></option>
|
|
|
@@ -101,45 +105,78 @@ if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
+ <?php
|
|
|
+ $_client = (isset($document["id_client"])) ? $document["id_client"] : NULL;
|
|
|
+ $_all_clients = clients::getAll();
|
|
|
+ ?>
|
|
|
+ <div class="form-group" id="client-section"<?php if($_type_document != 1){ echo 'style=" display: none;"'; } ?>>
|
|
|
+ <label>Facture(s) liée(s) à</label>
|
|
|
+ <select name="id_client" id="id_client" class="form-select" <?php if (!access::ifAccesss("add-client")) {
|
|
|
+ echo "disabled";
|
|
|
+ } ?>>
|
|
|
+ <option value=""></option>
|
|
|
+ <?php
|
|
|
+ foreach ($_all_clients as $client) {
|
|
|
+ echo '<option value="' . $client["id"] . '"';
|
|
|
+ echo $_client == $client["id"] ? " selected" : NULL;
|
|
|
+ echo '>' . $client["label"] . '</option>';
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ <br />
|
|
|
+ </div>
|
|
|
+
|
|
|
<?php $_montant = (isset($document["montant"])) ? $document["montant"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Montant associé</label>
|
|
|
- <input type="text" class="form-control" value="<?php core::printFormValue($_montant) ?>" name="montant" placeholder="" onkeypress="return (event.charCode >= 48 && event.charCode <= 57) || event.charCode == 46 || event.charCode == 0 " <?php if (!access::ifAccesss("add-document")) { echo "readonly"; } ?>>
|
|
|
+ <input type="text" class="form-control" value="<?php core::printFormValue($_montant) ?>" name="montant" placeholder="" onkeypress="return (event.charCode >= 48 && event.charCode <= 57) || event.charCode == 46 || event.charCode == 0 " <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "readonly";
|
|
|
+ } ?>>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<?php $_tagsSupplier = (isset($document["tagsSupplier"])) ? $document["tagsSupplier"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Tags associés</label>
|
|
|
- <input type="text" value="<?php core::printFormValue($_tagsSupplier) ?>" name="tagsSupplier" id="tagsSupplier" <?php if (!access::ifAccesss("add-document")) { echo "class=\"form-control\" readonly"; } ?> />
|
|
|
+ <input type="text" value="<?php core::printFormValue($_tagsSupplier) ?>" name="tagsSupplier" id="tagsSupplier" <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "class=\"form-control\" readonly";
|
|
|
+ } ?> />
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<?php $_date = (isset($document["date"])) ? $document["date"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Date associée à ce document</label>
|
|
|
- <input type="date" class="form-control" name="date" value="<?php core::printFormValue($_date) ?>" placeholder="" required <?php if (!access::ifAccesss("add-document")) { echo "readonly"; } ?>>
|
|
|
+ <input type="date" class="form-control" name="date" value="<?php core::printFormValue($_date) ?>" placeholder="" required <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "readonly";
|
|
|
+ } ?>>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<?php $_deadline = (isset($document["deadline"])) ? $document["deadline"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Date limite de traitement</label>
|
|
|
- <input type="date" class="form-control" name="deadline" value="<?php core::printFormValue($_deadline) ?>" placeholder="" required <?php if (!access::ifAccesss("add-document")) { echo "readonly"; } ?>>
|
|
|
+ <input type="date" class="form-control" name="deadline" value="<?php core::printFormValue($_deadline) ?>" placeholder="" required <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "readonly";
|
|
|
+ } ?>>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<?php $_description = (isset($document["description"])) ? $document["description"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Description et commentaires</label>
|
|
|
- <textarea class="form-control" name="description" style="height:100%;" <?php if (!access::ifAccesss("add-document")) { echo "readonly"; } ?>><?php core::printFormValue($_description) ?></textarea>
|
|
|
+ <textarea class="form-control" name="description" style="height:100%;" <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "readonly";
|
|
|
+ } ?>><?php core::printFormValue($_description) ?></textarea>
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
<?php $_tagsUser = (isset($document["tagsUser"])) ? $document["tagsUser"] : NULL; ?>
|
|
|
<div class="form-group">
|
|
|
<label>Attribution</label>
|
|
|
- <input type="text" value="<?php core::printFormValue($_tagsUser) ?>" name="tagsUser" id="tagsUser" <?php if (!access::ifAccesss("add-document")) { echo "class=\"form-control\" readonly"; } ?> />
|
|
|
+ <input type="text" value="<?php core::printFormValue($_tagsUser) ?>" name="tagsUser" id="tagsUser" <?php if (!access::ifAccesss("add-document")) {
|
|
|
+ echo "class=\"form-control\" readonly";
|
|
|
+ } ?> />
|
|
|
</div>
|
|
|
<br />
|
|
|
|
|
|
@@ -163,11 +200,11 @@ if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
document::printAttachement($files);
|
|
|
?>
|
|
|
<?php if (access::ifAccesss("add-document")) { ?>
|
|
|
- <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()" accept="image/jpeg,image/png,application/pdf,text/xml,application/xml">
|
|
|
- </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()" accept="image/jpeg,image/png,application/pdf,text/xml,application/xml">
|
|
|
+ </div>
|
|
|
<?php } ?>
|
|
|
</div>
|
|
|
<br />
|
|
|
@@ -184,8 +221,8 @@ if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
<br />
|
|
|
<?php } else {
|
|
|
$getMime = mime_content_type(file::download($files["principal"]["id"], DIR_DATAS_DOCS));
|
|
|
- $heigh = ($getMime == "application/pdf" OR $getMime == "text/xml" OR $getMime == "application/xml") ? "height:110vh;" : NULL;
|
|
|
- $marginTop = ($getMime == "text/xml" OR $getMime == "application/xml") ? "margin-top:4px;" : "margin-top:22px;";
|
|
|
+ $heigh = ($getMime == "application/pdf" or $getMime == "text/xml" or $getMime == "application/xml") ? "height:110vh;" : NULL;
|
|
|
+ $marginTop = ($getMime == "text/xml" or $getMime == "application/xml") ? "margin-top:4px;" : "margin-top:22px;";
|
|
|
echo ' <div style="' . $marginTop . '">
|
|
|
<embed src="/document.php?id=' . $files["principal"]["id"] . '" style="width:100%; margin-top:10px;' . $heigh . '" /></embed>
|
|
|
</div><br />
|
|
|
@@ -194,11 +231,11 @@ if (isset($document["id"]) AND access::ifAccesss("add-document")) {
|
|
|
?>
|
|
|
</div>
|
|
|
</div>
|
|
|
-<?php if (access::ifAccesss("add-document")) { ?>
|
|
|
- <input class="btn btn-primary btn-lg" style="width: 100%;" type="button" value="<?php echo $submit ?>" onclick="validateAndSubmit()">
|
|
|
-</form>
|
|
|
+ <?php if (access::ifAccesss("add-document")) { ?>
|
|
|
+ <input class="btn btn-primary btn-lg" style="width: 100%;" type="button" value="<?php echo $submit ?>" onclick="validateAndSubmit()">
|
|
|
+ </form>
|
|
|
|
|
|
<?php
|
|
|
-}
|
|
|
+ }
|
|
|
get::javascript("document");
|
|
|
-?>
|
|
|
+?>
|