Initial commit: Complete WooCommerce Smart Google Pricing plugin with vendor dependencies

This commit is contained in:
2025-12-23 07:48:45 +01:00
commit 9b66109ca1
32472 changed files with 4065017 additions and 0 deletions

200
assets/css/admin.css Normal file
View File

@@ -0,0 +1,200 @@
/**
* Admin styles for Informatiq Smart Pricing
*/
.informatiq-sp-admin {
max-width: 1400px;
}
.informatiq-sp-content {
display: flex;
gap: 30px;
margin-top: 20px;
}
.informatiq-sp-main {
flex: 1;
min-width: 0;
}
.informatiq-sp-sidebar {
width: 300px;
flex-shrink: 0;
}
.informatiq-sp-sidebar-box {
background: #fff;
border: 1px solid #ccd0d4;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.informatiq-sp-sidebar-box h3 {
margin-top: 0;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
.informatiq-sp-sidebar-box ul,
.informatiq-sp-sidebar-box ol {
margin: 10px 0 0 20px;
}
.informatiq-sp-sidebar-box li {
margin-bottom: 8px;
line-height: 1.5;
}
.informatiq-sp-actions {
background: #f9f9f9;
padding: 20px;
border: 1px solid #ccd0d4;
margin: 20px 0;
}
.informatiq-sp-actions h2 {
margin-top: 0;
}
.informatiq-sp-actions p {
margin-bottom: 0;
}
.informatiq-sp-actions .button {
margin-right: 10px;
}
#informatiq-sp-sync-status {
margin-top: 15px;
padding: 10px 15px;
}
#informatiq-sp-sync-status.notice-success {
border-left-color: #46b450;
}
#informatiq-sp-sync-status.notice-error {
border-left-color: #dc3232;
}
#informatiq-sp-sync-status.notice-info {
border-left-color: #00a0d2;
}
.informatiq-sp-schedule-info table {
margin-top: 15px;
}
.informatiq-sp-schedule-info th {
width: 200px;
font-weight: 600;
text-align: left;
padding: 12px;
}
.informatiq-sp-schedule-info td {
padding: 12px;
}
.informatiq-sp-logs {
margin-top: 30px;
}
.informatiq-sp-logs table {
margin-top: 15px;
}
.informatiq-sp-logs th,
.informatiq-sp-logs td {
padding: 10px;
}
.informatiq-sp-logs th {
font-weight: 600;
}
/* Loading state */
.informatiq-sp-loading {
opacity: 0.6;
pointer-events: none;
}
.informatiq-sp-loading::after {
content: "";
display: inline-block;
width: 16px;
height: 16px;
margin-left: 8px;
border: 2px solid #f3f3f3;
border-top: 2px solid #3498db;
border-radius: 50%;
animation: informatiq-sp-spin 1s linear infinite;
}
@keyframes informatiq-sp-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Responsive */
@media (max-width: 1024px) {
.informatiq-sp-content {
flex-direction: column;
}
.informatiq-sp-sidebar {
width: 100%;
}
}
/* Form styling */
.informatiq-sp-admin .form-table th {
padding: 20px 10px 20px 0;
font-weight: 600;
}
.informatiq-sp-admin .form-table td {
padding: 20px 10px;
}
.informatiq-sp-admin textarea.code {
font-family: Consolas, Monaco, monospace;
font-size: 12px;
line-height: 1.5;
}
.informatiq-sp-admin .description {
color: #646970;
font-style: italic;
}
/* Stats boxes */
.informatiq-sp-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin: 20px 0;
}
.informatiq-sp-stat-box {
background: #fff;
border: 1px solid #ccd0d4;
padding: 20px;
text-align: center;
box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.informatiq-sp-stat-box .stat-value {
font-size: 32px;
font-weight: 700;
color: #2271b1;
margin: 10px 0;
}
.informatiq-sp-stat-box .stat-label {
font-size: 14px;
color: #646970;
text-transform: uppercase;
letter-spacing: 0.5px;
}

149
assets/js/admin.js Normal file
View File

@@ -0,0 +1,149 @@
/**
* Admin JavaScript for Informatiq Smart Pricing
*/
(function($) {
'use strict';
var InformatiqSP = {
/**
* Initialize
*/
init: function() {
this.bindEvents();
},
/**
* Bind event handlers
*/
bindEvents: function() {
$('#informatiq-sp-manual-sync').on('click', this.handleManualSync);
$('#informatiq-sp-test-connection').on('click', this.handleTestConnection);
},
/**
* Handle manual sync button click
*/
handleManualSync: function(e) {
e.preventDefault();
var $button = $(this);
var $status = $('#informatiq-sp-sync-status');
// Confirm action
if (!confirm(informatiqSP.strings.confirmSync || 'Are you sure you want to run a manual price sync? This may take several minutes.')) {
return;
}
// Disable button and show loading state
$button.prop('disabled', true).addClass('informatiq-sp-loading');
// Show status message
$status
.removeClass('notice-success notice-error')
.addClass('notice-info')
.html('<p>' + (informatiqSP.strings.syncInProgress || 'Sync in progress...') + '</p>')
.show();
// Make AJAX request
$.ajax({
url: informatiqSP.ajaxUrl,
type: 'POST',
data: {
action: 'informatiq_sp_manual_sync',
nonce: informatiqSP.nonce
},
success: function(response) {
if (response.success) {
$status
.removeClass('notice-info notice-error')
.addClass('notice-success')
.html('<p>' + response.data.message + '</p>');
// Reload page after 2 seconds to show updated logs
setTimeout(function() {
location.reload();
}, 2000);
} else {
$status
.removeClass('notice-info notice-success')
.addClass('notice-error')
.html('<p>Error: ' + (response.data.message || 'Unknown error') + '</p>');
}
},
error: function(jqXHR, textStatus, errorThrown) {
$status
.removeClass('notice-info notice-success')
.addClass('notice-error')
.html('<p>Error: ' + errorThrown + '</p>');
},
complete: function() {
$button.prop('disabled', false).removeClass('informatiq-sp-loading');
}
});
},
/**
* Handle test connection button click
*/
handleTestConnection: function(e) {
e.preventDefault();
var $button = $(this);
var $status = $('#informatiq-sp-sync-status');
// Disable button and show loading state
$button.prop('disabled', true).addClass('informatiq-sp-loading');
// Show status message
$status
.removeClass('notice-success notice-error')
.addClass('notice-info')
.html('<p>' + (informatiqSP.strings.testInProgress || 'Testing connection...') + '</p>')
.show();
// Make AJAX request
$.ajax({
url: informatiqSP.ajaxUrl,
type: 'POST',
data: {
action: 'informatiq_sp_test_connection',
nonce: informatiqSP.nonce
},
success: function(response) {
if (response.success) {
$status
.removeClass('notice-info notice-error')
.addClass('notice-success')
.html('<p>' + response.data.message + '</p>');
} else {
$status
.removeClass('notice-info notice-success')
.addClass('notice-error')
.html('<p>Error: ' + (response.data.message || 'Unknown error') + '</p>');
}
},
error: function(jqXHR, textStatus, errorThrown) {
$status
.removeClass('notice-info notice-success')
.addClass('notice-error')
.html('<p>Error: ' + errorThrown + '</p>');
},
complete: function() {
$button.prop('disabled', false).removeClass('informatiq-sp-loading');
// Hide status message after 5 seconds
setTimeout(function() {
$status.fadeOut();
}, 5000);
}
});
}
};
// Initialize when document is ready
$(document).ready(function() {
InformatiqSP.init();
});
})(jQuery);