added new file upload and bug fix
This commit is contained in:
@@ -437,9 +437,10 @@ $pagination_entity_name = "Adressen";
|
||||
<div class="card-body">
|
||||
<button type="button" class="btn btn-sm btn-info" onclick="$('#new-journal').toggle(); $('#new-journal-text').focus()"><i class="fas fa-plus"></i> Neuer Journaleintrag</button>
|
||||
<div id="new-journal" class="hidden mt-2">
|
||||
<form method="post" action="<?=self::getUrl("ConstructionConsentJournal", "save")?>">
|
||||
<form method="post" action="<?=self::getUrl("ConstructionConsentJournal", "save")?>" enctype="multipart/form-data">
|
||||
<input type="hidden" name="consent_id" value="<?=$item->id?>" />
|
||||
<textarea id="new-journal-text" name="text" class="form-control mb-2" style="height:120px;" placeholder="Text hier eingeben..."></textarea>
|
||||
<input type="file" name="file" class="form-control mb-2" />
|
||||
<button class="btn btn-sm btn-primary" type="submit"><i class="fas fa-save"></i> Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -452,6 +453,19 @@ $pagination_entity_name = "Adressen";
|
||||
<td style="white-space: nowrap" class="text-monospace"><?=date("d.m.Y H:i", $j->create)?> (<?=$j->creator?>)</td>
|
||||
<td style="width: 100%">
|
||||
<?=nl2br($j->text)?>
|
||||
<?php if($j->file_id): ?>
|
||||
<a href="<?=self::getUrl("File", "download", ["id" => $j->file_id])?>" class="ml-2"><i class="far fa-fw fa-file"></i>
|
||||
<?php
|
||||
$file = new File($j->file_id);
|
||||
if ($file->fileExists()) {
|
||||
echo $file->filename;
|
||||
} else {
|
||||
echo "Datei nicht gefunden";
|
||||
}
|
||||
?>
|
||||
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@@ -1161,8 +1175,8 @@ $pagination_entity_name = "Adressen";
|
||||
notify("error", "Begründung muss mindestens 3 Zeichen lang sein");
|
||||
$(this).prop("checked", false);
|
||||
switcheries.forEach(s => s.setPosition());
|
||||
ret
|
||||
if (reason != null) {
|
||||
return;
|
||||
} if (true) {
|
||||
$.post("<?php echo self::getUrl("ConstructionConsentJournal", "save")?>", {
|
||||
consent_id: <?=$item->id?>,
|
||||
text: `Genehmigung überschreiben wurde ${$(this).prop("checked") ? "aktiviert" : "deaktiviert"} | Begründung: ${reason}`
|
||||
@@ -1191,7 +1205,7 @@ $pagination_entity_name = "Adressen";
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
}});
|
||||
});
|
||||
|
||||
// do the same for prioritize
|
||||
$("#prioritize").on("change", function() {
|
||||
|
||||
@@ -65,7 +65,7 @@ class ConstructionConsentJournal extends mfBaseModel {
|
||||
$model = new ConstructionConsentJournal();
|
||||
|
||||
$table_fields = [
|
||||
"constructionconsent_id", "text",
|
||||
"constructionconsent_id", "text", "file_id",
|
||||
"create_by","edit_by","create","edit"
|
||||
];
|
||||
|
||||
|
||||
@@ -44,8 +44,19 @@ class ConstructionConsentJournalController extends mfBaseController {
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$uploaded = mfUpload::handleFormUpload("file", false, "/ConstructionConsentJournal");
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
die();
|
||||
$this->layout()->setFlash("Fehler beim speichern!", "error");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $consent->id]);
|
||||
}
|
||||
|
||||
|
||||
$journal = ConstructionConsentJournal::create([
|
||||
"constructionconsent_id" => $consent->id,
|
||||
"file_id" => $uploaded->id,
|
||||
"text" => $text
|
||||
]);
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php /** @noinspection ALL */
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class AddNewIndexesThetool extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table('ConstructionConsentJournal');
|
||||
$table->addColumn('file_id', 'integer', ['null' => true, 'after' => 'text'])
|
||||
->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table('ConstructionConsentJournal');
|
||||
$table->removeColumn('file_id')
|
||||
->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user