diff --git a/app/Http/Controllers/ContainerTypeController.php b/app/Http/Controllers/ContainerTypeController.php
new file mode 100644
index 0000000..bd254b1
--- /dev/null
+++ b/app/Http/Controllers/ContainerTypeController.php
@@ -0,0 +1,134 @@
+baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
+ $this->model = new ContainerType();
+ $this->conceptModel = new Concept();
+ }
+
+ public function index(Request $request){
+ $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
+ $concepts = $this->conceptModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->get();
+ $containerTypes = $this->model::with(['containerName', 'sampleType'])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
+ ->when(!empty($request->kword), function ($query) use($request){
+ $query->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhereRaw("replace(name_kh, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
+ })->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('nrml.pagination.perpage', 10));
+ return view('sample_container', ['containerTypes' => $containerTypes, 'concepts' => $concepts]);
+ }
+
+ public function save(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'cap_color' => 'required',
+ 'container_type_concept_id' => 'required',
+ 'sample_type_concept_id' => 'required',
+ 'volume_ml' => 'integer|required'
+ ]);
+ if ($validator->fails()) {
+ return response()->json(['success' => false, 'message' => __('building.create_fail'), 'errors' => $validator->errors()->all()]);
+ }
+ $data = array(
+ 'container_type_concept_id' => $request->container_type_concept_id,
+ 'sample_type_concept_id' => $request->sample_type_concept_id,
+ 'additive' => $request->additive,
+ 'cap_color' => $request->cap_color,
+ 'volume_ml' => $request->volume_ml,
+ 'storage_temp' => $request->storage_temp,
+ 'sterile' => $request->sterile,
+ 'created_at' => date('Y-m-d H:i:s'),
+ 'created_by' => Auth::id()
+ );
+ $this->model::query()->insert($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.create_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+ public function update(Request $request){
+ try {
+ $validator = \Validator::make($request->all(), [
+ 'cap_color' => 'required',
+ 'container_type_concept_id' => 'required',
+ 'sample_type_concept_id' => 'required',
+ 'volume_ml' => 'integer|required'
+ ]);
+ if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
+ $data = array(
+ 'container_type_concept_id' => $request->container_type_concept_id,
+ 'sample_type_concept_id' => $request->sample_type_concept_id,
+ 'additive' => $request->additive,
+ 'cap_color' => $request->cap_color,
+ 'volume_ml' => $request->volume_ml,
+ 'storage_temp' => $request->storage_temp,
+ 'sterile' => $request->sterile,
+ 'updated_at' => date('Y-m-d H:i:s'),
+ 'updated_by' => Auth::id()
+ );
+ $this->model::query()->where('id', $request->container_type_id)->update($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function get(Request $request){
+ try{
+ $lab = $this->model::query()->where('id', $request->container_type_id)->get()->first();
+ return response()->json(['success' => true, 'message' => __('laboratory.get_success'), 'data' => $lab]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.get_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function delete(Request $request){
+ try{
+ $this->model::query()->where('id', $request->container_type_id)->update(array(
+ BaseModel::DELETED_AT_FIELD => date('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){
+ return response()->json(['success' => false, 'message' => __('laboratory.delete_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function restore(Request $request){
+ try{
+ $this->model::query()->where('id', $request->container_type_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::ACTIVE));
+ return response()->json(['success' => true, 'message' => __('laboratory.restore_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.restore_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+}
diff --git a/app/Http/Controllers/IncidentTypeController.php b/app/Http/Controllers/IncidentTypeController.php
new file mode 100644
index 0000000..ea94386
--- /dev/null
+++ b/app/Http/Controllers/IncidentTypeController.php
@@ -0,0 +1,123 @@
+base = Session::get('base_organization');
+ $this->model = new IncidentType();
+ }
+
+ public function index(Request $request){
+ $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
+ $incidentTypes = $this->model::query()->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
+ ->when(!empty($request->kword), function ($query) use($request){
+ $query->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhereRaw("replace(name_kh, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhereRaw("replace(code, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
+ })->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('nrml.pagination.perpage', 10));
+ return view('incident_type', ['incidentTypes' => $incidentTypes]);
+ }
+
+ public function save(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'name_en' => 'required',
+ 'name_kh' => 'required',
+ 'code' => 'required',
+ ]);
+ if ($validator->fails()) {
+ return response()->json(['success' => false, 'message' => __('building.create_fail'), 'errors' => $validator->errors()->all()]);
+ }
+ $data = array(
+ 'name_en' => $request->name_en,
+ 'name_kh' => $request->name_kh,
+ 'code' => $request->code,
+ 'description' => $request->description,
+ 'created_at' => date('Y-m-d H:i:s'),
+ 'created_by' => Auth::id()
+ );
+ $this->model::query()->insert($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.create_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+ public function update(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'name_en' => 'required',
+ 'name_kh' => 'required',
+ 'code' => 'required',
+ ]);
+ if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
+ $data = array(
+ 'name_en' => $request->name_en,
+ 'name_kh' => $request->name_kh,
+ 'code' => $request->code,
+ 'description' => $request->description,
+ 'updated_at' => date('Y-m-d H:i:s'),
+ 'updated_by' => Auth::id()
+ );
+ $this->model::query()->where('id', $request->incident_type_id)->update($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function get(Request $request){
+ try{
+ $lab = $this->model::query()->where('id', $request->incident_type_id)->get()->first();
+ return response()->json(['success' => true, 'message' => __('laboratory.get_success'), 'data' => $lab]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.get_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function delete(Request $request){
+ try{
+ $this->model::query()->where('id', $request->incident_type_id)->update(array(
+ BaseModel::DELETED_AT_FIELD => date('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){
+ return response()->json(['success' => false, 'message' => __('laboratory.delete_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function restore(Request $request){
+ try{
+ $this->model::query()->where('id', $request->incident_type_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::ACTIVE));
+ return response()->json(['success' => true, 'message' => __('laboratory.restore_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.restore_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+}
diff --git a/app/Http/Controllers/RoomController.php b/app/Http/Controllers/RoomController.php
new file mode 100644
index 0000000..9c8b82f
--- /dev/null
+++ b/app/Http/Controllers/RoomController.php
@@ -0,0 +1,147 @@
+baseOrganizationId = Session::get('base_organization_id');
+ $this->base = Session::get('base_organization');
+ $this->model = new Room();
+ $this->buildingModel = new Building();
+ $this->conceptModel = new Concept();
+ }
+
+ public function index(Request $request){
+ $recordStatusCondition = Auth::id()==1 ? [RecordStatusEnum::DELETE, RecordStatusEnum::ACTIVE] : [RecordStatusEnum::ACTIVE];
+ $buildings = $this->buildingModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)
+ ->where('organization_id', $this->baseOrganizationId)->get();
+ $concepts = $this->conceptModel::query()->where(BaseModel::RECORD_STATUS_FIELD, RecordStatusEnum::ACTIVE)->get();
+ $rooms = $this->model::with(['building', 'bsl'])->whereIn(BaseModel::RECORD_STATUS_FIELD, $recordStatusCondition)
+ ->where('organization_id', $this->baseOrganizationId)
+ ->when(!empty($request->kword), function ($query) use($request){
+ $query->whereRaw("replace(name_en, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhereRaw("replace(name_kh, ' ','') like '%".str_replace(" ","",$request->kword)."%'")
+ ->orWhereRaw("replace(code, ' ','') like '%".str_replace(" ","",$request->kword)."%'");
+ })->when(!empty(trim($request->building_id)), function ($query) use($request){
+ $query->where('building_id', $request->building_id);
+ })->orderBy(BaseModel::CREATED_AT,'desc')->paginate(config('nrml.pagination.perpage', 10));
+ return view('room', ['rooms' => $rooms, 'buildings' => $buildings, 'concepts' => $concepts]);
+ }
+
+ public function save(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'name_en' => 'required',
+ 'name_kh' => 'required',
+ 'building_id' => 'required',
+ 'code' => 'required',
+ 'biosafety_level_concept_id' => 'required'
+ ]);
+ if ($validator->fails()) {
+ return response()->json(['success' => false, 'message' => __('building.create_fail'), 'errors' => $validator->errors()->all()]);
+ }
+ $data = array(
+ 'name_en' => $request->name_en,
+ 'name_kh' => $request->name_kh,
+ 'code' => $request->code,
+ 'description' => $request->description,
+ 'building_id' => $request->building_id,
+ 'biosafety_level_concept_id' => $request->biosafety_level_concept_id,
+ 'temperature_range' => $request->temperature_range,
+ 'organization_id' => $this->baseOrganizationId,
+ 'created_at' => date('Y-m-d H:i:s'),
+ 'created_by' => Auth::id()
+ );
+ $this->model::query()->insert($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.create_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.create_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+ public function update(Request $request){
+ try {
+
+ $validator = \Validator::make($request->all(), [
+ 'name_en' => 'required',
+ 'name_kh' => 'required',
+ 'building_id' => 'required',
+ 'code' => 'required',
+ 'biosafety_level_concept_id' => 'required'
+ ]);
+ if ($validator->fails()) return response()->json(['errors' => $validator->errors()->all()]);
+ $data = array(
+ 'name_en' => $request->name_en,
+ 'name_kh' => $request->name_kh,
+ 'code' => $request->code,
+ 'description' => $request->description,
+ 'building_id' => $request->building_id,
+ 'biosafety_level_concept_id' => $request->biosafety_level_concept_id,
+ 'temperature_range' => $request->temperature_range,
+ 'updated_at' => date('Y-m-d H:i:s'),
+ 'updated_by' => Auth::id()
+ );
+ $this->model::query()->where('id', $request->room_id)->update($data);
+ return response()->json(['success' => true, 'message' => __('laboratory.update_success')]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.update_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+ public function get(Request $request){
+ try{
+ $lab = $this->model::query()->where('id', $request->room_id)->get()->first();
+ return response()->json(['success' => true, 'message' => __('laboratory.get_success'), 'data' => $lab]);
+ } catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.get_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function delete(Request $request){
+ try{
+ $this->model::query()->where('id', $request->room_id)->update(array(
+ BaseModel::DELETED_AT_FIELD => date('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){
+ return response()->json(['success' => false, 'message' => __('laboratory.delete_fail'), 'errors' => $e->getMessage()]);
+ }
+
+ }
+
+ public function restore(Request $request){
+ try{
+ $this->model::query()->where('id', $request->room_id)->update(array(BaseModel::RECORD_STATUS_FIELD=> RecordStatusEnum::ACTIVE));
+ return response()->json(['success' => true, 'message' => __('laboratory.restore_success')]);
+ }
+ catch (\Exception $e){
+ return response()->json(['success' => false, 'message' => __('laboratory.restore_fail'), 'errors' => $e->getMessage()]);
+ }
+ }
+
+
+}
diff --git a/app/Models/ContainerType.php b/app/Models/ContainerType.php
new file mode 100644
index 0000000..1a16260
--- /dev/null
+++ b/app/Models/ContainerType.php
@@ -0,0 +1,48 @@
+belongsTo(Concept::class, 'sample_type_concept_id', 'id');
+ }
+
+ public function containerName(){
+ return $this->belongsTo(Concept::class, 'container_type_concept_id', 'id');
+ }
+
+
+}
diff --git a/app/Models/IncidentType.php b/app/Models/IncidentType.php
new file mode 100644
index 0000000..93d7e69
--- /dev/null
+++ b/app/Models/IncidentType.php
@@ -0,0 +1,40 @@
+belongsTo(Building::class, 'building_id', 'id');
+ }
+
+ public function bsl(){
+ return $this->belongsTo(Concept::class, 'biosafety_level_concept_id', 'id');
+ }
+
}
diff --git a/config/nrml.php b/config/nrml.php
index bb08f43..0f7f8f5 100644
--- a/config/nrml.php
+++ b/config/nrml.php
@@ -3,7 +3,7 @@
return [
'pagination' => [
- 'perpage' => 20,
+ 'perpage' => 14,
]
];
diff --git a/public/storage/assets/css/overwrite.css b/public/storage/assets/css/overwrite.css
index de8939c..22bf718 100644
--- a/public/storage/assets/css/overwrite.css
+++ b/public/storage/assets/css/overwrite.css
@@ -753,21 +753,21 @@ div select{
.pagination .page-link:hover {
color: #FFF !important; /* Your desired hover text color */
- background: rgba(4,100,144,0.96) !important;
- border-color: rgba(4,100,144,0.96) !important;
+ background: rgb(6 157 73 / 96%) !important;
+ border-color: rgb(6 157 73 / 96%) !important;
}
.page-item.disabled .page-link {
color: #FFF !important; /* Your desired hover text color */
- background: rgba(4,100,144,0.96) !important;
- border-color: rgba(4,100,144,0.96) !important;
+ background: rgb(6 157 73 / 96%) !important;
+ border-color: rgb(46 183 69 / 96%) !important;
}
/* Optional: Ensure the hover/focus states for the disabled item are also the same */
.page-item.disabled .page-link:hover,
.page-item.disabled .page-link:focus {
color: #FFF !important; /* Your desired hover text color */
- background: rgba(4,100,144,0.96) !important;
+ background: rgb(6 157 73 / 96%) !important;
}
.content-wrapper .card-body .card-title i{
diff --git a/public/storage/assets/css/overwrite.select2.css b/public/storage/assets/css/overwrite.select2.css
index 81e0c2f..a8cc7f1 100644
--- a/public/storage/assets/css/overwrite.select2.css
+++ b/public/storage/assets/css/overwrite.select2.css
@@ -1,13 +1,13 @@
.select2-selection__rendered {
- line-height: 25px !important;
+ line-height: 19px !important;
}
.select2-container .select2-selection--single{
box-shadow: none;
outline: none;
}
.select2-container .select2-selection--single, .select2-selection--multiple {
- min-height: 36px !important;
+ min-height: 46px !important;
border-radius: 0;
border-color: #f3f3f3 !important;
}
@@ -15,7 +15,7 @@
outline: none;
}
.select2-selection__arrow {
- height: 36px !important;
+ height: 46px !important;
}
.select2-selection__choice{
font-size: 13px !important;
@@ -87,7 +87,7 @@
content: 'hhghgh';
}
-.select2-container .select2-selection--single, .main-panel .select2-selection--multiple {
- padding-top: 5px !important;
- padding-left: 5px !important;
-}
+/*.select2-container .select2-selection--single, .main-panel .select2-selection--multiple {*/
+/* padding-top: 5px !important;*/
+/* padding-left: 5px !important;*/
+/*}*/
diff --git a/public/storage/assets/js/admin/building.js b/public/storage/assets/js/admin/building.js
index d4ce91a..1e2dd68 100644
--- a/public/storage/assets/js/admin/building.js
+++ b/public/storage/assets/js/admin/building.js
@@ -78,7 +78,6 @@ function restore_lab(building_id){
$('#modal-building').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
- $('#shareable_lab_result').prop("checked", false)
var modal = $(this);
if(action === "new"){
// Clear inputs
diff --git a/public/storage/assets/js/admin/concept.js b/public/storage/assets/js/admin/concept.js
index 47a2d17..c83a5df 100644
--- a/public/storage/assets/js/admin/concept.js
+++ b/public/storage/assets/js/admin/concept.js
@@ -68,7 +68,7 @@ function restore_lab(concept_id){
},
success:function(res){
handleMessage(res.success, res.message)
- setTimeout(function () {location.reload()}, messageDuration)
+ if(res.success) {setTimeout(function () {location.reload()}, messageDuration)}
}
})
@@ -79,7 +79,6 @@ function restore_lab(concept_id){
$('#modal-concept').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
- $('#shareable_lab_result').prop("checked", false)
var modal = $(this);
if(action === "new"){
// Clear inputs
diff --git a/public/storage/assets/js/admin/incident_type.js b/public/storage/assets/js/admin/incident_type.js
new file mode 100644
index 0000000..182ad13
--- /dev/null
+++ b/public/storage/assets/js/admin/incident_type.js
@@ -0,0 +1,114 @@
+
+$("#btnSave").on('click',function(e){
+ e.preventDefault();
+ let incident_type_id = $('#incident_type_id').val();
+ url = parseInt(incident_type_id) === 0 ? save_url : update_url;
+ $.ajax({
+ url: url,
+ type:"POST",
+ data:{
+ "_token": csrf_token,
+ incident_type_id : incident_type_id,
+ name_en: $('#name-en').val(),
+ name_kh: $('#name-kh').val(),
+ code: $('#code').val(),
+ description: $('#description').val(),
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ setTimeout(function () {location.reload()}, messageDuration)
+ }
+ });
+});
+
+function delete_lab(incident_type_id){
+ Swal.fire({
+ text: confirm_delete_record,
+ icon: 'question',
+ showCancelButton: true,
+ cancelButtonClass:'danger',
+ confirmButtonText: confirm_ok_delete,
+ cancelButtonText: confirm_cancel
+ }).then((result) => {
+ if (result.value) {
+ $.ajax({
+ url: delete_url,
+ method:'POST',
+ data:{
+ "_token": csrf_token,
+ incident_type_id : incident_type_id,
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ setTimeout(function () {location.reload()}, messageDuration)
+ }
+ })
+
+ }
+ });
+}
+
+function restore_lab(incident_type_id){
+ Swal.fire({
+ text: confirm_restore_record,
+ icon: 'question',
+ showCancelButton: true,
+ cancelButtonClass:'danger',
+ confirmButtonText: confirm_ok_restore,
+ cancelButtonText: confirm_cancel_restore,
+ }).then((result) => {
+ if (result.value) {
+ $.ajax({
+ url: restore_url,
+ method:'POST',
+ data:{
+ "_token": csrf_token,
+ incident_type_id : incident_type_id,
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ setTimeout(function () {location.reload()}, messageDuration)
+ }
+ })
+
+ }
+ });
+}
+
+$('#modal-incident-type').on('show.bs.modal', function (event) {
+ var button = $(event.relatedTarget) // Button that triggered the modal
+ var action = button.data('action') // Extract info from data-* attributes
+ var modal = $(this);
+ if(action === "new"){
+ // Clear inputs
+ modal.find('.modal-body input').val("");
+ modal.find('.modal-body textarea').val("");
+ modal.find('.modal-body input[name="incident_type_id"]').val(0);
+ modal.find('.modal-title').html(modal_add_title);
+ }else if(action === "edit"){
+ incident_type_id = button.data('incident_type_id');
+ modal.find('.modal-body input[name="incident_type_id"]').val(incident_type_id);
+ modal.find('.modal-title').html(modal_edit_title);
+ //e.preventDefault();
+ $.ajax({
+ url: get_url,
+ type:"POST",
+ data:{
+ "_token": csrf_token,
+ incident_type_id: incident_type_id,
+ },
+ success:function(res){
+ if(res.success) {
+ let data = res.data;
+ 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 textarea[name="description"]').val(data.description);
+ } else{
+ handleMessage(res.success, res.message)
+ }
+ },
+ });
+ }
+})
+
diff --git a/public/storage/assets/js/admin/laboratory.js b/public/storage/assets/js/admin/laboratory.js
index fdc19aa..d33fe26 100644
--- a/public/storage/assets/js/admin/laboratory.js
+++ b/public/storage/assets/js/admin/laboratory.js
@@ -81,7 +81,6 @@ function restore_lab(labid){
$('#modal-laboratory').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var action = button.data('action') // Extract info from data-* attributes
- $('#shareable_lab_result').prop("checked", false)
var modal = $(this);
if(action === "new"){
// Clear inputs
diff --git a/public/storage/assets/js/admin/room.js b/public/storage/assets/js/admin/room.js
new file mode 100644
index 0000000..a93c25e
--- /dev/null
+++ b/public/storage/assets/js/admin/room.js
@@ -0,0 +1,122 @@
+
+$("#btnSave").on('click',function(e){
+ e.preventDefault();
+ let room_id = $('#room_id').val();
+ url = parseInt(room_id) === 0 ? save_url : update_url;
+ $.ajax({
+ url: url,
+ type:"POST",
+ data:{
+ "_token": csrf_token,
+ room_id : room_id,
+ name_en: $('#name-en').val(),
+ name_kh: $('#name-kh').val(),
+ code: $('#code').val(),
+ building_id: $('#building_id').val(),
+ biosafety_level_concept_id: $('#biosafety_level_concept_id').val(),
+ temperature_range: $('#temperature_range').val(),
+ description: $('#description').val(),
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ if(res.success){ setTimeout(function () {location.reload()}, messageDuration)}
+ }
+ });
+});
+
+function delete_lab(room_id){
+ Swal.fire({
+ text: confirm_delete_record,
+ icon: 'question',
+ showCancelButton: true,
+ cancelButtonClass:'danger',
+ confirmButtonText: confirm_ok_delete,
+ cancelButtonText: confirm_cancel
+ }).then((result) => {
+ if (result.value) {
+ $.ajax({
+ url: delete_url,
+ method:'POST',
+ data:{
+ "_token": csrf_token,
+ room_id : room_id,
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ setTimeout(function () {location.reload()}, messageDuration)
+ }
+ })
+
+ }
+ });
+}
+
+function restore_lab(room_id){
+ Swal.fire({
+ text: confirm_restore_record,
+ icon: 'question',
+ showCancelButton: true,
+ cancelButtonClass:'danger',
+ confirmButtonText: confirm_ok_restore,
+ cancelButtonText: confirm_cancel_restore,
+ }).then((result) => {
+ if (result.value) {
+ $.ajax({
+ url: restore_url,
+ method:'POST',
+ data:{
+ "_token": csrf_token,
+ room_id : room_id,
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ setTimeout(function () {location.reload()}, messageDuration)
+ }
+ })
+
+ }
+ });
+}
+
+$('#modal-room').on('show.bs.modal', function (event) {
+ var button = $(event.relatedTarget) // Button that triggered the modal
+ var action = button.data('action') // Extract info from data-* attributes
+ var modal = $(this);
+ if(action === "new"){
+ // Clear inputs
+ modal.find('.modal-body input').val("");
+ modal.find('.modal-body textarea').val("");
+ modal.find('.modal-body select[name="building_id"]').val("").trigger('change');
+ modal.find('.modal-body select[name="biosafety_level_concept_id"]').val("").trigger('change');
+ modal.find('.modal-body input[name="room_id"]').val(0);
+ modal.find('.modal-title').html(modal_add_title);
+ }else if(action === "edit"){
+ room_id = button.data('room_id');
+ modal.find('.modal-body input[name="room_id"]').val(room_id);
+ modal.find('.modal-title').html(modal_edit_title);
+ //e.preventDefault();
+ $.ajax({
+ url: get_url,
+ type:"POST",
+ data:{
+ "_token": csrf_token,
+ room_id: room_id,
+ },
+ success:function(res){
+ if(res.success) {
+ let data = res.data;
+ 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="temperature_range"]').val(data.temperature_range);
+ modal.find('.modal-body textarea[name="description"]').val(data.description);
+ modal.find('.modal-body select[name="building_id"]').val(data.building_id).trigger('change');
+ modal.find('.modal-body select[name="biosafety_level_concept_id"]').val(data.biosafety_level_concept_id).trigger('change');
+ } else{
+ handleMessage(res.success, res.message)
+ }
+ },
+ });
+ }
+})
+
diff --git a/public/storage/assets/js/admin/sample_container.js b/public/storage/assets/js/admin/sample_container.js
new file mode 100644
index 0000000..bd5bfc4
--- /dev/null
+++ b/public/storage/assets/js/admin/sample_container.js
@@ -0,0 +1,122 @@
+
+$("#btnSave").on('click',function(e){
+ e.preventDefault();
+ let container_type_id = $('#container_type_id').val();
+ url = parseInt(container_type_id) === 0 ? save_url : update_url;
+ $.ajax({
+ url: url,
+ type:"POST",
+ data:{
+ "_token": csrf_token,
+ container_type_id : container_type_id,
+ container_type_concept_id: $('#container_type_concept_id').val(),
+ sample_type_concept_id: $('#sample_type_concept_id').val(),
+ additive: $('#additive').val(),
+ cap_color: $('#cap_color').val(),
+ volume_ml: $('#volume_ml').val(),
+ storage_temp: $('#storage_temp').val(),
+ sterile: $('input[name="sterile"]:checked').attr('data-id'),
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ if(res.success){ setTimeout(function () {location.reload()}, messageDuration)}
+ }
+ });
+});
+
+function delete_lab(container_type_id){
+ Swal.fire({
+ text: confirm_delete_record,
+ icon: 'question',
+ showCancelButton: true,
+ cancelButtonClass:'danger',
+ confirmButtonText: confirm_ok_delete,
+ cancelButtonText: confirm_cancel
+ }).then((result) => {
+ if (result.value) {
+ $.ajax({
+ url: delete_url,
+ method:'POST',
+ data:{
+ "_token": csrf_token,
+ container_type_id : container_type_id,
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ if(res.success) {setTimeout(function () {location.reload()}, messageDuration)}
+ }
+ })
+
+ }
+ });
+}
+
+function restore_lab(container_type_id){
+ Swal.fire({
+ text: confirm_restore_record,
+ icon: 'question',
+ showCancelButton: true,
+ cancelButtonClass:'danger',
+ confirmButtonText: confirm_ok_restore,
+ cancelButtonText: confirm_cancel_restore,
+ }).then((result) => {
+ if (result.value) {
+ $.ajax({
+ url: restore_url,
+ method:'POST',
+ data:{
+ "_token": csrf_token,
+ container_type_id : container_type_id,
+ },
+ success:function(res){
+ handleMessage(res.success, res.message)
+ if(res.success) { setTimeout(function () {location.reload()}, messageDuration)}
+ }
+ })
+
+ }
+ });
+}
+
+$('#modal-sample-container').on('show.bs.modal', function (event) {
+ var button = $(event.relatedTarget) // Button that triggered the modal
+ var action = button.data('action') // Extract info from data-* attributes
+ var modal = $(this);
+ if(action === "new"){
+ // Clear inputs
+ modal.find('.modal-body input').val("");
+ modal.find('.modal-body select[name="container_type_concept_id"]').val("").trigger('change');
+ modal.find('.modal-body select[name="sample_type_concept_id"]').val("").trigger('change');
+ modal.find('.modal-body input[name="container_type_id"]').val(0);
+ modal.find('.modal-body input[name="cap_color"]').val(0);
+ modal.find('.modal-title').html(modal_add_title);
+ }else if(action === "edit"){
+ container_type_id = button.data('container_type_id');
+ modal.find('.modal-body input[name="container_type_id"]').val(container_type_id);
+ modal.find('.modal-title').html(modal_edit_title);
+ //e.preventDefault();
+ $.ajax({
+ url: get_url,
+ type:"POST",
+ data:{
+ "_token": csrf_token,
+ container_type_id: container_type_id,
+ },
+ success:function(res){
+ if(res.success) {
+ let data = res.data;
+ modal.find('.modal-body input[name="additive"]').val(data.additive);
+ modal.find('.modal-body select[name="cap_color"]').val(data.cap_color);
+ modal.find('.modal-body input[name="volume_ml"]').val(data.volume_ml);
+ modal.find('.modal-body input[name="storage_temp"]').val(data.storage_temp);
+ modal.find('.modal-body input:checkbox[name="sterile"]').filter("[data-id=" + data.sterile + "]").prop('checked', true);
+ modal.find('.modal-body select[name="container_type_concept_id"]').val(data.container_type_concept_id).trigger('change');
+ modal.find('.modal-body select[name="sample_type_concept_id"]').val(data.sample_type_concept_id).trigger('change');
+ } else{
+ handleMessage(res.success, res.message)
+ }
+ },
+ });
+ }
+})
+
diff --git a/resources/views/building.blade.php b/resources/views/building.blade.php
index 773fc29..eac1299 100644
--- a/resources/views/building.blade.php
+++ b/resources/views/building.blade.php
@@ -111,17 +111,17 @@
diff --git a/resources/views/concept.blade.php b/resources/views/concept.blade.php
index bd59083..947ad87 100644
--- a/resources/views/concept.blade.php
+++ b/resources/views/concept.blade.php
@@ -38,7 +38,7 @@
@@ -54,10 +54,9 @@
| {{__('laboratory.table_no')}} |
- {{__('laboratory.table_action')}} |
- {{__('general.code')}} |
- {{__('laboratory.table_name_en')}} |
- {{__('laboratory.table_name_kh')}} |
+ {{__('laboratory.table_action')}} |
+ {{__('general.code')}} |
+ {{__('ឈ្មោះ')}} |
{{__('Category')}} |
{{__('laboratory.table_status')}} |
@@ -77,8 +76,7 @@
{{$concept->code}} |
- {{$concept->name_en}} |
- {{$concept->name_kh}} |
+ {{$concept->name}} |
{{$concept->concept_category_code}} |
@@ -119,19 +117,19 @@
diff --git a/resources/views/layout/sidebar.blade.php b/resources/views/layout/sidebar.blade.php
index b434ea9..f28dd49 100644
--- a/resources/views/layout/sidebar.blade.php
+++ b/resources/views/layout/sidebar.blade.php
@@ -48,48 +48,48 @@
@endif
-
- |
- +- តារាងឧប្បត្តិហេតុ
+ - ប្រភេទឧប្បត្តិហេតុ
បន្ទប់សុវត្ថិភាព
++
{{__('_')}}
+ +ឧបករណ៍ផ្ទុកសំណាក
++
{{__('_')}}
+ +