mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 23:54:43 +08:00
Stock modal UX fixes [SCI-6714] (#3998)
Co-authored-by: Anton <anton@scinote.net>
This commit is contained in:
parent
f8a598b408
commit
3a4cab9d0a
4 changed files with 11 additions and 9 deletions
|
@ -45,7 +45,7 @@ var RepositoryStockValues = (function() {
|
||||||
$manageModal.find('form').on('ajax:success', function() {
|
$manageModal.find('form').on('ajax:success', function() {
|
||||||
var dataTable = $('.dataTable').DataTable();
|
var dataTable = $('.dataTable').DataTable();
|
||||||
$manageModal.modal('hide');
|
$manageModal.modal('hide');
|
||||||
dataTable.ajax.reload();
|
dataTable.ajax.reload(null, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.stock-operator-option').click(function() {
|
$('.stock-operator-option').click(function() {
|
||||||
|
@ -60,11 +60,14 @@ var RepositoryStockValues = (function() {
|
||||||
switch ($(this).data('operator')) {
|
switch ($(this).data('operator')) {
|
||||||
case 'set':
|
case 'set':
|
||||||
dropdownSelector.enableSelector(UNIT_SELECTOR);
|
dropdownSelector.enableSelector(UNIT_SELECTOR);
|
||||||
|
$stockInput.val($stockInput.data('currentAmount'));
|
||||||
break;
|
break;
|
||||||
case 'add':
|
case 'add':
|
||||||
|
$stockInput.val('');
|
||||||
dropdownSelector.disableSelector(UNIT_SELECTOR);
|
dropdownSelector.disableSelector(UNIT_SELECTOR);
|
||||||
break;
|
break;
|
||||||
case 'remove':
|
case 'remove':
|
||||||
|
$stockInput.val('');
|
||||||
dropdownSelector.disableSelector(UNIT_SELECTOR);
|
dropdownSelector.disableSelector(UNIT_SELECTOR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -114,7 +117,7 @@ var RepositoryStockValues = (function() {
|
||||||
var inputAmount = parseFloat($(this).val());
|
var inputAmount = parseFloat($(this).val());
|
||||||
var newAmount;
|
var newAmount;
|
||||||
|
|
||||||
if (!inputAmount) return;
|
if (!(inputAmount >= 0)) return;
|
||||||
|
|
||||||
switch ($(this).data('operator')) {
|
switch ($(this).data('operator')) {
|
||||||
case 'set':
|
case 'set':
|
||||||
|
@ -159,6 +162,8 @@ var RepositoryStockValues = (function() {
|
||||||
|
|
||||||
$manageModal.modal('show');
|
$manageModal.modal('show');
|
||||||
$('#stock-input-amount').focus();
|
$('#stock-input-amount').focus();
|
||||||
|
$('#stock-input-amount')[0].selectionStart = $('#stock-input-amount')[0].value.length;
|
||||||
|
$('#stock-input-amount')[0].selectionEnd = $('#stock-input-amount')[0].value.length;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -228,12 +228,6 @@
|
||||||
|
|
||||||
// Stock
|
// Stock
|
||||||
.stock-value-view-render {
|
.stock-value-view-render {
|
||||||
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
};
|
|
||||||
|
|
||||||
&.stock-alert {
|
&.stock-alert {
|
||||||
color: $brand-danger;
|
color: $brand-danger;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
data-current-amount="<%= repository_stock_value.amount %>"
|
data-current-amount="<%= repository_stock_value.amount %>"
|
||||||
data-decimals="<%= repository_stock_column.metadata['decimals'] %>"
|
data-decimals="<%= repository_stock_column.metadata['decimals'] %>"
|
||||||
value="<%= repository_stock_value.formatted_value %>"
|
value="<%= repository_stock_value.formatted_value %>"
|
||||||
placeholder="<%= t('repository_stock_values.manage_modal.amount_placeholder') %>"
|
placeholder="<%= t("repository_stock_values.manage_modal.amount_placeholder#{repository_stock_value.new_record? ? '_new' : ''}") %>"
|
||||||
required />
|
required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -105,6 +105,8 @@
|
||||||
tabindex="5"
|
tabindex="5"
|
||||||
placeholder="Enter amount"/>
|
placeholder="Enter amount"/>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="units">
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1717,6 +1717,7 @@ en:
|
||||||
set: "Set to"
|
set: "Set to"
|
||||||
amount: "Amount"
|
amount: "Amount"
|
||||||
amount_placeholder: "Enter amount"
|
amount_placeholder: "Enter amount"
|
||||||
|
amount_placeholder_new: "100, 2000, ..."
|
||||||
amount_error: "Enter an amount"
|
amount_error: "Enter an amount"
|
||||||
unit: "Unit"
|
unit: "Unit"
|
||||||
unit_prompt: "Select unit"
|
unit_prompt: "Select unit"
|
||||||
|
|
Loading…
Add table
Reference in a new issue