mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 18:51:31 +00:00
resolved conflicts
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\ChartOfAccount;
|
||||
use Streamline\Models\GeneralForm;
|
||||
use Streamline\Models\PriceListCategories;
|
||||
use Streamline\Models\Sundry;
|
||||
use Streamline\Http\Controllers\StreamlineSetupManager;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
//use Log;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Streamline\Models\Patient;
|
||||
use Streamline\Models\PatientEpisode;
|
||||
use Streamline\Models\OrderedSundry;
|
||||
use Streamline\Models\Consultation;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Streamline\Models\User;
|
||||
|
||||
class SundryFormController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:sundry-form-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:sundry-form-create', ['only' => ['create', 'store']]);
|
||||
// $this->middleware('permission:sundry-form-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:sundry-form-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index() {
|
||||
$sundry_forms = GeneralForm::get_all_forms_type(2);
|
||||
return view('clinical_data::sundry_form.index', compact('sundry_forms'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create() {
|
||||
|
||||
return view('clinical_data::sundry_form.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
$data['name']=$request->name;
|
||||
$data['type']= 2;
|
||||
try{
|
||||
//create new radiology form
|
||||
$new_form = GeneralForm::add_new_form((object)$data);
|
||||
flash("Sundry form has been created successfully")->success();
|
||||
return redirect('/sundry_form');
|
||||
} catch (QueryException $e){
|
||||
flash("Something went wrong. Please try again")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id) {
|
||||
$sundry = GeneralForm::find($id);
|
||||
|
||||
if (!$sundry) {
|
||||
flash()->error("Sundry Form not found");
|
||||
return redirect('/sundry_form/');
|
||||
} else {
|
||||
return view('clinical_data::sundry_form.edit', compact('sundry'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
request()->validate([
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
//validation passed
|
||||
$data['name']=$request->name;
|
||||
$data['type']= 2;
|
||||
try{
|
||||
//update sundry form
|
||||
$form = GeneralForm::find($id);
|
||||
$form->update($data);
|
||||
flash($request->name . " Sundry Form has been updated")->success();
|
||||
return redirect('/sundry_form');
|
||||
}catch (QueryException $e){
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$sundry = GeneralForm::find($id);
|
||||
if ($sundry->delete()):
|
||||
flash("Sundry Form has been deleted.")->success();
|
||||
return redirect('/sundry_form');
|
||||
endif;
|
||||
}
|
||||
|
||||
public function inactive() {
|
||||
$sundries = GeneralForm::onlyTrashed()
|
||||
->where('item_type', 2)
|
||||
->orderBy('name', 'asc')
|
||||
->get();
|
||||
|
||||
if (empty($sundries)) {
|
||||
flash()->error("There is no inactive sundry");
|
||||
return redirect()->route('sundry_form.index');
|
||||
} else {
|
||||
return view('clinical_data::sundry_form.inactive', compact('sundries'));
|
||||
}
|
||||
}
|
||||
|
||||
public function activate($id) {
|
||||
$sundry = GeneralForm::withTrashed()->find($id);
|
||||
|
||||
if ($sundry->restore()):
|
||||
flash("Sundry Form has been activated.")->success();
|
||||
return redirect()-route('sundry_forms.inactive');
|
||||
endif;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user