06/03/2024 9h19

This commit is contained in:
2024-03-06 09:19:26 +07:00
parent eafb7bfb5f
commit 91d317607a
32 changed files with 2878 additions and 102 deletions

51
assets/script/checkbox.js Normal file
View File

@@ -0,0 +1,51 @@
/**
* Created by Glee on 03-Nov-2020.
*/
const Checkbox = function (deleteItemCb){
const INPUT_CHECKBOX_CLASS = '.js-checkbox-id';
let _deleteItemCb = deleteItemCb;
return {
setAllChecked,
getCheckedIds,
deleteSelected
}
function setAllChecked() {
var all_checkboxes = $(INPUT_CHECKBOX_CLASS);
if($(this).is(':checked')) {
all_checkboxes.each(function (index, item) {
$(item).prop( "checked", true);
})
}else{
all_checkboxes.each(function (index, item) {
$(item).prop( "checked", false);
})
}
}
function deleteSelected() {
if(!confirm('Bạn chắc chắn muốn xóa ?')) {
return ;
}
$(INPUT_CHECKBOX_CLASS).each(function (index, item) {
if($(item).is(':checked')) {
//delete_deal(item.value, false);
_deleteItemCb(item.value)
}
});
}
function getCheckedIds() {
let list_ids = [];
$(INPUT_CHECKBOX_CLASS).each(function (index, item) {
if($(item).is(':checked')) list_ids.push(item.value);
});
return list_ids;
}
};