TextColumn::make('detalles.total') ->label('Total Detalle') ->getStateUsing(fn ($record) => $record->anulado? 0 : $record->detalles->sum('total')) ->money('ARS') ->summarize([ Sum::make('total')->query(fn (\Illuminate\Database\Query\Builder $query) => $query ->join('proformas', 'proformas.id', '=', 'proformas_detalles.proforma_id') ->where('anulado', false))->money('ARS') ]),
class EditFormInicio extends Component implements HasForms { use InteractsWithForms; public Expediente $expediente; public $expediente_estado = null; public $expe_id = null; public $data = []; public function mount($expe_id): void { $this->expe_id = $expe_id; $this->expediente = Expediente::with('expedienteEstado')->find($this->expe_id); $this->form->fill($this->expediente->toArray()); } public function form(Form $form): Form{ return $form ->schema([ TextInput::make('titulo') ->label('Título del Expediente') ->default($this->expediente['titulo']) ->required(), Select::make('tipo_cod') ->label('Tipo de Expediente') ->options(GeneralList::where('code', 1)->pluck('s_value', 'value')->toArray()) ->searchable() ->required(), ]) ->columns(2) ->statePath('data'); } public function getFormStatePath(): ?string{ return null; } public function render() { return view('livewire.edit-form-inicio'); }}
public function form(Form $form): Form{ dump($this->expediente); return $form ->schema([ Section::make() ->id('inicio') ->schema([ Group::make() ->schema([ TextInput::make('expe_title') ->label('Título del Expediente')->required(), Select::make('expe_type') ->label('Tipo de Expediente') ->options(GeneralList::where('code', 1)->pluck('s_value', 'value')->toArray()) ->searchable() ->required(), ])->columns(2), ]) ])->model($this->expediente); }