Created
May 27, 2020 22:15
-
-
Save jongravois/dfb8d4f3d9ffa069edb7a73737dfeba1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Livewire\Customers; | |
use App\Models\Company; | |
use App\Models\CompanyCustomerAgreement; | |
use Livewire\Component; | |
class CafRow extends Component | |
{ | |
public $cafID; | |
public $cmpID; | |
public $ar_contact; | |
public $ar_email; | |
public $companyCode; | |
public $country; | |
public $deniedPartyChecked; | |
public $deniedPartyCleared; | |
public $legalName; | |
public $location; | |
public $phone; | |
public $reporter; | |
public $reporter_email; | |
public $statusID; | |
protected $listeners = [ | |
'cafDeniedCheck' => '$refresh', | |
]; | |
public function mount($id) | |
{ | |
$this->cmpID = $id; | |
} // end function | |
public function render() | |
{ | |
$cmp = Company::with('caf', 'contacts')->find($this->cmpID); | |
if($cmp) { | |
$this->cafID = $cmp->caf->id; | |
$this->ar_contact = ($cmp->contact ? $cmp->contacts->accounting_name : null); | |
$this->ar_email = ($cmp->contacts ? $cmp->contacts->accounting_email : null); | |
$this->companyCode = $cmp->company_code; | |
$this->country = $cmp->country; | |
$this->deniedPartyChecked = $cmp->denied_party_checked; | |
$this->deniedPartyCleared = $cmp->denied_party_cleared; | |
$this->legalName = strtoupper($cmp->legal_name); | |
$this->location = ucwords(strtolower($cmp->city)) . ' ' . $cmp->state; | |
$this->phone = $cmp->phone; | |
$this->reporter = $cmp->caf->reporter; | |
$this->reporter_email = $cmp->caf->reporter_email; | |
$this->statusID = $cmp->caf->status_id; | |
} // end if | |
return view('livewire.customers.caf-row'); | |
} // end function | |
public function checkDenied($id) | |
{ | |
$co = Company::with('caf')->find($id); | |
if($co) { | |
check_embargo($co); | |
$this->dispatchBrowserEvent('toast', [ | |
'type' => 'success', | |
'msg' => 'Company Embargo Check complete' | |
]); | |
$this->emit('cafDeniedCheck'); | |
} // end if | |
} // end function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment