From b4dec7b042e4acb91da44f21ef4c4e98c316f734 Mon Sep 17 00:00:00 2001 From: JB Date: Fri, 9 Aug 2024 19:15:29 +0100 Subject: [PATCH 01/39] - v10.9 --- CHANGELOG.md | 2 ++ VERSION.md | 2 +- db/schema.ver | 2 +- releasenotes.md | 10 +--------- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a183c14e..df9b4839 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ # CHANGELOG +### Version 10.9 + ### Version 10.8 - Fix API key update not returning error in correct format - Rewrite API page diff --git a/VERSION.md b/VERSION.md index f5d39891..73def33c 100755 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -10.8 +10.9 diff --git a/db/schema.ver b/db/schema.ver index f5d39891..73def33c 100644 --- a/db/schema.ver +++ b/db/schema.ver @@ -1 +1 @@ -10.8 +10.9 diff --git a/releasenotes.md b/releasenotes.md index 4941034a..17d4bcae 100755 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,11 +1,3 @@ -Whats New in v10.8 +Whats New in v10.9 -------------------------- -- This release also contains various UI and backend minor improvements -- Added support for a dark theme -- Complete rewrite for Finished Product page -- Added a font size when exporting a PDF in Sell Formula -- Added brand logo when exporting a PDF in Sell Formula -- Added opacity for watermak in Sell Formula page -- Replaced PDF export in Sell Formula with the native DataTables function -- Under the hood improvements for Finished Product page - This release may include more changes, for full details please refer to the CHANGELOG From 0ef67fc1827d55eaa00ef35cbf0f82d083c4ea51 Mon Sep 17 00:00:00 2001 From: JB Date: Sat, 10 Aug 2024 11:10:31 +0100 Subject: [PATCH 02/39] - Fix materials not updating corrrectly when added in the cart - Added CSV export for cart ingredients - Added a toast message for the cart actions - Added a toast message when adding an ingredient to the cart in Make Formula - CSS clean-up --- CHANGELOG.md | 5 +++++ LIMITATIONS.md | 2 +- css/sb-admin-2.css | 1 - js/makeFormula.js | 12 +++++++----- pages/cart.php | 41 +++++++++++++++++++++++++++++++++-------- pages/manageFormula.php | 5 ++++- pages/top.php | 9 ++++----- releasenotes.md | 2 ++ 8 files changed, 56 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df9b4839..868d631b 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG ### Version 10.9 +- Fix materials not updating corrrectly when added in the cart +- Added CSV export for cart ingredients +- Added a toast message for the cart actions +- Added a toast message when adding an ingredient to the cart in Make Formula +- CSS clean-up ### Version 10.8 - Fix API key update not returning error in correct format diff --git a/LIMITATIONS.md b/LIMITATIONS.md index 826e4abc..85f90c2a 100644 --- a/LIMITATIONS.md +++ b/LIMITATIONS.md @@ -1,4 +1,4 @@ #Limitations - No support for enviroments like XAMPP -- Own vhost is required if run outide docker \ No newline at end of file +- Own vhost is required if run outside docker \ No newline at end of file diff --git a/css/sb-admin-2.css b/css/sb-admin-2.css index 7e506ef5..3e094249 100755 --- a/css/sb-admin-2.css +++ b/css/sb-admin-2.css @@ -9597,7 +9597,6 @@ a:focus { } .bg-gradient-primary { - background-color: #4e73df; background-image: linear-gradient(180deg, #4e73df 10%, #224abe 100%); background-size: cover; } diff --git a/js/makeFormula.js b/js/makeFormula.js index cdf9c078..3d9017b0 100644 --- a/js/makeFormula.js +++ b/js/makeFormula.js @@ -295,13 +295,15 @@ function formatSuppliersSelection (supplierData) { }, dataType: 'json', success: function (data) { - if(data.success) { - var msg = '
x' + data.success + '
'; + if(data.success){ + $('#toast-title').html('' + data.success); + $('.toast-header').removeClass().addClass('toast-header alert-success'); reload_data(); - } else { - var msg = '
x' + data.error + '
'; + }else if(data.error){ + $('#toast-title').html('' + data.error); + $('.toast-header').removeClass().addClass('toast-header alert-danger'); } - $('#msg').html(msg); + $('.toast').toast('show'); } }); }); diff --git a/pages/cart.php b/pages/cart.php index 95cf5cdd..92668538 100644 --- a/pages/cart.php +++ b/pages/cart.php @@ -9,6 +9,14 @@
+
+ +
@@ -45,6 +53,15 @@ search: 'Quick Search:', searchPlaceholder: 'Name..', }, + buttons: [{ + extend: "csv", + filename: "Cart ingredients", + exportOptions: { + columns: [0, 1, 2], + stripHtml: true, + orthogonal: 'export' + } + }], ajax: { url: '/core/cart_data.php', type: 'POST', @@ -61,7 +78,7 @@ { data : 'purity', title: 'Purity (%)' }, { data : 'quantity', title: 'Quantity ()' }, { data : null, title: '', render: actions }, - + ], order: [[ 0, 'asc' ]], lengthMenu: [[20, 50, 100, 200, 400], [20, 50, 100, 200, 400]], @@ -90,6 +107,9 @@ function name(data, type, row){ }else{ data = 'N/A'; } + if (type === 'export') { + data = row.name; + } return data; } @@ -126,13 +146,14 @@ className : "btn-danger", dataType: 'json', success: function (data) { if(data.success) { - var msg = '
x' + data.success + '
'; - reload_cart_data(); - } else { - var msg = '
x' + data.error + '
'; - - } - $('#innermsg').html(msg); + $('#toast-title').html('' + data.success); + $('.toast-header').removeClass().addClass('toast-header alert-success'); + reload_cart_data(); + }else if(data.error){ + $('#toast-title').html('' + data.error); + $('.toast-header').removeClass().addClass('toast-header alert-danger'); + } + $('.toast').toast('show'); } }); @@ -150,5 +171,9 @@ className : "btn-secondary", }); }); + $('#export_csv').click(() => { + $('#tdDataCart').DataTable().button(0).trigger(); + }); + }); //END DOC \ No newline at end of file diff --git a/pages/manageFormula.php b/pages/manageFormula.php index da733564..c0e9183a 100644 --- a/pages/manageFormula.php +++ b/pages/manageFormula.php @@ -716,13 +716,16 @@ if(mysqli_query($conn, "UPDATE cart SET quantity = quantity + '$quantity' WHERE name = '$material'")){ $response['success'] = 'Additional '.$quantity.$settings['mUnit'].' of '.$material.' added to the cart.'; } + echo json_encode($response); + return; } if(mysqli_query($conn, "INSERT INTO cart (ingID,name,quantity,purity) VALUES ('$ingID','$material','$quantity','$purity')")){ $response['success'] = $material.' added to the cart!'; + echo json_encode($response); + return; } - echo json_encode($response); return; } diff --git a/pages/top.php b/pages/top.php index 5f5258e7..e4094d9f 100755 --- a/pages/top.php +++ b/pages/top.php @@ -45,11 +45,10 @@
  • Add new
  • @@ -38,152 +38,158 @@ $('[data-bs-toggle="tooltip"]').tooltip(); var tdIngDocs = $('#tdIngDocs').DataTable( { - columnDefs: [ - { className: 'text-center', targets: '_all' }, - { orderable: false, targets: [4]} - ], - dom: 'lfrtip', - processing: true, - language: { - loadingRecords: ' ', - processing: 'Loading...', - emptyTable: 'No documents added yet.', - search: 'Search:' + columnDefs: [ + { className: 'text-center', targets: '_all' }, + { orderable: false, targets: [4]} + ], + dom: 'lfrtip', + processing: true, + language: { + loadingRecords: ' ', + processing: 'Loading...', + emptyTable: 'No documents added yet.', + search: 'Search:' }, - ajax: { url: '/core/list_ing_doc_data.php?id=' }, - columns: [ - { data : 'name', title: 'Document', render: dName }, - { data : 'docData', title: 'File', render: docData}, - { data : 'notes', title: 'Notes', render: dNotes}, - { data : 'docSize', title: 'Size'}, - { data : null, title: '', render: dActions}, - ], - order: [[ 1, 'asc' ]], - lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]], - pageLength: 20, - displayLength: 20, + ajax: { url: '/core/list_ing_doc_data.php?id=' }, + columns: [ + { data : 'name', title: 'Document', render: dName }, + { data : 'docData', title: 'File', render: docData}, + { data : 'notes', title: 'Notes', render: dNotes}, + { data : 'docSize', title: 'Size'}, + { data : null, title: '', render: dActions}, + ], + order: [[ 1, 'asc' ]], + lengthMenu: [[20, 50, 100, -1], [20, 50, 100, "All"]], + pageLength: 20, + displayLength: 20, }); -}); -function dName(data, type, row){ - return ''+row.name+''; -} -function docData(data, type, row){ - return ''; -} -function dNotes(data, type, row){ - return ''+row.notes+''; -} -function dActions(data, type, row){ - return ''; -} + + function dName(data, type, row){ + return ''+row.name+''; + }; + + function docData(data, type, row){ + return ''; + }; + + function dNotes(data, type, row){ + return ''+row.notes+'' + }; + + function dActions(data, type, row){ + return '' + }; -$('#tdIngDocs').editable({ - container: 'body', - selector: 'i.name', - type: 'POST', - url: "update_data.php?ingDoc=update&ingID=", - title: 'Document name', - }); + $('#tdIngDocs').editable({ + container: 'body', + selector: 'i.name', + type: 'POST', + url: "/pages/update_data.php?ingDoc=update&ingID=", + title: 'Document name', + }); $('#tdIngDocs').editable({ container: 'body', selector: 'i.notes', type: 'POST', - url: "update_data.php?ingDoc=update&ingID=", + url: "/pages/update_data.php?ingDoc=update&ingID=", title: 'Notes', }); -$('#tdIngDocs').on('click', '[id*=dDel]', function () { - var d = {}; - d.ID = $(this).attr('data-id'); - d.Name = $(this).attr('data-name'); - - bootbox.dialog({ - title: "Confirm document removal", - message : 'Remove '+ d.Name +' from the list?', - buttons :{ - main: { - label : "Remove", - className : "btn-danger", - callback: function (){ - - $.ajax({ - url: 'update_data.php', - type: 'GET', - data: { - doc: 'delete', - id: d.ID, - ownerID: '' + $('#tdIngDocs').on('click', '[id*=dDel]', function () { + var d = {}; + d.ID = $(this).attr('data-id'); + d.Name = $(this).attr('data-name'); + + bootbox.dialog({ + title: "Confirm document removal", + message : 'Remove '+ d.Name +' from the list?', + buttons :{ + main: { + label : "Remove", + className : "btn-danger", + callback: function (){ + + $.ajax({ + url: '/pages/update_data.php', + type: 'GET', + data: { + doc: 'delete', + id: d.ID, + ownerID: '' }, - dataType: 'html', - success: function (data) { - $('#msg_doc').html(data); - reload_doc_data(); - } - }); - - return true; - } - }, - cancel: { - label : "Cancel", - className : "btn-secondary", - callback : function() { - return true; - } - } - },onEscape: function () {return true;} - }); -}); - -$('#addDoc').on('click', '[id*=doc_upload]', function () { - - $("#doc_inf").html('
    Please wait, file upload in progress....
    '); - $("#doc_upload").prop("disabled", true); - $("#doc_upload").prop('value', 'Please wait...'); - - var fd = new FormData(); - var files = $('#doc_file')[0].files; - var doc_name = $('#doc_name').val(); - var doc_notes = $('#doc_notes').val(); + dataType: 'html', + success: function (data) { + $('#msg_doc').html(data); + reload_doc_data(); + } + }); + + return true; + } + }, + cancel: { + label : "Cancel", + className : "btn-secondary", + callback : function() { + return true; + } + } + },onEscape: function () {return true;} + }); + }); - if(files.length > 0 ){ - fd.append('doc_file',files[0]); + $('#addDoc').on('click', '[id*=doc_upload]', function () { + + $("#doc_inf").html('
    Please wait, file upload in progress....
    '); + $("#doc_upload").prop("disabled", true); + $("#doc_upload").prop('value', 'Please wait...'); + + var fd = new FormData(); + var files = $('#doc_file')[0].files; + var doc_name = $('#doc_name').val(); + var doc_notes = $('#doc_notes').val(); + + if(files.length > 0 ){ + fd.append('doc_file',files[0]); + + $.ajax({ + url: '/pages/upload.php?type=1&doc_name=' + btoa(doc_name) + '&doc_notes=' + btoa(doc_notes) + '&id=', + type: 'POST', + data: fd, + dataType: 'json', + contentType: false, + processData: false, + cache: false, + success: function(response){ + if(response.success){ + var msg = '
    x' + response.success + '
    '; + $("#doc_upload").prop("disabled", false); + $("#doc_upload").prop('value', 'Upload'); + reload_doc_data(); + }else{ + $("#doc_inf").html('
    x' + response.error + '
    '); + $("#doc_upload").prop("disabled", false); + $("#doc_upload").prop('value', 'Upload'); + } + $('#doc_inf').html(msg); + }, + }); + }else{ + $("#doc_inf").html('
    xError: Please select a file to upload!
    '); + $("#doc_upload").prop("disabled", false); + $("#doc_upload").prop('value', 'Upload'); + } + + }); - $.ajax({ - url: 'upload.php?type=1&doc_name=' + btoa(doc_name) + '&doc_notes=' + btoa(doc_notes) + '&id=', - type: 'POST', - data: fd, - dataType: 'json', - contentType: false, - processData: false, - cache: false, - success: function(response){ - if(response.success){ - var msg = '
    x' + response.success + '
    '; - $("#doc_upload").prop("disabled", false); - $("#doc_upload").prop('value', 'Upload'); - reload_doc_data(); - }else{ - $("#doc_inf").html('
    x' + response.error + '
    '); - $("#doc_upload").prop("disabled", false); - $("#doc_upload").prop('value', 'Upload'); - } - $('#doc_inf').html(msg); - }, - }); - }else{ - $("#doc_inf").html('
    xError: Please select a file to upload!
    '); - $("#doc_upload").prop("disabled", false); - $("#doc_upload").prop('value', 'Upload'); - } - + function reload_doc_data() { + $('#tdIngDocs').DataTable().ajax.reload(null, true); + }; + }); -function reload_doc_data() { - $('#tdIngDocs').DataTable().ajax.reload(null, true); -}; @@ -195,20 +201,20 @@ function reload_doc_data() {
    - - - - - - - - - - -

    Olfactive family

    Physical State

    + +
    +
    +

    Olfactive family

    +
    +
    +

    +
    +
    +

    Physical State

    +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + From 8fdfa74c2598bbf8266009daf3aeeb4da526b350 Mon Sep 17 00:00:00 2001 From: JB Date: Sat, 10 Aug 2024 21:31:58 +0100 Subject: [PATCH 17/39] - Minor UI update --- pages/compounds.php | 2 +- pages/customers.php | 370 ++++++++++++++++++++++---------------------- 2 files changed, 183 insertions(+), 189 deletions(-) diff --git a/pages/compounds.php b/pages/compounds.php index 4e2bbfa4..f3d99e93 100644 --- a/pages/compounds.php +++ b/pages/compounds.php @@ -58,7 +58,7 @@