|
|
@@ -1,7 +1,7 @@
|
|
|
<%= form_for(AvailableProduct.new, :html => {:class=>"form-horizontal", :id=> "available_products_form"}) do |f| %>
|
|
|
<div class="portlet-body form">
|
|
|
- <div id="error_explanation"></div>
|
|
|
-
|
|
|
+ <div id="error_explanation"></div>
|
|
|
+
|
|
|
<table class="table table-striped table-bordered table-hover stock-table" id="pointsale_stock" data-source="<%= @showcolumns == 'initial' ? products_initial_stock_path(current_user.pointsale_id, :format => 'json') : products_stock_path(current_user.pointsale_id, :format => 'json') %>">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
@@ -11,7 +11,7 @@
|
|
|
<th>Producto</th>
|
|
|
<th>Línea</th>
|
|
|
<th>Sublínea</th>
|
|
|
- <% case @showcolumns
|
|
|
+ <% case @showcolumns
|
|
|
when "initial" %>
|
|
|
<th>Stock inicial</th>
|
|
|
<% when "minMax" %>
|
|
|
@@ -31,14 +31,14 @@
|
|
|
var rows_selected = [];
|
|
|
var tableClass = '.stock-table';
|
|
|
var columns = "<%= @column_definition %>";
|
|
|
- var tableColumns = JSON.parse(columns.replace(/"/g,'"'));
|
|
|
+ var tableColumns = JSON.parse(columns.replace(/"/g,'"'));
|
|
|
var order = 3;
|
|
|
var extraData = {};
|
|
|
|
|
|
tableWithCheckboxAjax.init(tableClass, tableColumns, order, extraData, rows_selected);
|
|
|
|
|
|
// $(document).on("page:change", function() {
|
|
|
-// App.init();
|
|
|
+// App.init();
|
|
|
// });
|
|
|
|
|
|
toastr.options = {
|
|
|
@@ -69,10 +69,10 @@ function updateStock() {
|
|
|
//almenos 1 producto seleccionado
|
|
|
} else if(rows_selected.length == 0) {
|
|
|
toastr["error"]("Error, Se debe seleccionar al menos un producto para actualizar");
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
$.ajax({
|
|
|
type: "PUT",
|
|
|
- url: "/updateStock",
|
|
|
+ url: "/update_stock",
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
ids: rows_selected,
|
|
|
@@ -81,7 +81,7 @@ function updateStock() {
|
|
|
},
|
|
|
success: function(xhr, status, error) {
|
|
|
var table = $('.stock-table').dataTable();
|
|
|
- var rows = $(".stock-table").dataTable().fnGetNodes();
|
|
|
+ var rows = $(".stock-table").dataTable().fnGetNodes();
|
|
|
$.each(rows, function(i, row) {
|
|
|
var id = $(this).attr('id').substring($(this).attr('id').indexOf('_') + 1, $(this).attr('id').length);
|
|
|
|
|
|
@@ -95,9 +95,9 @@ function updateStock() {
|
|
|
$('#select-all').click();
|
|
|
$('#min_stock_general').val("");
|
|
|
$('#max_stock_general').val("");
|
|
|
- toastr["success"]("Stock mínimo y máximo actualizado.");
|
|
|
+ toastr["success"]("Stock mínimo y máximo actualizado.");
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -108,7 +108,7 @@ function initialStock() {
|
|
|
if(rows_selected.length > 0) {
|
|
|
$.ajax({
|
|
|
type: "PUT",
|
|
|
- url: "/initialStock",
|
|
|
+ url: "/set_initial_stock",
|
|
|
dataType: "json",
|
|
|
data: {
|
|
|
ids: rows_selected,
|
|
|
@@ -116,7 +116,7 @@ function initialStock() {
|
|
|
},
|
|
|
success: function(xhr, status, error) {
|
|
|
var table = $('.stock-table').dataTable();
|
|
|
- var rows = $(".stock-table").dataTable().fnGetNodes();
|
|
|
+ var rows = $(".stock-table").dataTable().fnGetNodes();
|
|
|
$.each(rows, function(i, row) {
|
|
|
var id = $(this).attr('id').substring($(this).attr('id').indexOf('_') + 1, $(this).attr('id').length);
|
|
|
|
|
|
@@ -127,9 +127,9 @@ function initialStock() {
|
|
|
});
|
|
|
$('#select-all').click();
|
|
|
$('#initial_stock').val("");
|
|
|
- toastr["success"]("Stock inicial actualizado.");
|
|
|
+ toastr["success"]("Stock inicial actualizado.");
|
|
|
}
|
|
|
- });
|
|
|
+ });
|
|
|
} else {
|
|
|
toastr["error"]("Error, Se debe seleccionar al menos un producto para actualizar");
|
|
|
}
|