Changed be able to edit names

This commit is contained in:
williamengbjerg committed 2021-06-06 23:00:54 +02:00
1 parent 072d54f46f
commit a9cd16d987
3 files changed
+18 -9

No files matched your search

+9 -4
View File
@@ -217,10 +217,10 @@ class Projected extends Component
})->where("id", $id)->first();
if($post) {
$this->rowPostID = $post->id;
$this->rowName = $post->name;
$this->rowTypeHTML = "<span class=\"".($post->is_expense ? "col-neg" : "col-pos")."\">".($post->is_expense ? "expense" : "income")."</span>";
$this->modalRowUpdate = true;
$this->rowPostID = $post->id;
$this->rowName = $post->name;
$this->rowTypeHTML = "<span class=\"".($post->is_expense ? "col-neg" : "col-pos")."\">".($post->is_expense ? "expense" : "income")."</span>";
$this->modalRowUpdate = true;
$this->emit("focusField", "rowValue");
}
}
@@ -230,6 +230,11 @@ class Projected extends Component
return $query->where('user_id', \Auth::user()->id);
})->where("id", $this->rowPostID)->first();
if ($post->name !== $this->rowName) {
$post->update(['name' => $this->rowName]);
$post->save();
}
$value = null;
if($this->rowValue != null && trim($this->rowValue) != "" && is_numeric(trim($this->rowValue))) {
$value = floatval($this->rowValue);