feat: migrate recipe editor
- using eventbus in recipe editor - migrate to logging instead of console log - fix case swap not saved, value not update after change, topping slot bug Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
270faf6b34
commit
f0619c5a10
65 changed files with 1600 additions and 557 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { logger } from '$lib/core/utils/logger';
|
||||
import { sendCommandRequest, sendMessage } from '../handlers/ws_messageSender';
|
||||
import { get } from 'svelte/store';
|
||||
import { auth } from '../stores/auth';
|
||||
|
|
@ -87,14 +88,14 @@ export async function updateMenu(
|
|||
}
|
||||
|
||||
export async function addMenu(country: string, catalog: string, content: any[]): Promise<boolean> {
|
||||
console.log('[sheetService] Adding menu:', { country, catalog, content });
|
||||
logger.info('[sheetService] Adding menu:', { country, catalog, content });
|
||||
const sent = await sendCommandRequest('sheet', {
|
||||
country: country,
|
||||
catalog: catalog,
|
||||
content: content,
|
||||
param: 'add/menu'
|
||||
});
|
||||
console.log('[sheetService] Add menu sent:', sent);
|
||||
logger.info('[sheetService] Add menu sent:', sent);
|
||||
return sent;
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +141,7 @@ export async function requestListMenu(country: string, boxid?: string): Promise<
|
|||
productCodesLoading.set(true);
|
||||
setPendingProductCodesCountry(country);
|
||||
|
||||
console.log('[sheetService] Sending list_menu request for country:', country, 'boxid:', boxid);
|
||||
logger.info('[sheetService] Sending list_menu request for country:', country, 'boxid:', boxid);
|
||||
|
||||
return await sendMessage({
|
||||
type: 'list_menu',
|
||||
|
|
@ -166,7 +167,7 @@ export async function requestGenLayout(country: string): Promise<boolean> {
|
|||
|
||||
setGenLayoutGenerating();
|
||||
|
||||
console.log('[sheetService] Sending gen-layout request for country:', country);
|
||||
logger.info('[sheetService] Sending gen-layout request for country:', country);
|
||||
|
||||
return await sendMessage({
|
||||
type: 'command',
|
||||
|
|
@ -190,12 +191,12 @@ export async function requestGenLayout(country: string): Promise<boolean> {
|
|||
export async function requestSheetPrice(country: string, productCodes: string[]): Promise<boolean> {
|
||||
// Check if already sent
|
||||
if (hasSheetPriceBeenSent('price')) {
|
||||
console.warn('[sheetService] Price request already sent, skipping');
|
||||
logger.warn('[sheetService] Price request already sent, skipping');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!productCodes || productCodes.length === 0) {
|
||||
console.warn('[sheetService] No product codes to request price for');
|
||||
logger.warn('[sheetService] No product codes to request price for');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +219,7 @@ export async function requestSheetPrice(country: string, productCodes: string[])
|
|||
// Convert to array of objects (backend expects objects, not strings)
|
||||
const content = productCodes.map((code) => ({ product_code: code }));
|
||||
|
||||
console.log(
|
||||
logger.info(
|
||||
'[sheetService] Sending sheet price request for country:',
|
||||
country,
|
||||
'codes:',
|
||||
|
|
@ -253,11 +254,11 @@ export async function updateSheetPrice(
|
|||
content: { row_index: number; cells: { value: string; coord: { row: number; col: number } }[] }[]
|
||||
): Promise<boolean> {
|
||||
if (!content || content.length === 0) {
|
||||
console.warn('[sheetService] No content to update');
|
||||
logger.warn('[sheetService] No content to update');
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(
|
||||
logger.info(
|
||||
'[sheetService] Updating sheet price for country:',
|
||||
country,
|
||||
'items:',
|
||||
|
|
@ -280,11 +281,11 @@ export async function addSheetPrice(
|
|||
content: { cells: string[] }[]
|
||||
): Promise<boolean> {
|
||||
if (!content || content.length === 0) {
|
||||
console.warn('[sheetService] No content to add');
|
||||
logger.warn('[sheetService] No content to add');
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log(
|
||||
logger.info(
|
||||
'[sheetService] Adding price rows for country:',
|
||||
country,
|
||||
'items:',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue