<?php namespace Koneko\VuexyWarehouse\Livewire\InventoryMovements; use Koneko\SatCatalogs\Models\RegimenFiscal; use Koneko\SatCatalogs\Models\UsoCfdi; use Koneko\VuexyAdmin\Models\User; use Illuminate\Support\Facades\DB; use Spatie\Permission\Models\Role; use Illuminate\Support\Facades\Auth; use Livewire\Component; class InventoryMovementsIndex extends Component { public $tipo_persona_options, $estado_options, $status_options; public $status_list, $status_list_class; public $userId, $name, $email, $cargo, $rfc, $nombre_fiscal, $c_regimen_fiscal, $domicilio_fiscal, $c_uso_cfdi, $roles, $password, $status, $is_prospect, $is_customer, $is_provider, $is_user; public $statuses; public $rows_roles = []; public $roles_options = []; public $uso_cfdi_options = []; public $regimen_fiscal_options = []; public $roles_html_select; public function mount() { $this->tipo_persona_options = [ User::TIPO_RFC_FISICA => User::$tipoRfcList[User::TIPO_RFC_FISICA], User::TIPO_RFC_MORAL => User::$tipoRfcList[User::TIPO_RFC_MORAL], User::TIPO_RFC_PUBLICO => User::$tipoRfcList[User::TIPO_RFC_PUBLICO], ]; $this->estado_options = DB::table('sat_estado') ->select('sat_estado.c_estado', 'sat_estado.nombre_del_estado') ->join('sat_codigo_postal', 'sat_estado.c_estado', '=', 'sat_codigo_postal.c_estado') ->join('users', 'users.domicilio_fiscal', '=', 'sat_codigo_postal.c_codigo_postal') ->distinct() ->orderBy('sat_estado.c_estado') ->pluck('sat_estado.nombre_del_estado', 'sat_estado.c_estado'); $this->status_options = $this->status_list = [ User::STATUS_ENABLED => User::$statusList[User::STATUS_ENABLED], User::STATUS_DISABLED => User::$statusList[User::STATUS_DISABLED], ]; //$this->status = User::STATUS_ENABLED; $this->status_list_class = User::$statusListClass; $this->statuses = [ User::STATUS_ENABLED => ['title' => 'Activo', 'class' => 'badge bg-label-' . User::$statusListClass[User::STATUS_ENABLED]], User::STATUS_DISABLED => ['title' => 'Deshabilitado', 'class' => 'badge bg-label-' . User::$statusListClass[User::STATUS_DISABLED]], User::STATUS_REMOVED => ['title' => 'Eliminado', 'class' => 'badge bg-label-' . User::$statusListClass[User::STATUS_REMOVED]], ]; $roles = Role::whereNotIn('name', ['Patient', 'Doctor'])->get(); $this->roles_html_select = "<select id=\"UserRole\" class=\"form-select text-capitalize\"><option value=\"\"> Selecciona un rol </option>"; foreach ($roles as $role) { $this->rows_roles[$role->name] = "<span class=\"badge bg-label-" . $role->style . " mx-1\">" . $role->name . "</span>"; if (Auth::user()->hasRole('SuperAdmin') || $role->name != 'SuperAdmin') { $this->roles_html_select .= "<option value=\"" . $role->name . "\" class=\"text-capitalize\">" . $role->name . "</option>"; $this->roles_options[$role->name] = $role->name; } } $this->roles_html_select .= "</select>"; $this->status_options = [ User::STATUS_ENABLED => User::$statusList[User::STATUS_ENABLED], User::STATUS_DISABLED => User::$statusList[User::STATUS_DISABLED], ]; $this->uso_cfdi_options = UsoCfdi::selectList(); $this->regimen_fiscal_options = RegimenFiscal::selectList(); } public function render() { return view('vuexy-warehouse::livewire.inventory-movements.inventory-movements-index'); } }