edit form

This commit is contained in:
Dr Masroor Ehsan 2025-01-13 19:40:00 +06:00
parent 381f01ff6b
commit 2800786c94
4 changed files with 32 additions and 24 deletions

View File

@ -3,9 +3,10 @@
namespace App\Http\Controllers\Staff;
use App\Domain\ACL\Permission;
use App\Domain\Report\ReportStatus;
use App\Http\Controllers\HashidControllerBase;
use App\Http\Requests\StudyMetadataUpdateRequest;
use App\Models\Study;
use Illuminate\Http\Request;
class MetadataController extends HashidControllerBase
{
@ -27,16 +28,19 @@ public function edit()
return view('staff.meta.edit', compact('study'));
}
public function save(Request $request)
public function save(StudyMetadataUpdateRequest $request)
{
dd($request);
abort_unless(auth()->user()->may(Permission::StudyMetadataEdit), 403);
$this->decodeKeys();
$study = Study::find($this->key);
$study = Study::findOrFail($this->key);
$payload = array_trim_strings($request->validated());
if ($request->has('cancel_read')) {
$payload['report_status'] = ReportStatus::Cancelled->value;
unset($payload['cancel_read']);
}
$study->update($payload);
// return redirect()->route('staff.history.view', _h($this->key));
return redirect()->route('staff.meta.view', $study->hash);
return view('content.pages.close-window');
}
}

View File

@ -4,31 +4,30 @@
use Illuminate\Foundation\Http\FormRequest;
class StudyMetadataUpdateRequest extends FormRequest
final class StudyMetadataUpdateRequest extends FormRequest
{
public function rules(): array
{
return [
'patient_id' => ['nullable'],
'patient_name' => ['required'],
'patient_id' => ['nullable'],
'patient_sex' => ['nullable'],
'patient_birthdate' => ['nullable', 'date'],
'study_id' => ['nullable'],
'accession_number' => ['nullable'],
'study_description' => ['nullable'],
'body_part_examined' => ['nullable'],
'station_name' => ['nullable'],
'operators_name' => ['nullable'],
'manufacturer' => ['nullable'],
'manufacturer_model_name' => ['nullable'],
//'study_date' => ['required', 'date'],
'study_description' => ['required'],
'body_part_examined' => ['required'],
'referring_physician_name' => ['nullable'],
'study_modality' => ['nullable'],
'study_date' => ['required', 'date'],
'receive_date' => ['required', 'date'],
'assigned_physician_id' => ['nullable', 'exists:users,id'],
'institution_name' => ['nullable'],
'priority' => ['required', 'integer'],
'cancel_read' => ['nullable', 'boolean'],
/*
'referring_physician_id' => ['nullable', 'exists:users,id'],
'access_flags' => ['required', 'integer'],
'access_password' => ['nullable'],
*/
];
}

View File

@ -25,10 +25,7 @@
@include('staff.meta.partials._text', ['name' => 'patient_id', 'label' => 'Patient ID', 'value' => $study->patient_id])
@include('staff.meta.partials._text', ['name' => 'patient_name', 'label' => 'Patient Name', 'value' => $study->patient_name])
@include('staff.meta.partials._text', ['name' => 'patient_sex', 'label' => 'Sex', 'value' => $study->patient_sex])
<div class="form-floating form-floating-outline mb-6">
<input type="text" name="patient_birthdate" id="patient_birthdate" class="form-control dob-picker" placeholder="YYYY-MM-DD" value="{{ $study->patient_birthdate->toDateString() }}" />
<label for="patient_birthdate">Birth Date</label>
</div>
@include('staff.meta.partials._date', ['name' => 'patient_birthdate', 'label' => 'Birth Date', 'value' => $study->patient_birthdate->toDateString()])
@include('staff.meta.partials._text', ['name' => 'accession_number', 'label' => 'Accession number', 'value' => $study->accession_number])
</div>
</div>
@ -54,7 +51,7 @@
</div>
<label class="form-check m-0">
<input name="cancel_read" type="checkbox" class="form-check-input" />
<input name="cancel_read" type="checkbox" class="form-check-input"/>
<span class="form-check-label">Cancel interpretation by radiologist</span>
</label>
</div>
@ -63,6 +60,10 @@
</div>
<button type="submit" class="btn btn-primary">Save</button>
<button type="submit" class="btn btn-primary me-4">
<i class="fa-regular fa-cloud-arrow-up me-1"></i>
Save</button>
<button type="button" class="btn btn-danger" onclick="window.open('', '_self', ''); window.close();">Cancel
</button>
</form>
@endsection

View File

@ -0,0 +1,4 @@
<div class="form-floating form-floating-outline mb-6">
<input type="text" name="{{ $name }}" id="{{ $name }}" class="form-control dob-picker" placeholder="YYYY-MM-DD" value="{{ $value }}" />
<label for="{{ $name }}">{{ $label }}</label>
</div>