diff --git a/app/lang/de/tb.php b/app/lang/de/tb.php
index c9b612e..769d16a 100644
--- a/app/lang/de/tb.php
+++ b/app/lang/de/tb.php
@@ -7,5 +7,7 @@ return [
'deleted_plant' => 'Ich habe {name} gelöscht',
'created_task' => 'Ich habe eine neue Aufgabe erstellt: {name}',
'completed_task' => 'Ich habe eine Aufgabe fertiggestellt: {name}',
- 'reactivated_task' => 'Ich habe eine Aufgabe reaktiviert: {name}'
+ 'reactivated_task' => 'Ich habe eine Aufgabe reaktiviert: {name}',
+ 'created_inventory_item' => 'Ich habe einen neuen Eintrag im Inventar erstellt: {name}',
+ 'removed_inventory_item' => 'Ich habe den Eintrag {name} aus dem Inventar entfernt'
];
\ No newline at end of file
diff --git a/app/lang/en/tb.php b/app/lang/en/tb.php
index d5f1b59..b4e3605 100644
--- a/app/lang/en/tb.php
+++ b/app/lang/en/tb.php
@@ -7,5 +7,7 @@ return [
'deleted_plant' => 'I deleted {name}',
'created_task' => 'I created a new task: {name}',
'completed_task' => 'I completed a task: {name}',
- 'reactivated_task' => 'I reactivated a task: {name}'
+ 'reactivated_task' => 'I reactivated a task: {name}',
+ 'created_inventory_item' => 'I created a new inventory item: {name}',
+ 'removed_inventory_item' => 'I removed item {name} from the inventory'
];
\ No newline at end of file
diff --git a/app/models/InventoryModel.php b/app/models/InventoryModel.php
index 0dc3deb..268b8b7 100644
--- a/app/models/InventoryModel.php
+++ b/app/models/InventoryModel.php
@@ -50,7 +50,8 @@ class InventoryModel extends \Asatru\Database\Model {
}
LogModel::addLog($user->get('id'), 'inventory', 'add_inventory_item', $name, url('/inventory?expand=' . $row->get('id') . '#anchor-item-' . $row->get('id')));
-
+ TextBlockModule::createdInventoryItem($name, url('/inventory?expand=' . $row->get('id') . '#anchor-item-' . $row->get('id')));
+
return $row->get('id');
} catch (\Exception $e) {
throw $e;
@@ -221,6 +222,7 @@ class InventoryModel extends \Asatru\Database\Model {
static::raw('DELETE FROM `' . self::tableName() . '` WHERE id = ?', [$row->get('id')]);
LogModel::addLog($user->get('id'), 'inventory', 'remove_inventory_item', $row->get('name'), url('/inventory'));
+ TextBlockModule::removedInventoryItem($row->get('name'));
} catch (\Exception $e) {
throw $e;
}
diff --git a/app/modules/TextBlockModule.php b/app/modules/TextBlockModule.php
index a8ff2fb..15152e8 100644
--- a/app/modules/TextBlockModule.php
+++ b/app/modules/TextBlockModule.php
@@ -122,6 +122,39 @@ class TextBlockModule {
}
}
+ /**
+ * @param $name
+ * @param $url
+ * @return void
+ * @throws \Exception
+ */
+ public static function createdInventoryItem($name, $url)
+ {
+ try {
+ $text = __('tb.created_inventory_item', ['name' => $name, 'url' => $url]);
+
+ static::addToChat($text, 'x1fab4');
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
+ /**
+ * @param $name
+ * @return void
+ * @throws \Exception
+ */
+ public static function removedInventoryItem($name)
+ {
+ try {
+ $text = __('tb.removed_inventory_item', ['name' => $name]);
+
+ static::addToChat($text, 'x1fab4');
+ } catch (\Exception $e) {
+ throw $e;
+ }
+ }
+
/**
* @param $message
* @param $icon