bootstrapify inventory details form, fixed multilocation support that was broken (#116)

This commit is contained in:
FrancescoUK
2016-02-28 19:08:05 +00:00
parent 69fedb3712
commit 92bfd903dc
4 changed files with 101 additions and 112 deletions

View File

@@ -41,7 +41,7 @@
<table id="item_kit_items" class="table table-striped table-hover" role="grid">
<thead>
<tr role="row" class="tablesorter-headerRow">
<tr role="row">
<th role="columnheader"><?php echo $this->lang->line('common_delete'); ?></th>
<th role="columnheader"><?php echo $this->lang->line('item_kits_item'); ?></th>
<th role="columnheader"><?php echo $this->lang->line('item_kits_quantity'); ?></th>

View File

@@ -1,106 +1,94 @@
<?php echo form_open('items/save_inventory/'.$item_info->item_id, array('id'=>'item_form')); ?>
<?php echo form_open('items/save_inventory/'.$item_info->item_id, array('id'=>'item_form', 'class'=>'form-horizontal')); ?>
<fieldset id="inv_item_basic_info">
<table border="0" bgcolor="#CCCCCC">
<div class="form-group form-group-sm">
<tr>
<td>
<?php echo form_label($this->lang->line('items_item_number').':', 'name', array('class'=>'wide')); ?>
</td>
<td>
<?php $inumber = array (
'name'=>'item_number',
'id'=>'item_number',
'value'=>$item_info->item_number,
'style' => 'border:none',
'readonly' => 'readonly'
);
echo form_input($inumber);
?>
</td>
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_name').':', 'name', array('class'=>'wide')); ?>
</td>
<td>
<?php $iname = array (
'name'=>'name',
'id'=>'name',
'value'=>$item_info->name,
'style' => 'border:none',
'readonly' => 'readonly'
);
echo form_input($iname);
?>
</td>
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_category').':', 'category', array('class'=>'wide')); ?>
</td>
<td>
<?php $cat = array (
'name'=>'category',
'id'=>'category',
'value'=>$item_info->category,
'style' => 'border:none',
'readonly' => 'readonly'
);
echo form_input($cat);
?>
</td>
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_stock_location').':', 'stock_location', array('class'=>'wide')); ?>
</td>
<td>
<?php
echo form_dropdown('stock_location',$stock_locations,current($stock_locations),'onchange="display_stock(this.value)"');
?>
</td>
</tr>
<tr>
<td>
<?php echo form_label($this->lang->line('items_current_quantity').':', 'quantity', array('class'=>'wide')); ?>
</td>
<td>
<?php $qty = array (
'name'=>'quantity',
'id'=>'quantity',
'value'=>current($item_quantities),
'style' => 'border:none',
'readonly' => 'readonly'
);
echo form_input($qty);
?>
</td>
</tr>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_item_number').':', 'name', array('class'=>'control-label col-xs-3')); ?>
<div class="col-xs-6">
<?php echo form_input(array(
'name'=>'item_number',
'id'=>'item_number',
'value'=>$item_info->item_number,
'class'=>'form-control input-sm',
'disabled'=>'')
); ?>
</div>
</table>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_name').':', 'name', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-6'>
<?php echo form_input(array(
'name'=>'name',
'id'=>'name',
'value'=>$item_info->name,
'class'=>'form-control input-sm',
'disabled'=>'')
); ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_category').':', 'category', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-6'>
<?php echo form_input(array(
'name'=>'category',
'id'=>'category',
'value'=>$item_info->category,
'class'=>'form-control input-sm',
'disabled'=>'')
); ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_stock_location').':', 'stock_location', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-6'>
<?php echo form_dropdown('stock_location', $stock_locations, current($stock_locations), array('onchange'=>'display_stock(this.value);', 'class'=>'form-control')); ?>
</div>
</div>
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_current_quantity').':', 'quantity', array('class'=>'control-label col-xs-3')); ?>
<div class='col-xs-2'>
<?php echo form_input(array(
'name'=>'quantity',
'id'=>'quantity',
'value'=>current($item_quantities),
'class'=>'form-control input-sm',
'disabled'=>'')
); ?>
</div>
</div>
</fieldset>
<?php echo form_close(); ?>
<table class="table" role="grid" style="font-size: 80%">
<thead>
<tr role="row" bgcolor="#CCC">
<th style="text-align: center" colspan="4">Inventory Data Tracking</th>
</tr>
<tr role="row">
<th style="text-align: center" rolerole="columnheader">Date</th>
<th style="text-align: center" rolerole="columnheader">Employee</th>
<th style="text-align: center" role="columnheader">In/Out Qty</th>
<th style="text-align: center" rolerole="columnheader">Remarks</th>
</tr>
</thead>
<tbody id="inventory_result">
<?php
/*
* the tbody content of the table will be filled in by the javascript below
*/
$inventory_array = $this->Inventory->get_inventory_data_for_item($item_info->item_id)->result_array();
$employee_name = array();
<?php
$inventory_array = $this->Inventory->get_inventory_data_for_item($item_info->item_id)->result_array();
$employee_name = array();
foreach( $inventory_array as $row)
{
$person_id = $row['trans_user'];
$employee = $this->Employee->get_info($person_id);
array_push($employee_name, $employee->first_name." ".$employee->last_name);
}
?>
<table id="inventory_result" style="width:100%;">
<tr bgcolor="#FF0033" align="center" style="font-weight:bold"><td colspan="4">Inventory Data Tracking</td></tr>
<tr style="font-weight:bold"><td width="30%">Date</td><td width="25%">Employee</td><td width="15%">In/Out Qty</td><td width="45%">Remarks</td></tr>
foreach($inventory_array as $row)
{
$employee = $this->Employee->get_info($row['trans_user']);
array_push($employee_name, $employee->first_name . ' ' . $employee->last_name);
}
?>
</tbody>
</table>
<script type='text/javascript'>
@@ -111,48 +99,49 @@ $(document).ready(function()
function display_stock(location_id)
{
var item_quantities= <?php echo json_encode($item_quantities ); ?>;
var item_quantities= <?php echo json_encode($item_quantities); ?>;
document.getElementById("quantity").value = item_quantities[location_id];
var inventory_data = <?php echo json_encode($inventory_array); ?>;
var employee_data = <?php echo json_encode($employee_name); ?>;
var table = document.getElementById("inventory_result");
//Remove old query
// Remove old query from tbody
var rowCount = table.rows.length;
for (var index = rowCount; index > 2; index--)
for (var index = rowCount; index > 0; index--)
{
table.deleteRow(index-1);
}
//Add new query
// Add new query to tbody
for (var index = 0; index < inventory_data.length; index++)
{
var data = inventory_data[index];
if(data['trans_location'] == location_id)
{
var tr = document.createElement('TR');
tr.setAttribute("bgColor","#CCCCCC");
var tr = document.createElement('tr');
var td = document.createElement('TD');
var td = document.createElement('td');
td.appendChild(document.createTextNode(data['trans_date']));
tr.appendChild(td);
td = document.createElement('TD');
td = document.createElement('td');
td.appendChild(document.createTextNode(employee_data[index]));
tr.appendChild(td);
td = document.createElement('TD');
td = document.createElement('td');
td.appendChild(document.createTextNode(data['trans_inventory']));
td.setAttribute("style", "text-align:center");
tr.appendChild(td);
td = document.createElement('TD');
td = document.createElement('td');
td.appendChild(document.createTextNode(data['trans_comment']));
tr.appendChild(td);
table.appendChild(tr);
}
}
}
}
</script>

View File

@@ -2,7 +2,7 @@
<ul id="error_message_box" class="error_message_box"></ul>
<?php echo form_open('items/save_inventory/'.$item_info->item_id, array('id'=>'item_form', 'class' => 'form-horizontal')); ?>
<?php echo form_open('items/save_inventory/'.$item_info->item_id, array('id'=>'item_form', 'class'=>'form-horizontal')); ?>
<fieldset id="item_basic_info">
<div class="form-group form-group-sm">
<?php echo form_label($this->lang->line('items_item_number').':', 'name', array('class'=>'control-label col-xs-3')); ?>

View File

@@ -1,6 +1,6 @@
<table id="suspended_sales_table" class="table table-striped table-hover" role="grid">
<thead>
<tr role="row" class="tablesorter-headerRow">
<tr role="row">
<th role="columnheader"><?php echo $this->lang->line('sales_suspended_sale_id'); ?></th>
<th role="columnheader"><?php echo $this->lang->line('sales_date'); ?></th>
<th role="columnheader"><?php echo $this->lang->line('sales_customer'); ?></th>