laboratory
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Models\Organization;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use function Yajra\DataTables\Html\data;
|
||||
|
||||
|
||||
class OrganizationController extends Controller
|
||||
@@ -42,21 +43,18 @@ class OrganizationController extends Controller
|
||||
try {
|
||||
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'lab_name_en' => 'required',
|
||||
'lab_code' => 'required|max:10',
|
||||
'sample_number' => 'required',
|
||||
'patient_code' => 'required',
|
||||
'start_date' => 'required',
|
||||
'end_date' => 'nullable'
|
||||
'name_en' => 'required',
|
||||
'name_kh' => 'required',
|
||||
'code' => 'required|max:10'
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $validator->errors()->all()]);
|
||||
}
|
||||
$data = array(
|
||||
'name_en' => $request->lab_name_en,
|
||||
'name_kh' => $request->lab_name_kh,
|
||||
'code' => $request->lab_code,
|
||||
'phone_number' => $request->phone_number,
|
||||
'name_en' => $request->name_en,
|
||||
'name_kh' => $request->name_kh,
|
||||
'code' => $request->code,
|
||||
'phone' => $request->phone,
|
||||
'email' => $request->email,
|
||||
'address_en' => $request->address_en,
|
||||
'address_kh' => $request->address_kh,
|
||||
@@ -76,15 +74,15 @@ class OrganizationController extends Controller
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'name_en' => 'required',
|
||||
'name_kh' => 'required',
|
||||
'short_name' => 'required|max:10'
|
||||
'code' => 'required|max:10'
|
||||
]);
|
||||
if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
|
||||
$data = array(
|
||||
'name_en' => $request->name_en,
|
||||
'name_kh' => $request->name_kh,
|
||||
'short_name' => $request->short_name,
|
||||
'code' => $request->code,
|
||||
'email' => $request->email,
|
||||
'phone_number' => $request->phone_number,
|
||||
'phone' => $request->phone,
|
||||
'address_en' => $request->address_en,
|
||||
'address_kh' => $request->address_kh,
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
@@ -92,10 +90,8 @@ class OrganizationController extends Controller
|
||||
);
|
||||
$this->model::query()->where('id', $this->baseOrganizationId)->update($data);
|
||||
return redirect()->back();
|
||||
//return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
|
||||
} catch (\Exception $e){
|
||||
dd($e);
|
||||
//return redirect()->back();
|
||||
return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
@@ -104,31 +100,19 @@ class OrganizationController extends Controller
|
||||
try {
|
||||
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'lab_name_en' => 'required',
|
||||
'lab_code' => 'required|max:5',
|
||||
'sample_number' => 'required',
|
||||
'patient_code' => 'required',
|
||||
'start_date' => 'required',
|
||||
'end_date' => 'nullable'
|
||||
'name_en' => 'required',
|
||||
'name_kh' => 'required',
|
||||
'code' => 'required|max:10'
|
||||
]);
|
||||
if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
|
||||
$data = array(
|
||||
'name_en' => $request->lab_name_en,
|
||||
'name_kh' => $request->lab_name_kh,
|
||||
'short_name' => $request->lab_code,
|
||||
'sample_number' => $request->sample_number,
|
||||
'patient_code' => $request->patient_code,
|
||||
'phone_number' => $request->phone_number,
|
||||
'lab_category_id' => $request->lab_category_id,
|
||||
'is_auto_make_invoice' => $request->is_auto_make_invoice,
|
||||
'name_en' => $request->name_en,
|
||||
'name_kh' => $request->name_kh,
|
||||
'code' => $request->code,
|
||||
'email' => $request->email,
|
||||
'shareable_lab_result' => isset($request->shareable_lab_result) ? 1 : 0,
|
||||
'allow_external_request' => isset($request->allow_external_request) ? 1 : 0,
|
||||
'is_hide_comission_percentage' => isset($request->is_hide_comission_percentage) ? $request->is_hide_comission_percentage : 0,
|
||||
'phone' => $request->phone,
|
||||
'address_en' => $request->address_en,
|
||||
'address_kh' => $request->address_kh,
|
||||
'start_date' => ($request->start_date ? date('Y-m-d H:i:s', strtotime($request->start_date)) : null),
|
||||
'end_date' => ($request->end_date ? date('Y-m-d H:i:s', strtotime($request->end_date)) : null),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
'updated_by' => Auth::id()
|
||||
);
|
||||
@@ -152,7 +136,11 @@ class OrganizationController extends Controller
|
||||
|
||||
public function delete(Request $request){
|
||||
try{
|
||||
$this->model::query()->where('id', $request->organization_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::DELETE));
|
||||
$this->model::query()->where('id', $request->organization_id)->update(array(
|
||||
BaseModel::DELETED_AT_FIELD => data('Y-m-d H:i:s'),
|
||||
BaseModel::DELETED_BY_FIELD => Auth::id(),
|
||||
BaseModel::RECORD_STATUS_FIELD => RecordStatusEnum::DELETE
|
||||
));
|
||||
return response()->json(['success' => true, 'message' => __('laboratory.delete_success')]);
|
||||
}
|
||||
catch (\Exception $e){
|
||||
@@ -177,69 +165,5 @@ class OrganizationController extends Controller
|
||||
return view('organization_profile', ['info' => $organization]);
|
||||
}
|
||||
|
||||
public function labSettingSetters(Request $request){
|
||||
try{
|
||||
if(!GlobalController::user_can(Auth::user()->role_id, ['system_settings'])) return redirect(url('my-profile'));
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'sample_number' => 'required|integer',
|
||||
'patient_code' => 'required|integer',
|
||||
'technician_label' => 'nullable',
|
||||
'discount_type' => 'required|integer'
|
||||
]);
|
||||
if ($validator->fails()){ return response()->json(['errors'=>$validator->errors()->all()]);}
|
||||
$lab = $this->model::query()->where('id', $this->baseOrganizationId)->first();
|
||||
$lab->update(array(
|
||||
'sample_number' => $request->sample_number,
|
||||
'currency' => $request->currency,
|
||||
'patient_code' => $request->patient_code,
|
||||
'technician_label' => $request->technician_label,
|
||||
'discount_type' => $request->discount_type,
|
||||
'phone_number' => $request->phone_number,
|
||||
'email' => $request->email,
|
||||
'exchange_rate' => $request->exchange_rate,
|
||||
//'is_hide_inv_discount' => $request->is_hide_inv_discount,
|
||||
'abnormal_text_color' => $request->abnormal_text_color,
|
||||
'show_result_footer' => $request->show_result_footer,
|
||||
'abnormal_result_font_weight' => $request->abnormal_result_font_weight,
|
||||
'result_header_id' => $request->result_header_id,
|
||||
'is_auto_make_invoice' => $request->is_auto_make_invoice,
|
||||
'invoice_template_id' => $request->invoice_template_id
|
||||
));
|
||||
return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
|
||||
} catch (\Exception $e)
|
||||
{
|
||||
return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadImage(Request $request){
|
||||
try {
|
||||
$image = $request->file('image');
|
||||
$imageName = 'avatar_'.$this->baseOrganizationId.'.' . $image->getClientOriginalExtension();
|
||||
$lab = $this->model::query()->where('id', $this->baseOrganizationId)->first();
|
||||
$lab->update(array('logo' => $imageName));
|
||||
$image->move(public_path('storage/images/avatars/labs'), $imageName);
|
||||
return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
|
||||
}catch (\Exception $e){
|
||||
return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeLabLogo(Request $request){
|
||||
try {
|
||||
$lab = $this->model::query()->find($this->baseOrganizationId);
|
||||
if(!empty($lab->logo)) {
|
||||
if (file_exists(public_path('storage/images/avatars/labs/' . $lab->logo))) {
|
||||
unlink(public_path('storage/images/avatars/labs/' . $lab->logo));
|
||||
$lab->logo = null;
|
||||
}
|
||||
}
|
||||
$lab->save();
|
||||
return response()->json(['success' => true, 'message' => __('laboratory.update_success'), 'data' => $lab]);
|
||||
}catch (\Exception $e){
|
||||
return response()->json(['success'=> false , 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,20 +9,13 @@ $("#btnSave").on('click',function(e){
|
||||
data:{
|
||||
"_token": csrf_token,
|
||||
organization_id : labid,
|
||||
lab_name_en: $('#lab-name-en').val(),
|
||||
lab_name_kh: $('#lab-name-kh').val(),
|
||||
lab_code: $('#lab-code').val(),
|
||||
name_en: $('#lab-name-en').val(),
|
||||
name_kh: $('#lab-name-kh').val(),
|
||||
code: $('#lab-code').val(),
|
||||
address_en: $('#address-en').val(),
|
||||
address_kh: $('#address-kh').val(),
|
||||
sample_number: $('input[name="sample_number"]:checked').attr('data-id'),
|
||||
patient_code: $('input[name="patient_number"]:checked').attr('data-id'),
|
||||
is_auto_make_invoice: $('input[name="is_auto_make_invoice"]:checked').attr('data-id'),
|
||||
start_date : $('#start-date').val(),
|
||||
end_date : $('#end-date').val(),
|
||||
phone_number: $('#phone-number').val(),
|
||||
email: $('#email').val(),
|
||||
shareable_lab_result: $('input[name="shareable_lab_result"]:checked').attr('data-id'),
|
||||
lab_category_id : $('#lab-category-id').val()
|
||||
phone: $('#phone-number').val(),
|
||||
email: $('#email').val()
|
||||
},
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
@@ -110,20 +103,13 @@ $('#modal-laboratory').on('show.bs.modal', function (event) {
|
||||
success:function(res){
|
||||
if(res.success) {
|
||||
let data = res.data;
|
||||
modal.find('.modal-body input[name="lab_name_en"]').val(data.name_en);
|
||||
modal.find('.modal-body input[name="lab_name_kh"]').val(data.name_kh);
|
||||
modal.find('.modal-body input[name="lab_code"]').val(data.short_name);
|
||||
modal.find('.modal-body select[name="lab_category_id"]').val(data.lab_category_id);
|
||||
modal.find('.modal-body input:radio[name="sample_number"]').filter("[data-id=" + data.sample_number + "]").prop('checked', true);
|
||||
modal.find('.modal-body input:radio[name="is_auto_make_invoice"]').filter("[data-id=" + data.is_auto_make_invoice + "]").prop('checked', true);
|
||||
modal.find('.modal-body input[name="name_en"]').val(data.name_en);
|
||||
modal.find('.modal-body input[name="name_kh"]').val(data.name_kh);
|
||||
modal.find('.modal-body input[name="code"]').val(data.code);
|
||||
modal.find('.modal-body input[name="address_en"]').val(data.address_en);
|
||||
modal.find('.modal-body input[name="address_kh"]').val(data.address_kh);
|
||||
modal.find('.modal-body input[name="start_date"]').val(getDate(data.start_date));
|
||||
modal.find('.modal-body input[name="end_date"]').val(getDate(data.end_date));
|
||||
modal.find('.modal-body input:radio[name="patient_number"]').filter("[data-id=" + data.patient_code + "]").prop('checked', true);
|
||||
modal.find('.modal-body input:checkbox[name="shareable_lab_result"]').filter("[data-id=" + data.shareable_lab_result + "]").prop('checked', true);
|
||||
modal.find('.modal-body input[name="email"]').val(data.email);
|
||||
modal.find('.modal-body input[name="phone_number"]').val(data.phone_number);
|
||||
modal.find('.modal-body input[name="phone_number"]').val(data.phone);
|
||||
} else{
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="col-md-12 grid-margin stretch-card">
|
||||
<div class="card" style="min-height: 80vh;">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title"><i class="mdi text-info mdi-apps"></i> {{__('laboratory.table_title')}}</h4>
|
||||
<h4 class="card-title">{{__('laboratory.table_title')}}</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<form method="get" action="{{url('laboratory/search')}}">
|
||||
@@ -52,8 +52,6 @@
|
||||
<th class="py-2">{{__('laboratory.table_name_en')}}</th>
|
||||
<th class="py-2">{{__('laboratory.table_name_kh')}}</th>
|
||||
<th class="py-2">{{__('lab_profile.short_name')}}</th>
|
||||
<th class="py-2 text-center">{{__('lab_profile.sample_numner_conf')}}</th>
|
||||
<th class="py-2 text-center">{{__('lab_profile.patient_numner_conf')}}</th>
|
||||
<th class="py-2 text-center" width="100px">{{__('laboratory.table_status')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -73,17 +71,7 @@
|
||||
</td>
|
||||
<td class="py-1">{{$laboratory->name_en}}</td>
|
||||
<td class="py-1">{{$laboratory->name_kh}}</td>
|
||||
<td class="py-1">{{$laboratory->short_name}}</td>
|
||||
<td class="text-center py-1">
|
||||
<label class="badge badge-success">
|
||||
{{$laboratory->sample_number == 1 ? __('lab_profile.system_generate') : __('lab_profile.manual')}}
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-center py-1">
|
||||
<label class="badge badge-success">
|
||||
{{$laboratory->patient_code == 1 ? __('lab_profile.system_generate') : __('lab_profile.manual')}}
|
||||
</label>
|
||||
</td>
|
||||
<td class="py-1">{{$laboratory->code}}</td>
|
||||
<td class="py-1 text-center">
|
||||
<i class="mdi {{$laboratory->record_status_id == 1 ? 'mdi-check-circle text-primary' : 'mdi-checkbox-blank-circle-outline'}}"></i>
|
||||
</td>
|
||||
@@ -117,156 +105,54 @@
|
||||
<div class="modal-body">
|
||||
<form method="post" action="#" id="form" onkeydown="return event.key != 'Enter';">
|
||||
@csrf
|
||||
<input type="hidden" class="form-control" name="lab_id" id="lab-id" value="0" />
|
||||
<input type="hidden" class="form-control" name="organization_id" id="lab-id" value="0" />
|
||||
<div class="form-vertical">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('laboratory.table_name_kh')}} <span class="text-danger">*</span> </label>
|
||||
<input type="text" class="form-control form-control-sm" name="name_kh" id="lab-name-kh" value="" placeholder="{{__('laboratory.table_name_kh')}}"/>
|
||||
</div>
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-en">{{__('laboratory.table_name_en')}} <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control form-control-sm" name="lab_name_en" id="lab-name-en" placeholder="{{__('laboratory.table_name_en')}}">
|
||||
</div>
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('laboratory.table_name_kh')}} </label>
|
||||
<input type="text" class="form-control form-control-sm" name="lab_name_kh" id="lab-name-kh" placeholder="{{__('laboratory.table_name_kh')}}"/>
|
||||
</div>
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-code" class="control-label">{{__('lab_profile.short_name')}} <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control form-control-sm" name="lab_code" id="lab-code" maxlength="5" placeholder="{{__('lab_profile.short_name')}}">
|
||||
|
||||
<div class="input-group" id="testItem">
|
||||
<div class="form-group" style="flex:1 !important;">
|
||||
<input type="text" class="form-control form-control-sm rounded-right-0" name="name_en" id="lab-name-en" value="" placeholder="{{__('laboratory.table_name_en')}}">
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<input type="text" class="form-control form-control-sm rounded-left-0" style="width: 100px !important;" name="code" id="lab-code" value="" maxlength="10" placeholder="{{__('lab_profile.short_name')}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('patient.table_phon')}} </label>
|
||||
<input type="text" class="form-control form-control-sm" name="phone_number" id="phone-number" placeholder="{{__('patient.table_phon')}}"/>
|
||||
<label for="lab-name-kh">{{__('laboratory.phone')}} </label>
|
||||
<input type="text" class="form-control form-control-sm" name="phone_number" id="phone-number" value="" placeholder="{{__('laboratory.phone')}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('lab_profile.emial')}} </label>
|
||||
<input type="email" class="form-control form-control-sm" name="email" id="email" placeholder="{{__('lab_profile.emial')}}"/>
|
||||
<input type="email" class="form-control form-control-sm" name="email" id="email" value="" placeholder="{{__('lab_profile.emial')}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('Laboratory Type')}} </label>
|
||||
<select name="lab_category_id" class="form-control form-control-sm" id="lab-category-id">
|
||||
<option value="0">General Medical Laboratory</option>
|
||||
<option value="1">Anapathology Laboratory</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('Fixed Comission Rate')}} </label>
|
||||
<input type="number" class="form-control form-control-sm" name="is_hide_comission_percentage" id="is_hide_comission_percentage" value="0"/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group mb-1">
|
||||
<label for="address-en">{{__('laboratory.form_address_en')}}</label>
|
||||
<input type="text" class="form-control form-control-sm" name="address_en" id="address-en" placeholder="{{__('laboratory.form_address_en')}}">
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
|
||||
<div class="row form-group mb-1">
|
||||
<div class="col-sm-12">
|
||||
<label for="address-kh" class="control-label">{{__('laboratory.form_address_kh')}}</label>
|
||||
<input type="text" class="form-control form-control-sm" name="address_kh" id="address-kh" placeholder="{{__('laboratory.form_address_kh')}}">
|
||||
<input type="text" class="form-control form-control-sm" name="address_kh" id="address-kh" value="" placeholder="{{__('laboratory.form_address_kh')}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-code" class="control-label">{{__('lab_profile.start_date') . ' & '.__('lab_profile.usage_period')}} </label>
|
||||
<div class="input-group">
|
||||
<input class="form-control form-control-sm" name="start_date" onfocus="(this.type='date')" onblur="(this.type='text')" id="start-date" placeholder="{{__('general.type_date_placeholder')}}">
|
||||
<input class="form-control form-control-sm" onfocus="(this.type='date')" onblur="(this.type='text')" name="end_date" id="end-date" placeholder="{{__('general.type_date_placeholder')}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{-- <div class="form-group mb-1">--}}
|
||||
{{-- <label for="lab-code" class="control-label">{{__('lab_profile.start_date') }} <span class="text-danger">*</span></label>--}}
|
||||
{{-- <input class="form-control form-control-sm" name="start_date" onfocus="(this.type='date')" onblur="(this.type='text')" id="start-date" placeholder="{{__('general.type_date_placeholder')}}">--}}
|
||||
{{-- </div>--}}
|
||||
|
||||
{{-- <div class="form-group mb-1">--}}
|
||||
{{-- <label for="lab-code" class="control-label">{{__('lab_profile.usage_period')}} </label>--}}
|
||||
{{-- <input class="form-control form-control-sm" onfocus="(this.type='date')" onblur="(this.type='text')" name="end_date" id="end-date" placeholder="{{__('general.type_date_placeholder')}}">--}}
|
||||
{{-- </div>--}}
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-en">{{__('lab_profile.sample_numner_conf')}} <span class="text-danger">*</span></label>
|
||||
<div class="form-group pl-3">
|
||||
<div class="row">
|
||||
<div class="form-check col-sm-3">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="sample_number" data-id="0" value="0"> {{__('lab_profile.manual')}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check col-sm-9">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="sample_number" checked data-id="1" value="1"> {{__('lab_profile.system_generate')}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-en">{{__('lab_profile.patient_numner_conf')}} <span class="text-danger">*</span></label>
|
||||
<div class="form-group pl-3">
|
||||
<div class="row">
|
||||
<div class="form-check col-sm-3">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="patient_number" data-id="0" value="0"> {{__('lab_profile.manual')}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check col-sm-9">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="patient_number" checked data-id="1" value="1"> {{__('lab_profile.system_generate')}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-0">
|
||||
<label for="lab-name-en">{{__('Make Invoice')}} <span class="text-danger">*</span></label>
|
||||
<div class="form-group pl-3">
|
||||
<div class="row">
|
||||
<div class="form-check col-sm-3">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="is_auto_make_invoice" checked data-id="0" value="0"> {{__('lab_profile.manual')}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check col-sm-9">
|
||||
<label class="form-check-label">
|
||||
<input type="radio" class="form-check-input" name="is_auto_make_invoice" data-id="1" value="1"> {{__('lab_profile.system_generate')}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-check form-check-flat form-check-primary mb-1 mt-1">
|
||||
<div class="form-check form-check-primary">
|
||||
<label class="form-check-label">
|
||||
<input type="checkbox" class="checkbox" data-id="1" name="shareable_lab_result" id="shareable_lab_result"> {{__('Share Laboratory Result')}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-check form-check-flat form-check-primary mb-1 mt-1">
|
||||
<div class="form-check form-check-primary">
|
||||
<label class="form-check-label">
|
||||
<input type="checkbox" class="checkbox" data-id="1" name="allow_external_request" id="allow_external_request"> {{__('Allow External Request Test')}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label for="address-en">{{__('laboratory.form_address_en')}}</label>
|
||||
<input type="text" class="form-control form-control-sm" name="address_en" id="address-en" value="" placeholder="{{__('laboratory.form_address_en')}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -274,8 +160,8 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" id="btnSave"><i class="fa fa-floppy-o"></i> <span class="save">{{__('lang.save')}}</span><span class="update" style="display: none">{{__('lang.update')}}</span></button>
|
||||
<button type="button" class="btn btn-light" data-dismiss='modal'>{{__('lang.cancel')}}</button>
|
||||
<button type="button" class="btn btn-inverse-success rounded-25" id="btnSave"><i class="fa fa-floppy-o"></i> <span class="save">{{__('lang.save')}}</span><span class="update" style="display: none">{{__('lang.update')}}</span></button>
|
||||
<button type="button" class="btn btn-secondary rounded-25 ml-2" data-dismiss='modal'>{{__('lang.cancel')}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
<div class="row font-14 py-1">
|
||||
<span class="float-left col-sm-2">{{__('lab_profile.short_name')}}</span>
|
||||
<span class=" text-muted col-sm-10">{{$info->short_name}}</span>
|
||||
<span class=" text-muted col-sm-10">{{$info->code}}</span>
|
||||
</div>
|
||||
<div class="row font-14 py-1">
|
||||
<span class="float-left col-sm-2">{{__('laboratory.phone')}}</span>
|
||||
@@ -74,19 +74,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12 pr-4 border rounded-lg pt-3 pl-4 mt-3 bg-light">
|
||||
<h6 class="text-info">{{__('laboratory.license')}}</h6>
|
||||
<div class="py-2">
|
||||
<div class="row font-14 py-1">
|
||||
<span class="float-left col-sm-2">{{__('laboratory.start_date')}}</span>
|
||||
<span class="text-muted col-sm-10">{{date('l, F j, Y g:i A', strtotime($info->start_date))}}</span>
|
||||
</div>
|
||||
<div class="row font-14 py-1">
|
||||
<span class="float-left col-sm-2">{{__('laboratory.expiry_date')}}</span>
|
||||
<span class="text-muted col-sm-10">{{date('l, F j, Y g:i A', strtotime($info->end_date))}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -123,7 +111,7 @@
|
||||
<input type="text" class="form-control form-control-sm rounded-right-0" name="name_en" id="lab-name-en" value="{{$info->name_en}}" placeholder="{{__('laboratory.table_name_en')}}">
|
||||
</div>
|
||||
<div class="input-group-append">
|
||||
<input type="text" class="form-control form-control-sm rounded-left-0" style="width: 100px !important;" name="short_name" id="lab-code" value="{{$info->short_name}}" maxlength="10" placeholder="{{__('lab_profile.short_name')}}">
|
||||
<input type="text" class="form-control form-control-sm rounded-left-0" style="width: 100px !important;" name="code" id="lab-code" value="{{$info->code}}" maxlength="10" placeholder="{{__('lab_profile.short_name')}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,7 +121,7 @@
|
||||
|
||||
<div class="form-group mb-1">
|
||||
<label for="lab-name-kh">{{__('laboratory.phone')}} </label>
|
||||
<input type="text" class="form-control form-control-sm" name="phone_number" id="phone-number" value="{{$info->phone_number}}" placeholder="{{__('laboratory.phone')}}"/>
|
||||
<input type="text" class="form-control form-control-sm" name="phone" id="phone-number" value="{{$info->phone}}" placeholder="{{__('laboratory.phone')}}"/>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-1">
|
||||
@@ -185,372 +173,25 @@
|
||||
|
||||
let base_url = "{{url('laboratory-profile')}}";
|
||||
|
||||
let phone_number = "{{$info->phone_number}}";
|
||||
let phone = "{{$info->phone_number}}";
|
||||
let email = "{{$info->email}}";
|
||||
|
||||
function generateSlug(text) {
|
||||
return text
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.slice(0, 3)
|
||||
.slice(0, 4)
|
||||
.map(word => word[0])
|
||||
.join('')
|
||||
.toUpperCase().padEnd(3, 'X');
|
||||
.toUpperCase().padEnd(4, 'X');
|
||||
}
|
||||
|
||||
document.getElementById('lab-name-en').addEventListener('input', function () {
|
||||
document.getElementById('lab-name-en').addEventListener('input', function () {
|
||||
document.getElementById('lab-code').value = generateSlug(this.value);
|
||||
});
|
||||
|
||||
function showPreview(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("file-ip-1-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#image-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* alternative logo start */
|
||||
|
||||
function showAlternativeLogo(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("file-ip-2-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#alternative-logo-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#alternative-logo-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alternative-logo/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-alternative-logo').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alternative-logo/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#file-ip-2-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
/* alterntive logo end */
|
||||
|
||||
/* default_footer start */
|
||||
|
||||
function showDefaultFooter(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("file-ip-4-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#default-footer-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#default-footer-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/default-footer/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-default-footer').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/default-footer/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#file-ip-4-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* default_footer end */
|
||||
|
||||
/* alternative footer start */
|
||||
|
||||
function showAlternativeFooter(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("file-ip-3-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#alternative-footer-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
$('#alternative-footer-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alternative-footer/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-alternative-footer').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alternative-footer/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#file-ip-3-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* alternative footer end */
|
||||
|
||||
|
||||
function showPreviewAlterVerifyImage(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("alter-verify-image-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#alter-verify-image-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
$('#alter-verify-image-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alter-verify-sign/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-alter-verify-label').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alter-verify-sign/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#alter-verify-image-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function showPreviewAlterLabtechImage(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("alter-labtech-image-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#alter-labtech-image-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
$('#alter-labtech-image-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alter-labtech-sign/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-alter-labtech-label').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/alter-labtech-sign/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#alter-labtech-image-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#image-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/avatar/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn-remove-lab-logo').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/avatar/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#file-ip-1-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function postLabConfigure(attr_code, attr_value) {
|
||||
let url = base_url + '/configure/save';
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:"POST",
|
||||
data :{
|
||||
"_token": csrf_token,
|
||||
attribute_code : attr_code,
|
||||
attribute_value: attr_value
|
||||
},
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function postLabSettingSetter() {
|
||||
let url = base_url + '/save';
|
||||
|
||||
technician_label = $('#technician-label').val()
|
||||
sample_number = $("input[name='sample_number']:checked").attr('data-id')
|
||||
patient_code = $("input[name='patient_number']:checked").attr('data-id')
|
||||
discount_type = $("input[name='discount_type']:checked").attr('data-id')
|
||||
exchange_rate = $('#exchange-rate').val()
|
||||
abnormal_text_color = $('#abnormal-text-color').val()
|
||||
show_result_footer = $('input[name="show_result_footer"]:checked').attr('data-id')
|
||||
abnormal_result_font_weight = $('input[name="abnormal_result_font_weight"]:checked').attr('data-id')
|
||||
result_header_id = $('input[name="result_header_id"]:checked').attr('data-id')
|
||||
invoice_template_id = $('input[name="invoice_template_id"]:checked').attr('data-id')
|
||||
|
||||
if($('#phone-number').val()!='') phone_number = $('#phone-number').val()
|
||||
if($('#email').val()!='') email = $('#email').val()
|
||||
|
||||
currency = $("input[name='currency']:checked").attr('data-id')
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:"POST",
|
||||
data :{
|
||||
"_token": csrf_token,
|
||||
sample_number : sample_number,
|
||||
patient_code: patient_code,
|
||||
discount_type: discount_type,
|
||||
technician_label: technician_label,
|
||||
phone_number: phone_number,
|
||||
email: email,
|
||||
exchange_rate: exchange_rate,
|
||||
abnormal_text_color: abnormal_text_color,
|
||||
show_result_footer: show_result_footer,
|
||||
abnormal_result_font_weight: abnormal_result_font_weight,
|
||||
result_header_id: result_header_id,
|
||||
currency:currency,
|
||||
invoice_template_id: invoice_template_id
|
||||
},
|
||||
success:function(res){
|
||||
if(res.success){
|
||||
$('.sample-number-mode-getter label').text(res.data.sample_number == 0 ? 'Manual' : 'Auto-generate')
|
||||
$('.patient-number-mode-getter label').text(res.data.patient_code == 0 ? 'Manual' : 'Auto-generate')
|
||||
$('.discount-type-getter label').text(res.data.discount_type == 1 ? '(%) Percentage' : '($) Price')
|
||||
$('.verify-label-getter label').text(res.data.verify_label)
|
||||
$('.technician-label-getter label').text(res.data.technician_label)
|
||||
$('.phone-getter span').text(res.data.phone_number)
|
||||
$('.email-getter span').text(res.data.email)
|
||||
$('.base-currency-mode-getter label').text(res.data.currency == 0 ? 'USD ($)' :'Riel (៛)')
|
||||
$('.invoice-template-mode-getter label').text(res.data.invoice_template_id == 1 ? '{{__('laboratory-profile.invoice_detail')}}' : '{{__('laboratory-profile.invoice_summary')}}')
|
||||
}
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** verify label image */
|
||||
|
||||
$('#verify-image-upload-form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var formData = new FormData(this);
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/verifies/upload'}}',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success:function(res){
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function showPreviewVerifyImage(event){
|
||||
if(event.target.files.length > 0){
|
||||
var src = URL.createObjectURL(event.target.files[0]);
|
||||
var preview = document.getElementById("verify-image-preview");
|
||||
preview.src = src;
|
||||
preview.style.display = "block";
|
||||
$('#verify-image-upload-form').submit();
|
||||
}
|
||||
}
|
||||
|
||||
$('#btn-remove-verify-label').click(function(e) {
|
||||
$.ajax({
|
||||
url: '{{'laboratory-profile/verifies/remove'}}',
|
||||
type: 'POST',
|
||||
data: {"_token": "{{ csrf_token() }}"},
|
||||
success:function(res){
|
||||
$('#verify-image-preview').attr('src',"")
|
||||
handleMessage(res.success, res.message)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user