Files
tehran_taj/apps/admin-panel/src/views/order/MakeOrderModel.ts
T

38 lines
2.0 KiB
TypeScript
Raw Normal View History

// Ported from legacy henza_admin/src/views/order/MakeOrderModel.js
//
// Column keys, Farsi titles and filter types preserved exactly, including
// legacy's commented-out columns (total_price, items, branch.name) which stay
// absent. The gate on this table's status column is 'order.tamin.state' in
// legacy — NOT 'order.makeOrder.state' as the page name would suggest. Kept.
import XTbl, { Xtc } from '../../components/x-table/model';
import { useUsersStore } from '../../stores/users';
export function buildMakeOrderModel(): XTbl {
const users = useUsersStore();
const tbl = new XTbl('admin/pre-orders/list', 'سفارش های ساختنی');
tbl.add(new Xtc('customer.id', 'شماره').filterKey('id').filterNumber());
tbl.add(new Xtc('customer.fname', 'نام مشتری').filterKey('customer.fullName').filterText());
tbl.add(new Xtc('customer.lname', 'نام خانوادگی').filterKey('customer.fullName').filterText());
tbl.add(new Xtc('color', 'رنگ محصول').filterKey('colorName').filterText());
tbl.add(new Xtc('size', 'سایز محصول').filterKey('sizeSpec').filterText());
tbl.add(new Xtc('color_mina', 'رنگ مینا').filterKey('minaColor').filterText());
tbl.add(new Xtc('color_stone', 'رنگ سنگ').filterKey('stoneColor').filterText());
tbl.add(new Xtc('sum', 'تعداد').filterText());
tbl.add(new Xtc('time_creat_fa', 'تاریخ ثبت').filterKey('createdAt').filterDate().noSort());
tbl.add(
new Xtc('time_update_fa', 'تاریخ ویرایش').hidden().filterKey('updatedAt').filterDate().noSort(),
);
tbl.add(new Xtc('customer.name', 'ثبت کننده').renderSlot('name').noSort());
// legacy gate: 'order.tamin.state' (not makeOrder) — preserved verbatim
if (users.roles && users.roles.includes('order.tamin.state')) {
tbl.add(new Xtc('sts_str_fa', 'وضعیت').renderSlot('sts').noSort());
}
tbl.add(new Xtc('opt', 'عملیات').noSort().renderSlot('opt'));
return tbl;
}
export default buildMakeOrderModel;