File manager - Edit - /home/webapp69.cm.in.th/u69319090023/Shop23/_next/static/chunks/29ta1noe8z06s.js
Back
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,59544,t=>{"use strict";var e=t.i(43476);t.s(["default",0,({children:t,variant:a="primary",size:s="md",isLoading:r=!1,className:i="",disabled:o,...n})=>(0,e.jsxs)("button",{className:`inline-flex items-center justify-center font-semibold rounded-full transition-all duration-300 active:scale-95 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none disabled:active:scale-100 ${{primary:"bg-gradient-to-r from-primary to-secondary text-text-primary hover:from-accent hover:to-highlight shadow-luxury hover:shadow-luxury-glow hover:-translate-y-[2px]",secondary:"bg-white text-primary border border-gray-100 hover:bg-gray-50 shadow-card-soft",outline:"bg-transparent text-white border-2 border-white/20 hover:border-white hover:bg-white/10",glass:"glassmorphism text-white hover:bg-white/15 border border-white/10",danger:"bg-red-600 text-white hover:bg-red-700 shadow-sm"}[a]} ${{sm:"text-sm px-4 py-2",md:"text-base px-6 py-3",lg:"text-lg px-8 py-4"}[s]} ${i}`,disabled:o||r,...n,children:[r&&(0,e.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-current",fill:"none",viewBox:"0 0 24 24",children:[(0,e.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,e.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t]})])},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)},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)},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])},49817,t=>{"use strict";let e=(0,t.i(56420).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);t.s(["Home",0,e],49817)},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)},24071,t=>{"use strict";let e=(0,t.i(56420).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);t.s(["ChevronLeft",0,e],24071)},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)},13285,t=>{"use strict";let e=(0,t.i(56420).default)("layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);t.s(["Layers",0,e],13285)},47925,t=>{"use strict";let e=(0,t.i(56420).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);t.s(["Wrench",0,e],47925)},25981,t=>{"use strict";let e=(0,t.i(56420).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);t.s(["Upload",0,e],25981)},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)},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.26 |
proxy
|
phpinfo
|
Settings