fix: page directory naming, workspace shortcuts, remove pycache

This commit is contained in:
Westech Admin
2026-05-17 13:10:09 +00:00
parent 2695eb308d
commit 33410357d2
13 changed files with 54 additions and 260 deletions
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
{% extends "templates/web.html" %}
{% block style %}
<style>
.badge.badge-fresh { background-color: #28a745; }
.badge.badge-aging { background-color: #ffc107; color: #212529; }
.badge.badge-expired { background-color: #dc3545; }
.badge.badge-needs { background-color: #fd7e14; }
.badge.badge-error { background-color: #6c757d; }
</style>
{% endblock %}
{% block page_content %}
<div id="ebay-pricing-page"></div>
{% endblock %}
@@ -0,0 +1,8 @@
frappe.pages['ebay-pricing'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: __('eBay Pricing'),
single_column: true
});
$('<div style="padding:2rem;"><h3>eBay Pricing</h3><p>Search and batch price systems from eBay sold listings.</p></div>').appendTo(page.main);
};
@@ -0,0 +1,26 @@
{
"creation": "2026-05-17 05:30:00.000000",
"docstatus": 0,
"doctype": "Page",
"icon": "fa fa-tags",
"modified": "2026-05-17 05:30:00.000000",
"modified_by": "Administrator",
"module": "Westech R2",
"name": "ebay-pricing",
"owner": "Administrator",
"page_name": "ebay-pricing",
"roles": [
{
"role": "System Manager"
},
{
"role": "Stock User"
},
{
"role": "Sales User"
}
],
"standard": "Yes",
"system_page": 0,
"title": "eBay Pricing"
}
@@ -0,0 +1 @@
# eBay Pricing desk page
@@ -1,13 +0,0 @@
{% extends "templates/web.html" %}
{% block style %}
<style>
.badge.status-fresh { background-color: #28a745; }
.badge.status-aging { background-color: #ffc107; color: #212529; }
.badge.status-expired { background-color: #dc3545; }
.badge.status-needs { background-color: #fd7e14; }
.badge.status-error { background-color: #6c757d; }
</style>
{% endblock %}
{% block page_content %}
<div id="ebay-pricing-page"></div>
{% endblock %}
@@ -1,212 +0,0 @@
frappe.pages['ebay_pricing'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: __('eBay Pricing'),
single_column: true
});
let $container = $(`<div class="ebay-pricing-container" style="padding: 1rem;">
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label>Search Model</label>
<div class="input-group">
<input type="text" class="form-control" id="ebay-search-input"
placeholder="Dell Latitude 5410..." autocomplete="off">
<span class="input-group-btn">
<button class="btn btn-primary" id="ebay-search-btn">
<i class="fa fa-search"></i> Search
</button>
</span>
</div>
</div>
</div>
<div class="col-md-4 text-right">
<div class="form-group">
<label>Batch Size</label>
<select class="form-control" id="ebay-batch-size" style="display:inline-block; width:auto;">
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="all">All</option>
</select>
<button class="btn btn-warning" id="ebay-batch-btn">
<i class="fa fa-play"></i> Price Batch
</button>
</div>
</div>
</div>
<hr>
<div id="ebay-results-area">
<div class="text-muted text-center" style="padding: 4rem;">
<i class="fa fa-search" style="font-size: 3rem; opacity: 0.3;"></i>
<p>Search for a model or run batch pricing</p>
</div>
</div>
</div>`).appendTo(page.main);
$container.find('#ebay-search-btn').on('click', function() {
let query = $container.find('#ebay-search-input').val().trim();
if (!query) {
frappe.msgprint(__('Enter a model to search'));
return;
}
search_ebay(query);
});
$container.find('#ebay-search-input').on('keypress', function(e) {
if (e.which === 13) {
$container.find('#ebay-search-btn').trigger('click');
}
});
$container.find('#ebay-batch-btn').on('click', function() {
let size = $container.find('#ebay-batch-size').val();
run_batch(size);
});
function search_ebay(query) {
frappe.call({
method: 'westech_r2.api.ebay_pricing.search_model',
args: { query: query },
freeze: true,
freeze_message: __('Searching eBay sold listings...'),
callback: function(r) {
if (r.message && r.message.results) {
render_results(r.message);
} else {
let msg = (r.message && r.message.message) || __('No results found');
frappe.msgprint(msg);
}
}
});
}
function run_batch(size) {
frappe.call({
method: 'westech_r2.api.ebay_pricing.run_batch',
args: { batch_size: size },
freeze: true,
freeze_message: __('Running batch pricing...'),
callback: function(r) {
if (r.message) {
frappe.msgprint(__('Batch complete: {0} priced, {1} failed, {2} skipped',
[r.message.priced, r.message.failed, r.message.skipped]));
load_recent_pricing();
}
}
});
}
function render_results(data) {
let $area = $container.find('#ebay-results-area').empty();
if (!data.results || !data.results.length) {
$area.html(`<div class="text-muted text-center" style="padding: 2rem;">No results</div>`);
return;
}
let html = `<table class="table table-bordered">
<thead><tr>
<th>Title</th>
<th>Price</th>
<th>Condition</th>
<th>Sold</th>
<th>Shipping</th>
</tr></thead>
<tbody>`;
data.results.forEach(item => {
html += `<tr>
<td>${frappe.utils.escape_html(item.title || '')}</td>
<td>$${(item.price || 0).toFixed(2)}</td>
<td>${frappe.utils.escape_html(item.condition || '')}</td>
<td>${item.sold || ''}</td>
<td>${item.shipping || ''}</td>
</tr>`;
});
html += `</tbody></table>`;
if (data.pricing) {
html += `<div class="well">
<h4>Pricing Summary</h4>
<div class="row">
<div class="col-md-3"><strong>Low:</strong> $${data.pricing.price_low}</div>
<div class="col-md-3"><strong>High:</strong> $${data.pricing.price_high}</div>
<div class="col-md-3"><strong>Average:</strong> $${data.pricing.price_average}</div>
<div class="col-md-3"><strong>Median:</strong> $${data.pricing.price_auction}</div>
</div>
<div class="row" style="margin-top: 1rem;">
<div class="col-md-6"><strong>Source:</strong> ${data.pricing.source}</div>
<div class="col-md-6"><strong>Samples:</strong> ${data.pricing.sample_count}</div>
</div>
</div>`;
}
$area.html(html);
}
function load_recent_pricing() {
frappe.call({
method: 'westech_r2.api.ebay_pricing.get_recent_pricing',
args: { limit: 50 },
callback: function(r) {
if (r.message) {
render_pricing_grid(r.message);
}
}
});
}
function render_pricing_grid(items) {
let $area = $container.find('#ebay-results-area');
if (!items || !items.length) {
$area.html(`<div class="text-muted text-center" style="padding: 2rem;">No pricing data yet</div>`);
return;
}
let html = `<h4>Recent Pricing Results</h4>
<table class="table table-bordered table-hover">
<thead><tr>
<th>Manufacturer</th>
<th>Model</th>
<th>Status</th>
<th>Age</th>
<th>Low</th>
<th>High</th>
<th>Avg</th>
<th>Samples</th>
<th>Source</th>
<th>Last Priced</th>
</tr></thead>
<tbody>`;
items.forEach(row => {
let status_class = 'status-needs';
if (row.pricing_status === 'Priced') status_class = 'status-fresh';
else if (row.pricing_status === 'Manual Override') status_class = 'status-fresh';
else if (row.pricing_status === 'Expired') status_class = 'status-expired';
else if (row.pricing_status === 'Error') status_class = 'status-error';
let age = row.days_since_pricing || 0;
let age_badge = age < 90 ? 'status-fresh' : (age < 120 ? 'status-aging' : 'status-expired');
html += `<tr>
<td>${frappe.utils.escape_html(row.manufacturer || '')}</td>
<td>${frappe.utils.escape_html(row.model || '')}</td>
<td><span class="badge ${status_class}">${row.pricing_status}</span></td>
<td><span class="badge ${age_badge}">${age} days</span></td>
<td>$${row.price_low || ''}</td>
<td>$${row.price_high || ''}</td>
<td>$${row.price_average || ''}</td>
<td>${row.sample_count || ''}</td>
<td>${row.source || ''}</td>
<td>${frappe.datetime.str_to_user(row.scraped_at) || ''}</td>
</tr>`;
});
html += `</tbody></table>`;
$area.html(html);
}
load_recent_pricing();
};
@@ -1,20 +0,0 @@
{
"creation": "2026-05-17 05:30:00.000000",
"docstatus": 0,
"doctype": "Page",
"icon": "fa fa-tags",
"modified": "2026-05-17 05:30:00.000000",
"modified_by": "Administrator",
"module": "Westech R2",
"name": "ebay_pricing",
"owner": "Administrator",
"page_name": "eBay Pricing",
"roles": [
{"role": "System Manager"},
{"role": "Stock User"},
{"role": "Sales User"}
],
"standard": "Yes",
"system_page": 0,
"title": "eBay Pricing"
}
@@ -1,9 +0,0 @@
import frappe
from frappe import _
no_cache = 1
def get_context(context):
context.no_cache = 1
context.title = _("eBay Pricing")
return context
@@ -1,7 +1,7 @@
{ {
"charts": [], "charts": [],
"content": "[{\"type\": \"header\", \"data\": {\"text\": \"<span class=\\\"h4\\\"><b>Westech Recyclers</b></span>\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"New Intake\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Pallets\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Pallet List\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Scheduled Pickups\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Route Planner\"}}, {\"type\": \"spacer\", \"data\": {}}, {\"type\": \"header\", \"data\": {\"text\": \"<span class=\\\"h4\\\"><b>Tools</b></span>\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"EIM Device Portal\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"R2 Data Tracking\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Wes AI Assistant\"}}, {\"type\": \"spacer\", \"data\": {}}, {\"type\": \"header\", \"data\": {\"text\": \"<span class=\\\"h4\\\"><b>Records</b></span>\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Customers\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Suppliers\"}}]", "content": "[{\"type\": \"header\", \"data\": {\"text\": \"<span class=\\\"h4\\\"><b>Westech Recyclers</b></span>\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"New Intake\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Pallets\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Pallet List\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Scheduled Pickups\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Route Planner\"}}, {\"type\": \"spacer\", \"data\": {}}, {\"type\": \"header\", \"data\": {\"text\": \"<span class=\\\"h4\\\"><b>Tools</b></span>\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"EIM Device Portal\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"R2 Data Tracking\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Wes AI Assistant\"}}, {\"type\": \"spacer\", \"data\": {}}, {\"type\": \"header\", \"data\": {\"text\": \"<span class=\\\"h4\\\"><b>Records</b></span>\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Customers\"}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Suppliers\"}}]",
"creation": "2026-05-16 17:36:54.540512", "creation": "2026-05-17 05:39:20.222818",
"custom_blocks": [], "custom_blocks": [],
"docstatus": 0, "docstatus": 0,
"doctype": "Workspace", "doctype": "Workspace",
@@ -100,7 +100,7 @@
"type": "Link" "type": "Link"
} }
], ],
"modified": "2026-05-16 18:45:11.778496", "modified": "2026-05-17 06:07:36.785015",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Westech R2", "module": "Westech R2",
"name": "Westech", "name": "Westech",
@@ -176,10 +176,10 @@
}, },
{ {
"doc_view": "", "doc_view": "",
"icon": "truck", "icon": "fa fa-tags",
"label": "Truck Profiles", "label": "eBay Pricing",
"link_to": "Truck Profile", "link_to": "ebay-pricing",
"type": "DocType" "type": "Page"
} }
], ],
"title": "Westech" "title": "Westech"