PageSourceSearch

https://zakazitehnicki.rs/build/js/Create-BfaY1X07.js

js zakazitehnicki.rs collected 2026-10-02 00:13:45 UTC 7,051 bytes, 1 lines download raw bytes

1import{b as e}from"./inertia--ZEhmJS1.js";import t from"./FiscalReceiptForm-Bfhg09v2.js";import i from"./DeviceStatusIndicatorCompact-B66TOr4R.js";import s from"./EsirService-CLBTtw6C.js";import{s as a}from"./snackbarUtilities-BcDt-tG-.js";import{f as r}from"./fiscalReceiptOperations-LR1rLVqr.js";import{n}from"../assets/vueapp-bgl58m-v.js";import"./vue-core-C-VdNkoM.js";import"./TextField-DohCWWc7.js";import"./AutoComplete-DQK04rAO.js";import"./AdvanceReceiptSelector-Wn1Qm-C7.js";/* empty css                  *//* empty css                       */import"./vuetify-BmWxZWmK.js";import"./vendor-ui-pyLhEk5Z.js";const o=n({components:{FiscalReceiptForm:t,DeviceStatusIndicatorCompact:i},mixins:[a,r],props:{lines:Array,paymentTypes:Array,fiscalTypes:Object,errors:Object,taxLabels:Array},data(){const e=this.$page&&this.$page.props&&this.$page.props.user||{},t=[e.first_name||e.firstName||"",e.last_name||e.lastName||""].filter(Boolean).join(" ").trim()||e.name||"";return{processing:!1,currentTaxLabels:this.taxLabels||[],selectedAdvance:null,form:this.$inertia.form({line_id:null,fiscal_type:"SALE",buyer_name:"",buyer_pib:"",buyer_identification_number:"",amount:"",payment_type:1,items:[{name:"",quantity:1,unit_price:"",description:"",tax_label:""}],cashier_name:t,referent_document_number:"",referent_document_date:"",generate_invoice:!1,advance_receipt_id:null,advance_amount:null})}},computed:{selectedLine(){return this.lines.find(e=>e.id===this.form.line_id)},isFormValid(){return this.form.line_id&&this.form.fiscal_type&&this.form.amount&&this.form.items.every(e=>e.name&&e.unit_price)&&this.form.cashier_name},hasEsirConfig(){var e,t;return(null==(e=this.selectedLine)?void 0:e.esir_pin)&&(null==(t=this.selectedLine)?void 0:t.esir_device_endpoint)}},mounted(){this.lines&&this.lines.length>0&&!this.form.line_id&&(this.form.line_id=this.lines[0].id)},methods:{submit(){this.form.generate_invoice=!1,this.submitForm()},async submitAndGenerate(){const e=this.lines.find(e=>e.id===this.form.line_id);e?await this.generateInvoiceInBrowser(e):this.showErrorMessage("Greška: Linija nije pronađena")},async generateInvoiceInBrowser(e){this.processing=!0;try{this.form.generate_invoice=!1;await this.$inertia.post(this.route("fiscal-receipts.store"),this.form.data(),{preserveState:!0,preserveScroll:!0,onSuccess:async t=>{var i;const s=t.props.fiscalReceipt||(null==(i=t.props.flash)?void 0:i.fiscalReceipt);if(!s)return this.showErrorMessage("Greška: Fiskalni račun nije kreiran"),void(this.processing=!1);await this.generateAndSyncInvoice(s,e)},onError:e=>{this.showErrorMessage("Greška pri čuvanju fiskalnog računa"),this.processing=!1}})}catch(t){this.showErrorMessage(`Greška: ${t.message}`),this.processing=!1}},async generateAndSyncInvoice(t,i){try{(await e.get(this.route("api.fiscal-receipts.lines.esir-pin",i.id))).data.pin;const a={pos_invoice_number:t.pos_invoice_number,fiscal_type:t.fiscal_type,buyer_name:t.buyer_name,buyer_pib:t.buyer_pib,buyer_identification_number:t.buyer_identification_number,amount:t.amount,payment_type:t.payment_type,cashier_name:t.cashier_name,referent_document_number:t.referent_document_number,referent_document_date:t.referent_document_date,items:t.items||this.form.items,is_copy:!1};this.selectedAdvance&&"SALE"===t.fiscal_type&&(a.advance_amount=this.selectedAdvance.amount,a.advance_vat_amount=this.selectedAdvance.vat_amount||0,a.referent_document_number=this.selectedAdvance.invoice_number,a.referent_document_date=this.selectedAdvance.invoice_date);const r=new s,n=await r.generateInvoice(a,i);if(!n||!n.success)return this.showErrorMessage((null==n?void 0:n.message)||"Greška pri izdavanju računa"),void this.$inertia.visit(this.route("fiscal-receipts.show",t.id));if(n.success){await this.syncInvoiceToServer(t.id,n.data),await this.storePdfToServer(t.id,n.data.invoicePDF,n.data.invoiceNumber,"pdf_path");const e=n.message||"Fiskalni račun je uspešno izdat";this.showSuccessMessage(e),this.$inertia.visit(this.route("fiscal-receipts.show",t.id))}else this.showErrorMessage(n.message||"Greška pri izdavanju računa"),this.$inertia.visit(this.route("fiscal-receipts.show",t.id))}catch(a){this.showErrorMessage(`Greška: ${a.message}`),t.id&&this.$inertia.visit(this.route("fiscal-receipts.show",t.id))}finally{this.processing=!1}}
1,submitForm(){this.form.post(this.route("fiscal-receipts.store"))},updateTaxLabels(e){this.currentTaxLabels=e;const t=this.lines.find(e=>e.id===this.form.line_id),i=t&&t.default_tax_label?t.default_tax_label:e&&e.length>0?e[0].label:"";this.form.items.forEach(e=>{e.tax_label=i})},handleAdvanceSelected(e){this.selectedAdvance=e,e?(this.form.advance_receipt_id=e.id,this.form.advance_amount=e.amount,this.form.referent_document_number=e.invoice_number||"",this.form.referent_document_date=e.invoice_date||"",this.form.amount=e.amount||"",e.items&&e.items.length>0&&(this.form.items=e.items.map(e=>{let t="";return e.tax_labels&&Array.isArray(e.tax_labels)&&e.tax_labels.length>0?t=e.tax_labels[0]:e.tax_label&&(t=e.tax_label),{name:e.name||"",quantity:e.quantity||1,unit_price:e.unit_price||"",description:e.description||"",tax_label:t}})),e.buyer_name&&(this.form.buyer_name=e.buyer_name),e.buyer_pib&&(this.form.buyer_pib=e.buyer_pib),e.buyer_identification_number&&(this.form.buyer_identification_number=e.buyer_identification_number)):(this.form.advance_receipt_id=null,this.form.advance_amount=null,this.form.referent_document_number="",this.form.referent_document_date="",this.form.items=[{name:"",quantity:1,unit_price:"",description:"",tax_label:""}],this.form.amount="")}}},function(){var e=this,t=e._self._c;return t("div",[t("v-container",{staticClass:"py-2",attrs:{fluid:""}},[t("v-row",{attrs:{justify:"center"}},[t("v-col",{attrs:{cols:"12",md:"11",lg:"10"}},[t("v-card",[t("v-card-title",{staticClass:"d-flex align-center py-2"},[t("span",{staticClass:"text-h6"},[e._v("Novi Fiskalni Račun")]),t("v-spacer"),e.selectedLine?t("DeviceStatusIndicatorCompact",{attrs:{line:e.selectedLine},on:{"tax-labels-updated":e.updateTaxLabels}}):e._e()],1),t("v-form",{on:{submit:function(t){return t.preventDefault(),e.submit.apply(null,arguments)}}},[t("v-card-text",{staticClass:"py-2"},[t("FiscalReceiptForm",{attrs:{lines:e.lines,"payment-types":e.paymentTypes,"fiscal-types":e.fiscalTypes,errors:e.errors,"tax-labels":e.currentTaxLabels},on:{"tax-labels-updated":e.updateTaxLabels,"advance-selected":e.handleAdvanceSelected},model:{value:e.form,callback:function(t){e.form=t},expression:"form"}})],1),t("v-card-actions",{staticClass:"py-2"},[t("inertia-link",{attrs:{href:e.route("fiscal-receipts.index")}},[t("v-btn",{attrs:{outlined:""}},[e._v(" Otkaži ")])],1),t("v-spacer"),t("v-btn",{attrs:{type:"submit",color:"primary",loading:e.processing,disabled:!e.isFormValid}},[e._v(" Sačuvaj ")]),t("v-btn",{attrs:{color:"success",loading:e.processing,disabled:!e.isFormValid||!e.hasEsirConfig},on:{click:e.submitAndGenerate}},[e._v(" Sačuvaj i Izdaj Račun ")])],1)],1)],1)],1)],1)],1)],1)},[],!1,null,null).exports;export{o as default};

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.