flexbiz-server 12.7.1 → 12.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/server/app.js +23 -348
- package/server/cluster.js +1 -5
- package/server/models/account.js +7 -0
- package/server/models/actionLog.js +2 -0
- package/server/models/afflink.js +2 -0
- package/server/models/aimemory.js +1 -0
- package/server/models/app.js +16 -0
- package/server/models/approve.js +95 -0
- package/server/models/assabcihandler.js +35 -0
- package/server/models/assbank.js +19 -0
- package/server/models/assbooking.js +4 -0
- package/server/models/assbuy.js +3 -0
- package/server/models/asscashwithdraw.js +4 -0
- package/server/models/assfindhash.js +2 -0
- package/server/models/assinvestment.js +13 -0
- package/server/models/assissue.js +2 -0
- package/server/models/asskey.js +15 -0
- package/server/models/assneedtobuy.js +6 -0
- package/server/models/assperiod.js +7 -0
- package/server/models/assproduct.js +13 -0
- package/server/models/assprofitsharing.js +4 -0
- package/server/models/assreceiver.js +2 -0
- package/server/models/assrequest.js +10 -0
- package/server/models/asssell.js +7 -0
- package/server/models/asstransaction.js +3 -0
- package/server/models/asstransfer.js +4 -0
- package/server/models/assuser_identity.js +4 -0
- package/server/models/asswithdraw.js +4 -0
- package/server/models/attend.js +2 -0
- package/server/models/banggiaban.js +8 -0
- package/server/models/bangtinhluong.js +6 -0
- package/server/models/base.js +1 -0
- package/server/models/bg1.js +9 -0
- package/server/models/bg2.js +10 -0
- package/server/models/cache.js +3 -0
- package/server/models/cacheDataReport.js +2 -0
- package/server/models/cacheSessionReport.js +5 -0
- package/server/models/calllog.js +4 -0
- package/server/models/cart.js +5 -0
- package/server/models/cddiem.js +2 -0
- package/server/models/cddt.js +3 -0
- package/server/models/cdkh.js +5 -0
- package/server/models/cdkhtheongay.js +5 -0
- package/server/models/cdnphep.js +2 -0
- package/server/models/cdtk.js +3 -0
- package/server/models/cdtktheongay.js +3 -0
- package/server/models/cdvt.js +5 -0
- package/server/models/cdvtnpp.js +6 -0
- package/server/models/cdvttheongay.js +5 -0
- package/server/models/chamcong.js +7 -0
- package/server/models/chat_message.js +2 -0
- package/server/models/chat_session.js +2 -0
- package/server/models/checkin.js +4 -0
- package/server/models/checkinactivity.js +3 -0
- package/server/models/checkinkpi.js +4 -0
- package/server/models/checkinlocation.js +2 -0
- package/server/models/chitietluongds.js +12 -0
- package/server/models/chitieukpi.js +3 -0
- package/server/models/chudethaoluan.js +3 -0
- package/server/models/ckgtluong.js +2 -0
- package/server/models/colleague.js +2 -0
- package/server/models/comment.js +4 -0
- package/server/models/congdoansx.js +4 -0
- package/server/models/congtacvien.js +4 -0
- package/server/models/congthuctinhgiaban.js +8 -0
- package/server/models/consultant.js +4 -0
- package/server/models/contract.js +6 -0
- package/server/models/counter.js +2 -0
- package/server/models/csluongtheods.js +3 -0
- package/server/models/csphucap.js +2 -0
- package/server/models/ctds.js +5 -0
- package/server/models/ctds2.js +7 -0
- package/server/models/currency.js +3 -0
- package/server/models/custom_report.js +1 -0
- package/server/models/customer.js +31 -0
- package/server/models/customer_care.js +2 -0
- package/server/models/data_list_config.js +7 -0
- package/server/models/databanle.js +8 -0
- package/server/models/datlich.js +4 -0
- package/server/models/deal.js +2 -0
- package/server/models/dh2.js +20 -0
- package/server/models/diagram.js +2 -0
- package/server/models/dinhmucsx.js +8 -0
- package/server/models/dkhoc.js +6 -0
- package/server/models/dknphep.js +2 -0
- package/server/models/dmban.js +4 -0
- package/server/models/dmbp.js +12 -0
- package/server/models/dmca.js +2 -0
- package/server/models/dmchietkhau.js +8 -0
- package/server/models/dmchietkhauhd.js +19 -0
- package/server/models/dmchinhanh.js +2 -0
- package/server/models/dmcpmh.js +2 -0
- package/server/models/dmdiemthuong.js +3 -0
- package/server/models/dmdoi.js +4 -0
- package/server/models/dmdoituongdanhgia.js +2 -0
- package/server/models/dmdt.js +8 -0
- package/server/models/dmdvt.js +3 -0
- package/server/models/dmgiaban.js +9 -0
- package/server/models/dmgiamua.js +5 -0
- package/server/models/dmgiathitruong.js +5 -0
- package/server/models/dmgiathitruong_ngay.js +2 -0
- package/server/models/dmgiathitruong_theodoi.js +2 -0
- package/server/models/dmhoahonghd.js +8 -0
- package/server/models/dmhoahongnpp.js +8 -0
- package/server/models/dmkc.js +3 -0
- package/server/models/dmkho.js +7 -0
- package/server/models/dmkhuyenmai.js +9 -0
- package/server/models/dmkhuyenmaihd.js +11 -0
- package/server/models/dmletet.js +2 -0
- package/server/models/dmlo.js +4 -0
- package/server/models/dmloaicong.js +4 -0
- package/server/models/dmloaitask.js +2 -0
- package/server/models/dmloaits.js +2 -0
- package/server/models/dmnckkm.js +4 -0
- package/server/models/dmnghiepvu.js +4 -0
- package/server/models/dmnguonvon.js +2 -0
- package/server/models/dmnhnv.js +4 -0
- package/server/models/dmnv.js +17 -0
- package/server/models/dmnvt.js +10 -0
- package/server/models/dmphi.js +3 -0
- package/server/models/dmqct.js +3 -0
- package/server/models/dmqddvt.js +3 -0
- package/server/models/dmtanggiamts.js +3 -0
- package/server/models/dmto.js +4 -0
- package/server/models/dmtt.js +6 -0
- package/server/models/dmvt.js +17 -0
- package/server/models/dmyt.js +4 -0
- package/server/models/dn0.js +13 -0
- package/server/models/dnm.js +11 -0
- package/server/models/dokho.js +2 -0
- package/server/models/domain.js +2 -0
- package/server/models/dvcs.js +3 -0
- package/server/models/ecomcategories.js +3 -0
- package/server/models/ecomcategories_cty.js +3 -0
- package/server/models/ecomproductlines.js +2 -0
- package/server/models/ecompromotion_flashsales.js +2 -0
- package/server/models/ecompromotion_freeships.js +2 -0
- package/server/models/email.js +2 -0
- package/server/models/endpoint.js +1 -0
- package/server/models/events.js +3 -0
- package/server/models/evoucher.js +5 -0
- package/server/models/experiencejourney.js +2 -0
- package/server/models/experiencejourneydata.js +4 -0
- package/server/models/experiencejourneypersona.js +3 -0
- package/server/models/experiencejourneystage.js +2 -0
- package/server/models/exportexceltemplate.js +2 -0
- package/server/models/fbconversation.js +15 -0
- package/server/models/fbmessage.js +2 -0
- package/server/models/fbpage.js +2 -0
- package/server/models/fbpost.js +2 -0
- package/server/models/fieldright.js +2 -0
- package/server/models/fifo_dk.js +2 -0
- package/server/models/fifo_lot.js +3 -0
- package/server/models/fifo_trace.js +4 -0
- package/server/models/file.js +4 -0
- package/server/models/filechunk.js +2 -0
- package/server/models/financialroadmap.js +3 -0
- package/server/models/flow.js +2 -0
- package/server/models/flowdata.js +3 -0
- package/server/models/flowpending.js +2 -0
- package/server/models/folder.js +4 -0
- package/server/models/follow.js +2 -0
- package/server/models/forminfo.js +5 -0
- package/server/models/giaoca.js +4 -0
- package/server/models/giatb.js +3 -0
- package/server/models/group.js +9 -0
- package/server/models/gt_ctgt.js +4 -0
- package/server/models/gt_hspb.js +3 -0
- package/server/models/gt_sltk.js +3 -0
- package/server/models/gt_thcppstk.js +3 -0
- package/server/models/hanmucton.js +4 -0
- package/server/models/hd1.js +11 -0
- package/server/models/hd2.js +26 -0
- package/server/models/hd3.js +17 -0
- package/server/models/hd4.js +13 -0
- package/server/models/hd7.js +17 -0
- package/server/models/hd8.js +12 -0
- package/server/models/hde.js +11 -0
- package/server/models/hmcn.js +3 -0
- package/server/models/hmcnct.js +2 -0
- package/server/models/hspbts.js +4 -0
- package/server/models/htl.js +13 -0
- package/server/models/importexceltemplate.js +2 -0
- package/server/models/introducebonus.js +4 -0
- package/server/models/introducecode.js +3 -0
- package/server/models/introducer.js +4 -0
- package/server/models/kbbtpb.js +7 -0
- package/server/models/kbmPttct.js +4 -0
- package/server/models/kbmTkgtgt.js +5 -0
- package/server/models/kbm_bcdkt_old.js +4 -0
- package/server/models/kbm_kqhdkd_old.js +3 -0
- package/server/models/kbm_lcttgt_old.js +5 -0
- package/server/models/kbm_lctttt_old.js +4 -0
- package/server/models/kbm_pttct_old.js +4 -0
- package/server/models/kbm_tkgtgt_old.js +5 -0
- package/server/models/kbmbcdkt.js +4 -0
- package/server/models/kbmbcqt.js +4 -0
- package/server/models/kbmkqhdkd.js +3 -0
- package/server/models/kbmlcttgt.js +6 -0
- package/server/models/kbmlctttt.js +4 -0
- package/server/models/kbmtmbctc.js +4 -0
- package/server/models/kehoachdtcp.js +3 -0
- package/server/models/kehoachmh.js +8 -0
- package/server/models/keyresult.js +7 -0
- package/server/models/khunghangthanhvien.js +3 -0
- package/server/models/label.js +2 -0
- package/server/models/labelinfo.js +2 -0
- package/server/models/lenhcapphat.js +8 -0
- package/server/models/lenhsx.js +8 -0
- package/server/models/lienhe.js +4 -0
- package/server/models/like_module.js +2 -0
- package/server/models/link.js +2 -0
- package/server/models/listinfo.js +1365 -0
- package/server/models/loaidiem.js +2 -0
- package/server/models/lock.js +2 -0
- package/server/models/log.js +8 -0
- package/server/models/mailaccount.js +3 -0
- package/server/models/mailgroup.js +3 -0
- package/server/models/mailreceived.js +2 -0
- package/server/models/mailsent.js +2 -0
- package/server/models/mailtemplate.js +2 -0
- package/server/models/maudanhgia.js +2 -0
- package/server/models/menuinfo.js +2 -0
- package/server/models/message.js +8 -0
- package/server/models/message2.js +4 -0
- package/server/models/message2setting.js +3 -0
- package/server/models/moduleinfo.js +4 -0
- package/server/models/momo.js +18 -0
- package/server/models/news.js +3 -0
- package/server/models/newsfeed.js +4 -0
- package/server/models/note.js +2 -0
- package/server/models/notification.js +8 -0
- package/server/models/okr.js +4 -0
- package/server/models/okrdiagram.js +3 -0
- package/server/models/onepay.js +24 -0
- package/server/models/opportunity.js +4 -0
- package/server/models/options.js +2 -0
- package/server/models/originimportid.js +1 -0
- package/server/models/otp.js +1 -0
- package/server/models/parameter.js +2 -0
- package/server/models/participant.js +21 -0
- package/server/models/partner.js +1 -0
- package/server/models/payload.js +1 -0
- package/server/models/pbl.js +16 -0
- package/server/models/pc0.js +13 -0
- package/server/models/pc1.js +14 -0
- package/server/models/pc2.js +13 -0
- package/server/models/pc3.js +13 -0
- package/server/models/pc5.js +8 -0
- package/server/models/pc6.js +14 -0
- package/server/models/pcl.js +6 -0
- package/server/models/pdn.js +9 -0
- package/server/models/pdx.js +9 -0
- package/server/models/pgh.js +5 -0
- package/server/models/phieudanhgia.js +3 -0
- package/server/models/pht.js +8 -0
- package/server/models/phucap.js +4 -0
- package/server/models/pkc.js +6 -0
- package/server/models/pkh.js +6 -0
- package/server/models/pkk.js +10 -0
- package/server/models/pkt.js +12 -0
- package/server/models/pn1.js +18 -0
- package/server/models/pn2.js +12 -0
- package/server/models/pn3.js +13 -0
- package/server/models/pn5.js +14 -0
- package/server/models/pn6.js +14 -0
- package/server/models/pn9.js +17 -0
- package/server/models/pnc.js +9 -0
- package/server/models/pnh.js +11 -0
- package/server/models/pnk.js +10 -0
- package/server/models/po1.js +19 -0
- package/server/models/ppb.js +6 -0
- package/server/models/productcode.js +2 -0
- package/server/models/profile.js +4 -0
- package/server/models/pt1.js +12 -0
- package/server/models/pt5.js +8 -0
- package/server/models/ptl.js +5 -0
- package/server/models/ptthanhtoan.js +6 -0
- package/server/models/purchase_contract.js +17 -0
- package/server/models/pxc.js +9 -0
- package/server/models/pxh.js +11 -0
- package/server/models/pxk.js +9 -0
- package/server/models/qts.js +14 -0
- package/server/models/qts_dieuchinh.js +3 -0
- package/server/models/qts_dieuchuyen.js +4 -0
- package/server/models/quanhuyen.js +2 -0
- package/server/models/reason.js +2 -0
- package/server/models/receivedinvoice.js +2 -0
- package/server/models/reportinfo.js +5 -0
- package/server/models/right.js +4 -0
- package/server/models/rpt.js +2 -0
- package/server/models/rptform.js +3 -0
- package/server/models/rptobject.js +2 -0
- package/server/models/sale_contract.js +9 -0
- package/server/models/schedule.js +18 -0
- package/server/models/schedule_log.js +2 -0
- package/server/models/shipbook.js +12 -0
- package/server/models/shortcut.js +2 -0
- package/server/models/smsaccount.js +10 -0
- package/server/models/smssend.js +2 -0
- package/server/models/so1.js +22 -0
- package/server/models/so5.js +15 -0
- package/server/models/so9.js +19 -0
- package/server/models/socai.js +28 -0
- package/server/models/socainpp.js +18 -0
- package/server/models/socaitc.js +6 -0
- package/server/models/socaitmp.js +16 -0
- package/server/models/socaitt.js +4 -0
- package/server/models/sodiemthuong.js +4 -0
- package/server/models/sokho.js +27 -0
- package/server/models/sokhocapphat.js +18 -0
- package/server/models/sokhokhongton.js +19 -0
- package/server/models/sokhonpp.js +19 -0
- package/server/models/sokhotc.js +8 -0
- package/server/models/sokhott.js +18 -0
- package/server/models/sophanbokh.js +3 -0
- package/server/models/sosanxuat.js +5 -0
- package/server/models/sotinhkh.js +2 -0
- package/server/models/spdd_ck.js +3 -0
- package/server/models/spdd_dk.js +3 -0
- package/server/models/step.js +2 -0
- package/server/models/strategicdiagram.js +3 -0
- package/server/models/strategicgoal.js +4 -0
- package/server/models/strategickpi.js +6 -0
- package/server/models/strategicobjective.js +5 -0
- package/server/models/strategicplan.js +5 -0
- package/server/models/subscribe.js +2 -0
- package/server/models/support.js +2 -0
- package/server/models/synctime.js +2 -0
- package/server/models/sys_job_queue_book_keeping.js +2 -0
- package/server/models/sysconfig.js +2 -0
- package/server/models/sysgroup.js +2 -0
- package/server/models/tableinfo.js +3 -0
- package/server/models/task.js +9 -0
- package/server/models/tc.js +2 -0
- package/server/models/tdttco.js +9 -0
- package/server/models/tdttco_tt.js +5 -0
- package/server/models/tdttno.js +9 -0
- package/server/models/tdttno_tt.js +5 -0
- package/server/models/templaterpt.js +2 -0
- package/server/models/templatestore.js +3 -0
- package/server/models/templatevoucher.js +3 -0
- package/server/models/tinhthanh.js +2 -0
- package/server/models/tokens.js +3 -0
- package/server/models/tontucthoi.js +9 -0
- package/server/models/trangthai.js +4 -0
- package/server/models/trangthaiapp.js +4 -0
- package/server/models/transaction.js +16 -0
- package/server/models/trialinfo.js +2 -0
- package/server/models/user.js +40 -0
- package/server/models/usergroup.js +7 -0
- package/server/models/vanchuyen.js +12 -0
- package/server/models/vat.js +3 -0
- package/server/models/vatra.js +6 -0
- package/server/models/vatvao.js +6 -0
- package/server/models/versioninfo.js +2 -0
- package/server/models/vietqrbanks.js +2 -0
- package/server/models/vsocai.js +6 -0
- package/server/models/wallet.js +8 -0
- package/server/models/warranty.js +3 -0
- package/server/models/warrantyclaim.js +2 -0
- package/server/models/warrantypolicy.js +1 -0
- package/server/models/workflow.js +4 -0
- package/server/models/xaphuong.js +2 -0
- package/server/models/xhd.js +10 -0
- package/server/models/ytdd_ck.js +4 -0
- package/server/models/ytdd_dk.js +4 -0
- package/server/models/zalo.js +17 -0
- package/server/modules/lists/bg-cddiem.js +6 -0
- package/server/modules/lists/bg-cddt.js +7 -0
- package/server/modules/lists/bg-cdkh.js +11 -0
- package/server/modules/lists/bg-cdnphep.js +6 -0
- package/server/modules/lists/bg-cdtk.js +9 -0
- package/server/modules/lists/bg-cdvt.js +8 -0
- package/server/modules/lists/bg-cdvtnpp.js +8 -0
- package/server/modules/lists/bg-fifo_dk.js +8 -0
- package/server/modules/lists/ls-account.js +4 -0
- package/server/modules/lists/ls-afflink.js +3 -0
- package/server/modules/lists/ls-approve.js +5 -0
- package/server/modules/lists/ls-assabcihandler.js +3 -0
- package/server/modules/lists/ls-assbank.js +3 -0
- package/server/modules/lists/ls-assbooking.js +20 -0
- package/server/modules/lists/ls-assbuy.js +8 -0
- package/server/modules/lists/ls-asscashwithdraw.js +8 -0
- package/server/modules/lists/ls-assinvestment.js +31 -0
- package/server/modules/lists/ls-assissue.js +3 -0
- package/server/modules/lists/ls-asskey.js +41 -0
- package/server/modules/lists/ls-assneedtobuy.js +10 -0
- package/server/modules/lists/ls-assperiod.js +19 -0
- package/server/modules/lists/ls-assproduct.js +9 -0
- package/server/modules/lists/ls-assprofitsharing.js +8 -0
- package/server/modules/lists/ls-assreceiver.js +3 -0
- package/server/modules/lists/ls-assrequest.js +4 -0
- package/server/modules/lists/ls-asssell.js +13 -0
- package/server/modules/lists/ls-asstransaction.js +3 -0
- package/server/modules/lists/ls-asstransfer.js +3 -0
- package/server/modules/lists/ls-assuser_identity.js +1 -0
- package/server/modules/lists/ls-asswithdraw.js +12 -0
- package/server/modules/lists/ls-bangtinhluong.js +2 -0
- package/server/modules/lists/ls-calllog.js +4 -0
- package/server/modules/lists/ls-cart.js +14 -0
- package/server/modules/lists/ls-chamcong.js +3 -0
- package/server/modules/lists/ls-chat_session.js +5 -0
- package/server/modules/lists/ls-checkin.js +24 -0
- package/server/modules/lists/ls-checkinactivity.js +8 -0
- package/server/modules/lists/ls-checkinkpi.js +3 -0
- package/server/modules/lists/ls-checkinlocation.js +1 -0
- package/server/modules/lists/ls-chitietluongds.js +4 -0
- package/server/modules/lists/ls-chitieukpi.js +1 -0
- package/server/modules/lists/ls-chudethaoluan.js +1 -0
- package/server/modules/lists/ls-ckgtluong.js +1 -0
- package/server/modules/lists/ls-comment.js +9 -0
- package/server/modules/lists/ls-congdoansx.js +3 -0
- package/server/modules/lists/ls-congtacvien.js +5 -0
- package/server/modules/lists/ls-consultant.js +2 -0
- package/server/modules/lists/ls-contract.js +7 -0
- package/server/modules/lists/ls-csluongtheods.js +1 -0
- package/server/modules/lists/ls-csphucap.js +1 -0
- package/server/modules/lists/ls-ctds.js +4 -0
- package/server/modules/lists/ls-ctds2.js +4 -0
- package/server/modules/lists/ls-currency.js +1 -0
- package/server/modules/lists/ls-customer.js +22 -0
- package/server/modules/lists/ls-customer_care.js +1 -0
- package/server/modules/lists/ls-datlich.js +9 -0
- package/server/modules/lists/ls-dckhauhaots.js +3 -0
- package/server/modules/lists/ls-deal.js +3 -0
- package/server/modules/lists/ls-diagram.js +1 -0
- package/server/modules/lists/ls-dkhoc.js +6 -0
- package/server/modules/lists/ls-dknphep.js +1 -0
- package/server/modules/lists/ls-dmban.js +4 -0
- package/server/modules/lists/ls-dmbp.js +7 -0
- package/server/modules/lists/ls-dmca.js +1 -0
- package/server/modules/lists/ls-dmchietkhau.js +19 -0
- package/server/modules/lists/ls-dmchietkhauhd.js +4 -0
- package/server/modules/lists/ls-dmchinhanh.js +1 -0
- package/server/modules/lists/ls-dmchucvu.js +2 -0
- package/server/modules/lists/ls-dmcpmh.js +1 -0
- package/server/modules/lists/ls-dmdiemthuong.js +4 -0
- package/server/modules/lists/ls-dmdoi.js +4 -0
- package/server/modules/lists/ls-dmdoituongdanhgia.js +1 -0
- package/server/modules/lists/ls-dmdt.js +11 -0
- package/server/modules/lists/ls-dmdvt.js +2 -0
- package/server/modules/lists/ls-dmgiaban.js +4 -0
- package/server/modules/lists/ls-dmgiamua.js +4 -0
- package/server/modules/lists/ls-dmgiathitruong.js +15 -0
- package/server/modules/lists/ls-dmgiathitruong_ngay.js +2 -0
- package/server/modules/lists/ls-dmgiathitruong_theodoi.js +1 -0
- package/server/modules/lists/ls-dmhoahonghd.js +1 -0
- package/server/modules/lists/ls-dmhoahongnpp.js +1 -0
- package/server/modules/lists/ls-dmkc.js +3 -0
- package/server/modules/lists/ls-dmkho.js +7 -0
- package/server/modules/lists/ls-dmkhuyenmai.js +5 -0
- package/server/modules/lists/ls-dmkhuyenmaihd.js +3 -0
- package/server/modules/lists/ls-dmletet.js +1 -0
- package/server/modules/lists/ls-dmlo.js +1 -0
- package/server/modules/lists/ls-dmloaicong.js +1 -0
- package/server/modules/lists/ls-dmloaits.js +1 -0
- package/server/modules/lists/ls-dmnckkm.js +7 -0
- package/server/modules/lists/ls-dmnghiepvu.js +1 -0
- package/server/modules/lists/ls-dmnguonvon.js +1 -0
- package/server/modules/lists/ls-dmnhnv.js +6 -0
- package/server/modules/lists/ls-dmnhtask.js +5 -0
- package/server/modules/lists/ls-dmnkh.js +6 -0
- package/server/modules/lists/ls-dmntt.js +6 -0
- package/server/modules/lists/ls-dmnv.js +14 -0
- package/server/modules/lists/ls-dmnvt.js +7 -0
- package/server/modules/lists/ls-dmphi.js +6 -0
- package/server/modules/lists/ls-dmqct.js +2 -0
- package/server/modules/lists/ls-dmqddvt.js +3 -0
- package/server/modules/lists/ls-dmtanggiamts.js +1 -0
- package/server/modules/lists/ls-dmto.js +5 -0
- package/server/modules/lists/ls-dmtt.js +7 -0
- package/server/modules/lists/ls-dmvt.js +52 -0
- package/server/modules/lists/ls-dmyt.js +1 -0
- package/server/modules/lists/ls-dokho.js +1 -0
- package/server/modules/lists/ls-dvcs.js +1 -0
- package/server/modules/lists/ls-ecomcategories.js +5 -0
- package/server/modules/lists/ls-ecomcategories_cty.js +5 -0
- package/server/modules/lists/ls-email.js +4 -0
- package/server/modules/lists/ls-events.js +3 -0
- package/server/modules/lists/ls-evoucher.js +3 -0
- package/server/modules/lists/ls-experiencejourney.js +1 -0
- package/server/modules/lists/ls-experiencejourneydata.js +3 -0
- package/server/modules/lists/ls-experiencejourneypersona.js +4 -0
- package/server/modules/lists/ls-experiencejourneystage.js +1 -0
- package/server/modules/lists/ls-fbconversation.js +2 -0
- package/server/modules/lists/ls-fbmessage.js +2 -0
- package/server/modules/lists/ls-fbpage.js +11 -0
- package/server/modules/lists/ls-fbpost.js +2 -0
- package/server/modules/lists/ls-file.js +38 -0
- package/server/modules/lists/ls-financialroadmap.js +3 -0
- package/server/modules/lists/ls-flow.js +6 -0
- package/server/modules/lists/ls-flowdata.js +1 -0
- package/server/modules/lists/ls-flowpending.js +3 -0
- package/server/modules/lists/ls-folder.js +1 -0
- package/server/modules/lists/ls-forminfo.js +1 -0
- package/server/modules/lists/ls-giaoca.js +5 -0
- package/server/modules/lists/ls-group.js +5 -0
- package/server/modules/lists/ls-hmcn.js +2 -0
- package/server/modules/lists/ls-hspbts.js +3 -0
- package/server/modules/lists/ls-introducebonus.js +4 -0
- package/server/modules/lists/ls-introducecode.js +10 -0
- package/server/modules/lists/ls-introducer.js +21 -0
- package/server/modules/lists/ls-kbm-bcdkt.js +1 -0
- package/server/modules/lists/ls-kbm-bcqt.js +5 -0
- package/server/modules/lists/ls-kbm-kqhdkd.js +1 -0
- package/server/modules/lists/ls-kbm-lcttgt.js +1 -0
- package/server/modules/lists/ls-kbm-lctttt.js +1 -0
- package/server/modules/lists/ls-kbm-pttct.js +3 -0
- package/server/modules/lists/ls-kbm-tkgtgt.js +3 -0
- package/server/modules/lists/ls-kbm-tmbctc.js +3 -0
- package/server/modules/lists/ls-kehoachdtcp.js +4 -0
- package/server/modules/lists/ls-keyresult.js +7 -0
- package/server/modules/lists/ls-khunghangthanhvien.js +1 -0
- package/server/modules/lists/ls-label.js +1 -0
- package/server/modules/lists/ls-lienhe.js +4 -0
- package/server/modules/lists/ls-like-module.js +1 -0
- package/server/modules/lists/ls-link.js +1 -0
- package/server/modules/lists/ls-loaidiem.js +1 -0
- package/server/modules/lists/ls-lock.js +1 -0
- package/server/modules/lists/ls-log.js +3 -0
- package/server/modules/lists/ls-mailaccount.js +5 -0
- package/server/modules/lists/ls-mailreceived.js +5 -0
- package/server/modules/lists/ls-mailsent.js +4 -0
- package/server/modules/lists/ls-mailtemplate.js +4 -0
- package/server/modules/lists/ls-maudanhgia.js +3 -0
- package/server/modules/lists/ls-message2.js +8 -0
- package/server/modules/lists/ls-message2setting.js +5 -0
- package/server/modules/lists/ls-news.js +7 -0
- package/server/modules/lists/ls-newsfeed.js +4 -0
- package/server/modules/lists/ls-note.js +6 -0
- package/server/modules/lists/ls-okr.js +5 -0
- package/server/modules/lists/ls-okrdiagram.js +1 -0
- package/server/modules/lists/ls-opportunity.js +5 -0
- package/server/modules/lists/ls-options.js +4 -0
- package/server/modules/lists/ls-parameter.js +3 -0
- package/server/modules/lists/ls-participant.js +12 -0
- package/server/modules/lists/ls-phieudanhgia.js +7 -0
- package/server/modules/lists/ls-phucap.js +2 -0
- package/server/modules/lists/ls-productcode.js +9 -0
- package/server/modules/lists/ls-profile.js +1 -0
- package/server/modules/lists/ls-ptthanhtoan.js +3 -0
- package/server/modules/lists/ls-qts-dieuchinh.js +2 -0
- package/server/modules/lists/ls-qts-dieuchuyen.js +8 -0
- package/server/modules/lists/ls-reason.js +1 -0
- package/server/modules/lists/ls-rpt.js +5 -0
- package/server/modules/lists/ls-rptform.js +3 -0
- package/server/modules/lists/ls-shortcut.js +1 -0
- package/server/modules/lists/ls-smsaccount.js +1 -0
- package/server/modules/lists/ls-smssend.js +3 -0
- package/server/modules/lists/ls-sosanxuat.js +4 -0
- package/server/modules/lists/ls-step.js +1 -0
- package/server/modules/lists/ls-strategicdiagram.js +1 -0
- package/server/modules/lists/ls-strategicgoal.js +3 -0
- package/server/modules/lists/ls-strategickpi.js +7 -0
- package/server/modules/lists/ls-strategicobjective.js +3 -0
- package/server/modules/lists/ls-strategicplan.js +6 -0
- package/server/modules/lists/ls-support.js +3 -0
- package/server/modules/lists/ls-task.js +28 -0
- package/server/modules/lists/ls-tc.js +1 -0
- package/server/modules/lists/ls-templaterpt.js +5 -0
- package/server/modules/lists/ls-templatevoucher.js +1 -0
- package/server/modules/lists/ls-tontucthoi.js +3 -0
- package/server/modules/lists/ls-trangthaiapp.js +3 -0
- package/server/modules/lists/ls-transaction.js +4 -0
- package/server/modules/lists/ls-usergroup.js +7 -0
- package/server/modules/lists/ls-vat.js +1 -0
- package/server/modules/lists/ls-vatra.js +5 -0
- package/server/modules/lists/ls-vatvao.js +6 -0
- package/server/modules/lists/ls-warranty.js +3 -0
- package/server/modules/lists/ls-workflow.js +1 -0
- package/server/modules/lists/ls_hanmucton.js +3 -0
- package/server/modules/lists/ls_hspb.js +4 -0
- package/server/modules/lists/ls_spdd_ck.js +3 -0
- package/server/modules/lists/ls_spdd_dk.js +3 -0
- package/server/modules/lists/ls_ytdd_ck.js +4 -0
- package/server/modules/lists/ls_ytdd_dk.js +4 -0
- package/server/modules/lists/sys-attend.js +4 -0
- package/server/modules/lists/sys-follow.js +4 -0
- package/server/modules/lists/sys-right.js +2 -0
- package/server/modules/public/app.js +4 -0
- package/server/modules/public/approve.js +37 -0
- package/server/modules/public/callin.js +7 -0
- package/server/modules/public/comment.js +5 -0
- package/server/modules/public/dmnvt.js +4 -0
- package/server/modules/public/dmvt.js +9 -0
- package/server/modules/public/file.js +11 -0
- package/server/modules/public/forminfo.js +1 -0
- package/server/modules/public/group.js +4 -0
- package/server/modules/public/introducecode.js +1 -0
- package/server/modules/public/listinfo.js +1 -0
- package/server/modules/public/media-webhook.js +1 -0
- package/server/modules/public/partner.js +1 -0
- package/server/modules/public/paymentCallback.js +32 -0
- package/server/modules/public/province.js +1 -0
- package/server/modules/public/ptthanhtoan.js +4 -0
- package/server/modules/public/subscribe.js +30 -0
- package/server/modules/public/support.js +3 -0
- package/server/modules/public/tableinfo.js +1 -0
- package/server/modules/public/trialinfo.js +4 -0
- package/server/modules/public/versioninfo.js +1 -0
- package/server/modules/reports/calc-tinhgiafifo.js +8 -0
- package/server/modules/reports/calc-tinhgiatb.js +7 -0
- package/server/modules/reports/calc-tinhgiathanh.js +7 -0
- package/server/modules/reports/calc-tinhkhauhaots.js +3 -0
- package/server/modules/reports/calc-tinhluong.js +68 -0
- package/server/modules/reports/rp-analyzedata.js +6 -0
- package/server/modules/reports/rp-assbonus.js +4 -0
- package/server/modules/reports/rp-assinterest.js +8 -0
- package/server/modules/reports/rp-assproductowners.js +3 -0
- package/server/modules/reports/rp-asssupply.js +1 -0
- package/server/modules/reports/rp-asstransferlog.js +10 -0
- package/server/modules/reports/rp-backup.js +4 -0
- package/server/modules/reports/rp-banggiatb.js +3 -0
- package/server/modules/reports/rp-bangtinhkhauhao.js +6 -0
- package/server/modules/reports/rp-baoCaoFifoKy.js +1 -0
- package/server/modules/reports/rp-baocaokhachhang.js +6 -0
- package/server/modules/reports/rp-bcdkt.js +11 -0
- package/server/modules/reports/rp-bcintroducebonus.js +4 -0
- package/server/modules/reports/rp-bckhtiemnang.js +3 -0
- package/server/modules/reports/rp-bcqt.js +85 -0
- package/server/modules/reports/rp-bkchamcong.js +5 -0
- package/server/modules/reports/rp-bkct.js +13 -0
- package/server/modules/reports/rp-bkshipbook.js +8 -0
- package/server/modules/reports/rp-bkvanchuyen.js +8 -0
- package/server/modules/reports/rp-bkvatra.js +7 -0
- package/server/modules/reports/rp-bkvatvao.js +7 -0
- package/server/modules/reports/rp-capnhatsocaitc.js +4 -0
- package/server/modules/reports/rp-cdpsdiem.js +4 -0
- package/server/modules/reports/rp-cdpsdt.js +5 -0
- package/server/modules/reports/rp-cdpskh.js +8 -0
- package/server/modules/reports/rp-cdpsnphep.js +3 -0
- package/server/modules/reports/rp-cdpstk.js +4 -0
- package/server/modules/reports/rp-chitietchitientheohoadon.js +12 -0
- package/server/modules/reports/rp-chitiettaisan.js +13 -0
- package/server/modules/reports/rp-chitietthutientheohoadon.js +13 -0
- package/server/modules/reports/rp-ckcn.js +3 -0
- package/server/modules/reports/rp-ckdiem.js +2 -0
- package/server/modules/reports/rp-cktk.js +3 -0
- package/server/modules/reports/rp-ckvt.js +10 -0
- package/server/modules/reports/rp-ckvttheokho.js +4 -0
- package/server/modules/reports/rp-ckvttheotg.js +4 -0
- package/server/modules/reports/rp-ckvttt.js +3 -0
- package/server/modules/reports/rp-congnophaithutheotuoino.js +3 -0
- package/server/modules/reports/rp-congnophaitratheotuoino.js +3 -0
- package/server/modules/reports/rp-congnosapthu.js +4 -0
- package/server/modules/reports/rp-congnosaptra.js +4 -0
- package/server/modules/reports/rp-congviectheobp.js +9 -0
- package/server/modules/reports/rp-congviectheodt.js +8 -0
- package/server/modules/reports/rp-congviectheokh.js +8 -0
- package/server/modules/reports/rp-congviectheonv.js +9 -0
- package/server/modules/reports/rp-congviectheotimeline.js +6 -0
- package/server/modules/reports/rp-ctbanle.js +15 -0
- package/server/modules/reports/rp-ctbanle2.js +20 -0
- package/server/modules/reports/rp-ctbanlectv.js +20 -0
- package/server/modules/reports/rp-ctbanlenpp.js +24 -0
- package/server/modules/reports/rp-ctdanhgianhanvien.js +8 -0
- package/server/modules/reports/rp-cthangbanbitralai.js +4 -0
- package/server/modules/reports/rp-ctmuahang.js +7 -0
- package/server/modules/reports/rp-cttralaihang.js +4 -0
- package/server/modules/reports/rp-databanle.js +10 -0
- package/server/modules/reports/rp-diemthuong.js +2 -0
- package/server/modules/reports/rp-dkcn.js +3 -0
- package/server/modules/reports/rp-dktk.js +2 -0
- package/server/modules/reports/rp-dsnhanviencm.js +9 -0
- package/server/modules/reports/rp-dsnhanvientb.js +9 -0
- package/server/modules/reports/rp-dtbanlekempk.js +12 -0
- package/server/modules/reports/rp-dtbanletheoct.js +22 -0
- package/server/modules/reports/rp-dtbanletheoctkempk.js +25 -0
- package/server/modules/reports/rp-dtbanletheokh.js +17 -0
- package/server/modules/reports/rp-dtbanletheokhnpp.js +19 -0
- package/server/modules/reports/rp-dtbanletheokho.js +15 -0
- package/server/modules/reports/rp-dtbanletheonam.js +3 -0
- package/server/modules/reports/rp-dtbanletheongay.js +1 -0
- package/server/modules/reports/rp-dtbanletheonpp.js +23 -0
- package/server/modules/reports/rp-dtbanletheonv.js +19 -0
- package/server/modules/reports/rp-dtbanletheoquy.js +3 -0
- package/server/modules/reports/rp-dtbanletheosp.js +9 -0
- package/server/modules/reports/rp-dtbanletheospnpp.js +6 -0
- package/server/modules/reports/rp-dtbanletheothang.js +3 -0
- package/server/modules/reports/rp-dtbanletheothungan.js +12 -0
- package/server/modules/reports/rp-dtbanletheovt.js +2 -0
- package/server/modules/reports/rp-dtbanletheovtnpp.js +2 -0
- package/server/modules/reports/rp-dutoanthuchitheodt.js +4 -0
- package/server/modules/reports/rp-getPXC2PNC.js +8 -0
- package/server/modules/reports/rp-getariseofaccountsbymonth.js +4 -0
- package/server/modules/reports/rp-getbtpb.js +6 -0
- package/server/modules/reports/rp-getcashbycashier.js +7 -0
- package/server/modules/reports/rp-getcschietkhau.js +5 -0
- package/server/modules/reports/rp-getdinhmuc4lenhcp.js +7 -0
- package/server/modules/reports/rp-getdinhmuc4pxk.js +9 -0
- package/server/modules/reports/rp-getdk4pht.js +8 -0
- package/server/modules/reports/rp-getdk4pkc.js +10 -0
- package/server/modules/reports/rp-getdttheoca.js +5 -0
- package/server/modules/reports/rp-getinvoice2pay.js +4 -0
- package/server/modules/reports/rp-getinvoice2receive.js +4 -0
- package/server/modules/reports/rp-getinvoice2return.js +5 -0
- package/server/modules/reports/rp-getinvoice2return_bl.js +6 -0
- package/server/modules/reports/rp-getkehoachmh4lenhcp.js +4 -0
- package/server/modules/reports/rp-getkhauhao.js +7 -0
- package/server/modules/reports/rp-getluong.js +8 -0
- package/server/modules/reports/rp-getluongchuyen.js +5 -0
- package/server/modules/reports/rp-getpn2fee.js +5 -0
- package/server/modules/reports/rp-getpn2return.js +5 -0
- package/server/modules/reports/rp-getthanhpham4pnk.js +7 -0
- package/server/modules/reports/rp-getvc2xhd.js +11 -0
- package/server/modules/reports/rp-gt_cpnvltt.js +6 -0
- package/server/modules/reports/rp-hangbanbitralai.js +5 -0
- package/server/modules/reports/rp-hangthanhvien.js +3 -0
- package/server/modules/reports/rp-hoadonbanhangtheohantt.js +5 -0
- package/server/modules/reports/rp-hoadonmuahangtheohantt.js +5 -0
- package/server/modules/reports/rp-hoahong.js +15 -0
- package/server/modules/reports/rp-kcsns.js +19 -0
- package/server/modules/reports/rp-kgchamcong.js +1 -0
- package/server/modules/reports/rp-khoaso.js +11 -0
- package/server/modules/reports/rp-kiemtrasocaitcvssocai.js +6 -0
- package/server/modules/reports/rp-kqdanhgianhanvien.js +5 -0
- package/server/modules/reports/rp-kqhdkd.js +1 -0
- package/server/modules/reports/rp-lcttgt.js +16 -0
- package/server/modules/reports/rp-lctttt.js +11 -0
- package/server/modules/reports/rp-linkslist.js +4 -0
- package/server/modules/reports/rp-phanbochitienchohoadon.js +11 -0
- package/server/modules/reports/rp-phanbothutienchohoadon.js +11 -0
- package/server/modules/reports/rp-ptbitralai.js +7 -0
- package/server/modules/reports/rp-ptcttct.js +24 -0
- package/server/modules/reports/rp-ptdonhang.js +8 -0
- package/server/modules/reports/rp-pttct.js +52 -0
- package/server/modules/reports/rp-pttctkho.js +32 -0
- package/server/modules/reports/rp-pttctkho2.js +29 -0
- package/server/modules/reports/rp-referredusers.js +5 -0
- package/server/modules/reports/rp-sctbhxh.js +4 -0
- package/server/modules/reports/rp-sctcnkh.js +11 -0
- package/server/modules/reports/rp-sctdiem.js +3 -0
- package/server/modules/reports/rp-sctdt.js +7 -0
- package/server/modules/reports/rp-sctdtcp.js +11 -0
- package/server/modules/reports/rp-sctluong.js +6 -0
- package/server/modules/reports/rp-sctthuetncn.js +4 -0
- package/server/modules/reports/rp-scttk.js +9 -0
- package/server/modules/reports/rp-sctvt.js +5 -0
- package/server/modules/reports/rp-sctvt_sl.js +5 -0
- package/server/modules/reports/rp-sctvtnpp.js +6 -0
- package/server/modules/reports/rp-sctvttt.js +5 -0
- package/server/modules/reports/rp-search.js +4 -0
- package/server/modules/reports/rp-socai.js +6 -0
- package/server/modules/reports/rp-socaitk.js +1 -0
- package/server/modules/reports/rp-sochut.js +7 -0
- package/server/modules/reports/rp-sokho.js +7 -0
- package/server/modules/reports/rp-sokhott.js +5 -0
- package/server/modules/reports/rp-sonkbh.js +5 -0
- package/server/modules/reports/rp-sonkc.js +6 -0
- package/server/modules/reports/rp-sonkct.js +5 -0
- package/server/modules/reports/rp-sonkmh.js +5 -0
- package/server/modules/reports/rp-sonktt.js +5 -0
- package/server/modules/reports/rp-soquy.js +11 -0
- package/server/modules/reports/rp-sosanhkhvatt.js +13 -0
- package/server/modules/reports/rp-sosanhkhvatt2.js +5 -0
- package/server/modules/reports/rp-sotaisan.js +13 -0
- package/server/modules/reports/rp-sotiengui.js +7 -0
- package/server/modules/reports/rp-taodinhmuctudkhoc.js +5 -0
- package/server/modules/reports/rp-thbanhangkempk.js +28 -0
- package/server/modules/reports/rp-thdanhgianhanvien.js +9 -0
- package/server/modules/reports/rp-thgt.js +6 -0
- package/server/modules/reports/rp-thnxt.js +11 -0
- package/server/modules/reports/rp-thnxt_sl.js +9 -0
- package/server/modules/reports/rp-thnxtnpp.js +10 -0
- package/server/modules/reports/rp-thnxttt.js +9 -0
- package/server/modules/reports/rp-tkbanhangtheogioithieu.js +9 -0
- package/server/modules/reports/rp-tkgioithieukh.js +4 -0
- package/server/modules/reports/rp-tkgtgt.js +76 -0
- package/server/modules/reports/rp-tkgtgt_old.js +7 -0
- package/server/modules/reports/rp-tmbctc.js +20 -0
- package/server/modules/reports/rp-tonghopbanhang.js +6 -0
- package/server/modules/reports/rp-tonghopmuahang.js +5 -0
- package/server/modules/reports/rp-tonghoptralaihang.js +5 -0
- package/server/modules/reports/rp-tongquanbanle.js +20 -0
- package/server/modules/reports/rp-tongquanbds.js +3 -0
- package/server/modules/reports/rp-tongquancongty.js +6 -0
- package/server/modules/reports/rp-tongquanctvnpp.js +12 -0
- package/server/modules/reports/rp-tongquannvbh.js +14 -0
- package/server/modules/reports/rp-tongquannvnpp.js +5 -0
- package/server/modules/reports/rp-uoctinhnvl.js +11 -0
- package/server/modules/reports/rp-wallet.js +3 -0
- package/server/modules/reports/rpt-tkdiemtichluy.js +9 -0
- package/server/modules/systems/sys-app.js +34 -0
- package/server/modules/systems/sys-colleague.js +11 -0
- package/server/modules/systems/sys-data_list_config.js +1 -0
- package/server/modules/systems/sys-domain.js +1 -0
- package/server/modules/systems/sys-ecomproductlines.js +1 -0
- package/server/modules/systems/sys-exportexceltemplate.js +1 -0
- package/server/modules/systems/sys-fieldright.js +1 -0
- package/server/modules/systems/sys-importexceltemplate.js +1 -0
- package/server/modules/systems/sys-labelinfo.js +4 -0
- package/server/modules/systems/sys-listinfo.js +10 -0
- package/server/modules/systems/sys-menuinfo.js +4 -0
- package/server/modules/systems/sys-message.js +14 -0
- package/server/modules/systems/sys-moduleinfo.js +4 -0
- package/server/modules/systems/sys-notification.js +8 -0
- package/server/modules/systems/sys-quanhuyen.js +1 -0
- package/server/modules/systems/sys-reportinfo.js +5 -0
- package/server/modules/systems/sys-rptobject.js +1 -0
- package/server/modules/systems/sys-schedule.js +10 -0
- package/server/modules/systems/sys-sysconfig.js +1 -0
- package/server/modules/systems/sys-sysgroup.js +1 -0
- package/server/modules/systems/sys-tableinfo.js +1 -0
- package/server/modules/systems/sys-templatestore.js +5 -0
- package/server/modules/systems/sys-tinhthanh.js +1 -0
- package/server/modules/systems/sys-token.js +3 -0
- package/server/modules/systems/sys-trangthai.js +3 -0
- package/server/modules/systems/sys-trialinfo.js +1 -0
- package/server/modules/systems/sys-user.js +45 -0
- package/server/modules/systems/sys-users.js +10 -0
- package/server/modules/systems/sys-versioninfo.js +1 -0
- package/server/modules/systems/sys-vietqrbanks.js +1 -0
- package/server/modules/systems/sys-xaphuong.js +1 -0
- package/server/modules/vouchers/vo-banggiaban.js +8 -0
- package/server/modules/vouchers/vo-bc1.js +34 -0
- package/server/modules/vouchers/vo-bc5.js +15 -0
- package/server/modules/vouchers/vo-bg1.js +10 -0
- package/server/modules/vouchers/vo-bg2.js +12 -0
- package/server/modules/vouchers/vo-bn1.js +36 -0
- package/server/modules/vouchers/vo-bn5.js +15 -0
- package/server/modules/vouchers/vo-dh2.js +35 -0
- package/server/modules/vouchers/vo-dinhmucsx.js +6 -0
- package/server/modules/vouchers/vo-dkb.js +21 -0
- package/server/modules/vouchers/vo-dn0.js +9 -0
- package/server/modules/vouchers/vo-dnm.js +20 -0
- package/server/modules/vouchers/vo-hd1.js +37 -0
- package/server/modules/vouchers/vo-hd2.js +108 -0
- package/server/modules/vouchers/vo-hd3.js +38 -0
- package/server/modules/vouchers/vo-hd4.js +13 -0
- package/server/modules/vouchers/vo-hd7.js +29 -0
- package/server/modules/vouchers/vo-hd8.js +29 -0
- package/server/modules/vouchers/vo-hde.js +39 -0
- package/server/modules/vouchers/vo-htl.js +11 -0
- package/server/modules/vouchers/vo-kbbtpb.js +6 -0
- package/server/modules/vouchers/vo-kehoachmh.js +11 -0
- package/server/modules/vouchers/vo-lenhcapphat.js +9 -0
- package/server/modules/vouchers/vo-lenhsx.js +12 -0
- package/server/modules/vouchers/vo-pbl.js +94 -0
- package/server/modules/vouchers/vo-pc0.js +14 -0
- package/server/modules/vouchers/vo-pc1.js +31 -0
- package/server/modules/vouchers/vo-pc2.js +25 -0
- package/server/modules/vouchers/vo-pc3.js +14 -0
- package/server/modules/vouchers/vo-pc5.js +15 -0
- package/server/modules/vouchers/vo-pc6.js +19 -0
- package/server/modules/vouchers/vo-pcl.js +7 -0
- package/server/modules/vouchers/vo-pdn.js +11 -0
- package/server/modules/vouchers/vo-pdx.js +9 -0
- package/server/modules/vouchers/vo-pgh.js +16 -0
- package/server/modules/vouchers/vo-pht.js +6 -0
- package/server/modules/vouchers/vo-pkc.js +5 -0
- package/server/modules/vouchers/vo-pkh.js +9 -0
- package/server/modules/vouchers/vo-pkk.js +12 -0
- package/server/modules/vouchers/vo-pkt.js +12 -0
- package/server/modules/vouchers/vo-pn1.js +30 -0
- package/server/modules/vouchers/vo-pn2.js +17 -0
- package/server/modules/vouchers/vo-pn3.js +18 -0
- package/server/modules/vouchers/vo-pn5.js +18 -0
- package/server/modules/vouchers/vo-pn6.js +18 -0
- package/server/modules/vouchers/vo-pn9.js +23 -0
- package/server/modules/vouchers/vo-pnc.js +19 -0
- package/server/modules/vouchers/vo-pnh.js +17 -0
- package/server/modules/vouchers/vo-pnk.js +14 -0
- package/server/modules/vouchers/vo-pnknpp.js +12 -0
- package/server/modules/vouchers/vo-po1.js +14 -0
- package/server/modules/vouchers/vo-ppb.js +8 -0
- package/server/modules/vouchers/vo-pt1.js +20 -0
- package/server/modules/vouchers/vo-pt5.js +15 -0
- package/server/modules/vouchers/vo-ptl.js +8 -0
- package/server/modules/vouchers/vo-purchase_contract.js +9 -0
- package/server/modules/vouchers/vo-pxc.js +24 -0
- package/server/modules/vouchers/vo-pxh.js +18 -0
- package/server/modules/vouchers/vo-pxk.js +15 -0
- package/server/modules/vouchers/vo-pxknpp.js +14 -0
- package/server/modules/vouchers/vo-qts.js +12 -0
- package/server/modules/vouchers/vo-sale_contract.js +11 -0
- package/server/modules/vouchers/vo-shipbook.js +17 -0
- package/server/modules/vouchers/vo-so1.js +125 -0
- package/server/modules/vouchers/vo-so5.js +57 -0
- package/server/modules/vouchers/vo-so7.js +97 -0
- package/server/modules/vouchers/vo-so9.js +119 -0
- package/server/modules/vouchers/vo-vanchuyen.js +14 -0
- package/server/modules/vouchers/vo-xhd.js +33 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const model=global.getModel("dmchietkhau"),dmvt=global.getModel("dmvt"),dmnvt=global.getModel("dmnvt"),newsfeed=global.getModel("newsfeed"),controller=require("../../controllers/controller"),async=require("async");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmchietkhau",{unique:["ma_chietkhau"],sort:{stt:1,hieu_luc_tu:-1},onFinding:async($user_vt$$,$condition$$,$next$$,$options$$)=>{$options$$.req.query.fields&&($options$$.req.query.fields.indexOf("nh_kh")<0&&($options$$.req.query.fields+=",nh_kh,nh_kh2,nh_kh3,nh_kh4,nh_kh5"),$options$$.req.query.fields.indexOf("nh_tt")<0&&($options$$.req.query.fields+=",nh_tt,nh_tt2,nh_tt3,nh_tt4,nh_tt5"),$options$$.req.query.fields.indexOf("t_sl")<
|
|
3
|
+
0&&($options$$.req.query.fields+=",t_sl_tu,t_sl_den,t_sl_ntt_tu,t_sl_ntt_den,t_tien_ntt_tu,t_tien_ntt_den,sl_tu,sl_den"),$options$$.req.query.fields.indexOf("gt_hd_tu")<0&&($options$$.req.query.fields+=",gt_hd_tu,gt_hd_den"));$condition$$.sl_xuat&&($condition$$.sl_tu={$lte:$condition$$.sl_xuat},$options$$.req.query.sl_xuat=$condition$$.sl_xuat);delete $condition$$.sl_xuat;$options$$.req.query.t_sl=$condition$$.t_so_luong||$condition$$.t_sl_xuat||$condition$$.t_sl;delete $condition$$.t_so_luong;delete $condition$$.t_sl_xuat;
|
|
4
|
+
delete $condition$$.t_sl;$options$$.req.query.t_sl_ntt=$condition$$.t_so_luong_ntt||$condition$$.t_sl_xuat_ntt||$condition$$.t_sl_ntt;delete $condition$$.t_so_luong_ntt;delete $condition$$.t_sl_xuat_ntt;delete $condition$$.t_sl_ntt;$options$$.req.query.t_tien_ntt=$condition$$.t_tien_ntt;delete $condition$$.t_tien_ntt;$options$$.req.query.t_gt_hd=$condition$$.t_gt_hd;delete $condition$$.t_gt_hd;if($condition$$.ngay_ct){let $ngay$$=new Date($condition$$.ngay_ct);const $hieu_luc_den$$={$gte:$ngay$$};
|
|
5
|
+
$condition$$.hieu_luc_tu={$lte:$ngay$$};$condition$$.hieu_luc_den=$hieu_luc_den$$;delete $condition$$.ngay_ct}$condition$$.ma_vt?($options$$.req.query.ma_vt=$condition$$.ma_vt,$user_vt$$=($user_vt$$=await global.getModel("dmvt").findOne({id_app:$user_vt$$.current_id_app,ma_vt:$condition$$.ma_vt},{ma_vt:1,ma_nvt:1,ma_nvt2:1,ma_nvt3:1,ma_nvt4:1}).lean())||[],$condition$$.ma_vt={$in:[null,"",$condition$$.ma_vt]},$condition$$.ma_nvt={$in:[null,"",$user_vt$$.ma_nvt]},$user_vt$$.ma_nvt2||($user_vt$$.ma_nvt2=
|
|
6
|
+
[]),typeof $user_vt$$.ma_nvt2=="string"&&($user_vt$$.ma_nvt2=[$user_vt$$.ma_nvt2]),$condition$$.ma_nvt2={$in:[null,"",...$user_vt$$.ma_nvt2]},$user_vt$$.ma_nvt3||($user_vt$$.ma_nvt3=[]),typeof $user_vt$$.ma_nvt3=="string"&&($user_vt$$.ma_nvt3=[$user_vt$$.ma_nvt3]),$condition$$.ma_nvt3={$in:[null,"",...$user_vt$$.ma_nvt3]},$user_vt$$.ma_nvt4||($user_vt$$.ma_nvt4=[]),typeof $user_vt$$.ma_nvt4=="string"&&($user_vt$$.ma_nvt4=[$user_vt$$.ma_nvt4]),$condition$$.ma_nvt4={$in:[null,"",...$user_vt$$.ma_nvt4]}):
|
|
7
|
+
delete $condition$$.ma_vt;$condition$$.ma_kho?$condition$$.ma_kho={$in:[null,"",$condition$$.ma_kho]}:delete $condition$$.ma_kho;$condition$$.ma_ban?$condition$$.ma_ban={$in:[null,"",$condition$$.ma_ban]}:delete $condition$$.ma_ban;$condition$$.ma_tt1?($options$$.req.query.ma_tt1=$condition$$.ma_tt1,$condition$$.ma_tt1={$in:[null,"",$condition$$.ma_tt1]}):delete $condition$$.ma_tt1;$condition$$.ma_tt2?$condition$$.ma_tt2={$in:[null,"",$condition$$.ma_tt2]}:delete $condition$$.ma_tt2;$condition$$.ma_tt3?
|
|
8
|
+
$condition$$.ma_tt3={$in:[null,"",$condition$$.ma_tt3]}:delete $condition$$.ma_tt3;$condition$$.ma_kh?($condition$$.ma_kh={$in:[null,"",$condition$$.ma_kh]},$options$$.req.query.ma_kh=$condition$$.ma_kh):delete $condition$$.ma_kh;$condition$$.by_user!=void 0&&($options$$.req.query.by_user=$condition$$.by_user,delete $condition$$.by_user);$next$$(null,$condition$$)},onCreated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmchietkhau",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else $next$$(null,
|
|
9
|
+
$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmchietkhau",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}},onDeleted:async($user$$,$obj$$,$next$$)=>{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}});$contr_router$$.view=async function($q_query_kh_thuoc_tinh1_user$$,$items$$,$fn$$,$options$$){let $id_app$$=
|
|
10
|
+
$q_query_kh_thuoc_tinh1_user$$.current_id_app;$options$$.req.query.sl_xuat&&($items$$=$items$$.filter($item$$=>!$item$$.sl_den||$item$$.sl_den>$options$$.req.query.sl_xuat));$options$$.req.query.t_sl&&($items$$=$items$$.filter($item$$=>(!$item$$.t_sl_tu||$item$$.t_sl_tu<=$options$$.req.query.t_sl)&&(!$item$$.t_sl_den||$item$$.t_sl_den>$options$$.req.query.t_sl)));$options$$.req.query.t_sl_ntt&&($items$$=$items$$.filter($item$$=>(!$item$$.t_sl_ntt_tu||$item$$.t_sl_ntt_tu<=$options$$.req.query.t_sl_ntt)&&
|
|
11
|
+
(!$item$$.t_sl_ntt_den||$item$$.t_sl_ntt_den>$options$$.req.query.t_sl_ntt)));$options$$.req.query.t_tien_ntt&&($items$$=$items$$.filter($item$$=>(!$item$$.t_tien_ntt_tu||$item$$.t_tien_ntt_tu<=$options$$.req.query.t_tien_ntt)&&(!$item$$.t_tien_ntt_den||$item$$.t_tien_ntt_den>$options$$.req.query.t_tien_ntt)));$options$$.req.query.t_gt_hd&&($items$$=$items$$.filter($item$$=>(!$item$$.gt_hd_tu||$item$$.gt_hd_tu<=$options$$.req.query.t_gt_hd)&&(!$item$$.gt_hd_den||$item$$.gt_hd_den>$options$$.req.query.t_gt_hd)));
|
|
12
|
+
if($options$$.req.query.by_user!=0&&($options$$.req.query.ma_kh||$options$$.req.query.by_user)){$q_query_kh_thuoc_tinh1_user$$={id_app:$id_app$$};$options$$.req.query.ma_kh?$q_query_kh_thuoc_tinh1_user$$.ma_kh=$options$$.req.query.ma_kh:$q_query_kh_thuoc_tinh1_user$$.of_user=$options$$.req.user.email;const $_cust$$=await global.getModel("customer").findOne($q_query_kh_thuoc_tinh1_user$$,{ma_kh:1,nh_kh:1,nh_kh2:1,nh_kh3:1,nh_kh4:1,nh_kh5:1}).lean();if($_cust$$){let $nh_kh_me$$,$nh_kh2_me$$,$nh_kh3_me$$,
|
|
13
|
+
$nh_kh4_me$$,$nh_kh5_me$$;$_cust$$.nh_kh&&($nh_kh_me$$=await global.getModel("group").getAllMotherGroup($id_app$$,$_cust$$.nh_kh));$_cust$$.nh_kh2&&($nh_kh2_me$$=await global.getModel("group").getAllMotherGroup($id_app$$,$_cust$$.nh_kh2));$_cust$$.nh_kh3&&($nh_kh3_me$$=await global.getModel("group").getAllMotherGroup($id_app$$,$_cust$$.nh_kh3));$_cust$$.nh_kh4&&($nh_kh4_me$$=await global.getModel("group").getAllMotherGroup($id_app$$,$_cust$$.nh_kh4));$_cust$$.nh_kh5&&($nh_kh5_me$$=await global.getModel("group").getAllMotherGroup($id_app$$,
|
|
14
|
+
$_cust$$.nh_kh5));$items$$=$items$$.filter($ck$$=>(!$ck$$.ma_kh||$ck$$.ma_kh==$_cust$$.ma_kh)&&(!$ck$$.nh_kh||($nh_kh_me$$||[]).indexOf($ck$$.nh_kh)>=0)&&(!$ck$$.nh_kh2||$ck$$.nh_kh2.length==0||($nh_kh2_me$$||[]).find($nh$$=>$ck$$.nh_kh2.indexOf($nh$$)>=0))&&(!$ck$$.nh_kh3||$ck$$.nh_kh3.length==0||($nh_kh3_me$$||[]).find($nh$$=>$ck$$.nh_kh3.indexOf($nh$$)>=0))&&(!$ck$$.nh_kh4||$ck$$.nh_kh4.length==0||($nh_kh4_me$$||[]).find($nh$$=>$ck$$.nh_kh4.indexOf($nh$$)>=0))&&(!$ck$$.nh_kh5||$ck$$.nh_kh5.length==
|
|
15
|
+
0||($nh_kh5_me$$||[]).find($nh$$=>$ck$$.nh_kh5.indexOf($nh$$)>=0)))}else $items$$=$items$$.filter($ck$$=>!$ck$$.ma_kh&&!$ck$$.nh_kh&&(!$ck$$.nh_kh2||$ck$$.nh_kh2.length==0)&&(!$ck$$.nh_kh3||$ck$$.nh_kh3.length==0)&&(!$ck$$.nh_kh4||$ck$$.nh_kh4.length==0)&&(!$ck$$.nh_kh5||$ck$$.nh_kh5.length==0))}if($options$$.req.query.ma_vt&&$options$$.req.query.ma_tt1)if($q_query_kh_thuoc_tinh1_user$$={id_app:$id_app$$,ma_vt:$options$$.req.query.ma_vt,ma_tt:$options$$.req.query.ma_tt1,loai_tt:"1"},$q_query_kh_thuoc_tinh1_user$$=
|
|
16
|
+
await global.getModel("dmtt").findOne($q_query_kh_thuoc_tinh1_user$$).lean()){let $nh_tt_me$$,$nh_tt2_me$$,$nh_tt3_me$$,$nh_tt4_me$$,$nh_tt5_me$$;$nh_tt_me$$=$q_query_kh_thuoc_tinh1_user$$.nh_tt?await global.getModel("group").getAllMotherGroup($id_app$$,$q_query_kh_thuoc_tinh1_user$$.nh_tt):[];$nh_tt2_me$$=$q_query_kh_thuoc_tinh1_user$$.nh_tt2?await global.getModel("group").getAllMotherGroup($id_app$$,$q_query_kh_thuoc_tinh1_user$$.nh_tt2):[];$nh_tt3_me$$=$q_query_kh_thuoc_tinh1_user$$.nh_tt3?await global.getModel("group").getAllMotherGroup($id_app$$,
|
|
17
|
+
$q_query_kh_thuoc_tinh1_user$$.nh_tt3):[];$nh_tt4_me$$=$q_query_kh_thuoc_tinh1_user$$.nh_tt4?await global.getModel("group").getAllMotherGroup($id_app$$,$q_query_kh_thuoc_tinh1_user$$.nh_tt4):[];$nh_tt5_me$$=$q_query_kh_thuoc_tinh1_user$$.nh_tt5?await global.getModel("group").getAllMotherGroup($id_app$$,$q_query_kh_thuoc_tinh1_user$$.nh_tt5):[];$items$$=$items$$.filter($ck$$=>(!$ck$$.nh_tt||($nh_tt_me$$||[]).indexOf($ck$$.nh_tt)>=0)&&(!$ck$$.nh_tt2||$ck$$.nh_tt2.length==0||($nh_tt2_me$$||[]).find($nh$$=>
|
|
18
|
+
$ck$$.nh_tt2.indexOf($nh$$)>=0))&&(!$ck$$.nh_tt3||$ck$$.nh_tt3.length==0||($nh_tt3_me$$||[]).find($nh$$=>$ck$$.nh_tt3.indexOf($nh$$)>=0))&&(!$ck$$.nh_tt4||$ck$$.nh_tt4.length==0||($nh_tt4_me$$||[]).find($nh$$=>$ck$$.nh_tt4.indexOf($nh$$)>=0))&&(!$ck$$.nh_tt5||$ck$$.nh_tt5.length==0||($nh_tt5_me$$||[]).find($nh$$=>$ck$$.nh_tt5.indexOf($nh$$)>=0)))}else $items$$=$items$$.filter($ck$$=>!$ck$$.nh_tt&&(!$ck$$.nh_tt2||$ck$$.nh_tt2.length==0)&&(!$ck$$.nh_tt3||$ck$$.nh_tt3.length==0)&&(!$ck$$.nh_tt4||$ck$$.nh_tt4.length==
|
|
19
|
+
0)&&(!$ck$$.nh_tt5||$ck$$.nh_tt5.length==0));async.parallel([function($callback$$){$items$$.joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:["ten_vt","picture"]},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmnvt,{where:{ma_nvt:"_id"},fields:"ten_nvt"},function($rs$$){$callback$$(null,$rs$$)})}],function(){$fn$$(null,$items$$)})};$contr_router$$.route()};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const model=global.getModel("dmchietkhauhd"),newsfeed=global.getModel("newsfeed"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmchietkhauhd",{sort:{hieu_luc_tu:-1},unique:["ma_chietkhau"],onCreated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmchietkhauhd",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else $next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmchietkhauhd",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,
|
|
3
|
+
$obj$$)}},onDeleted:async($user$$,$obj$$,$next$$)=>{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}});$contr_router$$.route();$contr_router$$.createRoute("tinhchietkhau/:t_tien_nt",async($req$$,$next$$)=>{let $t_tien_nt$$=$req$$.params.t_tien_nt;try{$t_tien_nt$$=Number($t_tien_nt$$);if(isNaN($t_tien_nt$$)||!$t_tien_nt$$)return $next$$(`T\u1ed5ng ti\u1ec1n t\u00ednh chi\u1ebft kh\u1ea5u '${$t_tien_nt$$}' kh\u00f4ng h\u1ee3p l\u1ec7`);let $obj$$=$req$$.body||
|
|
4
|
+
{};$obj$$.details=$obj$$.details||[];let $ck$$=await model.tinhChietKhau($req$$.user.email,$req$$.user.current_id_app,$obj$$,$t_tien_nt$$);$next$$(null,$ck$$)}catch($e$$){return $next$$(`T\u1ed5ng ti\u1ec1n t\u00ednh chi\u1ebft kh\u1ea5u '${$t_tien_nt$$}' kh\u00f4ng h\u1ee3p l\u1ec7`)}},{method:"POST"})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmchinhanh"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmchinhanh",{sort:{ma_cn:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_cn"]})).route()};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const model=global.getModel("group"),controller=require("../../controllers/controller"),dmchucvu=function($router$$){(new controller($router$$,model,"dmchucvu",{sort:{group_name:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,findExact:{group_type:1},onFinding:($user$$,$condition$$,$cb$$)=>{$condition$$.group_type="DMCV";$cb$$(null,$condition$$)},onCreating:($user$$,$data$$,$cb$$)=>{$data$$.group_type="DMCV";$cb$$(null,$data$$)}})).route()};
|
|
2
|
+
module.exports=dmchucvu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmcpmh"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmcpmh",{sort:{ma_cp:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_cp"]})).route()};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const model=global.getModel("dmdiemthuong"),dmvt=global.getModel("dmvt"),dmnvt=global.getModel("dmnvt"),newsfeed=global.getModel("newsfeed"),controller=require("../../controllers/controller"),async=require("async");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmdiemthuong",{sort:{ma_kho:1},unique:["ma"],onCreated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmdiemthuong",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else $next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmdiemthuong",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,
|
|
3
|
+
$obj$$)}},onDeleted:async($user$$,$obj$$,$next$$)=>{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}});$contr_router$$.view=function($user$$,$items$$,$fn$$){let $id_app$$=$user$$.current_id_app;async.series([function($callback$$){$items$$.joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:["ten_vt","picture"]},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmnvt,{where:{ma_nvt:"_id"},fields:"ten_nvt"},function($rs$$){$callback$$(null,
|
|
4
|
+
$rs$$)})}],function(){$fn$$(null,$items$$)})};$contr_router$$.route()};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const model=global.getModel("dmdoi"),dmbp=global.getModel("dmbp"),Participant=global.getModel("participant"),controller=require("../../controllers/controller"),async=require("async");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"dmdoi",{sort:{ma_bp:1,ma_doi:1},unique:["ma_doi"],onView:function($user$$,$items$$,$next$$){async.series({dp:function($callback$$){$items$$.joinModel2($user$$.current_id_app,dmbp,[{where:{ma_bp:"ma_bp"},fields:["ten_bp"]}],function(){$callback$$(null,$items$$)})},pt:function($callback$$){$items$$.joinModel2($user$$.current_id_app,Participant,[{where:{phu_trach:"email"},fields:[{ten_phu_trach:"name"}]}],function(){$callback$$(null,
|
|
3
|
+
$items$$)})},ph:function($callback$$){$items$$.joinModel2($user$$.current_id_app,Participant,[{where:{phoi_hop:"email"},fields:[{ten_phoi_hop:"name"}]}],function(){$callback$$(null,$items$$)})}},()=>{$next$$(null,$items$$)})},onRightByItem:($user$$,$condition$$,$next$$)=>{async.series({phu_trach_bp:$callback$$=>{dmbp.find({id_app:$user$$.current_id_app,phu_trach:$user$$.email}).lean().then($bps$$=>{$callback$$(null,$bps$$)}).catch($e$$=>{$callback$$($e$$)})}},($$or_e$$,$_condition_rs$$)=>{if($$or_e$$)return $next$$($$or_e$$);
|
|
4
|
+
$$or_e$$=[{ma_bp:{$in:$_condition_rs$$.phu_trach_bp.map($p$$=>$p$$.ma_bp)}}];$_condition_rs$$=[];for(let $k$$ in $condition$$){let $_c$$={};$_c$$[$k$$]=$condition$$[$k$$];$_condition_rs$$.push($_c$$)}$$or_e$$.push({$and:$_condition_rs$$});$next$$(null,{$or:$$or_e$$})})}})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmdoituongdanhgia"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmdoituongdanhgia",{notNeedRight:!1})).route()};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const model=global.getModel("dmdt"),dkhoc=global.getModel("dkhoc"),controller=require("../../controllers/controller"),customer=global.getModel("customer"),trangthai=global.getModel("trangthai"),link=global.getModel("link"),group=global.getModel("group"),async=require("async"),{onAfterCommit}=require("../../libs/sessionContext"),getSysorder=function($item$$,$callback$$){let $sysorder$$=($item$$.stt||"0")+"-"+$item$$.ma_dt;$item$$.ma_dt_me&&$item$$.ma_dt_me!=$item$$.ma_dt.toString()?model.findOne({ma_dt:$item$$.ma_dt_me,
|
|
2
|
+
id_app:$item$$.id_app}).lean().then(function($item_me$$){$item_me$$?getSysorder($item_me$$,function($rs$$){$sysorder$$=$rs$$+"---"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{Logger.error($e$$);$callback$$($sysorder$$)}):$callback$$($sysorder$$)};
|
|
3
|
+
module.exports=function($contr_router$$){const $createLink$$=function($user$$,$obj$$,$next$$){$obj$$.id_kh&&link.find({$or:[{id_a:$obj$$._id.toString(),id_b:$obj$$.id_kh},{id_a:$obj$$.id_kh,id_b:$obj$$._id.toString()}]}).lean().then(function($rs$$){$rs$$&&$rs$$.length!==0||(new link({id_app:$obj$$.id_app,id_a:$obj$$.id_kh,id_b:$obj$$._id.toString(),collection_a:"dmkh",collection_b:"dmdt"})).save(function($e$$){$e$$&&Logger.error($e$$)})}).catch($e$$=>{Logger.error($e$$)});$next$$&&$next$$(null,$obj$$)},
|
|
4
|
+
$createLinkAndCode$$=function($user$$,$obj$$,$next$$){onAfterCommit(()=>{$createLink$$($user$$,$obj$$);$obj$$.ma_dt?$next$$(null,$obj$$):model.findByIdAndUpdate($obj$$._id,{$set:{ma_dt:$obj$$._id.toString().toUpperCase()}},function($error$$,$kh$$){return $error$$?$next$$($error$$):$kh$$?($kh$$.ma_dt=$obj$$._id.toString().toUpperCase(),$next$$(null,$kh$$)):$next$$(Error("Project is not exists"))})})};$contr_router$$=new controller($contr_router$$,model,"dmdt",{sort:{sysorder:1},unique:["ma_dt"],onFinding:function($user$$,
|
|
5
|
+
$condition$$,$next$$){async.series({find_ten_kh:function($callback$$){$condition$$.ten_kh?customer.find({id_app:$user$$.current_id_app,ten_kh:{$regex:$condition$$.ten_kh,$options:"i"}},{_id:1}).lean().then(function($khs$$){delete $condition$$.ten_kh;var $id_khs$$=[];$khs$$.forEach(function($kh$$){$id_khs$$.push($kh$$._id.toString())});$condition$$.id_kh={$in:$id_khs$$};$callback$$()}).catch($e$$=>{$callback$$($e$$)}):$callback$$()}},function($e$$){if($e$$)return $next$$($e$$);$next$$(null,$condition$$)})},
|
|
6
|
+
onFound:($user$$,$condition$$,$items$$,$next$$)=>{$next$$(null,$items$$)},onView:function($user$$,$items$$,$next$$){async.parallel({kh:$callback$$=>{$items$$.filter($d$$=>$d$$.id_kh).joinModel2(null,customer,[{where:{id_kh:"_id"},fields:[{name:"ten_kh",value:"ten_kh"}]}],function(){$callback$$()})},trangthai:$callback$$=>{$items$$.joinModel2(null,trangthai,[{where:$a$$=>$a$$.trang_thai===void 0?{}:{ma_ct:"DMDT",ma_trang_thai:$a$$.trang_thai},fields:["ten_trang_thai","ten_trang_thai_en","color"]}],
|
|
7
|
+
function(){$callback$$()})},group:$callback$$=>{$items$$.filter($d$$=>$d$$.nh_dt).joinModel2(null,group,[{where:{nh_dt:"_id"},fields:["group_name","group_name_en",{group_color:"color"}]}],function(){$callback$$()})},da_dang_ky:$callback$$=>{async.map($items$$,($item$$,$callback$$)=>{async.map($item$$.ds_ca_hoc,($ca$$,$callback$$)=>{dkhoc.find({id_app:$item$$.id_app,ma_dt:$item$$.ma_dt,ma_ca_hoc:$ca$$.ma_ca_hoc}).lean().then($rs$$=>{$ca$$.sl_da_dk=$rs$$.map(()=>1).reduce(($a$$,$b$$)=>$a$$+$b$$,0);
|
|
8
|
+
$callback$$()}).catch($e$$=>{$callback$$($e$$)})},()=>{$item$$.sl_da_dk=($item$$.ds_ca_hoc||[]).map($d$$=>$d$$.sl_da_dk).reduce(($a$$,$b$$)=>$a$$+$b$$,0);$item$$.sl_con_thieu=($item$$.sl_du_tinh||0)-$item$$.sl_da_dk;$callback$$()})},()=>{$callback$$()})}},()=>{$next$$(null,$items$$)})},onCreating:function($user$$,$obj$$,$fn$$){$obj$$.ma_dt||($obj$$.ma_dt=$obj$$.ten_dt.toUpperCase());$fn$$(null,$obj$$)},onCreated:($user$$,$obj$$,$next$$)=>{getSysorder($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;
|
|
9
|
+
$obj$$.bac=$rs$$.split("---").length;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$createLinkAndCode$$($user$$,$obj$$,$e$$=>{$e$$&&Logger.error($e$$)});$next$$(null,$obj$$)})},onUpdated:($user$$,$obj$$,$next$$)=>{getSysorder($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("---").length;$loai_nh_rs$$=1;await model.findOne({ma_dt_me:$obj$$.ma_dt.toString(),id_app:$obj$$.id_app})&&
|
|
10
|
+
($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$createLinkAndCode$$($user$$,$obj$$,$e$$=>{$e$$&&Logger.error($e$$)});$next$$(null,$obj$$)})}});$contr_router$$.route();$contr_router$$.on("saved",async function($obj$$){const $ma_dt_me$$=$obj$$.ma_dt_me;$ma_dt_me$$&&await model.updateOne({id_app:$obj$$.id_app,ma_dt:$ma_dt_me$$},{$set:{loai_nh:0}}).catch(console.error)});
|
|
11
|
+
$contr_router$$.on("deleted",async function($obj$$){$obj$$.ma_dt_me&&!await model.findOne({ma_dt_me:$obj$$.ma_dt_me,id_app:$obj$$.id_app}).catch(console.error)&&await model.updateOne({id_app:$obj$$.id_app,ma_dt:$obj$$.ma_dt_me},{$set:{loai_nh:1}}).catch(console.error)})};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const model=global.getModel("dmdvt"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmdvt",{sort:{ma_dvt:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_dvt"]});$contr_router$$.creating=function($user$$,$obj$$,$next$$){$obj$$.ma_dvt||($obj$$.ma_dvt=$obj$$.ten_dvt);$next$$(null,$obj$$)};$contr_router$$.updating=function($user$$,$data$$,$obj$$,$next$$){$data$$.ma_dvt||($data$$.ma_dvt=$data$$.ten_dvt);$next$$(null,$data$$,$obj$$)};$contr_router$$.route()};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var model=global.getModel("dmgiaban"),dmvt=global.getModel("dmvt"),dmkh=global.getModel("customer"),group=global.getModel("group"),dmnvt=global.getModel("dmnvt");const controller=require("../../controllers/controller"),async=require("async");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmgiaban",{sort:{date_created:-1,ma_vt:1,ma_kho:1,sl_tu:1,sl_den:1},onCreated:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)},onDeleted:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)}});$contr_router$$.view=function($user$$,$items$$,$fn$$){let $id_app$$=$user$$.current_id_app;async.parallel([function($callback$$){$items$$.joinModel2($id_app$$,
|
|
3
|
+
dmkh,{where:"ma_kh",fields:"ten_kh"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,group,{where:{nh_kh:"_id"},fields:{ten_nh_kh:"group_name"}},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:"ten_vt"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmnvt,{where:{ma_nvt:"_id"},fields:"ten_nvt"},function($rs$$){$callback$$(null,$rs$$)})}],
|
|
4
|
+
function(){$fn$$(null,$items$$)})};$contr_router$$.route()};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const model=global.getModel("dmgiamua"),dmvt=global.getModel("dmvt"),dmkh=global.getModel("customer"),controller=require("../../controllers/controller"),async=require("async"),dmqddvt=global.getModel("dmqddvt");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmgiamua",{sort:{ma_vt:1,ma_kh:1,sl_tu:1,sl_den:1},onCreating:async($dvt_user$$,$obj$$,$next$$)=>{$dvt_user$$=await dmqddvt.findOne({ma_vt:$obj$$.ma_vt,id_app:$obj$$.id_app,ma_dvt:$obj$$.ma_dvt});$obj$$.gia_mua_qd=$obj$$.gia_mua/($dvt_user$$&&$dvt_user$$.ty_le_qd?$dvt_user$$.ty_le_qd:1);$next$$(null,$obj$$)},onUpdating:async($dvt$jscomp$1_user$$,$data$$,$obj$$,$next$$)=>{$data$$.ma_vt=$data$$.ma_vt||$obj$$.ma_vt;
|
|
3
|
+
$data$$.ma_dvt=$data$$.ma_dvt||$obj$$.ma_dvt;$data$$.gia_mua=$data$$.gia_mua||$obj$$.gia_mua;$dvt$jscomp$1_user$$=await dmqddvt.findOne({ma_vt:$data$$.ma_vt,id_app:$obj$$.id_app,ma_dvt:$data$$.ma_dvt});$data$$.gia_mua_qd=$data$$.gia_mua/($dvt$jscomp$1_user$$&&$dvt$jscomp$1_user$$.ty_le_qd?$dvt$jscomp$1_user$$.ty_le_qd:1);$next$$(null,$data$$,$obj$$)}});$contr_router$$.view=function($user$$,$items$$,$fn$$){let $id_app$$=$user$$.current_id_app;async.series([function($callback$$){$items$$.filter($r$$=>
|
|
4
|
+
$r$$.ma_kh).joinModel2($id_app$$,dmkh,{where:"ma_kh",fields:"ten_kh"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:"ten_vt"},function($rs$$){$callback$$(null,$rs$$)})}],function(){$fn$$(null,$items$$)})};$contr_router$$.route()};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const model=global.getModel("dmgiathitruong"),dmvt=global.getModel("dmvt"),dmkh=global.getModel("customer"),controller=require("../../controllers/controller"),async=require("async"),dmqddvt=global.getModel("dmqddvt"),moment=require("moment"),{groupBy}=require("lodash"),{onAfterCommit}=require("../../libs/sessionContext"),tinhgiathaydoi=$obj$$=>{onAfterCommit(async()=>{var $ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$=moment($obj$$.ngay).format("YYYY-MM-DD");await global.getModel("dmgiathitruong_ngay").findOneAndUpdate({id_app:$obj$$.id_app,
|
|
2
|
+
ngay:$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$},{ngay:$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$,id_app:$obj$$.id_app},{new:!0,upsert:!0});var $ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$={id_app:$obj$$.id_app,ma_vt:$obj$$.ma_vt,ngay:{$gte:moment($obj$$.ngay).startOf("date").toDate(),$lte:moment($obj$$.ngay).endOf("date").toDate()}};$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$=await model.find($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$).sort({ngay:-1}).lean();
|
|
3
|
+
let $gia_thi_truong_tb_hom_nay$$=$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$.length>0?$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$.map($d$$=>$d$$.gia_thi_truong_qd||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0)/$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$.length:0;$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$={id_app:$obj$$.id_app,ma_vt:$obj$$.ma_vt,ngay:{$lt:moment($obj$$.ngay).startOf("date").toDate()}};$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$=
|
|
4
|
+
($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$=await model.findOne($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$,{ngay:1}).sort({ngay:-1}).lean())?$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$.ngay:moment($obj$$.ngay).subtract(1,"days").toDate();$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$={id_app:$obj$$.id_app,
|
|
5
|
+
ma_vt:$obj$$.ma_vt,ngay:{$gte:moment($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$).startOf("date").toDate(),$lte:moment($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$).endOf("date").toDate()}};$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$=await model.find($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$).sort({ngay:-1}).lean();
|
|
6
|
+
let $gia_thi_truong_tb_td$$=($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$=$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$.length>0?$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$.map($d$$=>$d$$.gia_thi_truong_qd||0).reduce(($a$$,$b$$)=>$a$$+$b$$,0)/$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$.length:0)?$gia_thi_truong_tb_hom_nay$$-
|
|
7
|
+
$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$:0;await Promise.all($ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$.map($hom_nay$$=>(async()=>{await model.updateOne({_id:$hom_nay$$._id},{gia_thi_truong_tb:$gia_thi_truong_tb_hom_nay$$,gia_thi_truong_tb_td:$gia_thi_truong_tb_td$$})})()));$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$=0;($ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$=await model.findOne({id_app:$obj$$.id_app,
|
|
8
|
+
ma_vt:$obj$$.ma_vt,tinh_thanh:$obj$$.tinh_thanh,ngay:{$lte:$obj$$.ngay},_id:{$ne:$obj$$._id}}).sort({ngay:-1}).lean())&&($ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$=$obj$$.gia_thi_truong_qd-$ds_hom_truoc_gia_thi_truong_tb_hom_truoc_ngay_hom_truoc_query_query_ngay_hom_truoc_truoc_do$$.gia_thi_truong_qd);await model.updateOne({_id:$obj$$._id},{gia_thi_truong_td:$ds_hom_nay_gia_thi_truong_td_ngay_cap_nhat$$,gia_thi_truong_tb:$gia_thi_truong_tb_hom_nay$$,gia_thi_truong_tb_td:$gia_thi_truong_tb_td$$})})};
|
|
9
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmgiathitruong",{sort:{ngay:-1,ma_vt:1,ma_kh:1,sl_tu:1,sl_den:1},notNeedRight:($user$$,$options$$)=>$options$$.action=="view"?!0:!1,onFinding:async($latest_user$$,$condition$$,$next$$,$options$$={})=>{if($condition$$.ngay&&(typeof $condition$$.ngay=="string"||$condition$$.ngay.getTime))try{$condition$$.ngay={$gte:moment($condition$$.ngay).startOf("date").toDate(),$lte:moment($condition$$.ngay).endOf("date").toDate()}}catch($e$$){return $next$$("\u0110i\u1ec1u ki\u1ec7n ngay kh\u00f4ng h\u1ee3p l\u1ec7")}else $condition$$.latest&&
|
|
10
|
+
($latest_user$$=await model.findOne({id_app:$latest_user$$.current_id_app,status:!0},{ngay:1}).sort({ngay:-1}).lean(),$condition$$.ngay={$gte:moment(($latest_user$$||{}).ngay).startOf("date").toDate(),$lte:moment(($latest_user$$||{}).ngay).endOf("date").toDate()});delete $condition$$.latest;$condition$$.unique&&!$options$$.req.query.unique&&($options$$.req.query.unique=$condition$$.unique);delete $condition$$.unique;$next$$(null,$condition$$)},onCreating:async($dvt_he_so_qd_user$$,$obj$$,$next$$)=>
|
|
11
|
+
{$dvt_he_so_qd_user$$=($dvt_he_so_qd_user$$=await dmqddvt.findOne({ma_vt:$obj$$.ma_vt,id_app:$obj$$.id_app,ma_dvt:$obj$$.ma_dvt}))&&$dvt_he_so_qd_user$$.ty_le_qd?$dvt_he_so_qd_user$$.ty_le_qd:1;$obj$$.gia_mua_qd=$obj$$.gia_mua/$dvt_he_so_qd_user$$;$obj$$.gia_thi_truong_qd=$obj$$.gia_thi_truong/$dvt_he_so_qd_user$$;$next$$(null,$obj$$)},onCreated:async($user$$,$obj$$,$next$$)=>{tinhgiathaydoi($obj$$);$next$$(null,$obj$$)},onUpdating:async($dvt$jscomp$1_he_so_qd$jscomp$1_user$$,$data$$,$obj$$,$next$$)=>
|
|
12
|
+
{$data$$.ma_vt=$data$$.ma_vt||$obj$$.ma_vt;$data$$.ma_dvt=$data$$.ma_dvt||$obj$$.ma_dvt;$data$$.gia_mua=$data$$.gia_mua!==void 0?$data$$.gia_mua:$obj$$.gia_mua;$data$$.gia_thi_truong=$data$$.gia_thi_truong||$obj$$.gia_thi_truong;$data$$.ngay=$data$$.ngay||$obj$$.ngay;$data$$.tinh_thanh=$data$$.tinh_thanh||$obj$$.tinh_thanh;$dvt$jscomp$1_he_so_qd$jscomp$1_user$$=($dvt$jscomp$1_he_so_qd$jscomp$1_user$$=await dmqddvt.findOne({ma_vt:$data$$.ma_vt,id_app:$obj$$.id_app,ma_dvt:$data$$.ma_dvt}))&&$dvt$jscomp$1_he_so_qd$jscomp$1_user$$.ty_le_qd?
|
|
13
|
+
$dvt$jscomp$1_he_so_qd$jscomp$1_user$$.ty_le_qd:1;$data$$.gia_mua_qd=$data$$.gia_mua/$dvt$jscomp$1_he_so_qd$jscomp$1_user$$;$data$$.gia_thi_truong_qd=$data$$.gia_thi_truong/$dvt$jscomp$1_he_so_qd$jscomp$1_user$$;$next$$(null,$data$$,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{tinhgiathaydoi($obj$$);$next$$(null,$obj$$)}});$contr_router$$.view=function($user$$,$items$$,$fn$$,$options$$={}){let $id_app$$=$user$$.current_id_app;async.parallel([function($callback$$){$items$$.filter($r$$=>$r$$.ma_kh).joinModel2($id_app$$,
|
|
14
|
+
dmkh,{where:"ma_kh",fields:"ten_kh"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:["ten_vt","ma_nvt","ma_danh_muc_cty","ma_danh_muc"]},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,"dmgiathitruong_theodoi",{where:$item$$=>({tinh_thanh:$item$$.tinh_thanh,ma_vt:$item$$.ma_vt,user:$user$$.email}),fields:["follow",{follow_id:"_id"}]},function($rs$$){$callback$$(null,$rs$$)})}],
|
|
15
|
+
function(){if($options$$.req.query.unique){let $groups$$=groupBy($items$$,$item$$=>$item$$.ma_vt+"::"+($item$$.tinh_thanh||""));$items$$=Object.keys($groups$$).map($g$$=>$groups$$[$g$$][0])}$fn$$(null,$items$$)})};$contr_router$$.route()};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const model=global.getModel("dmgiathitruong_ngay"),controller=require("../../controllers/controller"),dmgiathitruong_ngay=function($router$$){(new controller($router$$,model,"dmgiathitruong_ngay",{sort:{ngay:-1},notNeedRight:!0,onCreating:async($user$$,$obj$$,$next$$)=>{$next$$("Kh\u00f4ng th\u1ec3 t\u1ea1o tr\u1ef1c ti\u1ebfp")},onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{$next$$("Kh\u00f4ng th\u1ec3 c\u1eadp nh\u1eadt")},onDeleting:async($user$$,$obj$$,$next$$)=>{if(!$user$$.appAdmin)return $next$$("Kh\u00f4ng c\u00f3 quy\u1ec1n xo\u00e1");
|
|
2
|
+
$next$$(null,$obj$$)}})).route()};module.exports=dmgiathitruong_ngay;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmgiathitruong_theodoi"),controller=require("../../controllers/controller"),dmgiathitruong_theodoi=function($router$$){(new controller($router$$,model,"dmgiathitruong_theodoi",{sort:{ngay:-1},unique:["ma_vt","tinh_thanh","user"],notNeedRight:!0})).route()};module.exports=dmgiathitruong_theodoi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmhoahonghd"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmhoahonghd",{sort:{hieu_luc_tu:-1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_hoahong"],onCreated:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)},onDeleted:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)}})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmhoahongnpp"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmhoahongnpp",{sort:{hieu_luc_tu:-1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_hoahong"],onCreated:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)},onDeleted:async($user$$,$obj$$,$next$$)=>{$next$$(null,$obj$$)}})).route()};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var model=global.getModel("dmkc");const controller=require("../../controllers/controller");var Dmtk=global.getModel("account");const async=require("async");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmkc",{sort:{stt:1},unique:["stt"]});$contr_router$$.route();$contr_router$$.view=function($user$$,$items$$,$fn$$){let $id_app$$=$user$$.current_id_app;async.series([function($callback$$){$items$$.joinModel($id_app$$,Dmtk,[{akey:"tk_chuyen",bkey:"tk",fields:[{name:"ten_tk_chuyen",value:"ten_tk"}]},{akey:"tk_nhan",bkey:"tk",fields:[{name:"ten_tk_nhan",value:"ten_tk"}]}],function($rs$$){$callback$$(null,$rs$$)})}],
|
|
3
|
+
function(){$fn$$(null,$items$$)})}};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const model=global.getModel("dmkho"),customer=global.getModel("customer"),controller=require("../../controllers/controller"),getSysorder=function($item$$,$callback$$){let $sysorder$$=$item$$.ma_kho.toString();$item$$.ma_kho_me&&$item$$.ma_kho_me!=$item$$.ma_kho.toString()?model.findOne({ma_kho:$item$$.ma_kho_me}).lean().then(function($item_me$$){$item_me$$?getSysorder($item_me$$,function($rs$$){$sysorder$$=$rs$$+"---"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{Logger.error($e$$);
|
|
2
|
+
$callback$$($sysorder$$)}):$callback$$($sysorder$$)};
|
|
3
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmkho",{sort:{ma_kho:1},unique:["ma_kho"],onView:async($user$$,$items$$,$next$$)=>{await $items$$.asyncJoinModel2($user$$.current_id_app,customer,{where:{ma_kh:"ma_kh"},fields:{ten_kh:"ten_kh"}});$next$$(null,$items$$)},onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{if($data$$.ma_kho_me&&(await model.getAllChildrenGroup($obj$$.id_app,$obj$$.ma_kho.toString())).indexOf($data$$.ma_kho_me)>=0)return $next$$("Kh\u00f4ng th\u1ec3 ch\u1ecdn nh\u00f3m n\u00e0y l\u00e0m nh\u00f3m m\u1eb9");
|
|
4
|
+
$next$$(null,$data$$,$obj$$)}});$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("---").length;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);
|
|
5
|
+
$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("---").length;$loai_nh_rs$$=1;await model.findOne({ma_kho_me:$obj$$.ma_kho.toString(),id_app:$obj$$.id_app}).catch(console.error)&&($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);
|
|
6
|
+
$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $ma_kho_me$$=$obj$$.ma_kho_me;$ma_kho_me$$&&await model.updateOne({id_app:$obj$$.id_app,ma_kho:$ma_kho_me$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.ma_kho_me&&(await model.findOne({ma_kho_me:$obj$$.ma_kho_me,id_app:$obj$$.id_app}).select("_id").catch(console.error)||await model.updateOne({id_app:$obj$$.id_app,ma_kho:$obj$$.ma_kho_me},{$set:{loai_nh:1}}).catch(console.error))});
|
|
7
|
+
$contr_router$$.route()};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const model=global.getModel("dmkhuyenmai"),dmvt=global.getModel("dmvt"),dmnvt=global.getModel("dmnvt"),dmkh=global.getModel("customer"),groups=global.getModel("group"),controller=require("../../controllers/controller"),async=require("async"),newsfeed=global.getModel("newsfeed");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmkhuyenmai",{sort:{ma_vt:1,ma_kho:1,sl_tu:1,sl_den:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onCreated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmkhuyenmai",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else $next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmkhuyenmai",
|
|
3
|
+
$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}},onDeleted:async($user$$,$obj$$,$next$$)=>{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}});$contr_router$$.view=function($user$$,$items$$,$fn$$){let $id_app$$=$user$$.current_id_app;async.series([function($callback$$){$items$$.joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:["ten_vt","picture"]},
|
|
4
|
+
function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmnvt,{where:{ma_nvt:"_id"},fields:"ten_nvt"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,dmkh,{where:"ma_kh",fields:"ten_kh"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){$items$$.joinModel2($id_app$$,groups,{where:{nh_kh:"_id"},fields:"ten_nh_kh"},function($rs$$){$callback$$(null,$rs$$)})},function($callback$$){async.mapLimit($items$$,
|
|
5
|
+
20,($item$$,$callback$$)=>{($item$$.details_km||[]).joinModel2($id_app$$,dmvt,{where:"ma_vt",fields:["ten_vt","picture"]},function($rs$$){$callback$$(null,$rs$$)})},()=>{$callback$$()})}],function(){$fn$$(null,$items$$)})};$contr_router$$.route()};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const model=global.getModel("dmkhuyenmaihd"),controller=require("../../controllers/controller"),newsfeed=global.getModel("newsfeed");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"dmkhuyenmaihd",{sort:{ma_vt:1,ma_kho:1,sl_tu:1,sl_den:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onCreated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmkhuyenmaihd",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else $next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("dmkhuyenmaihd",
|
|
3
|
+
$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}},onDeleted:async($user$$,$obj$$,$next$$)=>{try{await newsfeed.delete($obj$$._id)}catch($e$$){Logger.error($e$$)}$next$$(null,$obj$$)}})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmletet"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmletet",{sort:{ma_le:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_le"]})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmlo"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmlo",{sort:{ma_lo:1,ma_vt:1,han_sd:1},unique:["ma_vt","ma_lo"]})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmloaicong"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmloaicong",{sort:{stt:1},unique:["ma_loai_cong"],notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmloaits"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmloaits",{sort:{ma_loai_ts:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_loai_ts"]})).route()};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const model=global.getModel("dmnckkm"),controller=require("../../controllers/controller"),{getCodeChildren}=require("../../libs/utils"),underscore=require("underscore");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmnckkm",{sort:{sysorder:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onView:function($user$$,$items$$,$next$$){$items$$.filter($item$$=>$item$$.nh_me).joinModel2($user$$.current_id_app,model,[{where:{nh_me:"_id"},fields:[{name:"ten_nh_me",value:"ten_nhom"}]}],function(){$items$$=underscore.sortBy($items$$,function($item$$){return $item$$.sysorder});$next$$(null,
|
|
3
|
+
$items$$)})},onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{if($data$$.nh_me&&(await getCodeChildren(model,$obj$$.id_app,$obj$$._id.toString(),"_id","nh_me")).indexOf($data$$.nh_me)>=0)return $next$$("Kh\u00f4ng th\u1ec3 ch\u1ecdn nh\u00f3m n\u00e0y l\u00e0m nh\u00f3m m\u1eb9");$next$$(null,$data$$,$obj$$)}});const $getSysorder$$=function($item$$,$callback$$){let $sysorder$$=($item$$.stt||"0")+$item$$._id.toString();$item$$.nh_me&&$item$$.nh_me!=$item$$._id.toString()?model.findOne({_id:$item$$.nh_me}).lean().then(function($item_me$$){$item_me$$?
|
|
4
|
+
$getSysorder$$($item_me$$,function($rs$$){$sysorder$$=$rs$$+"-"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{Logger.error($e$$);$callback$$($sysorder$$)}):$callback$$($sysorder$$)};$contr_router$$.route();$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){$getSysorder$$($obj$$,
|
|
5
|
+
async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("-").length;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){$getSysorder$$($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("-").length;$loai_nh_rs$$=1;await model.findOne({nh_me:$obj$$._id.toString(),id_app:$obj$$.id_app})&&($loai_nh_rs$$=
|
|
6
|
+
0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $nh_me$$=$obj$$.nh_me;$nh_me$$&&await model.updateOne({id_app:$obj$$.id_app,_id:$nh_me$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.nh_me&&!await model.findOne({nh_me:$obj$$.nh_me,id_app:$obj$$.id_app}).catch(console.error)&&
|
|
7
|
+
model.updateOne({id_app:$obj$$.id_app,_id:$obj$$.nh_me},{$set:{loai_nh:1}}).catch(console.error)})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmnghiepvu"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmnghiepvu",{sort:{ma_ct:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_ct","ma_nghiep_vu"]})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmnguonvon"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmnguonvon",{sort:{ma_nguon_von:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_nguon_von"]})).route()};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var model=global.getModel("dmnhnv"),dmbp=global.getModel("dmbp"),dmdoi=global.getModel("dmdoi"),dmto=global.getModel("dmto"),Participant=global.getModel("participant");const async=require("async"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"dmnhnv",{sort:{ma_bp:1,ma_doi:1,ma_to:1,ma_nh_nv:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_nh_nv"],onView:function($user$$,$items$$,$next$$){async.series({dp:function($callback$$){$items$$.joinModel2($user$$.current_id_app,dmbp,[{where:{ma_bp:"ma_bp"},fields:["ten_bp"]}],function(){$callback$$(null,$items$$)})},doi:function($callback$$){$items$$.joinModel2($user$$.current_id_app,
|
|
3
|
+
dmdoi,[{where:{ma_doi:"ma_doi",ma_bp:"ma_bp"},fields:["ten_doi"]}],function(){$callback$$(null,$items$$)})},to:function($callback$$){$items$$.joinModel2($user$$.current_id_app,dmto,[{where:{ma_doi:"ma_doi",ma_bp:"ma_bp",ma_to:"ma_to"},fields:["ten_to"]}],function(){$callback$$(null,$items$$)})},pt:function($callback$$){$items$$.joinModel2($user$$.current_id_app,Participant,[{where:{phu_trach:"email"},fields:[{ten_phu_trach:"name"}]}],function(){$callback$$(null,$items$$)})},ph:function($callback$$){$items$$.joinModel2($user$$.current_id_app,
|
|
4
|
+
Participant,[{where:{phoi_hop:"email"},fields:[{ten_phoi_hop:"name"}]}],function(){$callback$$(null,$items$$)})}},()=>{$next$$(null,$items$$)})},onRightByItem:($user$$,$condition$$,$next$$)=>{async.parallel({phu_trach_bp:$callback$$=>{dmbp.find({id_app:$user$$.current_id_app,phu_trach:$user$$.email}).lean().then($bps$$=>{$callback$$(null,$bps$$)}).catch($e$$=>{$callback$$($e$$)})},phu_trach_doi:$callback$$=>{dmdoi.find({id_app:$user$$.current_id_app,phu_trach:$user$$.email}).lean().then($bps$$=>{$callback$$(null,
|
|
5
|
+
$bps$$)}).catch($e$$=>{$callback$$($e$$)})},phu_trach_to:$callback$$=>{dmto.find({id_app:$user$$.current_id_app,phu_trach:$user$$.email}).lean().then($bps$$=>{$callback$$(null,$bps$$)}).catch($e$$=>{$callback$$($e$$)})}},($_condition_bps$jscomp$3_e$$,$$or_rs_tos$$)=>{if($_condition_bps$jscomp$3_e$$)return $next$$($_condition_bps$jscomp$3_e$$);$_condition_bps$jscomp$3_e$$=$$or_rs_tos$$.phu_trach_bp.map($bp$$=>$bp$$.ma_bp);var $_c_dois$$=$$or_rs_tos$$.phu_trach_doi.map($doi$$=>$doi$$.ma_doi);$$or_rs_tos$$=
|
|
6
|
+
$$or_rs_tos$$.phu_trach_to.map($to$$=>$to$$.ma_to);$$or_rs_tos$$=[{ma_bp:{$in:$_condition_bps$jscomp$3_e$$}},{ma_doi:{$in:$_c_dois$$}},{ma_to:{$in:$$or_rs_tos$$}}];$_condition_bps$jscomp$3_e$$=[];for(let $k$$ in $condition$$)$_c_dois$$={},$_c_dois$$[$k$$]=$condition$$[$k$$],$_condition_bps$jscomp$3_e$$.push($_c_dois$$);$$or_rs_tos$$.push({$and:$_condition_bps$jscomp$3_e$$});$next$$(null,{$or:$$or_rs_tos$$})})}})).route()};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const model=global.getModel("group"),dmdt=global.getModel("dmdt"),dmbp=global.getModel("dmbp"),task=global.getModel("task"),User=global.getModel("user"),UserGroup=global.getModel("usergroup"),Participant=global.getModel("participant"),controller=require("../../controllers/controller"),async=require("async"),dmnhtask=function($router$$){(new controller($router$$,model,"dmnhtask",{sort:{group_name:1},findExact:{group_type:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()==
|
|
2
|
+
"view"?!0:!1,onView:($user$$,$items$$,$next$$)=>{async.series({dt:$cb$$=>{$items$$.filter($r$$=>$r$$.ma_dt).joinModel2($user$$.current_id_app,dmdt,{where:"ma_dt",fields:[{ten_dt:"ten_dt"},{id_dt:"_id"}]},()=>{$cb$$(null)})},bp:$cb$$=>{$items$$.filter($r$$=>$r$$.ma_bp).joinModel2($user$$.current_id_app,dmbp,{where:"ma_bp",fields:"ten_bp"},()=>{$cb$$(null)})},pt:async()=>{await $items$$.asyncJoinModel2($user$$.current_id_app,Participant,{where:{phu_trach:"email"},fields:{nhom_phu_trach:"group_id"}});
|
|
3
|
+
await $items$$.asyncJoinModel2($user$$.current_id_app,UserGroup,{where:{nhom_phu_trach:"_id"},fields:{ten_nhom_phu_trach:"group_name"}});await $items$$.asyncJoinModel2(null,User,{where:{phu_trach:"email"},fields:{ten_phu_trach:"name"}});return null},tasks:async()=>{await Promise.all($items$$.map($item$$=>(async()=>{$item$$.total_tasks=await task.countDocuments({id_app:$user$$.current_id_app,nh_cv:$item$$._id.toString(),saved:{$ne:!0}});$item$$.total_tasks_done=await task.countDocuments({id_app:$user$$.current_id_app,
|
|
4
|
+
nh_cv:$item$$._id.toString(),progress:"3",saved:{$ne:!0}});return $item$$})()));return null}},()=>{$next$$(null,$items$$)})},onFinding:($user$$,$condition$$,$cb$$)=>{$condition$$.group_type="TASK";$cb$$(null,$condition$$)},onCreating:($user$$,$data$$,$cb$$)=>{$data$$.group_type="TASK";$data$$.attends&&($data$$.attends=[...(new Set($data$$.attends))]);$cb$$(null,$data$$)},onUpdating:($user$$,$data$$,$obj$$,$cb$$)=>{$data$$.group_type="TASK";$data$$.attends=$data$$.attends||$obj$$.attends;$data$$.attends&&
|
|
5
|
+
($data$$.attends=[...(new Set($data$$.attends))]);$cb$$(null,$data$$,$obj$$)}})).route()};module.exports=dmnhtask;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const model=global.getModel("group"),controller=require("../../controllers/controller"),getSysorder=function($item$$,$callback$$){let $sysorder$$=$item$$._id.toString();$item$$.group_mother&&$item$$.group_mother!=$item$$._id.toString()?model.findOne({_id:$item$$.group_mother}).lean().then(function($item_me$$){$item_me$$?getSysorder($item_me$$,function($rs$$){$sysorder$$=$rs$$+"---"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{$callback$$($e$$)}):$callback$$($sysorder$$)},
|
|
2
|
+
dmnhkh=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmnhkh",{sort:{sysorder:1},findExact:{group_type:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{if($data$$.group_mother&&(await model.getAllChildrenGroup($obj$$.id_app,$obj$$._id.toString())).indexOf($data$$.group_mother)>=0)return $next$$("Kh\u00f4ng th\u1ec3 ch\u1ecdn nh\u00f3m n\u00e0y l\u00e0m nh\u00f3m m\u1eb9");
|
|
3
|
+
$next$$(null,$data$$,$obj$$)},onView:async($user$$,$items$$,$next$$)=>{await $items$$.asyncJoinModel2($user$$.current_id_app,"groupkind",{where:{group_kind:"group_kind",group_type:"group_type"},fields:"group_kind_name"});$next$$(null,$items$$)}});$contr_router$$.route();$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,
|
|
4
|
+
$obj$$,$next$$){getSysorder($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("---").length;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("---").length;$loai_nh_rs$$=1;await model.findOne({group_mother:$obj$$._id.toString()}).catch(console.error)&&
|
|
5
|
+
($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $group_mother$$=$obj$$.group_mother;$group_mother$$&&await model.updateOne({id_app:$obj$$.id_app,_id:$group_mother$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.group_mother&&!await model.findOne({group_mother:$obj$$.group_mother,
|
|
6
|
+
id_app:$obj$$.id_app}).catch(console.error)&&await model.updateOne({id_app:$obj$$.id_app,_id:$obj$$.group_mother},{$set:{loai_nh:1}}).catch(console.error)})};module.exports=dmnhkh;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const model=global.getModel("group"),controller=require("../../controllers/controller"),getSysorder=function($item$$,$callback$$){let $sysorder$$=$item$$._id.toString();$item$$.group_mother&&$item$$.group_mother!=$item$$._id.toString()?model.findOne({_id:$item$$.group_mother}).lean().then(function($item_me$$){$item_me$$?getSysorder($item_me$$,function($rs$$){$sysorder$$=$rs$$+"---"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{Logger.error($e$$);$callback$$($sysorder$$)}):
|
|
2
|
+
$callback$$($sysorder$$)},dmntt=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmntt",{sort:{sysorder:1},findExact:{group_type:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,keyValues:{group_type:"PROPERTY"},onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{if($data$$.group_mother&&(await model.getAllChildrenGroup($obj$$.id_app,$obj$$._id.toString())).indexOf($data$$.group_mother)>=0)return $next$$("Kh\u00f4ng th\u1ec3 ch\u1ecdn nh\u00f3m n\u00e0y l\u00e0m nh\u00f3m m\u1eb9");
|
|
3
|
+
$next$$(null,$data$$,$obj$$)}});$contr_router$$.route();$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("---").length;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);
|
|
4
|
+
$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("---").length;$loai_nh_rs$$=1;await model.findOne({group_mother:$obj$$._id.toString()}).catch(console.error)&&($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};
|
|
5
|
+
$contr_router$$.on("saved",async function($obj$$){const $group_mother$$=$obj$$.group_mother;$group_mother$$&&await model.updateOne({id_app:$obj$$.id_app,_id:$group_mother$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.group_mother&&!await model.findOne({group_mother:$obj$$.group_mother,id_app:$obj$$.id_app}).catch(console.error)&&await model.updateOne({id_app:$obj$$.id_app,_id:$obj$$.group_mother},{$set:{loai_nh:1}}).catch(console.error)})};
|
|
6
|
+
module.exports=dmntt;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const model=global.getModel("dmnv"),dmbp=global.getModel("dmbp"),dmdoi=global.getModel("dmdoi"),dmto=global.getModel("dmto"),dmnhnv=global.getModel("dmnhnv"),User=global.getModel("user"),Usergroup=global.getModel("usergroup"),Participant=global.getModel("participant"),group=global.getModel("group"),async=require("async"),controller=require("../../controllers/controller"),{isValidObjectId}=require("mongoose"),dmnv=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmnv",
|
|
2
|
+
{sort:{ma_bp:1,ma_doi:1,ma_to:1,ten_nv:1},unique:["ma_nv"],onCreating:async($ex$jscomp$0$$,$data$$,$next$$)=>{if($data$$.user){let $ex$$=await model.findOne({id_app:$ex$jscomp$0$$.current_id_app,user:$data$$.user}).lean();if($ex$$)return $next$$("T\u00ean \u0111\u0103ng nh\u1eadp '"+$data$$.user+"' \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho nh\u00e2n vi\u00ean "+$ex$$.ten_nv)}if($data$$.device_user_id&&($ex$jscomp$0$$=await model.findOne({id_app:$ex$jscomp$0$$.current_id_app,device_user_id:$data$$.device_user_id}).lean()))return $next$$("M\u00e3 tr\u00ean m\u00e1y ch\u1ea5m c\u00f4ng '"+
|
|
3
|
+
$data$$.device_user_id+"' \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho nh\u00e2n vi\u00ean "+$ex$jscomp$0$$.ten_nv);$next$$(null,$data$$)},onUpdating:async($ex$jscomp$3_user$$,$data$$,$obj$$,$next$$)=>{if($data$$.user&&$data$$.user!==$obj$$.user){let $ex$$=await model.findOne({id_app:$ex$jscomp$3_user$$.current_id_app,user:$data$$.user}).lean();if($ex$$)return $next$$("T\u00ean \u0111\u0103ng nh\u1eadp '"+$data$$.user+"' \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho nh\u00e2n vi\u00ean "+
|
|
4
|
+
$ex$$.ten_nv)}if($data$$.device_user_id&&$data$$.device_user_id!==$obj$$.device_user_id&&($ex$jscomp$3_user$$=await model.findOne({id_app:$ex$jscomp$3_user$$.current_id_app,device_user_id:$data$$.device_user_id}).lean()))return $next$$("M\u00e3 tr\u00ean m\u00e1y ch\u1ea5m c\u00f4ng '"+$data$$.device_user_id+"' \u0111\u00e3 \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng cho nh\u00e2n vi\u00ean "+$ex$jscomp$3_user$$.ten_nv);$next$$(null,$data$$,$obj$$)},onView:($user$$,$items$$,$next$$)=>{$items$$.forEach($item$$=>
|
|
5
|
+
{delete $item$$.default_password});async.parallel([$callback$$=>{$items$$.filter($item$$=>$item$$.user&&!$item$$.group_user).joinModel2($user$$.current_id_app,"usergroup",[{where:{user:"email"},fields:[{name:"group_user",value:"_id"}]}],function(){$callback$$(null,$items$$)})},$callback$$=>{$items$$.filter($item$$=>$item$$.phu_trach).joinModel2(null,User,[{where:{phu_trach:"email"},fields:[{name:"ten_phu_trach",value:"name"}]}],function(){$callback$$(null,$items$$)})},$callback$$=>{$items$$.filter($item$$=>
|
|
6
|
+
$item$$.ma_bp).joinModel2($user$$.current_id_app,dmbp,[{where:{ma_bp:"ma_bp"},fields:"ten_bp"}],function(){$callback$$(null,$items$$)})},$callback$$=>{$items$$.filter($item$$=>$item$$.ma_doi).joinModel2($user$$.current_id_app,dmdoi,[{where:{ma_bp:"ma_bp",ma_doi:"ma_doi"},fields:"ten_doi"}],function(){$callback$$(null,$items$$)})},$callback$$=>{$items$$.filter($item$$=>$item$$.ma_to).joinModel2($user$$.current_id_app,dmto,[{where:{ma_bp:"ma_bp",ma_doi:"ma_doi",ma_to:"ma_to"},fields:"ten_to"}],function(){$callback$$(null,
|
|
7
|
+
$items$$)})},$callback$$=>{$items$$.filter($item$$=>$item$$.ma_nh_nv).joinModel2($user$$.current_id_app,dmnhnv,[{where:{ma_bp:"ma_bp",ma_doi:"ma_doi",ma_to:"ma_to",ma_nh_nv:"ma_nh_nv"},fields:"ten_nh_nv"}],function(){$callback$$(null,$items$$)})},$callback$$=>{$items$$.filter($item$$=>$item$$.chuc_vu).joinModel2($user$$.current_id_app,group,[{where:{chuc_vu:"_id"},fields:[{ten_chuc_vu:"group_name"},{color:"color"},{muc_tieu_bieu:"muc_tieu_bieu"}]}],function(){$callback$$(null,$items$$)})},$callback$$=>
|
|
8
|
+
{async.mapLimit($items$$,20,($item$$,$callback$$)=>{($item$$.bo_phan||[]).filter($item$$=>$item$$.chuc_vu).joinModel2($user$$.current_id_app,group,[{where:{chuc_vu:"_id"},fields:[{ten_chuc_vu:"group_name"},{color:"color"},{muc_tieu_bieu:"muc_tieu_bieu"}]}],function(){$callback$$(null,$items$$)})},()=>{$callback$$(null,$items$$)})},$callback$$=>{async.mapLimit($items$$,20,($item$$,$callback$$)=>{($item$$.bo_phan||[]).filter($item$$=>$item$$.ma_bp).joinModel2($user$$.current_id_app,dmbp,[{where:{ma_bp:"ma_bp"},
|
|
9
|
+
fields:[{ten_bp:"ten_bp"}]}],function(){$callback$$(null,$items$$)})},()=>{$callback$$(null,$items$$)})}],()=>{$items$$.filter($item$$=>$item$$.bo_phan).forEach($item$$=>{$item$$.bo_phan.forEach($bp$$=>{$bp$$.active=!$bp$$.den_ngay||$bp$$.den_ngay>=new Date;$bp$$.active&&($item$$.ma_bp=$item$$.map_bp||$bp$$.ma_bp,$item$$.ten_bp=$item$$.ten_bp||$bp$$.ten_bp,$item$$.phu_trach=$item$$.phu_trach||$bp$$.phu_trach,$item$$.chuc_vu=$item$$.chuc_vu||$bp$$.chuc_vu)})});$next$$(null,$items$$)})},onImport:($user$$,
|
|
10
|
+
$data$$,$columns$$,$next$$)=>{async.mapLimit($data$$,20,function($r$$,$callback$$){async.series({nhom:function($callback$$){$r$$.group_name&&!$r$$.nh_kh?group.findOneAndUpdate({id_app:$user$$.current_id_app,group_type:"DMNV",group_name:{$regex:$r$$.group_name,$options:"i"}},{group_name:$r$$.group_name,group_type:"DMNV",status:!0},{new:!0,upsert:!0},function($e$$,$n$$){if($e$$)return $callback$$($e$$);$r$$.nh_nv=$n$$._id.toString();$callback$$(null)}):$callback$$()}},function(){$callback$$()})},function(){$next$$()})},
|
|
11
|
+
onQuery:($req$$,$next$$)=>{if($req$$.obj&&$req$$.obj.user===$req$$.user.email)return $req$$.permission=!0,$next$$();$req$$.permission||($req$$.condition={user:$req$$.user.email});$req$$.permission=!0;$next$$()}});$contr_router$$.validating=async($id_app_user$$,$obj$$,$next$$,$options$$={})=>{if($options$$.action=="add"&&!$obj$$.ma_nv&&$obj$$.ten_nv){$id_app_user$$=$id_app_user$$.current_id_app;try{let $ma_nv$$=await model.asyncCreateEmployeeCode($id_app_user$$,$obj$$.ten_nv);$obj$$.ma_nv=$ma_nv$$;
|
|
12
|
+
$next$$(null,$obj$$)}catch($e$$){Logger.error($e$$),$next$$($e$$)}}else $next$$(null,$obj$$)};$contr_router$$.route();$contr_router$$.on("saved",async $data$$=>{let $_usergroup$$;try{let $query_user_group$$={};$data$$.group_user&&isValidObjectId($data$$.group_user)?$query_user_group$$._id=$data$$.group_user:$query_user_group$$.is_employee_group=!0;$_usergroup$$=await Usergroup.getInfo($data$$.id_app,$query_user_group$$)}catch($e$$){return}$data$$.user&&$_usergroup$$&&User.findOne({email:$data$$.user},
|
|
13
|
+
($e$$,$rs$$)=>{if($rs$$)Participant.createParticipant({id_app:$data$$.id_app,email:$data$$.user,group_id:$_usergroup$$._id,active:!0},$e$$=>{if($e$$)return Logger.info("can't add user",$data$$.user,"to company")});else{var $result$$=new User;$result$$.email=$data$$.user;$result$$.name=$data$$.ten_nv;$result$$.email2=$data$$.email;$result$$.local={};$result$$.local.email=$result$$.email;$result$$.local.name=$result$$.name;$result$$.local.picture="/images/avatar.jpg";$result$$.local.password=$result$$.generateHash($result$$.email+
|
|
14
|
+
($data$$.default_password||$result$$.email+"@123456"));$result$$.save($e$$=>{if($e$$)return Logger.info($e$$.message);Participant.createParticipant({id_app:$data$$.id_app,email:$result$$.email,group_id:$_usergroup$$._id,active:!0},$e$$=>{if($e$$)return Logger.info("can't add user",$result$$.email,"to company")})})}})})};module.exports=dmnv;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const model=global.getModel("dmnvt"),controller=require("../../controllers/controller"),underscore=require("underscore");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmnvt",{sort:{sysorder:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,onView:function($user$$,$items$$,$next$$){$items$$.filter($item$$=>$item$$.nh_me).joinModel2($user$$.current_id_app,model,[{where:{nh_me:"_id"},fields:[{name:"ten_nh_me",value:"ten_nvt"}]}],function(){$items$$=underscore.sortBy($items$$,function($item$$){return $item$$.sysorder});$items$$.forEach(async $item$$=>
|
|
3
|
+
{!$item$$.ma_nganh_hang||$item$$.ds_nganh_hang&&$item$$.ds_nganh_hang.length!=0||($item$$.ds_nganh_hang=[$item$$.ma_nganh_hang],await model.updateOne({_id:$item$$._id},{ds_nganh_hang:$item$$.ds_nganh_hang}))});$next$$(null,$items$$)})},onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{if($data$$.nh_me&&(await model.getAllChildrenGroup($obj$$.id_app,$obj$$._id.toString())).indexOf($data$$.nh_me)>=0)return $next$$("Kh\u00f4ng th\u1ec3 ch\u1ecdn nh\u00f3m n\u00e0y l\u00e0m nh\u00f3m m\u1eb9");$next$$(null,
|
|
4
|
+
$data$$,$obj$$)}});const $getSysorder$$=function($item$$,$callback$$){let $sysorder$$=($item$$.stt||"0")+$item$$._id.toString();$item$$.nh_me&&$item$$.nh_me!=$item$$._id.toString()?model.findOne({_id:$item$$.nh_me}).lean().then(function($item_me$$){$item_me$$?$getSysorder$$($item_me$$,function($rs$$){$sysorder$$=$rs$$+"-"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{Logger.error($e$$);$callback$$($sysorder$$)}):$callback$$($sysorder$$)};$contr_router$$.route();$contr_router$$.deleting=
|
|
5
|
+
function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){$getSysorder$$($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("-").length;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,
|
|
6
|
+
$obj$$,$next$$){$getSysorder$$($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("-").length;$loai_nh_rs$$=1;await model.findOne({nh_me:$obj$$._id.toString()})&&($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $nh_me$$=$obj$$.nh_me;$nh_me$$&&await model.updateOne({id_app:$obj$$.id_app,
|
|
7
|
+
_id:$nh_me$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.nh_me&&!await model.findOne({nh_me:$obj$$.nh_me,id_app:$obj$$.id_app}).catch(console.error)&&await model.updateOne({id_app:$obj$$.id_app,_id:$obj$$.nh_me},{$set:{loai_nh:1}}).catch(console.error)})};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const model=global.getModel("dmphi"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmphi",{sort:{sysorder:1,stt:1},unique:["ma_phi"]});$contr_router$$.route();const $getSysorder$$=function($item$$,$callback$$){let $sysorder$$=($item$$.stt||"0")+$item$$.ma_phi.toString();$item$$.ma_phi_me&&$item$$.ma_phi_me!=$item$$.ma_phi?model.findOne({ma_phi:$item$$.ma_phi_me,id_app:$item$$.id_app}).lean().then(function($item_me$$){$item_me$$?$getSysorder$$($item_me$$,function($rs$$){$sysorder$$=$rs$$+
|
|
3
|
+
"-"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}).catch($e$$=>{Logger.error("[dmphi] ",$e$$);$callback$$($sysorder$$)}):$callback$$($sysorder$$)};$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){$getSysorder$$($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("-").length;
|
|
4
|
+
await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){$getSysorder$$($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("-").length;$loai_nh_rs$$=1;await model.findOne({ma_phi_me:$obj$$.ma_phi,id_app:$obj$$.id_app})&&($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,
|
|
5
|
+
sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $ma_phi_me$$=$obj$$.ma_phi_me;$ma_phi_me$$&&await model.updateOne({id_app:$obj$$.id_app,ma_phi:$ma_phi_me$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.ma_phi_me&&!await model.findOne({ma_phi_me:$obj$$.ma_phi_me,id_app:$obj$$.id_app}).catch(console.error)&&await model.updateOne({id_app:$obj$$.id_app,
|
|
6
|
+
ma_phi:$obj$$.ma_phi_me},{$set:{loai_nh:1}}).catch(console.error)})};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const model=global.getModel("dmqct"),counter=global.getModel("counter"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmqct",{sort:{ma_ct:1}});$contr_router$$.route();$contr_router$$.on("saved",function($obj$$){counter.findOneAndUpdate({id_app:$obj$$.id_app,name:$obj$$._id.toString().toUpperCase(),field:$obj$$.field},{sequence:$obj$$.so_ht},{new:!0,upsert:!0},function($error$$){$error$$&&Logger.info("can't update sequence",$error$$)})})};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const model=global.getModel("dmqddvt"),dmvt=global.getModel("dmvt"),dmdvt=global.getModel("dmdvt"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"dmqddvt",{sort:{ma_vt:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_vt","ma_dvt"],onView:async($user$$,$items$$,$next$$)=>{await $items$$.asyncJoinModel2($user$$.current_id_app,dmvt,[{where:"ma_vt",fields:[{ten_vt:"ten_vt"},{ma_dvt_goc:"ma_dvt"}]}]);await $items$$.asyncJoinModel2($user$$.current_id_app,dmdvt,[{where:"ma_dvt",fields:[{ten_dvt:"ten_dvt"}]}]);$next$$(null,$items$$)},
|
|
3
|
+
onCreating:($user$$,$data$$,$next$$)=>{$data$$.tu&&$data$$.mau&&($data$$.ty_le_qd=$data$$.tu/$data$$.mau);$next$$(null,$data$$)},onUpdating:($user$$,$data$$,$obj$$,$next$$)=>{$data$$.tu&&$data$$.mau&&($data$$.ty_le_qd=$data$$.tu/$data$$.mau);$next$$(null,$data$$,$obj$$)}})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dmtanggiamts"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmtanggiamts",{sort:{ma_tang_giam_ts:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_tang_giam_ts"]})).route()};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const model=global.getModel("dmto"),dmbp=global.getModel("dmbp"),dmdoi=global.getModel("dmdoi"),Participant=global.getModel("participant"),async=require("async"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"dmto",{sort:{ma_bp:1,ma_doi:1,ma_to:1},unique:["ma_to"],onView:function($user$$,$items$$,$next$$){async.series({dp:function($callback$$){$items$$.joinModel2($user$$.current_id_app,dmbp,[{where:{ma_bp:"ma_bp"},fields:["ten_bp"]}],function(){$callback$$(null,$items$$)})},doi:function($callback$$){$items$$.joinModel2($user$$.current_id_app,dmdoi,[{where:{ma_doi:"ma_doi",ma_bp:"ma_bp"},fields:["ten_doi"]}],function(){$callback$$(null,
|
|
3
|
+
$items$$)})},pt:function($callback$$){$items$$.joinModel2($user$$.current_id_app,Participant,[{where:{phu_trach:"email"},fields:[{ten_phu_trach:"name"}]}],function(){$callback$$(null,$items$$)})},ph:function($callback$$){$items$$.joinModel2($user$$.current_id_app,Participant,[{where:{phoi_hop:"email"},fields:[{ten_phoi_hop:"name"}]}],function(){$callback$$(null,$items$$)})}},()=>{$next$$(null,$items$$)})},onRightByItem:($user$$,$condition$$,$next$$)=>{async.series({phu_trach_bp:$callback$$=>{dmbp.find({id_app:$user$$.current_id_app,
|
|
4
|
+
phu_trach:$user$$.email}).lean().exec(($e$$,$bps$$)=>{$callback$$(null,$bps$$)})},phu_trach_doi:$callback$$=>{dmdoi.find({id_app:$user$$.current_id_app,phu_trach:$user$$.email}).lean().exec(($e$$,$bps$$)=>{$callback$$(null,$bps$$)})}},($_condition_bps$jscomp$2_e$$,$$or_dois_rs$$)=>{$_condition_bps$jscomp$2_e$$=$$or_dois_rs$$.phu_trach_bp.map($bp$$=>$bp$$.ma_bp);$$or_dois_rs$$=$$or_dois_rs$$.phu_trach_doi.map($d$$=>$d$$.ma_doi);$$or_dois_rs$$=[{ma_bp:{$in:$_condition_bps$jscomp$2_e$$}},{ma_doi:{$in:$$or_dois_rs$$}}];
|
|
5
|
+
$_condition_bps$jscomp$2_e$$=[];for(let $k$$ in $condition$$){let $_c$$={};$_c$$[$k$$]=$condition$$[$k$$];$_condition_bps$jscomp$2_e$$.push($_c$$)}$$or_dois_rs$$.push({$and:$_condition_bps$jscomp$2_e$$});$next$$(null,{$or:$$or_dois_rs$$})})}})).route()};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const model=global.getModel("dmtt"),dmvt=global.getModel("dmvt"),dmdvt=global.getModel("dmdvt"),async=require("async"),dmntt=global.getModel("group"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"dmtt",{sort:{ma_vt:1},unique:["ma_vt","loai_tt","ma_tt"],onFinding:function($user$$,$condition$$,$next$$){async.parallel({nh_tt:$callback$$=>{$condition$$.nh_tt&&typeof $condition$$.nh_tt=="string"?dmntt.getAllChildrenGroup($condition$$.id_app,$condition$$.nh_tt,{status:!0,group_kind:1}).then($nh_tt$$=>{$condition$$.nh_tt={$in:[...(new Set($nh_tt$$))]};$callback$$()}):$callback$$()},nh_tt2:$callback$$=>{$condition$$.nh_tt2&&typeof $condition$$.nh_tt2==
|
|
3
|
+
"string"?dmntt.getAllChildrenGroup($condition$$.id_app,$condition$$.nh_tt2,{status:!0,group_kind:2}).then($nh_tt$$=>{$condition$$.nh_tt2={$in:[...(new Set($nh_tt$$))]};$callback$$()}):$callback$$()},nh_tt3:$callback$$=>{$condition$$.nh_tt3&&typeof $condition$$.nh_tt3=="string"?dmntt.getAllChildrenGroup($condition$$.id_app,$condition$$.nh_tt3,{status:!0,group_kind:3}).then($nh_tt$$=>{$condition$$.nh_tt3={$in:[...(new Set($nh_tt$$))]};Logger.info($condition$$.nh_tt3);$callback$$()}):$callback$$()},
|
|
4
|
+
nh_tt4:$callback$$=>{$condition$$.nh_tt4&&typeof $condition$$.nh_tt4=="string"?dmntt.getAllChildrenGroup($condition$$.id_app,$condition$$.nh_tt4,{status:!0,group_kind:4}).then($nh_tt$$=>{$condition$$.nh_tt4={$in:[...(new Set($nh_tt$$))]};$callback$$()}):$callback$$()},nh_tt5:$callback$$=>{$condition$$.nh_tt5&&typeof $condition$$.nh_tt5=="string"?dmntt.getAllChildrenGroup($condition$$.id_app,$condition$$.nh_tt5,{status:!0,group_kind:5}).then($nh_tt$$=>{$condition$$.nh_tt5={$in:[...(new Set($nh_tt$$))]};
|
|
5
|
+
$callback$$()}):$callback$$()}},()=>{$next$$(null,$condition$$)})},onView:async($user$$,$items$$,$next$$)=>{await $items$$.asyncJoinModel2($user$$.current_id_app,dmdvt,{where:"ma_dvt",fields:"ten_dvt"});await $items$$.asyncJoinModel2($user$$.current_id_app,dmvt,{where:"ma_vt",fields:"ten_vt"});$next$$(null,$items$$)},onCreating:async($user$$,$obj$$,$next$$)=>{if($obj$$.ma_can&&await model.findOne({id_app:$user$$.current_id_app,ma_can:$obj$$.ma_can}))return $next$$("M\u00e3 c\u00e2n n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i");
|
|
6
|
+
if($obj$$.ma_tt2&&await model.findOne({id_app:$user$$.current_id_app,ma_tt2:$obj$$.ma_tt2}))return $next$$("M\u00e3 v\u1ea1ch n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i");$next$$(null,$obj$$)},onUpdating:async($user$$,$data$$,$obj$$,$next$$)=>{if($data$$.ma_can&&$data$$.ma_can!==$obj$$.ma_can&&await model.findOne({id_app:$user$$.current_id_app,ma_can:$data$$.ma_can}))return $next$$("M\u00e3 c\u00e2n n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i");if($data$$.ma_tt2&&$data$$.ma_tt2!==$obj$$.ma_tt2&&await model.findOne({id_app:$user$$.current_id_app,
|
|
7
|
+
ma_tt2:$data$$.ma_tt2}))return $next$$("M\u00e3 v\u1ea1ch n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i");$next$$(null,$data$$,$obj$$)}})).route()};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const model=global.getModel("dmvt"),controller=require("../../controllers/controller"),Dmdvt=global.getModel("dmdvt"),Dmnvt=global.getModel("dmnvt"),Dmtt=global.getModel("dmtt"),ckvt=require("../../libs/ckvt"),Dmqddvt=global.getModel("dmqddvt"),Dmchietkhau=global.getModel("dmchietkhau"),Dmkh=global.getModel("customer"),underscore=require("underscore"),getGiaBan=require("../../libs/getGiaban"),counter=global.getModel("counter"),moment=require("moment"),_=require("lodash"),utils=require("../../libs/utils"),
|
|
2
|
+
getAllEcomcategories=($id_app$$,$ma_danh_muc$$)=>utils.getCodeChildren(global.getModel("ecomcategories"),$id_app$$,$ma_danh_muc$$,"ma_danh_muc","danh_muc_me"),getAllEcomcategories_cty=($id_app$$,$ma_danh_muc$$)=>utils.getCodeChildren(global.getModel("ecomcategories_cty"),$id_app$$,$ma_danh_muc$$,"ma_danh_muc","danh_muc_me"),tinhGiaBanAsync=($condition$$,$par$$)=>new Promise($resolve$$=>{getGiaBan($condition$$,($e$$,$gia$$)=>{if($e$$)return Logger.error("error when get gia_ban on dmvt",$e$$,$condition$$),
|
|
3
|
+
$resolve$$(null);$resolve$$($gia$$)},$par$$)}),buildGiaBanCondition=($fields_item$$,$q_reqQuery$$,$user$$)=>{$q_reqQuery$$=$q_reqQuery$$||{};const $condition$$={ma_vt:$fields_item$$.ma_vt,id_app:$fields_item$$.id_app,vt:$fields_item$$};$fields_item$$.ma_tt?$condition$$[`ma_tt${$fields_item$$.loai_tt||1}`]=$fields_item$$.ma_tt:($q_reqQuery$$.ma_tt1&&($condition$$.ma_tt1=$q_reqQuery$$.ma_tt1),$q_reqQuery$$.ma_tt2&&($condition$$.ma_tt2=$q_reqQuery$$.ma_tt2),$q_reqQuery$$.ma_tt3&&($condition$$.ma_tt3=
|
|
4
|
+
$q_reqQuery$$.ma_tt3));$fields_item$$="id_cs_ck id_cs ma_kho ma_ban ma_kh nh_kh online offline so_luong ma_dvt_sd t_gt_hd ma_ct".split(" ");for(const $f$$ of $fields_item$$)$q_reqQuery$$[$f$$]!==void 0&&($condition$$[$f$$]=$q_reqQuery$$[$f$$]);if($q_reqQuery$$.t_so_luong||$q_reqQuery$$.t_sl)$condition$$.t_so_luong=$q_reqQuery$$.t_so_luong||$q_reqQuery$$.t_sl;if($q_reqQuery$$.t_so_luong_ntt||$q_reqQuery$$.t_sl_ntt)$condition$$.t_so_luong_ntt=$q_reqQuery$$.t_so_luong_ntt||$q_reqQuery$$.t_sl_ntt;$q_reqQuery$$.t_tien_ntt&&
|
|
5
|
+
($condition$$.t_tien_ntt=$q_reqQuery$$.t_tien_ntt);if($q_reqQuery$$.by_user||$user$$?.email==="public")$condition$$.user=$user$$;$condition$$.get_promotion=$q_reqQuery$$.get_promotion;$condition$$.get_discount=$q_reqQuery$$.get_discount;$condition$$.get_price=$q_reqQuery$$.get_price;return $condition$$},TinhGiaBan=async($item$$,$condition$jscomp$2_reqQuery$$,$user$$,$allDetailsKm_gia$jscomp$1_par$$)=>{$condition$jscomp$2_reqQuery$$=buildGiaBanCondition($item$$,$condition$jscomp$2_reqQuery$$,$user$$);
|
|
6
|
+
if($allDetailsKm_gia$jscomp$1_par$$=await tinhGiaBanAsync($condition$jscomp$2_reqQuery$$,$allDetailsKm_gia$jscomp$1_par$$))delete $allDetailsKm_gia$jscomp$1_par$$._id,delete $allDetailsKm_gia$jscomp$1_par$$.ma_vt,delete $allDetailsKm_gia$jscomp$1_par$$.ten_vt,underscore.extend($item$$,$allDetailsKm_gia$jscomp$1_par$$),$allDetailsKm_gia$jscomp$1_par$$.promotion?.length>0&&($allDetailsKm_gia$jscomp$1_par$$=$allDetailsKm_gia$jscomp$1_par$$.promotion.flatMap($p$$=>$p$$.details_km||[]),$allDetailsKm_gia$jscomp$1_par$$.length>
|
|
7
|
+
0&&(await $allDetailsKm_gia$jscomp$1_par$$.asyncJoinModel2($item$$.id_app,model,{where:"ma_vt",fields:["ma_dvt","chieu_cao","chieu_rong","chieu_sau","trong_luong"]}),$allDetailsKm_gia$jscomp$1_par$$.forEach($r$$=>{$r$$.km_yn_for=`${$item$$.id_app}-${$item$$.ma_vt}`})))},batchFreeship=async($items$$,$id_app$$)=>{const $freeshipModel$$=global.getModel("ecompromotion_freeships"),$tu_ngay$$=moment().startOf("date").toDate(),$den_ngay$$=moment().endOf("date").toDate(),$ma_vts$$=[...(new Set($items$$.map($i$$=>
|
|
8
|
+
$i$$.ma_vt).filter(Boolean)))],$ma_danhmuc$$=[...(new Set($items$$.map($i$$=>$i$$.ma_danh_muc).filter(Boolean)))];$id_app$$=await $freeshipModel$$.find({id_app:$id_app$$,hieu_luc_tu:{$lte:$den_ngay$$},hieu_luc_den:{$gte:$tu_ngay$$},shared:!0,trang_thai:"1",$or:[{"details.0":{$exists:!1}},{"details.ma_danh_muc":{$in:[...$ma_danhmuc$$,null,void 0,""]},"details.ma_vt":{$in:[...$ma_vts$$,"",null,void 0]}}]}).lean();for(const $item$$ of $items$$)$item$$.freeship=$id_app$$.filter($f$$=>!$f$$.details?.length||
|
|
9
|
+
$f$$.details.some($d$$=>(!$d$$.ma_vt||$d$$.ma_vt===$item$$.ma_vt)&&(!$d$$.ma_danh_muc||$d$$.ma_danh_muc===$item$$.ma_danh_muc)))},batchFlashsale=async($items$$,$id_app$jscomp$3_rs$$)=>{const $flashsaleModel$$=global.getModel("ecompromotion_flashsales"),$tu_ngay$$=moment().startOf("date").toDate(),$den_ngay$$=moment().endOf("date").toDate(),$ma_vts$$=[...(new Set($items$$.map($i$$=>$i$$.ma_vt).filter(Boolean)))],$ma_danhmuc$$=[...(new Set($items$$.map($i$$=>$i$$.ma_danh_muc).filter(Boolean)))];$id_app$jscomp$3_rs$$=
|
|
10
|
+
await $flashsaleModel$$.find({id_app:$id_app$jscomp$3_rs$$,tu_ngay:{$lte:$den_ngay$$},den_ngay:{$gte:$tu_ngay$$},shared:!0,trang_thai:"1",$or:[{"details.0":{$exists:!1}},{"details.ma_danh_muc":{$in:[...$ma_danhmuc$$,null,void 0,""]},"details.ma_vt":{$in:[...$ma_vts$$,"",null,void 0]}}]}).lean();for(const $item$$ of $items$$)$item$$.flashsales=$id_app$jscomp$3_rs$$.filter($f$$=>!$f$$.details?.length||$f$$.details.some($d$$=>(!$d$$.ma_vt||$d$$.ma_vt===$item$$.ma_vt)&&(!$d$$.ma_danh_muc||$d$$.ma_danh_muc===
|
|
11
|
+
$item$$.ma_danh_muc)))},batchEnsureDmqddvt=async $created_items$$=>{$created_items$$=$created_items$$.filter($i$$=>$i$$.id_app&&$i$$.ma_dvt);if(!$created_items$$.length)return new Map;const $existing$$=await Dmqddvt.find({$or:$created_items$$.map($i$$=>({id_app:$i$$.id_app,ma_vt:$i$$.ma_vt,ma_dvt:$i$$.ma_dvt}))}).lean(),$map$$=new Map($existing$$.map($d$$=>[`${$d$$.id_app}|${$d$$.ma_vt}|${$d$$.ma_dvt}`,$d$$]));$created_items$$=$created_items$$.filter($i$$=>!$map$$.has(`${$i$$.id_app}|${$i$$.ma_vt}|${$i$$.ma_dvt}`));
|
|
12
|
+
if($created_items$$.length>0){$created_items$$=await Promise.all($created_items$$.map($i$$=>Dmqddvt.create({id_app:$i$$.id_app,ma_vt:$i$$.ma_vt,ma_dvt:$i$$.ma_dvt,ty_le_qd:1,tu:1,mau:1}).catch($e$$=>{Logger.error("Error create qddvt",$e$$.message);return null})));for(const $d$$ of $created_items$$)$d$$&&($d$$.tu=$d$$.tu||1,$d$$.mau=$d$$.mau||1,$map$$.set(`${$d$$.id_app}|${$d$$.ma_vt}|${$d$$.ma_dvt}`,$d$$))}return $map$$};
|
|
13
|
+
module.exports=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"dmvt",{sort:{ten_vt:1},unique:["ma_vt"],cache:!0,onFinding:async($user$$,$condition$$,$next$$,$deletFromCondition_options$$)=>{$condition$$.id_app=$condition$$.id_app||$user$$.current_id_app;const $q$$=$deletFromCondition_options$$.req.query;for(const $f$$ of["ma_tt1_yn","ma_tt2_yn","ma_tt3_yn","ma_lo_yn"])$q$$.fields&&!$q$$.fields.includes($f$$)&&($q$$.fields+=`,${$f$$}`);$deletFromCondition_options$$.req.sort?.gia_ban_le&&
|
|
14
|
+
($deletFromCondition_options$$.req.sort.gia_ban_le0=$deletFromCondition_options$$.req.sort.gia_ban_le,delete $deletFromCondition_options$$.req.sort.gia_ban_le);($fields$$=>{for(const $f$$ of $fields$$)$q$$[$f$$]||($q$$[$f$$]=$condition$$[$f$$])})("show_properties by_user online offline id_cs_ck id_cs ma_kho ma_dvt_sd ma_kh ma_tt1 ma_tt2 ma_tt3 nh_kh da_dat_hang wishlist ma_ct ma_ban t_tien_ntt t_gt_hd".split(" "));$q$$.get_price===void 0&&($q$$.get_price=$condition$$.get_price);$q$$.get_promotion===
|
|
15
|
+
void 0&&($q$$.get_promotion=$condition$$.get_promotion);$q$$.get_discount===void 0&&($q$$.get_discount=$condition$$.get_discount);$q$$.get_properties===void 0&&($q$$.get_properties=$condition$$.get_properties);$q$$.show_quantity_in_stock||($q$$.show_quantity_in_stock=$condition$$.show_quantity_in_stock);$q$$.so_luong||($q$$.so_luong=$condition$$.so_luong||$condition$$.sl_xuat);$q$$.t_sl||($q$$.t_sl=$condition$$.t_sl||$condition$$.t_so_luong);$q$$.t_sl_ntt||($q$$.t_sl_ntt=$condition$$.t_sl_ntt||$condition$$.t_so_luong_ntt);
|
|
16
|
+
$deletFromCondition_options$$="show_properties by_user show_quantity_in_stock online offline ma_kho ma_dvt_sd ma_tt1 ma_tt2 ma_tt3 ma_ban ma_kh nh_kh gia_theo_kh da_dat_hang wishlist so_luong sl_xuat t_sl t_so_luong t_sl_ntt t_so_luong_ntt t_tien_ntt t_gt_hd id_cs_ck id_cs ma_ct get_price get_promotion get_discount get_properties".split(" ");for(var $f$$ of $deletFromCondition_options$$)delete $condition$$[$f$$];$condition$$.ma_vt&&typeof $condition$$.ma_vt!=="object"&&(delete $condition$$.ma_danh_muc_cty,
|
|
17
|
+
delete $condition$$.ma_danh_muc);if($q$$.ma_kh||$condition$$.gia_theo_kh||$q$$.gia_theo_kh||$q$$.hh_theo_kh||$q$$.by_user||$q$$.da_dat_hang||$q$$.wishlist){if($f$$=$q$$.ma_kh?await global.getModel("customer").findOne({id_app:$condition$$.id_app,ma_kh:$q$$.ma_kh}).lean():await global.getModel("customer").findOne({id_app:$condition$$.id_app,of_user:$user$$.email}).lean()){$q$$.ma_kh=$f$$.ma_kh;for(var $f$jscomp$6_par$$ of["nh_kh","nh_kh2","nh_kh3","nh_kh4","nh_kh5"])$f$$[$f$jscomp$6_par$$]&&($q$$[$f$jscomp$6_par$$]=
|
|
18
|
+
$f$$[$f$jscomp$6_par$$])}$f$jscomp$6_par$$=$user$$.par||await global.getModel("participant").getPar($user$$,$user$$.current_app_info);$user$$.par=$f$jscomp$6_par$$;$f$jscomp$6_par$$?.group&&($f$jscomp$6_par$$.group.ma_nganh_hang?.length&&($condition$$.ma_nganh_hang=$condition$$.ma_nganh_hang?$f$jscomp$6_par$$.group.ma_nganh_hang.filter($m$$=>$m$$===$condition$$.ma_nganh_hang):$f$jscomp$6_par$$.group.ma_nganh_hang),$f$jscomp$6_par$$.group.ma_nvt?.length&&($condition$$.ma_nvt=$condition$$.ma_nvt?$f$jscomp$6_par$$.group.ma_nvt.filter($m$$=>
|
|
19
|
+
$m$$===$condition$$.ma_nvt):$f$jscomp$6_par$$.group.ma_nvt))}delete $condition$$.gia_theo_kh;try{var $buildSanPhamCoChinhSach_wishlistPromise$$=(async()=>{if($q$$.wishlist){var $query_wishlist_ws$$={id_app:$condition$$.id_app,user:$user$$.email};$condition$$.ma_vt&&($query_wishlist_ws$$.ma_vt=$condition$$.ma_vt);$query_wishlist_ws$$=await global.getModel("ecomwishlist").find($query_wishlist_ws$$,{ma_vt:1}).lean();$condition$$.ma_vt=$query_wishlist_ws$$.map($w$$=>$w$$.ma_vt)}})();const $daDatHangPromise$$=
|
|
20
|
+
(async()=>{if($q$$.da_dat_hang){var $base$$={id_app:$condition$$.id_app,$or:[{user_nv:$user$$.email},{user_ctv:$user$$.email},{user_created:$user$$.email}]},[$dhs$$,$so1s$$]=await Promise.all([global.getModel("dh2").find($condition$$.ma_vt?{...$base$$,"details.ma_vt":$condition$$.ma_vt}:$base$$,{details:1}).sort({date_created:-1}).limit(10).lean(),global.getModel("so1").find($base$$,{details:1}).sort({date_created:-1}).limit(10).lean()]);$base$$=$dhs$$.flatMap($dh$$=>$dh$$.details.map($d$$=>$d$$.ma_vt));
|
|
21
|
+
var $fromSo1$$=$so1s$$.flatMap($dh$$=>$dh$$.details.map($d$$=>$d$$.ma_vt));$condition$$.ma_vt=[...(new Set([...$base$$,...$fromSo1$$]))]}})();await Promise.all([$buildSanPhamCoChinhSach_wishlistPromise$$,$daDatHangPromise$$]);const $barcodePromise$$=(async()=>{if($condition$$.ma_vt2&&!$condition$$.ma_vt&&$q$$.show_properties&&(!Array.isArray($condition$$.ma_vt2)||$condition$$.ma_vt2.length!==0)){var [$ttRs$$,$vtRs$$]=await Promise.all([Dmtt.find({ma_tt2:$condition$$.ma_vt2,id_app:$condition$$.id_app},
|
|
22
|
+
{ma_vt:1}).lean(),model.find({ma_vt2:$condition$$.ma_vt2,id_app:$condition$$.id_app},{ma_vt:1}).lean()]);delete $condition$$.ma_vt2;$condition$$.ma_vt={$in:[...(new Set([...$ttRs$$.map($r$$=>$r$$.ma_vt),...$vtRs$$.map($r$$=>$r$$.ma_vt)]))]}}})(),$nvtPromise$$=(async()=>{if($condition$$.ma_nvt||$condition$$.la_nhom_hang_hoa||$condition$$.ma_nganh_hang){if($condition$$.ma_nganh_hang||$condition$$.la_nhom_hang_hoa){var $_q_nh_vt$$={id_app:$condition$$.id_app,status:!0};$condition$$.ma_nganh_hang&&($_q_nh_vt$$.ds_nganh_hang=
|
|
23
|
+
$condition$$.ma_nganh_hang);$condition$$.la_nhom_hang_hoa&&($_q_nh_vt$$.la_nhom_hang_hoa=$condition$$.la_nhom_hang_hoa);$condition$$.ma_nvt&&($_q_nh_vt$$._id=_.isArray($condition$$.ma_nvt)?{$in:$condition$$.ma_nvt}:$condition$$.ma_nvt);$condition$$.ma_nvt=(await Dmnvt.find($_q_nh_vt$$,{_id:1}).lean()).map($r$$=>$r$$._id.toString())}$_q_nh_vt$$=await Dmnvt.getAllChildrenGroup($condition$$.id_app,$condition$$.ma_nvt,$condition$$.la_nhom_hang_hoa,$condition$$.ma_nganh_hang);$condition$$.ma_nvt={$in:[...(new Set($_q_nh_vt$$))]}}delete $condition$$.la_nhom_hang_hoa;
|
|
24
|
+
delete $condition$$.ma_nganh_hang})(),$nvt2Promise$$=(async()=>{if($condition$$.ma_nvt2&&(typeof $condition$$.ma_nvt2!=="object"||Array.isArray($condition$$.ma_nvt2))){var $nh_vt$$=await Dmnvt.getAllChildrenGroup($condition$$.id_app,$condition$$.ma_nvt2,null,null,{group_kind:2});$condition$$.ma_nvt2={$in:[...(new Set($nh_vt$$))]}}})(),$nvt3Promise$$=(async()=>{if($condition$$.ma_nvt3&&(typeof $condition$$.ma_nvt3!=="object"||Array.isArray($condition$$.ma_nvt3))){var $nh_vt$$=await Dmnvt.getAllChildrenGroup($condition$$.id_app,
|
|
25
|
+
$condition$$.ma_nvt3,null,null,{group_kind:3});$condition$$.ma_nvt3={$in:[...(new Set($nh_vt$$))]}}})(),$nvt4Promise$$=(async()=>{if($condition$$.ma_nvt4&&(typeof $condition$$.ma_nvt4!=="object"||Array.isArray($condition$$.ma_nvt4))){var $nh_vt$$=await Dmnvt.getAllChildrenGroup($condition$$.id_app,$condition$$.ma_nvt4,null,null,{group_kind:4});$condition$$.ma_nvt4={$in:[...(new Set($nh_vt$$))]}}})(),$danhmucPromise$$=(async()=>{if($condition$$.ma_danh_muc&&typeof $condition$$.ma_danh_muc!=="object"){var $nh_vt$$=
|
|
26
|
+
await getAllEcomcategories($condition$$.id_app,$condition$$.ma_danh_muc);$condition$$.ma_danh_muc={$in:[...(new Set($nh_vt$$))]}}})(),$danhmucCtyPromise$$=(async()=>{if($condition$$.ma_danh_muc_cty&&typeof $condition$$.ma_danh_muc_cty!=="object"){var $nh_vt$$=await getAllEcomcategories_cty($condition$$.id_app,$condition$$.ma_danh_muc_cty);$condition$$.ma_danh_muc_cty={$in:[...(new Set($nh_vt$$))]}}})();$buildSanPhamCoChinhSach_wishlistPromise$$=async $$or_Model$$=>{var $_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$=
|
|
27
|
+
moment().startOf("date").toDate(),$_ma_vt_den_ngay$$=moment().endOf("date").toDate();$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$={status:!0,id_app:$condition$$.id_app,hieu_luc_tu:{$lte:$_ma_vt_den_ngay$$},hieu_luc_den:{$gte:$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$}};$condition$$.ma_vt&&($_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.ma_vt=$condition$$.ma_vt);$q$$.nh_kh&&($_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.nh_kh={$in:[null,"",$q$$.nh_kh]});$q$$.ma_kh&&($_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.ma_kh=
|
|
28
|
+
{$in:[null,"",$q$$.ma_kh]});$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$=await $$or_Model$$.find($_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$,{ma_vt:1,ma_nvt:1}).lean();$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.length?($$or_Model$$=[],$_ma_vt_den_ngay$$=$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.filter($r$$=>$r$$.ma_vt).map($r$$=>$r$$.ma_vt),$_ma_vt_den_ngay$$.length&&$$or_Model$$.push({ma_vt:{$in:$_ma_vt_den_ngay$$}}),$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$=$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.filter($r$$=>
|
|
29
|
+
$r$$.ma_nvt&&!$r$$.ma_vt).map($r$$=>$r$$.ma_nvt),$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$.length&&$$or_Model$$.push({ma_nvt:{$in:$_ma_nvt__q$jscomp$1_rs$jscomp$2_tu_ngay$$}}),$$or_Model$$.length&&($condition$$.$and=[...($condition$$.$and||[]),{$or:$$or_Model$$}])):$condition$$.ma_vt="__zzzzzzz__"};const $giaRePromise$$=$condition$$.low_price?$buildSanPhamCoChinhSach_wishlistPromise$$(global.getModel("dmgiaban")).then(()=>{delete $condition$$.low_price}):Promise.resolve(),$discountPromise$$=$condition$$.has_discount?
|
|
30
|
+
$buildSanPhamCoChinhSach_wishlistPromise$$(Dmchietkhau).then(()=>{delete $condition$$.has_discount}):Promise.resolve();await Promise.all([$barcodePromise$$,$nvtPromise$$,$nvt2Promise$$,$nvt3Promise$$,$nvt4Promise$$,$danhmucPromise$$,$danhmucCtyPromise$$,$giaRePromise$$,$discountPromise$$]);delete $condition$$.has_discount;$condition$$.$and?.length===0&&delete $condition$$.$and;$next$$(null,$condition$$)}catch($e$$){$next$$($e$$)}},onRightByItem:($user$$,$condition$$,$next$$)=>$next$$(null,$condition$$)});
|
|
31
|
+
$contr_router$$.route();$contr_router$$.validating=($user$$,$obj$$,$next$$,$options$$={})=>{$options$$.action!=="add"||$obj$$.ma_vt?$next$$(null,$obj$$):counter.getNextSequence($user$$.current_id_app,"DMVT","ma_vt",($error$$,$sequence$$)=>{$sequence$$=($sequence$$||0).toString();$obj$$.ma_vt="SP"+"00000000".substring(0,8-$sequence$$.length)+$sequence$$;$next$$(null,$obj$$)})};$contr_router$$.creating=async($user$$,$obj$$,$next$$)=>{$obj$$.warranty_policy===""&&delete $obj$$.warranty_policy;$obj$$.combo?.length>
|
|
32
|
+
0&&($obj$$.tg_tk=!1);if($obj$$.ma_can&&await model.findOne({ma_can:$obj$$.ma_can,id_app:$user$$.current_id_app},{_id:1}))return $next$$("M\u00e3 c\u00e2n \u0111\u00e3 t\u1ed3n t\u1ea1i");if($obj$$.ma_vt2&&await model.findOne({ma_vt2:$obj$$.ma_vt2,id_app:$user$$.current_id_app},{_id:1}))return $next$$("M\u00e3 v\u1eadt t\u01b0 2 \u0111\u00e3 t\u1ed3n t\u1ea1i");$next$$(null,$obj$$)};$contr_router$$.updating=async($check_arise_user$$,$data$$,$obj$$,$next$$)=>{$data$$.warranty_policy===""&&delete $data$$.warranty_policy;
|
|
33
|
+
for(const $f$$ of["ma_nvt2","ma_nvt3","ma_nvt4"])$data$$[$f$$]===void 0&&($data$$[$f$$]=$obj$$[$f$$]),$data$$[$f$$]&&($data$$[$f$$]=Array.isArray($data$$[$f$$])?[...(new Set($data$$[$f$$]))]:[$data$$[$f$$]]);$data$$.combo?.length>0&&($data$$.tg_tk=!1);[$check_arise_user$$]=await Promise.all([global.getModel("sokho").findOne({ma_vt:$obj$$.ma_vt,id_app:$obj$$.id_app},{_id:1})]);if($check_arise_user$$&&$data$$.ma_vt&&$data$$.ma_vt!==$obj$$.ma_vt)return $next$$(`V\u1eadt t\u01b0 ${$obj$$.ten_vt}(${$obj$$.ma_vt}) \u0111\u00e3 ph\u00e1t sinh d\u1eef li\u1ec7u n\u00ean kh\u00f4ng th\u1ec3 thay \u0111\u1ed5i m\u00e3 v\u1eadt t\u01b0`);
|
|
34
|
+
if($check_arise_user$$&&$data$$.ma_dvt&&$data$$.ma_dvt!==$obj$$.ma_dvt)return $next$$(`V\u1eadt t\u01b0 ${$obj$$.ten_vt}(${$obj$$.ma_vt}) \u0111\u00e3 ph\u00e1t sinh d\u1eef li\u1ec7u n\u00ean kh\u00f4ng th\u1ec3 thay \u0111\u1ed5i \u0111\u01a1n v\u1ecb t\u00ednh`);$data$$.ma_vt=$data$$.ma_vt||$obj$$.ma_vt;const [$checkCan$$,$checkVt2$$]=await Promise.all([$data$$.ma_can&&$data$$.ma_can!==$obj$$.ma_can?model.findOne({ma_can:$data$$.ma_can,id_app:$obj$$.id_app},{_id:1}):null,$data$$.ma_vt2&&$data$$.ma_vt2!==
|
|
35
|
+
$obj$$.ma_vt2?model.findOne({ma_vt2:$data$$.ma_vt2,id_app:$obj$$.id_app},{_id:1}):null]);if($checkCan$$)return $next$$("M\u00e3 c\u00e2n \u0111\u00e3 t\u1ed3n t\u1ea1i");if($checkVt2$$)return $next$$("M\u00e3 v\u1eadt t\u01b0 2 \u0111\u00e3 t\u1ed3n t\u1ea1i");$next$$(null,$data$$,$obj$$)};$contr_router$$.view=async($user$$,$items$$,$fn$$,$options$$)=>{$items$$.forEach($item$$=>{$item$$.ty_le_ck=0;$item$$.tien_ck=0});const $q$$=$options$$?.req?.query||{},$id_app$$=$user$$.current_id_app;$options$$=
|
|
36
|
+
batchEnsureDmqddvt($items$$);const $nvtJoinPromise$$=(async()=>{var $all_ma_nvt2_nvts$$=$items$$.flatMap($i$$=>$i$$.ma_nvt2||[]);const $ma_nvt3$$=$items$$.flatMap($i$$=>$i$$.ma_nvt3||[]),$ma_nvt4$$=$items$$.flatMap($i$$=>$i$$.ma_nvt4||[]);$all_ma_nvt2_nvts$$=[...(new Set([...$all_ma_nvt2_nvts$$,...$ma_nvt3$$,...$ma_nvt4$$]))];if($all_ma_nvt2_nvts$$.length){$all_ma_nvt2_nvts$$=await Dmnvt.find({id_app:$id_app$$,_id:{$in:$all_ma_nvt2_nvts$$}},{ten_nvt:1}).lean();var $set_nvt$$=Object.fromEntries($all_ma_nvt2_nvts$$.map($n$$=>
|
|
37
|
+
[$n$$._id.toString(),$n$$.ten_nvt]));for(const $item$$ of $items$$)$item$$.ma_nvt2&&($item$$.ten_nvt2=$item$$.ma_nvt2.map($k$$=>$set_nvt$$[$k$$])),$item$$.ma_nvt3&&($item$$.ten_nvt3=$item$$.ma_nvt3.map($k$$=>$set_nvt$$[$k$$])),$item$$.ma_nvt4&&($item$$.ten_nvt4=$item$$.ma_nvt4.map($k$$=>$set_nvt$$[$k$$]))}})(),$showFreeship$$=!$q$$.fields||$q$$.fields.includes("freeship"),$showFlashsale$$=!$q$$.fields||$q$$.fields.includes("flashsales"),$showWish$$=$q$$.wishlist||!$q$$.fields||$q$$.fields.includes("wish"),
|
|
38
|
+
$showPicture$$=!$q$$.fields||$q$$.fields.includes("picture");await Promise.all([$items$$.filter($i$$=>$i$$.ma_nvt).asyncJoinModel2(null,Dmnvt,[{where:{ma_nvt:"_id"},fields:["ten_nvt"]}]),$nvtJoinPromise$$,$items$$.filter($i$$=>$i$$.ma_thue).asyncJoinModel2(null,"vat",[{akey:"ma_thue",bkey:"ma_thue",fields:[{name:"thue_suat",value:"thue_suat"}]}]),$showWish$$?$items$$.filter($i$$=>$i$$.id_app).asyncJoinModel2(null,"ecomwishlist",[{where:$item$$=>({id_app:$item$$.id_app,user:$user$$.email,ma_vt:$item$$.ma_vt}),
|
|
39
|
+
setFields:($item$$,$ref$$)=>{$item$$.wish=!!$ref$$._id;$item$$.id_wish=$ref$$._id}}]):Promise.resolve(),$items$$.filter($i$$=>$i$$.ma_ncc).asyncJoinModel2(null,Dmkh,[{where:{id_app:"id_app",ma_ncc:"ma_kh"},fields:[{name:"ten_ncc",value:"ten_kh"}]}]),$options$$,$showFreeship$$&&$items$$.some($i$$=>$i$$.id_app)?batchFreeship($items$$.filter($i$$=>$i$$.id_app),$id_app$$).catch($e$$=>Logger.error($e$$)):Promise.resolve(),$showFlashsale$$&&$items$$.some($i$$=>$i$$.id_app)?batchFlashsale($items$$.filter($i$$=>
|
|
40
|
+
$i$$.id_app),$id_app$$).catch($e$$=>Logger.error($e$$)):Promise.resolve(),(async()=>{for(const $r$$ of $items$$)$r$$.picture_thumb=$r$$.picture||($showPicture$$?"/images/picture.png":void 0),$r$$.picture2&&($r$$.picture2_thumb=$r$$.picture2),$r$$.picture3&&($r$$.picture3_thumb=$r$$.picture3),$r$$.picture4&&($r$$.picture4_thumb=$r$$.picture4),$r$$.picture5&&($r$$.picture5_thumb=$r$$.picture5)})()]);$options$$=$items$$.flatMap($item$$=>{if($q$$.show_properties&&$item$$.ds_thuoc_tinh?.length>0){const $expanded$$=
|
|
41
|
+
$item$$.ds_thuoc_tinh.map($_new_tt$$=>{$_new_tt$$={...$item$$,ma_tt:$_new_tt$$.ma_tt,ten_tt:$_new_tt$$.ten_tt,loai_tt:$_new_tt$$.loai_tt,[`ma_tt${$_new_tt$$.loai_tt}`]:$_new_tt$$.ma_tt,nh_tt:$_new_tt$$.nh_tt,ma_dvt:$_new_tt$$.ma_dvt||$item$$.ma_dvt,ma_can:$_new_tt$$.ma_can||$item$$.ma_can,ma_vt2:$_new_tt$$.ma_tt2||$item$$.ma_vt2,gia_ban_le:$_new_tt$$.gia_ban_le||$item$$.gia_ban_le};delete $_new_tt$$.ds_thuoc_tinh;return $_new_tt$$}).sort(($a$$,$b$$)=>$a$$.gia_ban_le-$b$$.gia_ban_le);if($q$$.online){const $ds$$=
|
|
42
|
+
_.cloneDeep($expanded$$);$expanded$$.forEach($r$$=>{$r$$.ds_thuoc_tinh=$ds$$});return[$expanded$$[0]]}return $expanded$$}return[$item$$]});$fn$$(null,$options$$)};$contr_router$$.viewRequired=async($user$$,$items$$,$fn$$,$dvtSdMap_get_ton_kho_options$$)=>{const $q$$=$dvtSdMap_get_ton_kho_options$$?.req?.query||{},$id_app$$=$user$$.current_id_app;$dvtSdMap_get_ton_kho_options$$=$q$$.show_quantity_in_stock||!$q$$.fields||$q$$.fields.includes("ton00")||$q$$.fields.includes("ton_kho_online_hien_tai");
|
|
43
|
+
var $co_tinh_gia_ban_docs_needQd_tien_ck$$=($q$$.get_price!==!1||$q$$.get_promotion||$q$$.get_discount)&&(!$q$$.fields||$q$$.fields.includes("gia_ban_le"));let $par$$=$user$$.par,$tons$$;await Promise.all([$co_tinh_gia_ban_docs_needQd_tien_ck$$&&!$par$$?(async()=>{$par$$=await global.getModel("participant").getPar($user$$,$user$$.current_app_info);$user$$.par=$par$$})():Promise.resolve(),$dvtSdMap_get_ton_kho_options$$&&$id_app$$?(async()=>{var $cond_ds_kho$$=$q$$.ma_kho?[$q$$.ma_kho]:(await global.getModel("dmkho").find({id_app:$id_app$$,
|
|
44
|
+
status:!0},{ma_kho:1}).lean()).map($k$$=>$k$$.ma_kho);$cond_ds_kho$$={ma_vt:{$in:$items$$.map($i$$=>$i$$.ma_vt)},id_app:$id_app$$,ma_kho:{$in:$cond_ds_kho$$},groupBy:"id_app ma_vt ma_kho ma_tt1 ma_tt2 ma_tt3".split(" "),ngay:moment().endOf("date").toDate()};$q$$.ma_lo&&($cond_ds_kho$$.ma_lo=$q$$.ma_lo);$q$$.ma_dvcs&&($cond_ds_kho$$.ma_dvcs=$q$$.ma_dvcs);$tons$$=await ckvt($cond_ds_kho$$)})():Promise.resolve()]);$co_tinh_gia_ban_docs_needQd_tien_ck$$&&await Promise.all($items$$.map(async $item$$=>
|
|
45
|
+
{$item$$.id_app&&($item$$.ty_le_ck=0,$item$$.tien_ck=0,await Promise.all([TinhGiaBan($item$$,$q$$,$user$$,$par$$),$item$$.ds_thuoc_tinh?.length?Promise.all($item$$.ds_thuoc_tinh.map($tt$$=>TinhGiaBan($tt$$,$q$$,$user$$,$par$$))):Promise.resolve()]))}));if($dvtSdMap_get_ton_kho_options$$&&$tons$$){const $allTonGroups$$=[];await Promise.all($items$$.map(async $item$$=>{if($item$$.id_app){var $ton_vt$$=($tons$$||[]).filter($r$$=>$r$$.ma_vt===$item$$.ma_vt);$item$$.ton00=$ton_vt$$.reduce(($s$$,$a$$)=>
|
|
46
|
+
$s$$+($a$$.ton00||0),0);$item$$.ton_kho_online_hien_tai_dvt=$item$$.ton_kho_online_hien_tai=$item$$.ton00;$item$$.ds_thuoc_tinh?await Promise.all($item$$.ds_thuoc_tinh.filter($tt$$=>$tt$$.ma_vt).map(async $thuoc_tinh$$=>{$thuoc_tinh$$.ton_kho_online_hien_tai=$item$$.ton_kho_online_hien_tai;if($item$$.kg_kiem_tra_ton_kho_tt)$thuoc_tinh$$.ton_kho=await $ton_vt$$.asyncGroupBy(["id_app","ma_vt","ma_kho"],"sl_nhap sl_xuat ton00 du00 ton00_capphat du00_capphat tien_nhap tien_xuat ton_kho_mac_dinh ton_toi_thieu ton_toi_da".split(" "));
|
|
47
|
+
else{const $ma_tt_field$$=`ma_tt${$thuoc_tinh$$.loai_tt||1}`;$thuoc_tinh$$.ton_kho=$ton_vt$$.filter($t$$=>$t$$[$ma_tt_field$$]===$thuoc_tinh$$.ma_tt);$thuoc_tinh$$.ton_kho_online_hien_tai=$thuoc_tinh$$.ton_kho.reduce(($s$$,$a$$)=>$s$$+($a$$.ton00||0),0)}$allTonGroups$$.push(...$thuoc_tinh$$.ton_kho);if($thuoc_tinh$$.ma_dvt&&$thuoc_tinh$$.ma_dvt!==$item$$.ma_dvt&&$thuoc_tinh$$.ton_kho_online_hien_tai){const $dvtqd$$=await Dmqddvt.findOne({id_app:$item$$.id_app,ma_vt:$thuoc_tinh$$.ma_vt,ma_dvt:$thuoc_tinh$$.ma_dvt}).lean();
|
|
48
|
+
$dvtqd$$&&($thuoc_tinh$$.ton_kho_online_hien_tai_dvt=$dvtqd$$.tu&&$dvtqd$$.mau?utils.round($thuoc_tinh$$.ton_kho_online_hien_tai*$dvtqd$$.mau/$dvtqd$$.tu,4):utils.round($thuoc_tinh$$.ton_kho_online_hien_tai/($dvtqd$$.ty_le_qd||1),4))}})):($item$$.ton_kho=await $ton_vt$$.asyncGroupBy(["id_app","ma_vt","ma_kho"],"sl_nhap sl_xuat ton00 du00 ton00_capphat du00_capphat tien_nhap tien_xuat ton_kho_mac_dinh ton_toi_thieu ton_toi_da".split(" ")),$allTonGroups$$.push(...$item$$.ton_kho))}}));$allTonGroups$$.length>
|
|
49
|
+
0&&await $allTonGroups$$.asyncJoinModel2($id_app$$,"dmkho",{where:"ma_kho",fields:"ten_kho"})}$dvtSdMap_get_ton_kho_options$$=new Map;if($q$$.ma_dvt_sd&&($co_tinh_gia_ban_docs_needQd_tien_ck$$=$items$$.filter($i$$=>$i$$.ma_dvt&&$i$$.ma_dvt!==$q$$.ma_dvt_sd),$co_tinh_gia_ban_docs_needQd_tien_ck$$.length>0)){$co_tinh_gia_ban_docs_needQd_tien_ck$$=await Dmqddvt.find({$or:$co_tinh_gia_ban_docs_needQd_tien_ck$$.map($i$$=>({id_app:$i$$.id_app,ma_vt:$i$$.ma_vt,ma_dvt:$q$$.ma_dvt_sd}))}).lean();for(var $d$$ of $co_tinh_gia_ban_docs_needQd_tien_ck$$)$dvtSdMap_get_ton_kho_options$$.set(`${$d$$.id_app}|${$d$$.ma_vt}`,
|
|
50
|
+
$d$$)}for(const $item$$ of $items$$){$item$$.gia_ban_le0_qd=$item$$.gia_ban_le0_qd||$item$$.gia_ban_le0;$item$$.gia_ban_buon0_qd=$item$$.gia_ban_buon0_qd||$item$$.gia_ban_buon0;if($item$$.gia_ban_le){$item$$.ty_le_ck=$item$$.ty_le_ck||0;var $thue_suat_tien_thue$$=$item$$.thue_suat||0;$d$$=$item$$.ma_nt!=="VND"?2:0;$item$$.gia_ban_le_ct=$item$$.gia_ban_le_ct||utils.round($item$$.gia_ban_le/(1+$thue_suat_tien_thue$$/100),$d$$);$co_tinh_gia_ban_docs_needQd_tien_ck$$=utils.round($item$$.gia_ban_le_ct*
|
|
51
|
+
$item$$.ty_le_ck/100,$d$$);$thue_suat_tien_thue$$=utils.round(($item$$.gia_ban_le_ct-$co_tinh_gia_ban_docs_needQd_tien_ck$$)*$thue_suat_tien_thue$$/100,$d$$);$item$$.gia_ban_ck=$co_tinh_gia_ban_docs_needQd_tien_ck$$;$item$$.gia_ban_thue=$thue_suat_tien_thue$$;$item$$.gia_ban_le_sau_ck=utils.round($item$$.gia_ban_le_ct-$co_tinh_gia_ban_docs_needQd_tien_ck$$+$thue_suat_tien_thue$$,$d$$)}!$item$$.he_so_qd&&$item$$.ma_dvt&&($item$$.he_so_qd=1);$q$$.ma_dvt_sd&&$item$$.ma_dvt!==$q$$.ma_dvt_sd&&($d$$=$dvtSdMap_get_ton_kho_options$$.get(`${$item$$.id_app}|${$item$$.ma_vt}`))&&
|
|
52
|
+
($item$$.ma_dvt=$q$$.ma_dvt_sd,$item$$.he_so_qd=$d$$.mau&&$d$$.tu?$d$$.tu/$d$$.mau:$d$$.ty_le_qd||1)}await $items$$.filter($i$$=>$i$$.ma_dvt).asyncJoinModel2(null,Dmdvt,[{where:{id_app:"id_app",ma_dvt:"ma_dvt"},fields:[{name:"ten_dvt",value:"ten_dvt"}]}]);$fn$$(null,$items$$)}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var model=global.getModel("dmyt");const controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dmyt",{sort:{ma_yt:1},unique:["ma_yt"]})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dokho"),controller=require("../../controllers/controller"),dokho=function($router$$){(new controller($router$$,model,"dokho",{sort:{thoi_gian_du_kien:1}})).route()};module.exports=dokho;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("dvcs"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"dvcs",{sort:{ten_dvcs:1},notNeedRight:($user$$,$options$$={})=>($options$$.action||"").toLowerCase()=="view"?!0:!1,unique:["ma_dvcs"]})).route()};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const model=global.getModel("ecomcategories"),controller=require("../../controllers/controller"),getSysorder=function($item$$,$callback$$){let $sysorder$$=$item$$._id.toString();$item$$.danh_muc_me&&$item$$.danh_muc_me!=$item$$.ma_danh_muc?model.findOne({ma_danh_muc:$item$$.danh_muc_me,id_app:$item$$.id_app}).lean().exec(function($e$$,$item_me$$){$item_me$$?getSysorder($item_me$$,function($rs$$){$sysorder$$=$rs$$+"---"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}):$callback$$($sysorder$$)},
|
|
2
|
+
group=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"ecomcategories",{sort:{sysorder:1},unique:["ma_danh_muc"]});$contr_router$$.route();$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("---").length;
|
|
3
|
+
await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("---").length;$loai_nh_rs$$=1;await model.findOne({danh_muc_me:$obj$$.ma_danh_muc,id_app:$obj$$.id_app})&&($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},
|
|
4
|
+
{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $danh_muc_me$$=$obj$$.danh_muc_me;$danh_muc_me$$&&await model.updateOne({id_app:$obj$$.id_app,ma_danh_muc:$danh_muc_me$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.danh_muc_me&&!await model.findOne({danh_muc_me:$obj$$.danh_muc_me,id_app:$obj$$.id_app}).catch(console.error)&&
|
|
5
|
+
await model.updateOne({id_app:$obj$$.id_app,ma_danh_muc:$obj$$.danh_muc_me},{$set:{loai_nh:1}}).catch(console.error)})};module.exports=group;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const model=global.getModel("ecomcategories_cty"),controller=require("../../controllers/controller"),getSysorder=function($item$$,$callback$$){let $sysorder$$=$item$$._id.toString();$item$$.danh_muc_me&&$item$$.danh_muc_me!=$item$$.ma_danh_muc?model.findOne({ma_danh_muc:$item$$.danh_muc_me,id_app:$item$$.id_app}).lean().exec(function($e$$,$item_me$$){$item_me$$?getSysorder($item_me$$,function($rs$$){$sysorder$$=$rs$$+"---"+$sysorder$$;$callback$$($sysorder$$)}):$callback$$($sysorder$$)}):$callback$$($sysorder$$)},
|
|
2
|
+
group=function($contr_router$$){$contr_router$$=new controller($contr_router$$,model,"ecomcategories_cty",{sort:{sysorder:1},unique:["ma_danh_muc"]});$contr_router$$.route();$contr_router$$.deleting=function($user$$,$obj$$,$next$$){if($obj$$.loai_nh===0)return $next$$(Error("Kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p x\u00f3a nh\u00f3m m\u1eb9"));$next$$(null,$obj$$)};$contr_router$$.created=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($rs$$){$obj$$.sysorder=$rs$$;$obj$$.bac=$rs$$.split("---").length;
|
|
3
|
+
await model.updateOne({_id:$obj$$._id},{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:1}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.updated=function($user$$,$obj$$,$next$$){getSysorder($obj$$,async function($loai_nh_rs$$){$obj$$.sysorder=$loai_nh_rs$$;$obj$$.bac=$loai_nh_rs$$.split("---").length;$loai_nh_rs$$=1;await model.findOne({danh_muc_me:$obj$$.ma_danh_muc,id_app:$obj$$.id_app})&&($loai_nh_rs$$=0);$obj$$.loai_nh=$loai_nh_rs$$;await model.updateOne({_id:$obj$$._id},
|
|
4
|
+
{$set:{bac:$obj$$.bac,sysorder:$obj$$.sysorder,loai_nh:$loai_nh_rs$$}}).catch(console.error);$next$$(null,$obj$$)})};$contr_router$$.on("saved",async function($obj$$){const $danh_muc_me$$=$obj$$.danh_muc_me;$danh_muc_me$$&&await model.updateOne({id_app:$obj$$.id_app,ma_danh_muc:$danh_muc_me$$},{$set:{loai_nh:0}}).catch(console.error)});$contr_router$$.on("deleted",async function($obj$$){$obj$$.danh_muc_me&&!await model.findOne({danh_muc_me:$obj$$.danh_muc_me,id_app:$obj$$.id_app}).catch(console.error)&&
|
|
5
|
+
await model.updateOne({id_app:$obj$$.id_app,ma_danh_muc:$obj$$.danh_muc_me},{$set:{loai_nh:1}}).catch(console.error)})};module.exports=group;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const model=global.getModel("email"),controller=require("../../controllers/controller"),emailService=require("../../libs/email"),htmlReport=require("../../libs/htmlReport");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"email",{sort:{date_created:-1},notNeedRight:!0,onFinding:function($user$$,$condition$$,$next$$){$next$$(null,$condition$$)},onView:function($user$$,$items$$,$next$$){$next$$(null,$items$$)},onCreating:async function($user$$,$item$$,$next$$){if(!$item$$.to||!$item$$.to.trim())return $next$$("Ch\u01b0a c\u00f3 ng\u01b0\u1eddi nh\u1eadn");const $to$$=$item$$.to.split(",").map($t$$=>({address:$t$$.trim()}));$item$$.attachments?.length||
|
|
3
|
+
($item$$.attachments=$item$$.exfields?.__files__||[]);try{let $content$$=await htmlReport($item$$.content,{data:$item$$});emailService.sendHtml({to:$to$$,cc:$item$$.cc,bcc:$item$$.bcc,subject:$item$$.subject.replace(/<[^>]*>?/gm,""),html:$content$$,attachments:$item$$.attachments,app_info:$user$$.current_app_info},async $e$$=>{if($e$$)return $next$$($e$$.message||$e$$.error||$e$$);$item$$.sent=!0;$next$$(null,$item$$)})}catch($e$$){$next$$($e$$.message||$e$$.error||$e$$)}},onCreated:function($user$$,
|
|
4
|
+
$item$$,$next$$){$next$$(null,$item$$)},onUpdating:function($user$$,$data$$,$item$$,$next$$){return $next$$("B\u1ea1n kh\u00f4ng th\u1ec3 c\u1eadp nh\u1eadt")}})).route()};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const model=global.getModel("events"),newsfeed=global.getModel("newsfeed"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"events",{sort:{date_from:-1,date_created:-1},onCreated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("events",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else $next$$(null,$obj$$)},onUpdated:async($user$$,$obj$$,$next$$)=>{if($obj$$.newsfeed)try{await newsfeed.add("events",$obj$$),$next$$(null,$obj$$)}catch($e$$){$next$$($e$$.message)}else{try{await newsfeed.delete($obj$$._id)}catch($e$$){$e$$&&
|
|
3
|
+
Logger.error($e$$)}$next$$(null,$obj$$)}},onDeleted:async($user$$,$obj$$,$next$$)=>{try{await newsfeed.delete($obj$$._id)}catch($e$$){$e$$&&Logger.error($e$$)}$next$$(null,$obj$$)}})).route()};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const model=global.getModel("evoucher"),User=global.getModel("user"),Numeral=require("numeral"),controller=require("../../controllers/controller");
|
|
2
|
+
module.exports=function($router$$){(new controller($router$$,model,"evoucher",{sort:{date_created:-1},unique:["ma"],onView:($user$$,$items$$,$next$$)=>{$items$$.forEach($item$$=>{$item$$.so_lan_da_su_dung=[...(new Set($item$$.id_ct_useds||[]))].length});$next$$(null,$items$$)},onCreating:($user$$,$data$$,$next$$)=>{$data$$.id_ct_useds=[];$next$$(null,$data$$)},onCreated:($msg_user$$,$obj$$,$next$$)=>{if($obj$$.user){$msg_user$$={code:"evoucher",action:"NEW"};let $voucher$$=$obj$$.so_tien?`tr\u1ecb gi\u00e1 ${Numeral($obj$$.so_tien).format()}\u0111`:
|
|
3
|
+
`gi\u1ea3m gi\u00e1 ${$obj$$.ty_le}%`;$msg_user$$.title=`Qu\u00fd kh\u00e1ch \u0111\u00e3 nh\u1eadn \u0111\u01b0\u1ee3c voucher ${$voucher$$}`;User.emitEvent($obj$$.user,"evoucher:new",$msg_user$$)}$next$$(null,$obj$$)}})).route()};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const model=global.getModel("experiencejourney"),controller=require("../../controllers/controller");module.exports=function($router$$){(new controller($router$$,model,"experiencejourney",{sort:{stt:1}})).route()};
|