Compare commits

..

4 Commits

Author SHA1 Message Date
Bernd Bestel
dc530c80aa Released version 0.4.0 2017-04-18 21:33:44 +02:00
Bernd Bestel
6aaaa2073b Add possibility to have multiple barcodes per product 2017-04-18 21:15:45 +02:00
Bernd Bestel
4f0dc818f6 Make product overview a little bit smaller on large screens 2017-04-18 20:05:02 +02:00
Bernd Bestel
3ed6c9b28a Add a quantity unit conversion hint on product form 2017-04-18 19:54:51 +02:00
7 changed files with 51 additions and 20 deletions

View File

@@ -15,6 +15,7 @@
"datatables.net-responsive": "2.1.1",
"datatables.net-responsive-bs": "2.1.1",
"jquery-timeago": "1.5.4",
"toastr": "2.1.3"
"toastr": "2.1.3",
"tagmanager": "3.0.2"
}
}

View File

@@ -1 +1 @@
0.3.0
0.4.0

View File

@@ -26,7 +26,7 @@
</form>
</div>
<div class="col-sm-4 col-md-4 main well">
<div class="col-sm-6 col-md-5 col-lg-3 main well">
<h3>Product overview <strong><span id="selected-product-name"></span></strong></h3>
<h4><strong>Stock quantity unit:</strong> <span id="selected-product-stock-qu-name"></span></h4>

View File

@@ -18,6 +18,7 @@
<link href="/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css?v=<?php echo Grocy::GetInstalledVersion(); ?>" rel="stylesheet" />
<link href="/bower_components/datatables.net-responsive-bs/css/responsive.bootstrap.min.css?v=<?php echo Grocy::GetInstalledVersion(); ?>" rel="stylesheet" />
<link href="/bower_components/toastr/toastr.min.css?v=<?php echo Grocy::GetInstalledVersion(); ?>" rel="stylesheet" />
<link href="/bower_components/tagmanager/tagmanager.css?v=<?php echo Grocy::GetInstalledVersion(); ?>" rel="stylesheet" />
<link href="/style.css?v=<?php echo Grocy::GetInstalledVersion(); ?>" rel="stylesheet" />
<script src="/bower_components/jquery/dist/jquery.min.js?v=<?php echo Grocy::GetInstalledVersion(); ?>"></script>
@@ -122,6 +123,7 @@
<script src="/bower_components/datatables.net-responsive-bs/js/responsive.bootstrap.min.js?v=<?php echo Grocy::GetInstalledVersion(); ?>"></script>
<script src="/bower_components/jquery-timeago/jquery.timeago.js?v=<?php echo Grocy::GetInstalledVersion(); ?>"></script>
<script src="/bower_components/toastr/toastr.min.js?v=<?php echo Grocy::GetInstalledVersion(); ?>"></script>
<script src="/bower_components/tagmanager/tagmanager.js?v=<?php echo Grocy::GetInstalledVersion(); ?>"></script>
<?php if (file_exists(__DIR__ . '/' . str_replace('.php', '.js', $contentPage))) : ?>
<script src="/views/<?php echo str_replace('.php', '.js', $contentPage) . '?v=' . Grocy::GetInstalledVersion(); ?>"></script>

View File

@@ -32,16 +32,47 @@
$(function()
{
$('#barcode-taginput').tagsManager({
'hiddenTagListName': 'barcode',
'tagsContainer': '#barcode-taginput-container'
});
if (Grocy.EditMode === 'edit')
{
Grocy.FetchJson('/api/get-object/products/' + Grocy.EditObjectId,
function (product)
{
if (product.barcode.length > 0)
{
product.barcode.split(',').forEach(function(item)
{
$('#barcode-taginput').tagsManager('pushTag', item);
});
}
},
function(xhr)
{
console.error(xhr);
}
);
}
$('#qu_factor_purchase_to_stock').trigger('change');
$('#name').focus();
$('#product-form').validator();
$('#product-form').validator('validate');
});
$('#barcode').keydown(function(event)
$('.input-group-qu').on('change', function(e)
{
if (event.keyCode === 13) //Enter
var factor = $('#qu_factor_purchase_to_stock').val();
if (factor > 1)
{
event.preventDefault();
return false;
$('#qu-conversion-info').text('This means 1 ' + $("#qu_id_purchase option:selected").text() + ' purchased will be converted into ' + (1 * factor).toString() + ' ' + $("#qu_id_stock option:selected").text() + ' in stock.');
$('#qu-conversion-info').show();
}
else
{
$('#qu-conversion-info').hide();
}
});

View File

@@ -13,19 +13,15 @@
<input type="text" class="form-control" required id="name" name="name" value="<?php if ($mode == 'edit') echo $product->name; ?>">
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="barcode">Barcode</label>
<div class="input-group date">
<input type="text" class="form-control" id="barcode" name="barcode" value="<?php if ($mode == 'edit') echo $product->barcode; ?>">
<div class="input-group-addon">
<i class="fa fa-barcode"></i>
</div>
</div>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea class="form-control" rows="2" id="description" name="description"><?php if ($mode == 'edit') echo $product->description; ?></textarea>
</div>
<div class="form-group tm-group">
<label for="barcode-taginput">Barcode(s)</label>
<input type="text" class="form-control tm-input" id="barcode-taginput" placeholder="Add (scan) a barcode here to add one...">
<div id="barcode-taginput-container"></div>
</div>
<div class="form-group">
<label for="location_id">Location</label>
<select required class="form-control" id="location_id" name="location_id">
@@ -37,7 +33,7 @@
</div>
<div class="form-group">
<label for="qu_id_purchase">Quantity unit purchase</label>
<select required class="form-control" id="qu_id_purchase" name="qu_id_purchase">
<select required class="form-control input-group-qu" id="qu_id_purchase" name="qu_id_purchase">
<?php foreach ($quantityunits as $quantityunit) : ?>
<option <?php if ($mode == 'edit' && $quantityunit->id == $product->qu_id_purchase) echo 'selected="selected"'; ?> value="<?php echo $quantityunit->id; ?>"><?php echo $quantityunit->name; ?></option>
<?php endforeach; ?>
@@ -46,7 +42,7 @@
</div>
<div class="form-group">
<label for="qu_id_stock">Quantity unit stock</label>
<select required class="form-control" id="qu_id_stock" name="qu_id_stock">
<select required class="form-control input-group-qu" id="qu_id_stock" name="qu_id_stock">
<?php foreach ($quantityunits as $quantityunit) : ?>
<option <?php if ($mode == 'edit' && $quantityunit->id == $product->qu_id_stock) echo 'selected="selected"'; ?> value="<?php echo $quantityunit->id; ?>"><?php echo $quantityunit->name; ?></option>
<?php endforeach; ?>
@@ -55,9 +51,10 @@
</div>
<div class="form-group">
<label for="qu_factor_purchase_to_stock">Factor purchase to stock quantity unit</label>
<input required min="1" type="number" class="form-control" id="qu_factor_purchase_to_stock" name="qu_factor_purchase_to_stock" value="<?php if ($mode == 'edit') echo $product->qu_factor_purchase_to_stock; else echo '1'; ?>">
<input required min="1" type="number" class="form-control input-group-qu" id="qu_factor_purchase_to_stock" name="qu_factor_purchase_to_stock" value="<?php if ($mode == 'edit') echo $product->qu_factor_purchase_to_stock; else echo '1'; ?>">
<div class="help-block with-errors"></div>
</div>
<p id="qu-conversion-info" class="help-block text-muted"></p>
<button id="save-product-button" type="submit" class="btn btn-default">Save</button>
</form>
</div>

View File

@@ -31,7 +31,7 @@
</form>
</div>
<div class="col-sm-4 col-md-4 main well">
<div class="col-sm-6 col-md-5 col-lg-3 main well">
<h3>Product overview <strong><span id="selected-product-name"></span></strong></h3>
<h4><strong>Purchase quantity:</strong> <span id="selected-product-purchase-qu-name"></span></h4>