implemented inventory widget
This commit is contained in:
parent
8fdc841254
commit
30784cc992
|
@ -175,9 +175,6 @@ class InventoryWidget extends Widget
|
||||||
|
|
||||||
// Must be configured before using.
|
// Must be configured before using.
|
||||||
$this->configurationRequired = false;
|
$this->configurationRequired = false;
|
||||||
if (empty($this->values['inventoryModuleId']) === true) {
|
|
||||||
$this->configurationRequired = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->overflow_scrollbars = false;
|
$this->overflow_scrollbars = false;
|
||||||
}
|
}
|
||||||
|
@ -705,7 +702,7 @@ class InventoryWidget extends Widget
|
||||||
'no_sortable_columns' => [],
|
'no_sortable_columns' => [],
|
||||||
'data_element' => $data,
|
'data_element' => $data,
|
||||||
'searching' => true,
|
'searching' => true,
|
||||||
'dom_elements' => 'fti',
|
'dom_elements' => 'frtilp',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => $columns[0],
|
'field' => $columns[0],
|
||||||
'direction' => 'asc',
|
'direction' => 'asc',
|
||||||
|
@ -713,10 +710,10 @@ class InventoryWidget extends Widget
|
||||||
'zeroRecords' => __('No inventory found'),
|
'zeroRecords' => __('No inventory found'),
|
||||||
'emptyTable' => __('No inventory found'),
|
'emptyTable' => __('No inventory found'),
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'default_pagination' => 10,
|
|
||||||
'no_sortable_columns' => [-1],
|
'no_sortable_columns' => [-1],
|
||||||
'csv' => 0,
|
'csv' => 0,
|
||||||
|
'mini_pagination' => true,
|
||||||
|
'mini_search' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -822,7 +819,7 @@ class InventoryWidget extends Widget
|
||||||
'no_sortable_columns' => [],
|
'no_sortable_columns' => [],
|
||||||
'data_element' => $data,
|
'data_element' => $data,
|
||||||
'searching' => true,
|
'searching' => true,
|
||||||
'dom_elements' => 'fti',
|
'dom_elements' => 'frtilp',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => $columns[0],
|
'field' => $columns[0],
|
||||||
'direction' => 'asc',
|
'direction' => 'asc',
|
||||||
|
@ -830,9 +827,11 @@ class InventoryWidget extends Widget
|
||||||
'zeroRecords' => __('No inventory found'),
|
'zeroRecords' => __('No inventory found'),
|
||||||
'emptyTable' => __('No inventory found'),
|
'emptyTable' => __('No inventory found'),
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'default_pagination' => 10,
|
//'default_pagination' => 10,
|
||||||
'no_sortable_columns' => [-1],
|
'no_sortable_columns' => [-1],
|
||||||
'csv' => 0,
|
'csv' => 0,
|
||||||
|
'mini_pagination' => true,
|
||||||
|
'mini_search' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -987,7 +986,7 @@ class InventoryWidget extends Widget
|
||||||
'no_sortable_columns' => [],
|
'no_sortable_columns' => [],
|
||||||
'data_element' => $data,
|
'data_element' => $data,
|
||||||
'searching' => true,
|
'searching' => true,
|
||||||
'dom_elements' => 'fti',
|
'dom_elements' => 'frtilp',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => $columns[0],
|
'field' => $columns[0],
|
||||||
'direction' => 'asc',
|
'direction' => 'asc',
|
||||||
|
@ -995,9 +994,11 @@ class InventoryWidget extends Widget
|
||||||
'zeroRecords' => __('No inventory found'),
|
'zeroRecords' => __('No inventory found'),
|
||||||
'emptyTable' => __('No inventory found'),
|
'emptyTable' => __('No inventory found'),
|
||||||
'return' => true,
|
'return' => true,
|
||||||
'default_pagination' => 10,
|
//'default_pagination' => 10,
|
||||||
'no_sortable_columns' => [-1],
|
'no_sortable_columns' => [-1],
|
||||||
'csv' => 0,
|
'csv' => 0,
|
||||||
|
'mini_pagination' => true,
|
||||||
|
'mini_search' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1078,7 +1079,7 @@ class InventoryWidget extends Widget
|
||||||
'no_sortable_columns' => [],
|
'no_sortable_columns' => [],
|
||||||
'data_element' => $data,
|
'data_element' => $data,
|
||||||
'searching' => true,
|
'searching' => true,
|
||||||
'dom_elements' => 'fti',
|
'dom_elements' => 'frtilp',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => $columns[0],
|
'field' => $columns[0],
|
||||||
'direction' => 'asc',
|
'direction' => 'asc',
|
||||||
|
@ -1090,6 +1091,8 @@ class InventoryWidget extends Widget
|
||||||
'mini_search' => true,
|
'mini_search' => true,
|
||||||
'mini_pagination' => true,
|
'mini_pagination' => true,
|
||||||
'csv' => 0,
|
'csv' => 0,
|
||||||
|
'mini_pagination' => true,
|
||||||
|
'mini_search' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1102,7 +1105,7 @@ class InventoryWidget extends Widget
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ui_print_datatable(
|
$table = ui_print_datatable(
|
||||||
[
|
[
|
||||||
'id' => $id_table,
|
'id' => $id_table,
|
||||||
'class' => 'info_table w100p',
|
'class' => 'info_table w100p',
|
||||||
|
@ -1112,21 +1115,18 @@ class InventoryWidget extends Widget
|
||||||
'no_sortable_columns' => [],
|
'no_sortable_columns' => [],
|
||||||
'data_element' => $data,
|
'data_element' => $data,
|
||||||
'searching' => true,
|
'searching' => true,
|
||||||
|
'dom_elements' => 'frtilp',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => $columns[0],
|
'field' => $columns[0],
|
||||||
'direction' => 'asc',
|
'direction' => 'asc',
|
||||||
],
|
],
|
||||||
'zeroRecords' => __('No inventory found'),
|
'zeroRecords' => __('No inventory found'),
|
||||||
'emptyTable' => __('No inventory found'),
|
'emptyTable' => __('No inventory found'),
|
||||||
'print_pagination_search_csv' => true,
|
|
||||||
'csv' => 0,
|
'csv' => 0,
|
||||||
|
'mini_pagination' => true,
|
||||||
|
'mini_search' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
html_print_action_buttons(
|
|
||||||
'',
|
|
||||||
['type' => 'form_action']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1135,7 @@ class InventoryWidget extends Widget
|
||||||
$id_agente = $inventory_id_agent;
|
$id_agente = $inventory_id_agent;
|
||||||
$agentes = [];
|
$agentes = [];
|
||||||
$data = [];
|
$data = [];
|
||||||
$class = 'info_table';
|
$class = 'info_table w100p';
|
||||||
$style = 'width: 100%; font-size: 100px !important;';
|
$style = 'width: 100%; font-size: 100px !important;';
|
||||||
$ordering = true;
|
$ordering = true;
|
||||||
$searching = false;
|
$searching = false;
|
||||||
|
@ -1172,35 +1172,33 @@ class InventoryWidget extends Widget
|
||||||
|
|
||||||
ui_print_datatable(
|
ui_print_datatable(
|
||||||
[
|
[
|
||||||
'id' => 'basic_info',
|
'id' => 'basic_info',
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
'style' => $style,
|
'style' => $style,
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
'column_names' => $columns_names,
|
'column_names' => $columns_names,
|
||||||
'ordering' => $ordering,
|
'ordering' => $ordering,
|
||||||
'searching' => $searching,
|
'dom_elements' => 'frtilp',
|
||||||
'order' => [
|
'searching' => $searching,
|
||||||
'field' => $columns[0],
|
'order' => [
|
||||||
'direction' => 'asc',
|
'field' => $columns[0],
|
||||||
|
'direction' => 'asc',
|
||||||
],
|
],
|
||||||
'ajax_url' => 'operation/inventory/inventory',
|
'ajax_url' => 'operation/inventory/inventory',
|
||||||
'ajax_data' => [
|
'ajax_data' => [
|
||||||
'get_data_basic_info' => 1,
|
'get_data_basic_info' => 1,
|
||||||
'id_agent' => $id_agente,
|
'id_agent' => $id_agente,
|
||||||
'id_group' => $inventory_id_group,
|
'id_group' => $inventory_id_group,
|
||||||
],
|
],
|
||||||
'zeroRecords' => __('Agent info not found'),
|
'zeroRecords' => __('Agent info not found'),
|
||||||
'emptyTable' => __('Agent info not found'),
|
'emptyTable' => __('Agent info not found'),
|
||||||
'return' => false,
|
'return' => false,
|
||||||
'csv' => 0,
|
'csv' => 0,
|
||||||
|
'mini_pagination' => true,
|
||||||
|
'mini_search' => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
html_print_action_buttons(
|
|
||||||
'',
|
|
||||||
['type' => 'form_action']
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_require_jquery_file('pandora.controls');
|
ui_require_jquery_file('pandora.controls');
|
||||||
|
@ -1234,8 +1232,6 @@ class InventoryWidget extends Widget
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#text-agentAlias").on("keyup", function(event) {
|
$("#text-agentAlias").on("keyup", function(event) {
|
||||||
console.log("keyup");
|
|
||||||
console.log($("#text-agentAlias").val());
|
|
||||||
if (!clickedOnDynamicElement || $("#text-agentAlias").val() === "") {
|
if (!clickedOnDynamicElement || $("#text-agentAlias").val() === "") {
|
||||||
getInventoryModules();
|
getInventoryModules();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1249,13 +1245,11 @@ class InventoryWidget extends Widget
|
||||||
});
|
});
|
||||||
|
|
||||||
function getInventoryModules() {
|
function getInventoryModules() {
|
||||||
console.log("CALLED0");
|
|
||||||
const clickedId = $(this).attr(\'id\');
|
const clickedId = $(this).attr(\'id\');
|
||||||
|
|
||||||
$("#'.$selectbox_id.'").empty();
|
$("#'.$selectbox_id.'").empty();
|
||||||
|
|
||||||
if ($("#hidden-agentId").val() > 0 || $("#text-agentAlias").val() === "'.__('All').'") {
|
if ($("#hidden-agentId").val() > 0 || $("#text-agentAlias").val() === "'.__('All').'") {
|
||||||
console.log("CALLED1");
|
|
||||||
$("#module_inventory").enable();
|
$("#module_inventory").enable();
|
||||||
var inputs = [];
|
var inputs = [];
|
||||||
var metaconsoleID = $("#hidden-metaconsoleId").val();
|
var metaconsoleID = $("#hidden-metaconsoleId").val();
|
||||||
|
@ -1277,7 +1271,6 @@ class InventoryWidget extends Widget
|
||||||
$("#'.$selectbox_id.'").append($("<option value=0>All</option>"));
|
$("#'.$selectbox_id.'").append($("<option value=0>All</option>"));
|
||||||
$("#'.$selectbox_id.'").append($("<option value=\'basic\'>Basic info</option>"));
|
$("#'.$selectbox_id.'").append($("<option value=\'basic\'>Basic info</option>"));
|
||||||
jQuery.each (data, function(id, value) {
|
jQuery.each (data, function(id, value) {
|
||||||
console.log("qewqwe", value);
|
|
||||||
$("#'.$selectbox_id.'").append($("<option value=" + value.name + ">" + value.name + "</option>"));
|
$("#'.$selectbox_id.'").append($("<option value=" + value.name + ">" + value.name + "</option>"));
|
||||||
});
|
});
|
||||||
$("#'.$selectbox_id.'").val("'.$this->values['inventoryModuleId'].'");
|
$("#'.$selectbox_id.'").val("'.$this->values['inventoryModuleId'].'");
|
||||||
|
@ -1286,7 +1279,6 @@ class InventoryWidget extends Widget
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("CALLED2");
|
|
||||||
$("#module_inventory").disable();
|
$("#module_inventory").disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue