Skip to content

Instantly share code, notes, and snippets.

View ManotLuijiu's full-sized avatar
🏠
Working from home

Manot Luijiu ManotLuijiu

🏠
Working from home
View GitHub Profile
@ManotLuijiu
ManotLuijiu / chat-bot-hook.ts
Last active August 8, 2024 06:02
Disable Dark Mode in <iframe> Tag
useEffect(() => {
window.addEventListener('message', (e) => {
const { disableDarkMode, id } = e.data;
const botId = id;
if (disableDarkMode) {
document.body.style.backgroundColor = 'white';
document.body.style.color = 'black';
document.body.classList.remove('dark-mode');
}
@ManotLuijiu
ManotLuijiu / CardImage.tsx
Last active September 19, 2024 06:35
Migrate SST from V2 to V3 on Next.js app router project
// // @/components/Dashboard/CardImage/CardImage.tsx
interface CardImageProps {
lastFourDigits: string;
cardType: string;
}
export default function CardImage({ lastFourDigits, cardType }: CardImageProps) {
const apiUrl = process.env.NEXT_PUBLIC_API_URL; // Set this in your environment variables
const imageUrl = `${apiUrl}/api/card-image?lastFourDigits=${lastFourDigits}&cardType=${cardType}`;
@ManotLuijiu
ManotLuijiu / uninstall.py.new
Created March 17, 2025 13:45
print_designer uninstall.py (new)
import frappe
def before_uninstall():
# Remove Print Format record
if frappe.db.exists("Print Format", "Print Designer"):
frappe.delete_doc("Print Format", "Print Designer")
# Remove Print Designer entries from property setter
property_setters = frappe.get_all(
"Property Setter",
@ManotLuijiu
ManotLuijiu / erpnext-translation.service
Last active March 21, 2025 06:51
Systemd script for automate translation in Frappe/ERPNext
[Unit]
Description=ERPNext Thai Business Suite Translation Updater
After=network.target
[Service]
Type=oneshot
User=frappe
Group=frappe
WorkingDirectory=/home/frappe/moo-bench
ExecStart=/bin/bash -c '/usr/local/bin/bench update-po-files --app thai_business_suite && /usr/local/bin/bench compile-po-to-mo --app>
@ManotLuijiu
ManotLuijiu / setup-translation-eng2thai.sh
Last active March 22, 2025 06:28
Setup for Translation from English to Thai in th.po file
#!/bin/bash
# Setup script for ERPNext translation service using OpenAI API
# This script works with or without Thai Business Suite installed
set -e # Exit on any error
# Banner
echo "==============================================="
echo "ERPNext Translation Service Setup"
echo "==============================================="
frappe.ui.form.on("DFP External Storage", {
setup: (frm) => {
frm.button_remote_files_list = null;
},
refresh: function (frm) {
if (frm.is_new() && !frm.doc.doctypes_ignored.length) {
frm.doc.doctypes_ignored.push({ doctype_to_ignore: "Data Import" });
frm.doc.doctypes_ignored.push({ doctype_to_ignore: "Prepared Report" });
frm.refresh_field("doctypes_ignored");
@ManotLuijiu
ManotLuijiu / __init__.py
Created March 24, 2025 16:39
Example of creating workspace
# thai_business_suite/setup/__init__.py
from . import setup_default_workspace
def after_install():
"""Setup workspaces after app installation"""
setup_default_workspace.setup_workspaces()
@ManotLuijiu
ManotLuijiu / README.md
Last active March 29, 2025 12:19
Frappe/ERPNext custom app files structure at beginning point

Understanding Jinja vs. Vite.js (React.js) Build Processes in ERPNext

When developing custom applications in ERPNext, managing frontend assets efficiently is crucial. Traditionally, ERPNext uses Jinja templates to build web pages, while modern frontend frameworks like Vite.js with React.js offer a more dynamic approach. In this blog post, I'll explore how Jinja and Vite.js handle builds, where to place the build files, and how to integrate them into an ERPNext custom app.


How Jinja Builds and Where to Place Build Files

Jinja in ERPNext

@ManotLuijiu
ManotLuijiu / access_console.log
Created April 2, 2025 04:58
How to get Relations between Tables in ERPNext
bench --site your_site_name console
@ManotLuijiu
ManotLuijiu / App.jsx
Last active April 14, 2025 17:07
Using Tailwindcss V3 and Shadcn/ui V2 in Frappe/ERPNext Ecosystem
// translation_tools/public/js/translation_tools/App.jsx
import * as React from 'react';
import '../../css/tailwind.css';
import { Button } from '@/components/ui/button';
export function App() {
return (
<main className="tw">
<div className="tw-m-4">