PageSourceSearch

https://bncarmart.com/_next/static/chunks/7380-8785a41b658af225.js

js bncarmart.com collected 2026-10-02 00:09:59 UTC 13,891 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7380],{47380:function(e,r,n){var s=n(34051),t=n.n(s),a=n(85893),i=n(67294),o=n(29473),l=n(58056),c=n(5434),d=n(11163),u=n(82206),p=n(92297),h=n(96210),x=n(93627),j=n(50053),f=n(30498),m=n(79462),v=n(25195),g=n(6226),y=n(77405),Z=n(11382),_=n(81474),b=n(30381),w=n.n(b),S=n(51649),k=n(63750),D=n(86893),C=n(1946),N=(n(40993),n(99442)),Y=n(17523),P=n.n(Y),O=n(41664);function H(e,r,n,s,t,a,i){try{var o=e[a](i),l=o.value}catch(c){return void n(c)}o.done?r(l):Promise.resolve(l).then(s,t)}function I(e){return function(){var r=this,n=arguments;return new Promise((function(s,t){var a=e.apply(r,n);function i(e){H(a,s,t,i,o,"next",e)}function o(e){H(a,s,t,i,o,"throw",e)}i(void 0)}))}}function M(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function F(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},s=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),s.forEach((function(r){M(e,r,n[r])}))}return e}u.Z.Paragraph;r.Z=function(e){var r=e.titleColor,n=e.showToast,s=(0,i.useState)(!0),u=s[0],b=s[1],Y=(0,i.useState)([]),H=Y[0],M=Y[1],T=(0,i.useState)({}),A=T[0],E=T[1],U=(0,i.useState)(1),L=U[0],z=U[1],q=(0,i.useState)(""),B=q[0],V=q[1],R=(0,i.useState)(1),W=R[0],Q=R[1],X=(0,i.useState)(!1),G=X[0],J=X[1],K=(0,i.useState)(""),$=K[0],ee=K[1],re=(0,i.useState)(!1),ne=re[0],se=re[1],te=(0,i.useState)({id:null,isSold:!1}),ae=te[0],ie=te[1],oe=(0,i.useState)(!1),le=oe[0],ce=oe[1],de=(0,d.useRouter)(),ue=(0,i.useState)({sort:"",height:250,options:[{value:"",label:"Latest-Updated"},{value:"asc-price",label:"Price-Lowest"},{value:"desc-price",label:"Price-Highest"},{value:"asc-date-posted",label:"Date-Oldest"},{value:"desc-date-posted",label:"Date-Newest"}]}),pe=ue[0],he=ue[1];(0,i.useEffect)((function(){Object.keys(A).length?je():xe()}),[A,B,pe,L]),(0,i.useEffect)((function(){if(de.query.application_id&&"sgcalist"===de.query.application_id)localStorage.setItem("application_id",de.query.application_id),ce(!0);else{var e=localStorage.getItem("application_id");ce("sgcalist"===e)}}),[de]);var xe=function(){var e=I(t().mark((function e(){var r;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,localStorage.getItem("bearerToken");case 2:r=e.sent,E(l.Z.decode(r));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),je=function(){var e=I(t().mark((function e(){var r,n,s,a,i,l;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),n={page:L,product_condition:"Used",product_status:B,sort:pe.sort},e.next=5,o.h.POST(n,"/inventory/cars");case 5:(null===(s=e.sent)||void 0===s||null===(r=s.data)||void 0===r?void 0:r.success)?(M(s.data.data.filter((function(e){return!1===e.is_deleted}))),Q(null===s||void 0===s||null===(a=s.data)||void 0===a||null===(i=a.meta)||void 0===i||null===(l=i.pagination)||void 0===l?void 0:l.total),b(!1)):(M([]),b(!1));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fe=function(){var e=I(t().mark((function e(){var r,s,a,i;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),s=ae.id,a=ae.isSold,e.next=5,o.h.UPDATE("/inventory/cars/mark-as-sold",{id:s});case 5:(null===(i=e.sent)||void 0===i||null===(r=i.data)||void 0===r?void 0:r.success)?(b(!1),je(),n("success",a?"Successfully marked as unsold":"Successfully marked as sold")):(b(!1),n("error","Ooops! Something went wrog.")),se(!1),ie({id:null,isSold:!1});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),me=function(){var e=I(t().mark((function e(r){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ee(r),J(!0);case 2:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),ve=function(){var e=I(t().mark((function e(){var r,s;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),e.next=4,o.h.DELETE("/inventory/cars/delete",{id:$});case 4:(null===(s=e.sent)||void 0===s||null===(r=s.data)||void 0===r?void 0:r.success)?(b(!1),je(),n("success","Successfully deleted!")):(b(!1),n("error","Ooops! Something went wrong.")),je(),J(!1),ee(null);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ge=function(){var e=I(t().mark((function e(){var r;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={product_condition:"Used",product_status:B,sort:pe.sort,is_commercial_vehicle:!1},e.next=3,o.h.EXPORT_PDF_API("/inventory/cars/export-pdf",r,"used-car-listing");case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ye=function(e){return e.is_draft?(0,a.jsx)("span",{className:"".concat(P().productStatus," ").concat(P().draft),children:"Draft"}):e.is_sold?(0,a.jsx)("span",{className:"".concat(P().productStatus," ").concat(P().sold),children:"Sold"}):e.is_verified?(0,a.jsx)("span",{className:"".concat(P().productStatus," ").concat(P().verified),children:"Verified"}):(0,a.jsx)("span",{className:"".concat(P().productStatus," ").concat(P().processing),children:"Processing"})},Ze=function(e){return(0,a.jsxs)(v.Z,{gutter:[8,8],justify:"end",children:[(0,a.jsx)(g.Z,{xs:6,children:(0,a.jsx)(p.Z,{placement:"bottom",controlId:"control-id-hover",trigger:"hover",speaker:(0,a.jsx)(h.Z,{children:"View"}),children:(0,a.jsx)(x.Z,{disabled:e.is_draft,onClick:function(){return r=e._id,void d.default.push({pathname:"/product",query:{id:r,type:"sale"}});var r},color:"yellow",appearance:"primary",icon:(0,a.jsx)(S.qVU,{})})})}),(0,a.jsx)(g.Z,{xs:6,children:(0,a.jsx)(p.Z,{placement:"bottom",controlId:"control-id-hover",trigger:"hover",speaker:(0,a.jsx)(h.Z,{children:e.is_sold?"Already sold":"Mark as sold"}),children:(0,a.jsx)(x.Z,F({disabled:!e.is_verified||e.is_sold,style:{opacity:e.is_verified?1:.
16},onClick:function(){return r=e._id,n=e.is_sold,ie({id:r,isSold:n}),void se(!0);var r,n}},e.is_sold?{appearance:"primary",color:"green"}:{appearance:"default"},{icon:(0,a.jsx)(k.N9r,{style:{color:e.is_sold?"white":"gray"}})}))})}),(0,a.jsx)(g.Z,{xs:6,children:(0,a.jsx)(p.Z,{placement:"bottom",controlId:"control-id-hover",trigger:"hover",speaker:(0,a.jsx)(h.Z,{children:"Edit"}),children:(0,a.jsx)(x.Z,{disabled:e.is_sold,onClick:function(){return r=e._id,void d.default.push({pathname:"/edit-ad",query:{id:r}});var r},appearance:"primary",icon:(0,a.jsx)(D.vPQ,{color:"white"})})})}),(0,a.jsx)(g.Z,{xs:6,children:(0,a.jsx)(p.Z,{placement:"bottom",controlId:"control-id-hover",trigger:"hover",speaker:(0,a.jsx)(h.Z,{children:"Delete"}),children:(0,a.jsx)(x.Z,{onClick:function(){me(e._id)},color:"red",appearance:"primary",icon:(0,a.jsx)(c.ZkW,{})})})})]})};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(i.Fragment,{children:[(0,a.jsx)(v.Z,{children:(0,a.jsx)(g.Z,{span:24,children:(0,a.jsx)("div",{style:{display:"flex",flexDirection:"row"},children:(0,a.jsx)("h4",{style:{fontSize:"1.3em",fontWeight:"600",color:r},children:"My Used Cars"})})})}),(0,a.jsxs)(v.Z,{gutter:[16,8],justify:"start",children:[(0,a.jsx)(g.Z,{xs:{span:24,order:1},sm:{span:12,order:0},md:{span:6,order:0},children:(0,a.jsx)(y.Z,{defaultValue:B,onChange:function(e){return function(e){V(e),z(1)}(e)},options:[{value:"",label:"All"},{value:"sold",label:"Sold"},{value:"verified",label:"Verified"},{value:"processing",label:"Processing"},{value:"draft",label:"Draft"}],placeholder:"Filter By Status",size:"large",style:{width:"100%"}})}),(0,a.jsx)(g.Z,{xs:{span:24,order:2},sm:{span:12,order:1},md:{span:6,order:1},children:(0,a.jsx)(y.Z,{defaultValue:pe.sort,onChange:function(e){he(F({},pe,{sort:e}))},options:pe.options,placeholder:"Sort By",size:"large",style:{width:"100%"}})}),(0,a.jsx)(g.Z,{xs:{span:24,order:2},sm:{span:12,order:1},md:{span:6,order:1},children:le?(0,a.jsx)(O.default,{passHref:!0,href:{pathname:"/download-carlist-pdf",query:{product_condition:"Used",product_status:B,sort:pe.sort,is_commercial_vehicle:!1,route:"/inventory/cars/export-pdf",type:"used-car-listing"}},children:(0,a.jsx)("a",{target:"_blank",rel:"noopener noreferrer",children:(0,a.jsxs)(j.Z,{appearance:"ghost",color:"green",style:{padding:"0 16px",width:"100%",height:40},children:[(0,a.jsx)(c._TA,{})," Download PDF"]})})}):(0,a.jsxs)(j.Z,{onClick:ge,appearance:"ghost",color:"green",style:{padding:"0 16px",width:"100%",height:40},children:[(0,a.jsx)(c._TA,{})," Download PDF"]})}),(0,a.jsx)(g.Z,{xs:{span:24,order:0},sm:{span:12,order:3},md:{span:6,order:3},children:(0,a.jsx)(j.Z,{onClick:function(){d.default.push({pathname:"/sell-car"})},appearance:"primary",style:{padding:"0 16px",width:"100%",height:40},children:"Create Used Car"})})]}),(0,a.jsx)(C.Z,{bottom:10}),(0,a.jsxs)(v.Z,{children:[(0,a.jsx)(g.Z,{xs:0,sm:0,md:0,lg:24,xl:24,children:(0,a.jsxs)("div",{className:P().inventoryTable,children:[(0,a.jsxs)(v.Z,{gutter:[8,8],justify:"end",className:P().inventoryTableHeader,children:[(0,a.jsxs)(g.Z,{span:5,children:[" ",(0,a.jsx)("strong",{children:" Car Title "})," "]}),(0,a.jsx)(g.Z,{span:2,children:(0,a.jsx)("strong",{children:"No. of Owners "})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("strong",{children:" Status "})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("strong",{children:" Created By "})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("strong",{children:"Created At"})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("strong",{children:"sold"===B?"Date Sold":"Updated At"})}),(0,a.jsx)(g.Z,{span:5,children:(0,a.jsx)("strong",{children:"Actions"})})]}),u?(0,a.jsx)("div",{className:"loading-spinner-wrapper",children:(0,a.jsx)(Z.Z,{className:"loading-spinner",size:"large"})}):(0,a.jsx)(a.Fragment,{children:null===H||void 0===H?void 0:H.map((function(e,r){return(0,a.jsxs)(v.Z,{gutter:[8,8],justify:"center",className:P().inventoryTableData,children:[(0,a.jsx)(g.Z,{span:5,children:(0,a.jsx)("div",{children:e.product_name})}),(0,a.jsx)(g.Z,{span:2,children:(0,a.jsx)("div",{children:e.number_of_owners})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("div",{children:ye(e)})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("div",{children:e.created_by})}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("div",{children:w().utc(e.date_created).local().format("DD-MM-YYYY HH:mm")}
1)}),(0,a.jsx)(g.Z,{span:3,children:(0,a.jsx)("div",{children:"sold"===B?w().utc(e.date_sold).local().format("DD-MM-YYYY HH:mm"):w().utc(e.date_updated).local().format("DD-MM-YYYY HH:mm")})}),(0,a.jsx)(g.Z,{span:5,children:Ze(e)})]},r)}))})]})}),(0,a.jsx)(g.Z,{xs:24,sm:24,md:24,lg:0,xl:0,children:(0,a.jsx)(v.Z,{gutter:[24,24],children:u?(0,a.jsx)(g.Z,{span:24,children:(0,a.jsx)("div",{className:"loading-spinner-wrapper",children:(0,a.jsx)(Z.Z,{className:"loading-spinner",size:"large"})})}):(0,a.jsx)(a.Fragment,{children:null===H||void 0===H?void 0:H.map((function(e,r){return(0,a.jsx)(g.Z,{xs:24,sm:12,md:12,children:(0,a.jsxs)(_.Z,{title:e.product_name,actions:[Ze(e)],bordered:!1,style:{width:"100%",border:"1px solid #ddd"},children:[(0,a.jsxs)("div",{className:P().cardListItem,children:[(0,a.jsx)("strong",{children:"Status: "}),ye(e)]}),(0,a.jsxs)("div",{className:P().cardListItem,children:[(0,a.jsx)("strong",{children:"Created By: "})," ",(0,a.jsxs)("span",{children:[" ",e.created_by," "]})]}),(0,a.jsxs)("div",{className:P().cardListItem,children:[(0,a.jsx)("strong",{children:"Created Date: "})," ",(0,a.jsxs)("span",{children:[" ",w().utc(e.date_created).local().format("DD-MM-YYYY HH:mm")," "]})]}),(0,a.jsx)("div",{className:P().cardListItem,children:"sold"===B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:"Date Sold: "}),(0,a.jsxs)("span",{children:[" ",w().utc(e.date_sold).local().format("DD-MM-YYYY HH:mm")]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("strong",{children:"Updated At: "}),(0,a.jsxs)("span",{children:[" ",w().utc(e.date_updated).local().format("DD-MM-YYYY HH:mm")]})]})}),(0,a.jsxs)("div",{className:P().cardListItem,children:[(0,a.jsx)("strong",{children:"No. of Owners: "})," ",(0,a.jsxs)("span",{children:[" ",e.number_of_owners," "]})]})]})},r)}))})})})]}),(0,a.jsx)(v.Z,{gutter:[0,16],justify:"center",children:(0,a.jsx)(g.Z,{span:24,children:H.length||u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(C.Z,{bottom:15}),(0,a.jsx)(v.Z,{children:(0,a.jsx)(g.Z,{span:24,style:{display:"flex",justifyContent:"center",alignItems:"center"},children:(0,a.jsx)(f.Z,{prev:!0,last:!0,next:!0,first:!0,size:"sm",total:u?10:W,limit:10,activePage:L,onChangePage:z})})})]}):(0,a.jsx)(N.Z,{imageSrc:"/nodata.png",title:"",description:"No record found. Please try different filter."})})})]}),(0,a.jsxs)(m.Z,{size:"xs",open:G,onClose:function(){return J(!1)},children:[(0,a.jsx)(m.Z.Body,{children:(0,a.jsx)("div",{style:{color:"red"},children:"Are you sure to delete this record?"})}),(0,a.jsxs)(m.Z.Footer,{children:[(0,a.jsxs)(j.Z,{onClick:function(){return ve()},disabled:u,color:"red",appearance:"primary",style:{marginLeft:"8px"},children:[u&&(0,a.jsx)(Z.Z,{style:{marginRight:"10px"}}),u?"Deleting...":"Delete"]}),(0,a.jsx)(j.Z,{onClick:function(){return J(!1)},children:"Cancel"})]})]}),(0,a.jsxs)(m.Z,{size:"xs",open:ne,onClose:function(){return se(!1)},children:[(0,a.jsxs)(m.Z.Body,{children:[(0,a.jsx)("div",{children:"Are you sure to mark this record as sold?"}),(0,a.jsx)("div",{style:{color:"red",marginTop:"10px"},children:"Note: Once marked as sold, this car cannot be edited."})]}),(0,a.jsxs)(m.Z.Footer,{children:[(0,a.jsxs)(j.Z,{onClick:function(){return fe()},disabled:u,appearance:"primary",style:{marginLeft:"8px"},children:[u&&(0,a.jsx)(Z.Z,{style:{marginRight:"10px"}}),u?"Updating...":"Confirm"]}),(0,a.jsx)(j.Z,{onClick:function(){return se(!1)},children:"Cancel"})]})]})]})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.