PageSourceSearch

https://planeta-avtodv.ru/_next/static/chunks/pages/accounting-a80173c37a2ab874.js

js planeta-avtodv.ru collected 2026-10-08 10:00:39 UTC 10,201 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9260],{8169:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/accounting",function(){return t(3671)}])},8132:function(e,n,t){"use strict";var i=t(5893);t(7294);var a=t(1664),c=t.n(a);n.Z=e=>(0,i.jsxs)("div",{className:"mt-5",children:[(0,i.jsx)("div",{className:"bg-[#f5f5f5] text-center text-xs font-semibold uppercase text-[#666]",children:"ОБЩИЕ"}),(0,i.jsx)(c(),{href:"/orders",className:"block border-l-[3px] border-transparent px-[15px] py-[10px] text-[13px] font-semibold text-[#333] no-underline hover:border-[#111] hover:bg-[#f0f0f0]",children:"Заказы"}),(0,i.jsx)(c(),{href:"/accounting",className:"block border-l-[3px] border-transparent px-[15px] py-[10px] text-[13px] font-semibold text-[#333] no-underline hover:border-[#111] hover:bg-[#f0f0f0]",children:"Взаиморасчеты"}),(0,i.jsx)("div",{className:"bg-[#f5f5f5] text-center text-xs font-semibold uppercase text-[#666]",children:"Настройки"}),(0,i.jsx)(c(),{href:"/settings/companies",className:"block border-l-[3px] border-transparent px-[15px] py-[10px] text-[13px] font-semibold text-[#333] no-underline hover:border-[#111] hover:bg-[#f0f0f0]",children:"Организация"}),(0,i.jsx)(c(),{href:"/settings/password",className:"block border-l-[3px] border-transparent px-[15px] py-[10px] text-[13px] font-semibold text-[#333] no-underline hover:border-[#111] hover:bg-[#f0f0f0]",children:"Смена пароля"})]})},9814:function(e,n,t){"use strict";var i=t(5893),a=t(7294),c=t(8132),s=t(4981),r=t(1594);n.Z=({children:e})=>{let[n,t]=a.useState(!1);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"MobileMenuBar",children:(0,i.jsxs)("button",{type:"button",className:"MobileMenuButton",onClick:()=>t(!0),children:[(0,i.jsx)(s.Z,{"aria-hidden":"true"}),(0,i.jsx)("span",{children:"Разделы"})]})}),(0,i.jsxs)("div",{className:`MobileMenuDrawer ${n?"MobileMenuDrawer--open":""}`,"aria-hidden":!n,children:[(0,i.jsx)("button",{type:"button",className:"MobileMenuDrawer-backdrop",onClick:()=>t(!1),"aria-label":"Закрыть меню"}),(0,i.jsxs)("div",{className:"MobileMenuDrawer-panel",children:[(0,i.jsxs)("div",{className:"MobileMenuDrawer-header",children:[(0,i.jsx)("span",{children:"Разделы"}),(0,i.jsx)("button",{type:"button",className:"MobileMenuDrawer-close",onClick:()=>t(!1),"aria-label":"Закрыть меню",children:(0,i.jsx)(r.Z,{"aria-hidden":"true"})})]}),(0,i.jsx)("div",{onClick:()=>t(!1),children:(0,i.jsx)(c.Z,{})})]})]}),(0,i.jsxs)("div",{className:"App-wrapper",children:[(0,i.jsx)("div",{className:"App-spacer"}),(0,i.jsx)("div",{className:"App-menu App-column--sticky",children:(0,i.jsx)(c.Z,{})}),(0,i.jsx)("div",{className:"App-content",children:e}),(0,i.jsx)("div",{className:"App-sidebar"})]})]})}},3671:function(e,n,t){"use strict";t.r(n);var i=t(5893),a=t(9814),c=t(5457),s=t(1664),r=t.n(s),l=t(1163),o=t(7294),d=t(8100);let x=e=>!!(e&&!Array.isArray(e)&&e.error),u=e=>{if(!e)return"—";let n=e.match(/^(\d{2})\.(\d{2})\.(\d{4})/);if(n)return`${n[1]}.${n[2]}.${n[3]}`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString("ru-RU")},h=e=>{let n=new Date(e.date).getTime();return Number.isNaN(n)?0:n},m=e=>{let n=new Map,t=e.map((e,n)=>({invoice:e,index:n})).sort((e,n)=>h(e.invoice)-h(n.invoice)||e.index-n.index),i=0;return t.forEach(({invoice:e})=>{i+=e.amount-e.payment,n.set(e.id,i)}),n},p=({title:e,text:n,tone:t="default",loading:a=!1})=>(0,i.jsxs)("div",{className:`AccountingNotice AccountingNotice--${t}${a?" AccountingNotice--loading":""}`,role:a?"status":void 0,"aria-live":a?"polite":void 0,children:[a&&(0,i.jsx)("span",{className:"AccountingNotice_spinner","aria-hidden":"true"}),(0,i.jsx)("div",{className:"AccountingNotice_title",children:e}),(0,i.jsx)("div",{className:"AccountingNotice_text",children:n})]}),j=({contractId:e,contractBalance:n})=>{let{data:t,error:a,mutate:c}=(0,d.ZP)(`/companies/contracts?contract_id=${encodeURIComponent(e)}&with_status=true`),s=Array.isArray(null==t?void 0:t.invoices)?t.invoices:[],r=!t&&!a||!!(null==t?void 0:t.unavailable);return(o.useEffect(()=>{if(!(null==t?void 0:t.unavailable))return;let e=window.setTimeout(()=>{c()},5e3);return()=>window.clearTimeout(e)},[null==t?void 0:t.unavailable,c]),r)?(0,i.jsx)(p,{title:"Загружаем доÐ
1ºÑƒÐ¼ÐµÐ½Ñ‚Ñ‹",text:"Получаем данные из 1С. Это может занять несколько секунд.",loading:!0}):a?(0,i.jsx)(p,{title:"Счета временно недоступны",text:"Не удалось получить документы по этому договору. Попробуйте обновить страницу позже.",tone:"warning"}):0===s.length?(0,i.jsx)(p,{title:"Нет неоплаченных документов",text:"По выбранному договору сейчас нет счетов для отображения."}):(0,i.jsx)(N,{invoices:s,contractBalance:n})},v=({contract:e,isSelected:n})=>{let t=e.balance>0?"ContractLink_balance_value--debt":"ContractLink_balance_value--paid",a=0===e.balance?"Все оплачено":(0,c.Z)(e.balance);return(0,i.jsxs)(r(),{href:`/accounting?contract_id=${encodeURIComponent(e.id)}`,className:`ContractLink${n?" ContractLink--selected":""}`,"aria-current":n?"true":void 0,children:[(0,i.jsx)("div",{className:"ContractLink_company",children:e.company}),(0,i.jsx)("div",{className:"ContractLink_title",children:e.title}),(0,i.jsxs)("div",{className:"ContractLink_balance",children:[(0,i.jsx)("span",{children:"Баланс"}),(0,i.jsx)("span",{className:`ContractLink_balance_value ${t}`,children:a})]})]})},b=({invoice:e,balanceAfter:n})=>{let t=u(e.payBefore),a=n>0;return(0,i.jsxs)("tr",{className:`InvoiceRow${a?" InvoiceRow--debt":""}`,children:[(0,i.jsx)("td",{className:"InvoiceRow_title",children:(0,i.jsx)("div",{className:"InvoiceRow_document",children:e.title})}),(0,i.jsx)("td",{className:"InvoiceRow_amount",children:(0,c.Z)(e.amount)}),(0,i.jsx)("td",{className:"InvoiceRow_payment",children:(0,c.Z)(e.payment)}),(0,i.jsx)("td",{className:"InvoiceRow_debt",children:(0,c.Z)(a?n:0)}),(0,i.jsx)("td",{className:"InvoiceRow_pay_before",children:(0,i.jsx)("span",{children:t})})]})},N=({invoices:e,contractBalance:n})=>{let t="number"==typeof n?n:e.reduce((e,n)=>e+n.balance,0),a=t>0,s=m(e);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:`InvoiceSummary${a?" InvoiceSummary--debt":" InvoiceSummary--paid"}`,children:[(0,i.jsx)("span",{children:a?"Баланс по договору":"Задолженности нет"}),(0,i.jsx)("strong",{children:a?(0,c.Z)(t):"Все документы оплачены"})]}),(0,i.jsx)("div",{className:"InvoiceTableWrap",children:(0,i.jsxs)("table",{className:"InvoiceTable",children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{scope:"col",className:"InvoiceRow_title",children:"Документ"}),(0,i.jsx)("th",{scope:"col",className:"InvoiceRow_amount",children:"Начислено"}),(0,i.jsx)("th",{scope:"col",className:"InvoiceRow_payment",children:"Оплачено"}),(0,i.jsx)("th",{scope:"col",className:"InvoiceRow_debt",children:"Долг после операции"}),(0,i.jsx)("th",{scope:"col",className:"InvoiceRow_pay_before",children:"Оплатить до"})]})}),(0,i.jsx)("tbody",{children:e.map(e=>(0,i.jsx)(b,{invoice:e,balanceAfter:s.get(e.id)||0},e.id))})]})})]})};n.default=()=>{let{data:e,error:n}=(0,d.ZP)("/companies/contracts",{revalidateOnFocus:!1,revalidateOnMount:!0}),t=(0,l.useRouter)(),c=Array.isArray(t.query.contract_id)?t.query.contract_id[0]:t.query.contract_id,s=Array.isArray(e)?e:[],r=c||(c||1!==s.length?void 0:s[0].id),o=r?s.find(e=>e.id===r):void 0,u=!e&&!n,h=!!n||x(e);return(0,i.jsx)(a.Z,{children:(0,i.jsxs)("div",{className:"AccountingPage",children:[(0,i.jsxs)("div",{className:"AccountingHeader",children:[(0,i.jsx)("h1",{children:"Взаиморасчеты"}),(0,i.jsx)("p",{className:"AccountingHeader_text",children:"Выберите договор, чтобы посмотреть счета, оплаты и текущий долг по документам."}),(0,i.jsxs)("div",{className:"AccountingHeader_current",children:[(0,i.jsx)("span",{children:"Текущий выбор:"})," ",o?o.title:r?"договор из ссылки":"договор не выбран"]})]}),(0,i.jsxs)("section",{className:"AccountingSection","aria-labelledby":"
1contracts-title",children:[(0,i.jsxs)("div",{className:"AccountingSection_header",children:[(0,i.jsx)("h2",{id:"contracts-title",children:"Договоры"}),(0,i.jsx)("span",{className:"AccountingSection_hint",children:s.length?`${s.length} ${1===s.length?"договор":"договора"}`:"Данные из 1С"})]}),u&&(0,i.jsx)(p,{title:"Загружаем договоры",text:"Получаем список договоров и балансы.",loading:!0}),h&&(0,i.jsx)(p,{title:"Договоры временно недоступны",text:"1С не ответила или вернула ошибку. Попробуйте обновить страницу позже.",tone:"warning"}),!u&&!h&&0===s.length&&(0,i.jsx)(p,{title:"Договоров пока нет",text:"Для вашей организации не найдено активных договоров."}),s.length>0&&(0,i.jsx)("div",{className:"ContractList",children:s.map(e=>(0,i.jsx)(v,{contract:e,isSelected:e.id===r},e.id))})]}),(0,i.jsxs)("section",{className:"AccountingSection","aria-labelledby":"invoices-title",children:[(0,i.jsx)("div",{className:"AccountingSection_header",children:(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{id:"invoices-title",children:"Счета и оплаты"}),o&&(0,i.jsxs)("p",{className:"AccountingSection_subtitle",children:[o.company," \xb7 ",o.title]})]})}),!r&&(0,i.jsx)(p,{title:"Выберите договор",text:"Список счетов появится здесь после выбора договора."}),r&&(0,i.jsx)(j,{contractId:r,contractBalance:null==o?void 0:o.balance})]})]})})}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=8169)}),_N_E=e.O()}]);

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.