Skip to content

Commit

Permalink
- Minor overall improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JB committed Aug 9, 2024
1 parent a61d77c commit 9205560
Show file tree
Hide file tree
Showing 4 changed files with 193 additions and 216 deletions.
67 changes: 29 additions & 38 deletions pages/bottles.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,39 @@
$supplier[] = $suppliers;
}
?>
<div>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h2 class="m-0 font-weight-bold text-primary"><a href="#" id="mainTitle">Bottles</a></h2>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tr class="noBorder">
<div class="text-right">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-bars mx-2"></i>Actions</button>
<div class="dropdown-menu dropdown-menu-right">
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addBottle"><i class="fa-solid fa-plus mx-2"></i>Add new</a></li>
<li><a class="dropdown-item" id="exportCSV" href="#"><i class="fa-solid fa-file-export mx-2"></i>Export to CSV</a></li>
<li><a class="dropdown-item" id="exportJSON" href="/pages/export.php?format=json&kind=bottles"><i class="fa-solid fa-file-export mx-2"></i>Export to JSON</a></li>

</div>
</div>
</div>
</tr>
</table>
<table class="table table-striped" id="tdDataBottles" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Size (ml)</th>
<th>Price</th>
<th>Supplier</th>
<th>Pieces</th>
<th>Created</th>
<th>Updated</th>
<th></th>
</tr>
</thead>
</table>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h2 class="m-0 font-weight-bold text-primary"><a href="#" id="mainTitle">Bottles</a></h2>
</div>
<div class="card-body">
<div class="text-right">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-bars mx-2"></i>Actions</button>
<div class="dropdown-menu dropdown-menu-right">
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addBottle"><i class="fa-solid fa-plus mx-2"></i>Add new</a></li>
<li><a class="dropdown-item" id="exportCSV" href="#"><i class="fa-solid fa-file-export mx-2"></i>Export to CSV</a></li>
<li><a class="dropdown-item" id="exportJSON" href="/pages/export.php?format=json&kind=bottles"><i class="fa-solid fa-file-export mx-2"></i>Export to JSON</a></li>
</div>
</div>
</div>
</div>
</div>
<table class="table table-striped" id="tdDataBottles" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Size (ml)</th>
<th>Price</th>
<th>Supplier</th>
<th>Pieces</th>
<th>Created</th>
<th>Updated</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>

<!-- ADD BOTTLE MODAL-->
<div class="modal fade" id="addBottle" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="addBottle" aria-hidden="true">
Expand Down
44 changes: 18 additions & 26 deletions pages/compounds.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,25 @@
<h2 class="m-0 font-weight-bold text-primary"><a href="#" id="mainTitle">Compounds</a></h2>
</div>
<div class="card-body">
<div class="table-responsive">
<div id="innermsg"></div>
<table class="table table-striped table-bordered">
<tr class="noBorder">
<div class="form-inline mb-3">
<input type="text" class="form-control mt-2 ml-2" id="btlSize" placeholder="Enter bottle size, eg: 100">
<button type="button" class="btn btn-primary" id="submitBottleAmount">Submit</button>
<div class="ml-2 mt-2">
<input type="checkbox" class="form-check-input" id="expandCheckbox">
<label class="form-check-label" for="expandCheckbox">Expand All</label>
</div>
</div>
<div class="text-right">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-bars mx-2"></i>Actions</button>
<div class="dropdown-menu dropdown-menu-right">
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addCompound"><i class="fa-solid fa-plus mx-2"></i>Add new</a></li>
<li><a class="dropdown-item" id="exportCSV" href="#"><i class="fa-solid fa-file-export mx-2"></i>Export to CSV</a></li>
<li><a class="dropdown-item" id="exportJSON" href="/pages/export.php?format=json&kind=inventory_compounds"><i class="fa-solid fa-file-export mx-2"></i>Export to JSON</a></li>
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#importJSON"><i class="fa-solid fa-file-import mx-2"></i>Import from JSON</a></li>

</div>
</div>
<div class="form-inline mb-3">
<input type="text" class="form-control mt-2 ml-2" id="btlSize" placeholder="Enter bottle size, eg: 100">
<button type="button" class="btn btn-primary" id="submitBottleAmount">Submit</button>
<div class="ml-2 mt-2">
<input type="checkbox" class="form-check-input" id="expandCheckbox">
<label class="form-check-label" for="expandCheckbox">Expand All</label>
</div>
</div>
<div class="text-right">
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-bars mx-2"></i>Actions</button>
<div class="dropdown-menu dropdown-menu-right">
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addCompound"><i class="fa-solid fa-plus mx-2"></i>Add new</a></li>
<li><a class="dropdown-item" id="exportCSV" href="#"><i class="fa-solid fa-file-export mx-2"></i>Export to CSV</a></li>
<li><a class="dropdown-item" id="exportJSON" href="/pages/export.php?format=json&kind=inventory_compounds"><i class="fa-solid fa-file-export mx-2"></i>Export to JSON</a></li>
<li><a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#importJSON"><i class="fa-solid fa-file-import mx-2"></i>Import from JSON</a></li>
</div>
</tr>
</table>
</div>
</div>

<table class="table table-striped" id="tdDataCompounds" width="100%" cellspacing="0">
<thead>
Expand All @@ -62,7 +55,6 @@
</div>
</div>
</div>
</div>

<!-- ADD NEW MODAL-->
<div class="modal fade" id="addCompound" data-bs-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="addCompound" aria-hidden="true">
Expand Down
103 changes: 51 additions & 52 deletions pages/editUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
<div class="col-md-4">
<div class="text-center">
<div id="profile_pic"><div class="loader"></div></div>
<h6>Upload a different photo...</h6>
<input type="file" name="avatar" id="avatar" class="form-control">
<input type="file" name="avatar" id="avatar" class="mt-2 form-control">
</div>
<div class="dropdown-divider"></div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="text-right">
<input name="upload-avatar" type="submit" class="btn-dark" id="upload-avatar" value="Upload" />
<input name="upload-avatar" type="submit" class="btn btn-secondary mt-2" id="upload-avatar" value="Upload" />
</div>
</div>
</div>
Expand Down Expand Up @@ -60,7 +59,7 @@
</div>
<div class="dropdown-divider"></div>
<div class="form-row">
<div class="col-sm-12">
<div class="col-sm-auto">
<div class="mt-2 text-right">
<button type="button" id="save-profile" name="save-profile" class="btn btn-primary">Update</button>
</div>
Expand All @@ -86,56 +85,56 @@
}
});

$('#profile_pic').html('<img class="img-profile-avatar" src="<?=$doc['avatar']?: '/img/logo_def.png'; ?>">');

$('#save-profile').click(function() {
$.ajax({
url: '/pages/update_settings.php',
type: 'POST',
data: {
update_user_profile: 1,
user_fname: $("#fullName").val(),
user_email: $("#email").val(),
user_pass: $("#password").val()
},
dataType: 'json',
success: function (data) {
if(data.success){
var msg = '<div class="alert alert-success">'+data.success+'</div>';
}else if( data.error){
var msg = '<div class="alert alert-danger">'+data.error+'</div>';
$('#profile_pic').html('<img class="img-profile-avatar" src="<?=$doc['avatar']?: '/img/logo_def.png'; ?>">');

$('#save-profile').click(function() {
$.ajax({
url: '/pages/update_settings.php',
type: 'POST',
data: {
update_user_profile: 1,
user_fname: $("#fullName").val(),
user_email: $("#email").val(),
user_pass: $("#password").val()
},
dataType: 'json',
success: function (data) {
if(data.success){
var msg = '<div class="alert alert-success">'+data.success+'</div>';
}else if( data.error){
var msg = '<div class="alert alert-danger">'+data.error+'</div>';
}
$('#msgU').html(msg);
}
$('#msgU').html(msg);
});
});

$('#upload-avatar').click(function() {
var fd = new FormData();
var files = $('#avatar')[0].files;

if(files.length > 0 ){
fd.append('avatar',files[0]);
}
});
});

$('#upload-avatar').click(function() {
var fd = new FormData();
var files = $('#avatar')[0].files;

if(files.length > 0 ){
fd.append('avatar',files[0]);
}
$.ajax({
url: '/pages/update_settings.php?update_user_avatar=1',
type: 'POST',
data: fd,
contentType: false,
processData: false,
cache: false,
dataType: 'json',
success: function (data) {
if(data.success){
var msg = '<div class="alert alert-success">'+data.success.msg+'</div>';
$('#profile_pic').html('<img class="img-profile-avatar" src="'+data.success.avatar+'">');

}else if( data.error){
var msg = '<div class="alert alert-danger">'+data.error+'</div>';
$.ajax({
url: '/pages/update_settings.php?update_user_avatar=1',
type: 'POST',
data: fd,
contentType: false,
processData: false,
cache: false,
dataType: 'json',
success: function (data) {
if(data.success){
var msg = '<div class="alert alert-success">'+data.success.msg+'</div>';
$('#profile_pic').html('<img class="img-profile-avatar" src="'+data.success.avatar+'">');

}else if( data.error){
var msg = '<div class="alert alert-danger">'+data.error+'</div>';
}
$('#msgU').html(msg);
}
$('#msgU').html(msg);
}
});
});
});
});
});
</script>
Loading

0 comments on commit 9205560

Please sign in to comment.