fix
This commit is contained in:
parent
eac8e9eb08
commit
50c6806c3a
File diff suppressed because it is too large
Load Diff
|
|
@ -76,6 +76,7 @@ const VariantForm: React.FC<VariantFormProps> = ({ variant, onSave, onCancel, is
|
|||
enabled: true,
|
||||
fee_percentage: 0,
|
||||
profit_percentage: 0,
|
||||
tax_percentage: 0,
|
||||
stock_limit: 0,
|
||||
stock_managed: true,
|
||||
stock_number: 0,
|
||||
|
|
@ -99,6 +100,7 @@ const VariantForm: React.FC<VariantFormProps> = ({ variant, onSave, onCancel, is
|
|||
const [weightDisplay, setWeightDisplay] = useState(variant?.weight?.toString() || '');
|
||||
const [feePercentageDisplay, setFeePercentageDisplay] = useState(variant?.fee_percentage?.toString() || '');
|
||||
const [profitPercentageDisplay, setProfitPercentageDisplay] = useState(variant?.profit_percentage?.toString() || '');
|
||||
const [taxPercentageDisplay, setTaxPercentageDisplay] = useState(variant?.tax_percentage?.toString() || '');
|
||||
|
||||
const { mutateAsync: uploadFile } = useFileUpload();
|
||||
const { mutate: deleteFile } = useFileDelete();
|
||||
|
|
@ -119,11 +121,14 @@ const VariantForm: React.FC<VariantFormProps> = ({ variant, onSave, onCancel, is
|
|||
if (variant?.profit_percentage !== undefined) {
|
||||
setProfitPercentageDisplay(variant.profit_percentage.toString());
|
||||
}
|
||||
if (variant?.tax_percentage !== undefined) {
|
||||
setTaxPercentageDisplay(variant.tax_percentage.toString());
|
||||
}
|
||||
// Load variant attribute value if exists
|
||||
if (variantAttributeName && variant?.attributes && variant.attributes[variantAttributeName]) {
|
||||
setVariantAttributeValue(variant.attributes[variantAttributeName].toString());
|
||||
}
|
||||
}, [variant?.weight, variant?.fee_percentage, variant?.profit_percentage, variant?.attributes, variantAttributeName]);
|
||||
}, [variant?.weight, variant?.fee_percentage, variant?.profit_percentage, variant?.tax_percentage, variant?.attributes, variantAttributeName]);
|
||||
|
||||
const handleInputChange = (field: keyof ProductVariantFormData, value: any) => {
|
||||
if (typeof value === 'string') {
|
||||
|
|
@ -261,6 +266,28 @@ const VariantForm: React.FC<VariantFormProps> = ({ variant, onSave, onCancel, is
|
|||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
||||
درصد مالیات
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
inputMode="decimal"
|
||||
value={taxPercentageDisplay}
|
||||
onChange={(e) => {
|
||||
const converted = persianToEnglish(e.target.value);
|
||||
setTaxPercentageDisplay(converted);
|
||||
}}
|
||||
onBlur={(e) => {
|
||||
const converted = persianToEnglish(e.target.value);
|
||||
const numValue = parseFloat(converted) || 0;
|
||||
handleInputChange('tax_percentage', numValue);
|
||||
}}
|
||||
className="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-1 focus:ring-primary-500 dark:bg-gray-700 dark:text-gray-100"
|
||||
placeholder="مثال: ۹"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
|
||||
وزن (گرم)
|
||||
|
|
@ -580,6 +607,9 @@ export const VariantManager: React.FC<VariantManagerProps> = ({ variants, onChan
|
|||
<div>
|
||||
<strong>درصد سود:</strong> {variant.profit_percentage}%
|
||||
</div>
|
||||
<div>
|
||||
<strong>درصد مالیات:</strong> {variant.tax_percentage}%
|
||||
</div>
|
||||
<div>
|
||||
<strong>موجودی:</strong> {variant.stock_managed ? `${variant.stock_number} عدد` : 'بدون محدودیت'}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@ export const useUpdatePaymentCard = () => {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,3 +21,4 @@ export interface UpdatePaymentCardResponse {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ export const updatePaymentCard = async (
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,3 +36,4 @@ export const useUpdateIPGStatus = () => {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -31,3 +31,4 @@ export const IPG_LABELS: Record<IPGType, string> = {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ export const updateIPGStatus = async (
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -151,3 +151,4 @@ export default IPGListPage;
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export interface ProductVariant {
|
|||
enabled: boolean;
|
||||
fee_percentage: number;
|
||||
profit_percentage: number;
|
||||
tax_percentage: number;
|
||||
stock_limit: number;
|
||||
stock_managed: boolean;
|
||||
stock_number: number;
|
||||
|
|
@ -77,6 +78,7 @@ export interface ProductVariantFormData {
|
|||
enabled: boolean;
|
||||
fee_percentage: number;
|
||||
profit_percentage: number;
|
||||
tax_percentage: number;
|
||||
stock_limit: number;
|
||||
stock_managed: boolean;
|
||||
stock_number: number;
|
||||
|
|
@ -133,6 +135,7 @@ export interface CreateVariantRequest {
|
|||
enabled: boolean;
|
||||
fee_percentage: number;
|
||||
profit_percentage: number;
|
||||
tax_percentage: number;
|
||||
stock_limit: number;
|
||||
stock_managed: boolean;
|
||||
stock_number: number;
|
||||
|
|
@ -147,6 +150,7 @@ export interface UpdateVariantRequest {
|
|||
enabled: boolean;
|
||||
fee_percentage: number;
|
||||
profit_percentage: number;
|
||||
tax_percentage: number;
|
||||
stock_limit: number;
|
||||
stock_managed: boolean;
|
||||
stock_number: number;
|
||||
|
|
|
|||
|
|
@ -400,6 +400,12 @@ const ProductDetailPage = () => {
|
|||
{formatNumber(variant.profit_percentage)}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="p-3 bg-gray-50 dark:bg-gray-700 rounded">
|
||||
<span className="text-xs text-gray-600 dark:text-gray-400 block">درصد مالیات</span>
|
||||
<span className="font-medium text-gray-900 dark:text-gray-100">
|
||||
{formatNumber(variant.tax_percentage || 0)}%
|
||||
</span>
|
||||
</div>
|
||||
<div className="p-3 bg-gray-50 dark:bg-gray-700 rounded">
|
||||
<span className="text-xs text-gray-600 dark:text-gray-400 block">وزن</span>
|
||||
<span className="font-medium text-gray-900 dark:text-gray-100">
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ const ProductFormPage = () => {
|
|||
enabled: variant.enabled,
|
||||
fee_percentage: variant.fee_percentage,
|
||||
profit_percentage: variant.profit_percentage,
|
||||
tax_percentage: variant.tax_percentage || 0,
|
||||
stock_limit: variant.stock_limit,
|
||||
stock_managed: variant.stock_managed,
|
||||
stock_number: variant.stock_number,
|
||||
|
|
@ -351,6 +352,7 @@ const ProductFormPage = () => {
|
|||
enabled: variant.enabled,
|
||||
fee_percentage: variant.fee_percentage,
|
||||
profit_percentage: variant.profit_percentage,
|
||||
tax_percentage: variant.tax_percentage || 0,
|
||||
stock_limit: variant.stock_limit,
|
||||
stock_managed: variant.stock_managed,
|
||||
stock_number: variant.stock_number,
|
||||
|
|
@ -380,6 +382,7 @@ const ProductFormPage = () => {
|
|||
enabled: variant.enabled,
|
||||
fee_percentage: variant.fee_percentage,
|
||||
profit_percentage: variant.profit_percentage,
|
||||
tax_percentage: variant.tax_percentage || 0,
|
||||
stock_limit: variant.stock_limit,
|
||||
stock_managed: variant.stock_managed,
|
||||
stock_number: variant.stock_number,
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@ export const useUpdateWalletStatus = () => {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,3 +28,4 @@ export const WALLET_LABELS: Record<WalletType, string> = {
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,3 +23,4 @@ export const updateWalletStatus = async (
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -151,3 +151,4 @@ export default WalletListPage;
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue