Created
October 26, 2020 16:26
-
-
Save jongravois/1f3344694a80d47296d3f265e6082b3d to your computer and use it in GitHub Desktop.
This file contains hidden or 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\Modeler; | |
use App\Models\AcModel; | |
use Livewire\Component; | |
class ResetManifest extends Component | |
{ | |
public AcModel $ac_model; | |
public $modelID; | |
public $showModal = false; | |
public function mount($id) | |
{ | |
$this->modelID = $id; | |
$this->ac_model = AcModel::find($id); | |
} // end function | |
public function render() | |
{ | |
return view('livewire.modeler.reset-manifest'); | |
} // end function | |
public function closeModal() | |
{ | |
$this->dispatchBrowserEvent('modal-away'); | |
$this->dispatchBrowserEvent('refreshTable'); | |
} // end function | |
public function resetManifest() | |
{ | |
$this->ac_model->components()->delete(); | |
$this->ac_model->was_uploaded = false; | |
$this->ac_model->occm_path = null; | |
$this->ac_model->no_master = 0; | |
$this->ac_model->cat1_count = 0; | |
$this->ac_model->cat2_count = 0; | |
$this->ac_model->cat3_count = 0; | |
$this->ac_model->qec_count = 0; | |
$this->ac_model->other_count = 0; | |
$this->ac_model->total_count = 0; | |
$this->ac_model->cat1_sum = 0; | |
$this->ac_model->cat2_sum = 0; | |
$this->ac_model->cat3_sum = 0; | |
$this->ac_model->qec_sum = 0; | |
$this->ac_model->other_sum = 0; | |
$this->ac_model->total_value = 0; | |
$this->ac_model->save(); | |
$this->closeModal(); | |
$this->emit('refreshTable'); | |
} // end function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment