"use strict";(()=>{var e={};e.id=287,e.ids=[287],e.modules={53524:e=>{e.exports=require("@prisma/client")},72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},46629:(e,r,s)=>{s.r(r),s.d(r,{GlobalError:()=>i.a,__next_app__:()=>p,originalPathname:()=>m,pages:()=>d,routeModule:()=>u,tree:()=>c}),s(7014),s(72014),s(35866);var a=s(23191),n=s(88716),t=s(37922),i=s.n(t),l=s(95231),o={};for(let e in l)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>l[e]);s.d(r,o);let c=["",{children:["contracts",{children:["new",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,7014)),"/Users/hassanmahmoud/erp-system/app/contracts/new/page.tsx"]}]},{}]},{}]},{layout:[()=>Promise.resolve().then(s.bind(s,72014)),"/Users/hassanmahmoud/erp-system/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"]}],d=["/Users/hassanmahmoud/erp-system/app/contracts/new/page.tsx"],m="/contracts/new/page",p={require:s,loadChunk:()=>Promise.resolve()},u=new a.AppPageRouteModule({definition:{kind:n.x.APP_PAGE,page:"/contracts/new/page",pathname:"/contracts/new",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},7014:(e,r,s)=>{s.r(r),s.d(r,{default:()=>l});var a=s(19510),n=s(56842),t=s(57371),i=s(9487);async function l(){let[e,r,s]=await Promise.all([i.Z.car.findMany({where:{status:"AVAILABLE"}}),i.Z.company.findMany({where:{OR:[{type:"CLIENT"},{type:"BOTH"}]}}),i.Z.company.findMany({where:{OR:[{type:"SUPPLIER"},{type:"BOTH"}]}})]);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex-between",style:{marginBottom:"2rem"},children:[a.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"إنشاء عقد مزدوج جديد"}),a.jsx(t.default,{href:"/contracts",className:"btn btn-outline",children:"عودة للقائمة"})]}),(0,a.jsxs)("form",{action:n.createContract,className:"grid grid-cols-2",children:[(0,a.jsxs)("div",{className:"card",children:[a.jsx("h3",{style:{marginBottom:"1.5rem",color:"var(--primary-color)"},children:"البيانات الأساسية"}),(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"السيارة المتاحة"}),(0,a.jsxs)("select",{name:"carId",className:"form-control",required:!0,children:[a.jsx("option",{value:"",children:"-- اختر سيارة --"}),e.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.plate," - ",e.model]},e.id))]})]}),(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"العميل المستأجر"}),(0,a.jsxs)("select",{name:"clientId",className:"form-control",required:!0,children:[a.jsx("option",{value:"",children:"-- اختر عميل --"}),r.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]})]}),(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"المورد (المالك)"}),(0,a.jsxs)("select",{name:"supplierId",className:"form-control",required:!0,children:[a.jsx("option",{value:"",children:"-- اختر مورد --"}),s.map(e=>a.jsx("option",{value:e.id,children:e.name},e.id))]})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"card",children:[a.jsx("h3",{style:{marginBottom:"1.5rem",color:"var(--success)"},children:"عقد العميل (الإيرادات)"}),(0,a.jsxs)("div",{className:"grid grid-cols-2",children:[(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"سعر الإيجار للعميل (ريال)"}),a.jsx("input",{type:"number",step:"0.01",name:"clientPrice",className:"form-control",required:!0})]}),(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"مدة العقد (بالشهور)"}),a.jsx("input",{type:"number",name:"clientDuration",className:"form-control",required:!0,defaultValue:"1"})]})]})]}),(0,a.jsxs)("div",{className:"card",children:[a.jsx("h3",{style:{marginBottom:"1.5rem",color:"var(--warning)"},children:"عقد المورد (التكلفة)"}),(0,a.jsxs)("div",{className:"grid grid-cols-2",children:[(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"سعر الإيجار للمورد (ريال)"}),a.jsx("input",{type:"number",step:"0.01",name:"supplierPrice",className:"form-control",required:!0})]}),(0,a.jsxs)("div",{className:"form-group",children:[a.jsx("label",{children:"مدة العقد (بالشهور)"}),a.jsx("input",{type:"number",name:"supplierDuration",className:"form-control",required:!0,defaultValue:"1"})]})]})]}),a.jsx("button",{type:"submit",className:"btn btn-primary",style:{width:"100%",padding:"1rem",fontSize:"1.1rem",justifyContent:"center"},children:"اعتماد وحفظ العقد المزدوج"})]})]})]})}}};var r=require("../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),a=r.X(0,[551,77,946],()=>s(46629));module.exports=a})();