#389 Quick-Add widget

This commit is contained in:
Daniel Brendel
2025-05-24 22:03:30 +02:00
parent 63527ac367
commit f8fd2ecb1e
6 changed files with 40 additions and 1 deletions
+1
View File
@@ -32,6 +32,7 @@ class AppModel_Migration {
$this->database->add('language VARCHAR(512) NOT NULL DEFAULT \'en\'');
$this->database->add('timezone VARCHAR(512) NULL');
$this->database->add('scroller BOOLEAN NOT NULL DEFAULT 1');
$this->database->add('quick_add BOOLEAN NOT NULL DEFAULT 0');
$this->database->add('tasks_enable BOOLEAN NOT NULL DEFAULT 1');
$this->database->add('inventory_enable BOOLEAN NOT NULL DEFAULT 1');
$this->database->add('calendar_enable BOOLEAN NOT NULL DEFAULT 1');
+1
View File
@@ -11,6 +11,7 @@ class UpgradeModule {
*/
private static function upgradeTo5dot0()
{
AppModel::raw('ALTER TABLE `@THIS` ADD COLUMN IF NOT EXISTS quick_add BOOLEAN NOT NULL DEFAULT 0');
PlantsModel::raw('ALTER TABLE `@THIS` ADD COLUMN IF NOT EXISTS hardy BOOLEAN NULL');
PlantDefAttrModel::raw('INSERT INTO `@THIS` (name, active) VALUES(?, ?)', ['hardy', true]);
}
+21
View File
@@ -2538,6 +2538,27 @@ fieldset .field {
color: rgb(255, 255, 255);
}
.quick-add {
position: fixed;
z-index: 102;
bottom: 150px;
right: 12px;
}
.quick-add-inner {
background-color: rgb(102, 195, 83);
border-radius: 50%;
padding-top: 12px;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 12px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.quick-add-inner a {
color: rgb(255, 255, 255);
}
.auth-main {
width: 100%;
height: 100%;
+9
View File
@@ -1915,6 +1915,7 @@
</div>
</div>
@include('quickadd.php')
@include('scanner.php')
@include('scroller.php')
@@ -1939,6 +1940,14 @@
};
@endif
window.addNewPlant = function() {
@if (LocationsModel::getCount() > 0)
document.getElementById('inpLocationId').value = {{ ((isset($location)) && (is_numeric($location)) ? $location : '0') }}; window.vue.bShowAddPlant = true;
@else
window.vue.bShowAddFirstLocation = true;
@endif
};
document.addEventListener('DOMContentLoaded', function(){
@foreach (LocationsModel::getAll() as $location)
window.vue.comboLocation.push({ ident: {{ $location->get('id') }}, label: '{{ $location->get('name') }}'});
+7
View File
@@ -0,0 +1,7 @@
@if (app('quick_add'))
<div class="quick-add">
<div class="quick-add-inner">
<a href="javascript:void(0);" onclick="window.addNewPlant();"><i class="fas fa-plus fa-2x"></i></a>
</div>
</div>
@endif
+1 -1
View File
File diff suppressed because one or more lines are too long