Skip to content

Commit 79b64d7

Browse files
authored
Merge pull request #300 from ury-erp/fix/branch
Fix/branch
2 parents 3f0b395 + 118b9d8 commit 79b64d7

10 files changed

Lines changed: 468 additions & 82 deletions

File tree

frontend/src/components/layout/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const SETTINGS_ITEMS: NavItem[] = [
3838
{ label: 'POS Profile', path: '/pos-profile', icon: SlidersHorizontal },
3939
{ label: 'User', path: '/user', icon: Users },
4040
{ label: 'Aggregators', path: '/aggregator', icon: Store },
41-
{ label: 'URY Report Settings', path: '/report-settings', icon: FileText },
41+
{ label: 'Daily P&L Settings', path: '/report-settings', icon: FileText },
4242
{ label: 'Production Unit', path: '/production-unit', icon: Grid }
4343
];
4444

frontend/src/pages/Dashboard/AggregatorPage.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ export const AggregatorPage: React.FC = () => {
3232
mode_of_payment: '',
3333
mode_of_payments: ''
3434
});
35+
const [originalEditForm, setOriginalEditForm] = useState<AggregatorSetting>({
36+
aggregator: '',
37+
customer: '',
38+
price_list: '',
39+
mode_of_payment: '',
40+
mode_of_payments: ''
41+
});
3542

3643
const [priceLists, setPriceLists] = useState<{ name: string }[]>([]);
3744
const [modesOfPayment, setModesOfPayment] = useState<{ name: string }[]>([]);
@@ -192,13 +199,15 @@ export const AggregatorPage: React.FC = () => {
192199
const pl = item.price_list || '';
193200

194201
setEditingIndex(idx);
195-
setEditForm({
202+
const initialForm = {
196203
aggregator: aggName,
197204
customer: aggName,
198205
price_list: pl,
199206
mode_of_payment: mop,
200207
mode_of_payments: mop
201-
});
208+
};
209+
setEditForm(initialForm);
210+
setOriginalEditForm(initialForm);
202211
};
203212

204213
const handleSaveEdit = async (e: React.FormEvent) => {
@@ -212,6 +221,21 @@ export const AggregatorPage: React.FC = () => {
212221
return;
213222
}
214223

224+
const original = {
225+
aggregator: (originalEditForm.aggregator || '').trim(),
226+
price_list: originalEditForm.price_list || '',
227+
mode_of_payment: originalEditForm.mode_of_payment || '',
228+
};
229+
const current = {
230+
aggregator: (editForm.aggregator || '').trim(),
231+
price_list: editForm.price_list || '',
232+
mode_of_payment: editForm.mode_of_payment || '',
233+
};
234+
if (JSON.stringify(original) === JSON.stringify(current)) {
235+
showToast.warning('No changes in document');
236+
return;
237+
}
238+
215239
setSaving(true);
216240
try {
217241
// Ensure Customer exists if aggregator name changed

0 commit comments

Comments
 (0)