Commit 97d6611e authored by Malcolm Blaney's avatar Malcolm Blaney

Don't use jquery-ui dialogs on mobile, currently only applies to

Stock module but will change everywhere if it proves useful.
parent b1a56d14
Pipeline #17810991 passed with stage
in 1 minute and 9 seconds
......@@ -279,7 +279,7 @@ class Stock extends Base {
'</div></div>' .
'<button id="stock-column-right">right</button>' .
'</div><div id="stock-clear"></div>' .
'<form id="stock-form">' .
'<form id="stock-form" class="hidden">' .
'<div id="stock-form-buttons">' .
'<button id="stock-form-previous">Previous</button>' .
'<button id="stock-form-clear">New Product</button>' .
......@@ -360,7 +360,7 @@ class Stock extends Base {
'<span class="stock-new-available"></span>' .
'<button class="stock-list-all hidden">show all</button>' .
'</div>' .
'<div class="stock-import-info">' .
'<div class="stock-import-info hidden">' .
$this->Substitute('stock-import-info') .
'</div>' .
'<div class="stock-profile-dialog hidden">' .
......
This diff is collapsed.
......@@ -65,6 +65,7 @@ if (!this.dobrado.stock) {
var checkboxDisplayed = [];
// This is the auto-complete list for categories.
var categories = [];
var mobile = false;
$(function() {
// Don't run if the module isn't on the page.
......@@ -72,35 +73,48 @@ if (!this.dobrado.stock) {
return;
}
$('#stock-form').dialog({
show: true, autoOpen: false, width: 760, height: 450,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Form', close: hideCheckbox,
create: dobrado.fixedDialog });
$('.stock-quantity-dialog').dialog({
show: true, autoOpen: false, width: 600, height: 400,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Adjustment',
create: dobrado.fixedDialog });
$('.stock-import-info').dialog({
show: true, autoOpen: false, width: 700, height: 400,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Import Help',
create: dobrado.fixedDialog });
$('.stock-profile-dialog').dialog({
show: true, autoOpen: false, width: 530, height: 400,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Column Profiles',
create: dobrado.fixedDialog });
mobile = $('.dobrado-mobile').is(':visible');
if (!mobile) {
$('#stock-form').dialog({
show: true, autoOpen: false, width: 760, height: 450,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Form', close: hideCheckbox,
create: dobrado.fixedDialog });
$('.stock-quantity-dialog').dialog({
show: true, autoOpen: false, width: 600, height: 400,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Adjustment',
create: dobrado.fixedDialog });
$('.stock-import-info').dialog({
show: true, autoOpen: false, width: 700, height: 400,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Import Help',
create: dobrado.fixedDialog });
$('.stock-profile-dialog').dialog({
show: true, autoOpen: false, width: 530, height: 400,
position: { my: 'top', at: 'top+50', of: window },
title: 'Stock Column Profiles',
create: dobrado.fixedDialog });
}
$('#stock-group-select').selectmenu({ change: changeGroup });
$('#stock-import-file').val('').change(loadImportData);
$('#stock-import-supplier').selectmenu();
$('#stock-open-product-form').button().click(function() {
$('#stock-form').dialog('open');
if (mobile) {
$('#stock-form').toggle();
}
else {
$('#stock-form').dialog('open');
}
});
$('#stock-import-help').button().click(function() {
$('.stock-import-info').dialog('open');
if (mobile) {
$('.stock-import-info').toggle();
}
else {
$('.stock-import-info').dialog('open');
}
});
$('#stock-profiles').selectmenu({ change: changeProfile });
$('#stock-profile-add').button().click(addProfile);
......@@ -236,7 +250,12 @@ if (!this.dobrado.stock) {
$('#stock-profiles').html(profile.options);
$('#stock-profiles').selectmenu('refresh');
$('#stock-profile-input').val('');
$('.stock-profile-dialog').dialog('close');
if (mobile) {
$('.stock-profile-dialog').hide();
}
else {
$('.stock-profile-dialog').dialog('close');
}
});
}
......@@ -513,7 +532,9 @@ if (!this.dobrado.stock) {
$('#stock-user-input').parent().show();
$('label[for=stock-alternative]').show();
$('#stock-total-quantity-input').parent().show();
$('#stock-form').dialog('option', 'title', 'Stock Form');
if (!mobile) {
$('#stock-form').dialog('option', 'title', 'Stock Form');
}
}
else if (item.rows.length === 1) {
showCheckbox();
......@@ -522,7 +543,9 @@ if (!this.dobrado.stock) {
$('#stock-user-input').parent().show();
$('label[for=stock-alternative]').show();
$('#stock-total-quantity-input').parent().show();
$('#stock-form').dialog('option', 'title', 'Stock Form');
if (!mobile) {
$('#stock-form').dialog('option', 'title', 'Stock Form');
}
showProduct(stockGridView.getItem(item.rows[0]));
}
else {
......@@ -536,9 +559,14 @@ if (!this.dobrado.stock) {
$('#stock-user-input').parent().hide();
$('label[for=stock-alternative]').hide();
$('#stock-total-quantity-input').parent().hide();
$('#stock-form').dialog('option', 'title', 'Stock Form: Updating ' +
item.rows.length + ' products');
$('#stock-form').dialog('open');
if (mobile) {
$('#stock-form').show();
}
else {
$('#stock-form').dialog('option', 'title', 'Stock Form: Updating ' +
item.rows.length + ' products');
$('#stock-form').dialog('open');
}
}
});
stockGrid.onSort.subscribe(function (e, args) {
......@@ -752,7 +780,12 @@ if (!this.dobrado.stock) {
return;
}
$('#stock-profiles').val(value);
$('.stock-profile-dialog').dialog('close');
if (mobile) {
$('.stock-profile-dialog').hide();
}
else {
$('.stock-profile-dialog').dialog('close');
}
changeProfile();
});
}
......@@ -1252,7 +1285,12 @@ if (!this.dobrado.stock) {
// Set the current total for this product in the adjustment form.
var total = $('#stock-total-quantity-input').val();
$('#stock-quantity-adjust-input').val(total);
$('.stock-quantity-dialog').dialog('open');
if (mobile) {
$('.stock-quantity-dialog').show();
}
else {
$('.stock-quantity-dialog').dialog('open');
}
});
return false;
}
......@@ -1340,7 +1378,12 @@ if (!this.dobrado.stock) {
}
var rows = stockGridView.mapIdsToRows([oldId]);
stockGrid.setSelectedRows(rows);
$('.stock-quantity-dialog').dialog('close');
if (mobile) {
$('.stock-quantity-dialog').hide();
}
else {
$('.stock-quantity-dialog').dialog('close');
}
if (adjust.remove && confirm('Remove ' + name + ' from stock?')) {
remove();
}
......@@ -1474,7 +1517,9 @@ if (!this.dobrado.stock) {
}
resetForm(false);
showAll(false);
$('#stock-form').dialog('close');
if (!mobile) {
$('#stock-form').dialog('close');
}
});
return false;
}
......@@ -2189,7 +2234,12 @@ if (!this.dobrado.stock) {
}
if (value === 'edit') {
$('#stock-profiles').val(profile).selectmenu('refresh');
$('.stock-profile-dialog').dialog('open');
if (mobile) {
$('.stock-profile-dialog').show();
}
else {
$('.stock-profile-dialog').dialog('open');
}
}
else {
dobrado.log('Changing profile.', 'info');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment