|
@@ -6,7 +6,7 @@ use Livewire\Component;
|
|
|
|
|
|
|
|
class Motivation extends Component
|
|
class Motivation extends Component
|
|
|
{
|
|
{
|
|
|
- public $records, $name, $type, $enabled, $dataId, $update = false, $add = false;
|
|
|
|
|
|
|
+ public $records, $name, $type, $enabled, $show_in_member_presences, $dataId, $update = false, $add = false;
|
|
|
|
|
|
|
|
protected $rules = [
|
|
protected $rules = [
|
|
|
'name' => 'required'
|
|
'name' => 'required'
|
|
@@ -47,7 +47,7 @@ class Motivation extends Component
|
|
|
|
|
|
|
|
public function render()
|
|
public function render()
|
|
|
{
|
|
{
|
|
|
- $this->records = \App\Models\Motivation::select('id', 'name', 'type', 'enabled')->get();
|
|
|
|
|
|
|
+ $this->records = \App\Models\Motivation::select('id', 'name', 'type', 'show_in_member_presences', 'enabled')->get();
|
|
|
return view('livewire.motivation');
|
|
return view('livewire.motivation');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -65,7 +65,8 @@ class Motivation extends Component
|
|
|
\App\Models\Motivation::create([
|
|
\App\Models\Motivation::create([
|
|
|
'name' => $this->name,
|
|
'name' => $this->name,
|
|
|
'type' => $this->type,
|
|
'type' => $this->type,
|
|
|
- 'enabled' => $this->enabled
|
|
|
|
|
|
|
+ 'enabled' => $this->enabled,
|
|
|
|
|
+ 'show_in_member_presences' => $this->show_in_member_presences,
|
|
|
]);
|
|
]);
|
|
|
session()->flash('success','Campo creata');
|
|
session()->flash('success','Campo creata');
|
|
|
$this->resetFields();
|
|
$this->resetFields();
|
|
@@ -79,11 +80,12 @@ class Motivation extends Component
|
|
|
try {
|
|
try {
|
|
|
$motivation = \App\Models\Motivation::findOrFail($id);
|
|
$motivation = \App\Models\Motivation::findOrFail($id);
|
|
|
if( !$motivation) {
|
|
if( !$motivation) {
|
|
|
- session()->flash('error','Campo non trovata');
|
|
|
|
|
|
|
+ session()->flash('error','Motivazione non trovata');
|
|
|
} else {
|
|
} else {
|
|
|
$this->name = $motivation->name;
|
|
$this->name = $motivation->name;
|
|
|
$this->type = $motivation->type;
|
|
$this->type = $motivation->type;
|
|
|
$this->enabled = $motivation->enabled;
|
|
$this->enabled = $motivation->enabled;
|
|
|
|
|
+ $this->show_in_member_presences = $motivation->show_in_member_presences;
|
|
|
$this->dataId = $motivation->id;
|
|
$this->dataId = $motivation->id;
|
|
|
$this->update = true;
|
|
$this->update = true;
|
|
|
$this->add = false;
|
|
$this->add = false;
|
|
@@ -100,9 +102,10 @@ class Motivation extends Component
|
|
|
\App\Models\Motivation::whereId($this->dataId)->update([
|
|
\App\Models\Motivation::whereId($this->dataId)->update([
|
|
|
'name' => $this->name,
|
|
'name' => $this->name,
|
|
|
'type' => $this->type,
|
|
'type' => $this->type,
|
|
|
- 'enabled' => $this->enabled
|
|
|
|
|
|
|
+ 'enabled' => $this->enabled,
|
|
|
|
|
+ 'show_in_member_presences' => $this->show_in_member_presences,
|
|
|
]);
|
|
]);
|
|
|
- session()->flash('success','Campo aggiornata');
|
|
|
|
|
|
|
+ session()->flash('success','Motivazione aggiornata');
|
|
|
$this->resetFields();
|
|
$this->resetFields();
|
|
|
$this->update = false;
|
|
$this->update = false;
|
|
|
} catch (\Exception $ex) {
|
|
} catch (\Exception $ex) {
|
|
@@ -121,7 +124,7 @@ class Motivation extends Component
|
|
|
{
|
|
{
|
|
|
try{
|
|
try{
|
|
|
\App\Models\Motivation::find($id)->delete();
|
|
\App\Models\Motivation::find($id)->delete();
|
|
|
- session()->flash('success',"Campo eliminata");
|
|
|
|
|
|
|
+ session()->flash('success',"Motivazione eliminata");
|
|
|
return redirect(request()->header('Referer'));
|
|
return redirect(request()->header('Referer'));
|
|
|
}catch(\Exception $e){
|
|
}catch(\Exception $e){
|
|
|
session()->flash('error','Errore (' . $ex->getMessage() . ')');
|
|
session()->flash('error','Errore (' . $ex->getMessage() . ')');
|