|
|
@@ -13,7 +13,7 @@ class RecordIN extends Component
|
|
|
use WithPagination;
|
|
|
protected $paginationTheme = 'bootstrap';
|
|
|
|
|
|
- protected $listeners = ['setCausal' => 'setCausal'];
|
|
|
+ protected $listeners = ['setCausal' => 'setCausal','refreshMembers' => 'refreshMembers'];
|
|
|
|
|
|
public $sortField ='date';
|
|
|
public $sortAsc = false;
|
|
|
@@ -167,6 +167,11 @@ class RecordIN extends Component
|
|
|
$this->canSave = $this->checkCanSave();
|
|
|
}
|
|
|
|
|
|
+ public function updatedCommercial($value)
|
|
|
+ {
|
|
|
+ $this->emitSelf('refreshMembers');
|
|
|
+ }
|
|
|
+
|
|
|
public function checkCanSave()
|
|
|
{
|
|
|
$ret = true;
|
|
|
@@ -187,6 +192,15 @@ class RecordIN extends Component
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
+ public function refreshMembers()
|
|
|
+ {
|
|
|
+ if($this->commercial){
|
|
|
+ $this->members = \App\Models\Member::select(['id', 'first_name', 'last_name', 'fiscal_code'])->orderBy('last_name')->orderBy('first_name')->get();
|
|
|
+ } else {
|
|
|
+ $this->members = \App\Models\Member::select(['id', 'first_name', 'last_name', 'fiscal_code'])->where('current_status', 2)->orderBy('last_name')->orderBy('first_name')->get();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function setAmount()
|
|
|
{
|
|
|
$tot = 0;
|
|
|
@@ -315,7 +329,7 @@ class RecordIN extends Component
|
|
|
|
|
|
//$this->buildTree(\App\Models\Causal::all(), null);
|
|
|
|
|
|
- $this->members = \App\Models\Member::select(['id', 'first_name', 'last_name', 'fiscal_code'])->orderBy('last_name')->orderBy('first_name')->get();
|
|
|
+ $this->refreshMembers();
|
|
|
$this->payments = \App\Models\PaymentMethod::select('id', 'name')->where('enabled', true)->whereIn('type', array('ALL', 'IN'))->orderBy('name')->get();
|
|
|
$this->vats = \App\Models\Vat::select('id', 'name', 'value')->orderBy('value')->get();
|
|
|
|
|
|
@@ -388,7 +402,7 @@ class RecordIN extends Component
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if (isset($_GET["createSubscription"]) && $_GET["createSubscription"] == 1)
|
|
|
{
|
|
|
|
|
|
@@ -407,7 +421,7 @@ class RecordIN extends Component
|
|
|
$this->rows[$count]["causal_id"] = $_GET["subCausalId"];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
$this->first = false;
|
|
|
|
|
|
@@ -795,7 +809,7 @@ class RecordIN extends Component
|
|
|
public function rigenerate()
|
|
|
{
|
|
|
$this->emit('refresh');
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
|
|
|
$record = \App\Models\Record::findOrFail($this->dataId);
|