File manager - Edit - /home/webapp69.cm.in.th/u69319090023/Shop23/_next/static/chunks/322qbu0-swpg_.js
Back
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,28623,t=>{"use strict";let e=(0,t.i(56420).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);t.s(["Sparkles",0,e],28623)},77071,t=>{"use strict";let e=(0,t.i(56420).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);t.s(["Plus",0,e],77071)},89664,t=>{"use strict";let e=(0,t.i(56420).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);t.s(["Check",0,e],89664)},23067,t=>{"use strict";let e=()=>{let t=window.location.pathname;return t.includes("/u69319090023/Shop23")?"/u69319090023/Shop23/api":t.includes("/Shop23")?"/Shop23/api":t.includes("/CMTC SHOP")||t.includes("/CMTC%20SHOP")?"/CMTC%20SHOP/api":"/api"},a=t=>Array.isArray(t)?t.filter(t=>{var e;return t&&t.id&&!((e=t.id)&&(e.startsWith("prod_170000000000")||e.startsWith("prod_tshirt_")||e.startsWith("prod_polo_")||e.startsWith("prod_hoodie_")||e.startsWith("prod_shop_")||e.startsWith("prod_cap_")||e.startsWith("prod_belt_")||e.startsWith("prod_badge_")||e.startsWith("prod_jacket_")||e.startsWith("prod_amulet_")||e.startsWith("prod_bag_")||e.startsWith("prod_backpack_")||!/^prod_\d+$/.test(e)))&&!t.id.startsWith("prod_170000000000")&&"เสื้อเกราะ"!==t.name&&"รถมอเตอร์ไซค์ไฟฟ้า"!==t.name&&"รถมอเตอร์ไซค์"!==t.name}):[],s=()=>{let t=localStorage.getItem("ctc_products"),e=[];if(t)try{e=JSON.parse(t)}catch{e=[]}let s=a(e);return s.length!==e.length&&(e=s,localStorage.setItem("ctc_products",JSON.stringify(e))),e},r=t=>{let e=a(t);localStorage.setItem("ctc_products",JSON.stringify(e)),window.dispatchEvent(new Event("storage"))},i=class{static async getProducts(){let t=s();try{let s=e(),i=await fetch(`${s}/products.php`,{cache:"no-store"});if(i.ok){let e=await i.json();if(e&&e.success&&Array.isArray(e.data)&&e.data.length>0){let s=a(e.data),i=new Map;s.forEach(t=>i.set(t.id,t)),t.forEach(t=>{i.has(t.id)||i.set(t.id,t)});let o=Array.from(i.values());return r(o),o}}}catch(t){}return t}static async getRecommendedProducts(){let t=await this.getProducts();if(!t||0===t.length)return[];let e=t.filter(t=>t.isRecommended);return e.length>=3?e:[...e,...t.filter(t=>!t.isRecommended)]}static async getProductById(t){let a=s(),i=a.find(e=>e.id===t);if(i)return i;try{let s=e(),i=await fetch(`${s}/products.php?id=${encodeURIComponent(t)}`,{cache:"no-store"});if(i.ok){let e=await i.json();if(e&&e.success&&e.data){let s=e.data,i=[s,...a.filter(e=>e.id!==t)];return r(i),s}}}catch{}}static async getProductBySlug(t){let a=s(),i=a.find(e=>e.slug===t);if(i)return i;try{let s=e(),i=await fetch(`${s}/products.php?slug=${encodeURIComponent(t)}`,{cache:"no-store"});if(i.ok){let t=await i.json();if(t&&t.success&&t.data){let e=t.data,s=[e,...a.filter(t=>t.id!==e.id)];return r(s),e}}}catch{}}static async saveProduct(t){let a=s();r(-1!==a.findIndex(e=>e.id===t.id)?a.map(e=>e.id===t.id?t:e):[t,...a]);try{let a=e();await fetch(`${a}/products.php`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch(t){console.warn("Backend sync failed, saved locally:",t)}return t}static async deleteProduct(t){r(s().filter(e=>e.id!==t));try{let a=e();await fetch(`${a}/products.php?id=${encodeURIComponent(t)}`,{method:"DELETE"})}catch(t){console.warn("Backend delete sync failed:",t)}return!0}static async updateProducts(t){return r(t),!0}static async updateProductStock(t,a,i){let o=s(),n=o.findIndex(e=>e.id===t);if(-1!==n){o[n].inStock=a,void 0!==i&&(o[n].stockCount=i),r(o);try{let s=e();await fetch(`${s}/products.php`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:t,inStock:a,stockCount:i})})}catch(t){}return!0}return!1}};t.s(["default",0,i])},67927,t=>{"use strict";let e=(0,t.i(56420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);t.s(["ChevronRight",0,e],67927)},79258,t=>{"use strict";let e=(0,t.i(56420).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);t.s(["Package",0,e],79258)},49882,t=>{"use strict";let e=(0,t.i(56420).default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);t.s(["Calendar",0,e],49882)},8734,t=>{"use strict";let e=(0,t.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);t.s(["Copy",0,e],8734)},10818,t=>{"use strict";let e=(0,t.i(56420).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);t.s(["Info",0,e],10818)},94105,t=>{"use strict";let e=(0,t.i(56420).default)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);t.s(["LayoutDashboard",0,e],94105)},70812,t=>{"use strict";let e=(0,t.i(56420).default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);t.s(["Bell",0,e],70812)},53138,t=>{"use strict";let e=(0,t.i(56420).default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);t.s(["AlertTriangle",0,e],53138)},70387,t=>{"use strict";let e=(0,t.i(56420).default)("credit-card",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);t.s(["CreditCard",0,e],70387)},29210,t=>{"use strict";let e=(0,t.i(56420).default)("landmark",[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]]);t.s(["Landmark",0,e],29210)},70904,t=>{"use strict";let e=(0,t.i(56420).default)("wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);t.s(["Wallet",0,e],70904)},26909,2773,94164,35034,30801,t=>{"use strict";var e=t.i(56420);let a=(0,e.default)("arrow-left-right",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);t.s(["ArrowLeftRight",0,a],26909);let s=(0,e.default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);t.s(["Filter",0,s],2773);var r=t.i(43476),i=t.i(71645),o=t.i(46932),n=t.i(88653),l=t.i(63676);t.s(["default",0,({isOpen:t,onClose:e,children:a})=>((0,i.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset"}),[t]),(0,r.jsx)(n.AnimatePresence,{children:t&&(0,r.jsxs)("div",{className:"fixed inset-0 z-50 flex",children:[(0,r.jsx)(o.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:e,className:"fixed inset-0 bg-black/60 backdrop-blur-xs cursor-pointer"}),(0,r.jsxs)(o.motion.div,{initial:{x:"-100%"},animate:{x:0},exit:{x:"-100%"},transition:{type:"spring",damping:25,stiffness:220},className:"relative w-80 max-w-[85vw] h-full bg-white shadow-2xl flex flex-col p-5 z-50 text-left border-r border-[#F3F1ED]",children:[(0,r.jsx)("button",{onClick:e,className:"absolute top-4 right-4 p-2 text-gray-500 hover:text-gray-900 hover:bg-gray-50 rounded-xl transition-all cursor-pointer border-none bg-transparent","aria-label":"Close menu",children:(0,r.jsx)(l.X,{className:"w-5 h-5"})}),(0,r.jsx)("div",{className:"h-full flex flex-col justify-between pt-8 overflow-y-auto",children:a})]})]})}))],94164);let c=class{static STORAGE_KEY="ctc_commission_settings";static getDefaultSettings(){return{enabled:!0,baseRatePercent:5,isTieredEnabled:!0,tierThresholdAmount:2e4,tierRatePercent:8,updatedAt:"16/08/2569"}}static getCommissionSettings(){try{let t=localStorage.getItem(this.STORAGE_KEY);if(t)return{...this.getDefaultSettings(),...JSON.parse(t)}}catch(t){console.error("Error reading commission settings:",t)}return this.getDefaultSettings()}static saveCommissionSettings(t){try{let e={...t,updatedAt:new Date().toLocaleDateString("th-TH")};localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e)),window.dispatchEvent(new Event("storage")),window.dispatchEvent(new CustomEvent("commissionChange",{detail:e}))}catch(t){console.error("Error saving commission settings:",t)}}static calculateStoreCommission(t,e){let a=e||this.getCommissionSettings();if(!a.enabled)return{effectiveRate:0,isTier2:!1,commissionAmount:0,netEarnings:t,tierThresholdAmount:a.tierThresholdAmount,progressPercent:0,amountToThreshold:Math.max(0,a.tierThresholdAmount-t)};let s=a.isTieredEnabled&&t>=a.tierThresholdAmount,r=s?a.tierRatePercent:a.baseRatePercent,i=Math.round(t*r/100),o=Math.max(0,t-i),n=a.tierThresholdAmount>0?Math.min(100,Math.round(t/a.tierThresholdAmount*100)):100,l=Math.max(0,a.tierThresholdAmount-t);return{effectiveRate:r,isTier2:s,commissionAmount:i,netEarnings:o,tierThresholdAmount:a.tierThresholdAmount,progressPercent:n,amountToThreshold:l}}};t.s(["default",0,c],35034);let d=class{static PAYOUTS_KEY="ctc_payout_requests";static BANKS_PREFIX="ctc_merchant_banks_";static getBankAccounts(t){try{let e=localStorage.getItem(this.BANKS_PREFIX+t.toLowerCase());if(e)return JSON.parse(e);let a={id:`bank_${Date.now()}`,bankName:"ธนาคารกสิกรไทย (KBANK)",bankCode:"kbank",accountNumber:"142-2-89541-0",accountName:"บัญชีร้านค้า CMTC SHOP",isDefault:!0,createdAt:new Date().toLocaleDateString("th-TH")};return localStorage.setItem(this.BANKS_PREFIX+t.toLowerCase(),JSON.stringify([a])),[a]}catch{return[]}}static saveBankAccount(t,e){let a=this.getBankAccounts(t),s={id:`bank_${Date.now()}`,...e,isDefault:e.isDefault||0===a.length,createdAt:new Date().toLocaleDateString("th-TH")},r=[...a];return s.isDefault&&(r=r.map(t=>({...t,isDefault:!1}))),r.push(s),localStorage.setItem(this.BANKS_PREFIX+t.toLowerCase(),JSON.stringify(r)),window.dispatchEvent(new Event("storage")),s}static deleteBankAccount(t,e){let a=this.getBankAccounts(t).filter(t=>t.id!==e);a.length>0&&!a.some(t=>t.isDefault)&&(a[0].isDefault=!0),localStorage.setItem(this.BANKS_PREFIX+t.toLowerCase(),JSON.stringify(a)),window.dispatchEvent(new Event("storage"))}static getAllPayoutRequests(){try{let t=localStorage.getItem(this.PAYOUTS_KEY);return t?JSON.parse(t):[]}catch{return[]}}static getMerchantPayoutRequests(t){return this.getAllPayoutRequests().filter(e=>e.merchantEmail.toLowerCase()===t.toLowerCase())}static createPayoutRequest(t,e,a,s){let r=this.getAllPayoutRequests(),i={id:`PO-${Math.floor(1e5+9e5*Math.random())}`,merchantEmail:t.toLowerCase(),merchantName:e,amount:a,fee:0,netAmount:a,bankAccount:s,status:"pending",requestedAt:new Date().toISOString()},o=[i,...r];return localStorage.setItem(this.PAYOUTS_KEY,JSON.stringify(o)),window.dispatchEvent(new Event("storage")),i}static approvePayout(t,e,a,s){let r=this.getAllPayoutRequests(),i=r.findIndex(e=>e.id===t);return -1!==i&&(r[i].status="approved",r[i].processedAt=new Date().toISOString(),r[i].slipUrl=e,r[i].transactionRef=a||`TXN-${Date.now()}`,r[i].adminNote=s||"โอนเงินสำเร็จเรียบร้อย",localStorage.setItem(this.PAYOUTS_KEY,JSON.stringify(r)),window.dispatchEvent(new Event("storage")),!0)}static rejectPayout(t,e){let a=this.getAllPayoutRequests(),s=a.findIndex(e=>e.id===t);return -1!==s&&(a[s].status="rejected",a[s].processedAt=new Date().toISOString(),a[s].adminNote=e,localStorage.setItem(this.PAYOUTS_KEY,JSON.stringify(a)),window.dispatchEvent(new Event("storage")),!0)}};t.s(["default",0,d],30801)}]);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.34 |
proxy
|
phpinfo
|
Settings