CRUD building and concept codes

This commit is contained in:
2026-06-24 14:11:55 +07:00
parent 09de1c3e92
commit 75830562c4
24 changed files with 1024 additions and 82 deletions

View File

@@ -469,7 +469,6 @@ Lab & User Profile
border-color: #d3d5d7 !important;
}
.nav .menu-icon{
/*color: #3b86d1 !important;*/
color: #12931d !important;
}
.sidebar .nav.sub-menu .nav-item::before {
@@ -536,10 +535,15 @@ input[type=number] {
}
.sidebar .nav.sub-menu .nav-item::before {
width: 5px;
height: 5px;
border-radius: 50px !important;
background: #469f37;
width: 6px;
height: 6px;
border-radius: 0px !important;
background: #ffffff;
border: 1px solid #12931d;
}
.sidebar .nav-item:has(.nav-link.active)::before {
background: #12931d;
}
.modal-header .modal-title{
@@ -614,11 +618,6 @@ div select{
}
.sidebar .nav.sub-menu .nav-item .nav-link.active {
font-weight: 450 !important;
border-right: 5px solid #1460ab !important;
}
.nav-tabs .nav-link {
border-top-left-radius: 0 !important;

View File

@@ -1,13 +1,13 @@
.select2-selection__rendered {
line-height: 18px !important;
line-height: 25px !important;
}
.select2-container .select2-selection--single{
box-shadow: none;
outline: none;
}
.select2-container .select2-selection--single, .select2-selection--multiple {
min-height: 46px !important;
min-height: 36px !important;
border-radius: 0;
border-color: #f3f3f3 !important;
}
@@ -15,7 +15,7 @@
outline: none;
}
.select2-selection__arrow {
height: 46px !important;
height: 36px !important;
}
.select2-selection__choice{
font-size: 13px !important;
@@ -86,3 +86,8 @@
.select2-selection .select2-selection--multiple:after {
content: 'hhghgh';
}
.select2-container .select2-selection--single, .main-panel .select2-selection--multiple {
padding-top: 5px !important;
padding-left: 5px !important;
}

View File

@@ -0,0 +1,115 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
let building_id = $('#building_id').val();
url = parseInt(building_id) === 0 ? save_url : update_url;
$.ajax({
url: url,
type:"POST",
data:{
"_token": csrf_token,
building_id : building_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(building_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,
building_id : building_id,
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_lab(building_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,
building_id : building_id,
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#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
modal.find('.modal-body input').val("");
modal.find('.modal-body textarea').val("");
modal.find('.modal-body input[name="building_id"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
building_id = button.data('building_id');
modal.find('.modal-body input[name="building_id"]').val(building_id);
modal.find('.modal-title').html(modal_edit_title);
//e.preventDefault();
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
building_id: building_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)
}
},
});
}
})

View File

@@ -0,0 +1,118 @@
$("#btnSave").on('click',function(e){
e.preventDefault();
let concept_id = $('#concept_id').val();
url = parseInt(concept_id) === 0 ? save_url : update_url;
$.ajax({
url: url,
type:"POST",
data:{
"_token": csrf_token,
concept_id : concept_id,
name_en: $('#name-en').val(),
name_kh: $('#name-kh').val(),
code: $('#code').val(),
concept_category_code: $('#concept_category_code').val(),
description: $('#description').val(),
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
});
});
function delete_lab(concept_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,
concept_id : concept_id,
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
function restore_lab(concept_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,
concept_id : concept_id,
},
success:function(res){
handleMessage(res.success, res.message)
setTimeout(function () {location.reload()}, messageDuration)
}
})
}
});
}
$('#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
modal.find('.modal-body input').val("");
modal.find('.modal-body textarea').val("");
modal.find('.modal-body select[name="concept_category_code"]').val("").trigger('change');
modal.find('.modal-body input[name="concept_id"]').val(0);
modal.find('.modal-title').html(modal_add_title);
}else if(action === "edit"){
concept_id = button.data('concept_id');
modal.find('.modal-body input[name="concept_id"]').val(concept_id);
modal.find('.modal-title').html(modal_edit_title);
//e.preventDefault();
$.ajax({
url: get_url,
type:"POST",
data:{
"_token": csrf_token,
concept_id: concept_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 select[name="concept_category_code"]').val(data.concept_category_code).trigger('change');
modal.find('.modal-body textarea[name="description"]').val(data.description);
} else{
handleMessage(res.success, res.message)
}
},
});
}
})