fix: use standard doctype APIs for portal

This commit is contained in:
Rohan Bansal 2025-05-15 15:28:25 +05:30
parent 1d797cab85
commit 18406c6da3
29 changed files with 115 additions and 123 deletions

View file

@ -23,13 +23,13 @@
<div class="mb-2 row">
<div class="col">
<div class="row">
<label for="supplier_invoice_number" class="col-sm-3 col-form-label">Invoice Number</label>
<label for="bill_no" class="col-sm-3 col-form-label">Invoice Number</label>
<div class="col-sm-8">
<input
type="text"
class="form-control"
id="supplier_invoice_number"
v-model.number="invoiceData.supplier_invoice_number" />
id="bill_no"
v-model.number="invoiceData.bill_no" />
</div>
</div>
</div>
@ -66,16 +66,16 @@
</div>
<div class="col">
<div class="row">
<label for="invoice_date" class="col-sm-3 col-form-label">Invoice Date</label>
<label for="posting_date" class="col-sm-3 col-form-label">Invoice Date</label>
<div class="col-sm-8">
<TextInput
:type="'date'"
size="lg"
variant="outline"
placeholder="Invoice Date"
id="invoice_date"
id="posting_date"
:disabled="false"
v-model="invoiceData.invoice_date" />
v-model="invoiceData.posting_date" />
</div>
</div>
</div>
@ -97,7 +97,7 @@
id="supplier_name"
:options="portalSuppliers.data"
:placeholder="'Supplier Name'"
:hideSearch="!invoiceData.supplier_invoice_number"
:hideSearch="!invoiceData.bill_no"
:label="'company_name'"
v-model="invoiceData.supplier_name"
v-else />
@ -106,12 +106,12 @@
</div>
<div class="col">
<div class="row">
<label for="invoice_terms" class="col-sm-3 col-form-label">Invoice Terms</label>
<label for="payment_terms_template" class="col-sm-3 col-form-label">Invoice Terms</label>
<div class="col-sm-8">
<select
class="form-select form-select-mb h-100 d-inline-block"
aria-label="Invoice Terms"
v-model="invoiceData.invoice_terms">
v-model="invoiceData.payment_terms_template">
<option readonly></option>
<option v-for="option in invoiceTermOptions" :value="option.value">
{{ option.label }}
@ -125,7 +125,7 @@
<div class="col"></div>
<div class="col">
<div class="row">
<label for="invoice_date" class="col-sm-3 col-form-label">Due Date</label>
<label for="posting_date" class="col-sm-3 col-form-label">Due Date</label>
<div class="col-sm-8">
<TextInput
:type="'date'"
@ -212,15 +212,15 @@
<div id="collapse-2" class="accordion-collapse collapse show" data-bs-parent="#address-accordion">
<div class="accordion-body">
<div class="row mb-1">
<label for="notes" class="col-sm-3 col-form-label">Notes</label>
<label for="remarks" class="col-sm-3 col-form-label">Notes</label>
<div class="col-md-8">
<Textarea
:variant="'subtle'"
size="md"
placeholder="Enter Notes Here"
:disabled="false"
v-model="invoiceData.notes"
id="notes" />
v-model="invoiceData.remarks"
id="remarks" />
</div>
</div>
</div>
@ -251,7 +251,7 @@
<select
class="form-select form-select-mb h-100 d-inline-block"
aria-label="Service Types"
v-model="item.service_type">
v-model="item.item_code">
<option readonly></option>
<option v-for="option in serviceTypeOption" :value="option.value">
{{ option.label }}
@ -260,7 +260,7 @@
</div>
</td>
<td>
<input type="text" class="form-control" v-model="item.quantity" />
<input type="text" class="form-control" v-model="item.qty" />
</td>
<td>
<div class="input-group">
@ -297,11 +297,11 @@
<div class="col"></div>
<div class="col">
<div class="input-group">
<label for="total_amount" class="col-sm-3 col-form-label">Total Amount</label>
<label for="grand_total" class="col-sm-3 col-form-label">Total Amount</label>
<div class="cols-sm-5">
<div class="input-group">
<span class="input-group-text currency-fmt"><i class="bi bi-currency-dollar"></i> </span>
<input type="text" readonly class="form-control" v-model.number="invoiceData.total_amount" />
<input type="text" readonly class="form-control" v-model.number="invoiceData.grand_total" />
</div>
</div>
</div>
@ -325,7 +325,7 @@ import Autocomplete from 'frappe-ui/src/components/Autocomplete.vue'
const isAdministrator = sessionUser() === 'Administrator'
const portalInvoice = createListResource({
doctype: 'Invoices',
doctype: 'Purchase Invoice',
insert: {
onSuccess() {
router.push({ name: 'SupplierInvoiceList' })
@ -333,6 +333,13 @@ const portalInvoice = createListResource({
},
})
const portalSuppliers = createListResource({
doctype: 'Supplier',
fields: ['name as value', 'supplier_name as label'],
orderBy: 'creation desc',
})
portalSuppliers.fetch()
const invoiceTermOptions = [
{
label: 'NET 10',
@ -372,25 +379,25 @@ const serviceTypeOption = [
]
const invoiceData = reactive({
supplier_invoice_number: '',
bill_no: '',
supplier: sessionSupplierId(),
service_date: new Date().toISOString().split('T')[0],
invoice_date: new Date().toISOString().split('T')[0],
posting_date: new Date().toISOString().split('T')[0],
supplier_name: sessionSupplierName(),
invoice_terms: '',
total_amount: 0,
payment_terms_template: '',
grand_total: 0,
site_code: '',
street: '',
city: '',
state: '',
zip_code: '',
notes: '',
remarks: '',
})
const invoiceItems = reactive([])
let invoiceDueDate = computed(() => {
if (invoiceData.invoice_terms) {
let result = addDays(invoiceData.invoice_date, parseInvoiceTerms(invoiceData.invoice_terms))
if (invoiceData.payment_terms_template) {
let result = addDays(invoiceData.posting_date, parseInvoiceTerms(invoiceData.payment_terms_template))
// return as string
return result.toISOString().split('T')[0]
}
@ -399,12 +406,12 @@ let invoiceDueDate = computed(() => {
const addRow = () => {
const rowObject = reactive({
service_type: '',
quantity: 0,
item_code: '',
qty: 0,
rate: 0,
amount: 0,
})
rowObject.amount = computed(() => rowObject.quantity * rowObject.rate)
rowObject.amount = computed(() => rowObject.qty * rowObject.rate)
invoiceItems.push(rowObject)
}
@ -412,39 +419,30 @@ const deleteRow = index => {
invoiceItems.splice(index, 1)
}
invoiceData.total_amount = computed(() => {
invoiceData.grand_total = computed(() => {
return invoiceItems.reduce((acc, item) => acc + item.amount, 0)
})
const saveInvoice = () => {
portalInvoice.insert.submit({
supplier_invoice_number: invoiceData.supplier_invoice_number,
supplier: invoiceData.supplier,
service_date: invoiceData.service_date,
invoice_date: invoiceData.invoice_date,
supplier_name: invoiceData.supplier_name,
invoice_terms: invoiceData.invoice_terms,
...invoiceData,
set_posting_time: true,
due_date: invoiceDueDate.value,
site_code: invoiceData.site_code,
street: invoiceData.street,
city: invoiceData.city,
state: invoiceData.state,
zip_code: invoiceData.zip_code,
notes: invoiceData.notes,
supplier_invoice_items: invoiceItems.map(item => {
remarks: invoiceData.remarks,
items: invoiceItems.map(item => {
return {
service_type: item.service_type,
quantity: item.quantity,
item_code: item.item_code,
qty: item.qty,
rate: item.rate,
}
}),
})
}
const portalSuppliers = createListResource({
doctype: 'Supplier',
fields: ['name as value', 'company_name as label'],
orderBy: 'creation desc',
})
portalSuppliers.fetch()
// watch for changes in invoiceData.supplier_name
watch(

View file

@ -1,12 +1,12 @@
<template>
<div v-if="!invoice.loading && invoice.doc">
<div v-if="!invoice.loading && documents.invoice">
<div class="container mt-5 py-3 border">
<div class="row mb-3 vr-aligned">
<div class="col-6">
<h1 class="text-gray-900 font-bold text-[32px]">
Supplier Invoice: {{ invoice.doc.name }}
Supplier Invoice: {{ documents.invoice.name }}
<Badge>
{{ invoice.doc.status }}
{{ documents.invoice.status }}
</Badge>
</h1>
</div>
@ -22,7 +22,7 @@
</div>
</div>
</div>
<div :class="invoice.doc.supplier_invoice_items ? 'container border-bottom pb-3' : 'container pb-3'">
<div :class="documents.invoice.items ? 'container border-bottom pb-3' : 'container pb-3'">
<div class="mb-1 row">
<div class="col">
<div class="row">
@ -33,7 +33,7 @@
readonly
class="form-control-plaintext"
id="suppplier_id"
:value="invoice.doc.supplier" />
:value="documents.invoice.supplier" />
</div>
</div>
</div>
@ -48,7 +48,7 @@
placeholder="Payment Date"
id="service_date"
:disabled="true"
v-model="invoice.doc.service_date" />
v-model="documents.invoice.service_date" />
</div>
</div>
</div>
@ -63,22 +63,22 @@
readonly
class="form-control-plaintext"
id="suppplier_name"
:value="invoice.doc.supplier_name" />
:value="documents.invoice.supplier_name" />
</div>
</div>
</div>
<div class="col">
<div class="row mb-1">
<label for="invoice_date" class="col-sm-3 col-form-label">Invoice Date</label>
<label for="posting_date" class="col-sm-3 col-form-label">Invoice Date</label>
<div class="col-sm-8">
<TextInput
:type="'date'"
size="lg"
variant="outline"
placeholder="Invoice Date"
id="invoice_date"
id="posting_date"
:disabled="true"
v-model="invoice.doc.invoice_date" />
v-model="documents.invoice.posting_date" />
</div>
</div>
</div>
@ -96,7 +96,7 @@
placeholder="Due Date"
id="due_date"
:disabled="true"
v-model="invoice.doc.due_date" />
v-model="documents.invoice.due_date" />
</div>
</div>
</div>
@ -105,14 +105,14 @@
<div class="col"></div>
<div class="col">
<div class="row">
<label for="invoice_terms" class="col-sm-3 col-form-label">Invoice Terms</label>
<label for="payment_terms_template" class="col-sm-3 col-form-label">Invoice Terms</label>
<div class="col-sm-8">
<input
type="text"
readonly
class="form-control-plaintext h-100 d-inline-block"
id="invoice_terms"
:value="invoice.doc.invoice_terms" />
id="payment_terms_template"
:value="documents.invoice.payment_terms_template" />
</div>
</div>
</div>
@ -142,7 +142,7 @@
readonly
class="form-control-plaintext"
id="site_code"
:value="invoice.doc.site_code" />
:value="documents?.address?.doc?.site_code" />
</div>
</div>
<div class="row mb-1">
@ -153,7 +153,7 @@
readonly
class="form-control-plaintext"
id="street"
:value="invoice.doc.street" />
:value="documents?.address?.doc?.address_line1" />
</div>
</div>
<div class="row mb-1">
@ -164,7 +164,7 @@
readonly
class="form-control-plaintext"
id="city"
:value="invoice.doc.city" />
:value="documents?.address?.doc?.city" />
</div>
</div>
<div class="row mb-1">
@ -175,7 +175,7 @@
readonly
class="form-control-plaintext"
id="state"
:value="invoice.doc.state" />
:value="documents?.address?.doc?.state" />
</div>
</div>
<div class="row mb-1">
@ -186,7 +186,7 @@
readonly
class="form-control-plaintext"
id="zip_code"
:value="invoice.doc.zip_code" />
:value="documents?.address?.doc?.pincode" />
</div>
</div>
</div>
@ -211,16 +211,16 @@
<div id="collapse-2" class="accordion-collapse collapse" data-bs-parent="#address-accordion">
<div class="accordion-body">
<div class="row mb-1">
<label for="notes" class="col-sm-4 col-form-label">Notes</label>
<label for="remarks" class="col-sm-4 col-form-label">Notes</label>
<div class="col-sm-8">
<Textarea
:variant="'subtle'"
size="md"
placeholder="Enter Notes Here"
:disabled="true"
v-model="invoice.doc.notes"
v-model="documents.invoice.remarks"
label=""
id="notes" />
id="remarks" />
</div>
</div>
</div>
@ -231,7 +231,7 @@
</div>
</div>
<div class="container" v-if="invoice.doc.supplier_invoice_items">
<div class="container" v-if="documents.invoice.items">
<table class="table">
<thead>
<tr>
@ -243,10 +243,10 @@
</tr>
</thead>
<tbody class="table-group-divider">
<tr v-for="(item, index) in invoice.doc.supplier_invoice_items" :key="item.name">
<tr v-for="(item, index) in documents.invoice.items" :key="item.name">
<th scope="row">{{ index + 1 }}</th>
<td>{{ item.service_type }}</td>
<td>{{ item.quantity }}</td>
<td>{{ item.item_code }}</td>
<td>{{ item.qty }}</td>
<td><i class="bi bi-currency-dollar"></i> {{ item.rate }}</td>
<td><i class="bi bi-currency-dollar"></i> {{ item.amount }}</td>
</tr>
@ -259,11 +259,11 @@
<div class="col"></div>
<div class="col">
<div class="input-group">
<label for="total_amount" class="col-sm-3 col-form-label">Total Amount</label>
<label for="grand_total" class="col-sm-3 col-form-label">Total Amount</label>
<div class="cols-sm-5">
<div class="input-group">
<span class="input-group-text"><i class="bi bi-currency-dollar"></i> </span>
<input type="text" readonly class="form-control" v-model.number="invoice.doc.total_amount" />
<input type="text" readonly class="form-control" v-model.number="documents.invoice.grand_total" />
</div>
</div>
</div>
@ -274,22 +274,28 @@
</div>
</template>
<script setup>
<script setup lang="ts">
import { createDocumentResource, createListResource, Badge } from 'frappe-ui'
import Textarea from 'frappe-ui/src/components/Textarea.vue'
import TextInput from 'frappe-ui/src/components/TextInput.vue'
import { reactive, watch } from 'vue'
const props = defineProps({
supplierInvoiceNumber: {
type: String,
required: true,
},
})
const { supplierInvoiceNumber } = defineProps<{
supplierInvoiceNumber: string
}>()
const documents = reactive({})
const invoice = createDocumentResource({
doctype: 'Invoices',
name: props.supplierInvoiceNumber,
auto: true,
doctype: 'Purchase Invoice',
name: supplierInvoiceNumber,
onSuccess: (data) => {
documents.invoice = data
documents.address = createDocumentResource({
doctype: 'Address',
name: data.supplier_address,
auto: true
})
}
})
</script>

View file

@ -46,7 +46,7 @@
<td>
<Badge>{{ item.status }}</Badge>
</td>
<td><i class="bi bi-currency-dollar"></i> {{ item.total_amount }}</td>
<td><i class="bi bi-currency-dollar"></i> {{ item.grand_total }}</td>
</tr>
</tbody>
</table>
@ -70,7 +70,7 @@ onBeforeMount(() => {
})
let invoiceParams = {
doctype: 'Invoices',
doctype: 'Purchase Invoice',
fields: ['*'],
orderBy: 'creation desc',
start: 0,

View file

@ -151,7 +151,9 @@ scheduler_events = {
# "all": [
# "suppliers_portal.tasks.all"
# ],
"daily": ["suppliers_portal.utils.daily_invoice_status_update"],
# "daily": [
# "suppliers_portal.tasks.daily"
# ],
# "hourly": [
# "suppliers_portal.tasks.hourly"
# ],

View file

@ -236,7 +236,7 @@ def import_invoices():
"posting_date": getdate(invoice.get("invoice_date")),
"due_date": getdate(invoice.get("due_date")),
"payment_terms_template": invoice.get("invoice_terms"),
"remarks": invoice.get("remarks"),
"remarks": remarks,
"owner": invoice.get("owner"),
"creation": invoice.get("creation"),
}

View file

@ -1 +1 @@
import{_ as x,R as g,S as _,N as l,w as r,g as c,o,T as p,U as C,V as k,m as a,e as d,z as u,W as m,F as h,G as b}from"./vendor.99304cc5.js";const v={name:"FontColor",props:["editor"],components:{Popover:g,Tooltip:_},methods:{setBackgroundColor(t){t.name!="Default"?this.editor.chain().focus().toggleHighlight({color:t.hex}).run():this.editor.chain().focus().unsetHighlight().run()},setForegroundColor(t){t.name!="Default"?this.editor.chain().focus().setColor(t.hex).run():this.editor.chain().focus().unsetColor().run()}},computed:{foregroundColors(){return[{name:"Default",hex:"#1F272E"},{name:"Yellow",hex:"#ca8a04"},{name:"Orange",hex:"#ea580c"},{name:"Red",hex:"#dc2626"},{name:"Green",hex:"#16a34a"},{name:"Blue",hex:"#1579D0"},{name:"Purple",hex:"#9333ea"},{name:"Pink",hex:"#db2777"}]},backgroundColors(){return[{name:"Default",hex:null},{name:"Yellow",hex:"#fef9c3"},{name:"Orange",hex:"#ffedd5"},{name:"Red",hex:"#fee2e2"},{name:"Green",hex:"#dcfce7"},{name:"Blue",hex:"#D3E9FC"},{name:"Purple",hex:"#f3e8ff"},{name:"Pink",hex:"#fce7f3"}]}}},y={class:"p-2"},B=a("div",{class:"text-sm text-gray-700"},"Text Color",-1),P={class:"mt-1 grid grid-cols-8 gap-1"},F=["aria-label","onClick"],w=a("div",{class:"mt-2 text-sm text-gray-700"},"Background Color",-1),D={class:"mt-1 grid grid-cols-8 gap-1"},T=["aria-label","onClick"];function z(t,R,$,j,A,n){const i=c("Tooltip"),f=c("Popover");return o(),l(f,{transition:"default"},{target:r(({togglePopover:e,isOpen:s})=>[p(t.$slots,"default",C(k({onClick:()=>e(),isActive:s})))]),"body-main":r(()=>[a("div",y,[B,a("div",P,[(o(!0),d(h,null,u(n.foregroundColors,e=>(o(),l(i,{class:"flex",key:e.name,text:e.name},{default:r(()=>[a("button",{"aria-label":e.name,class:"flex h-5 w-5 items-center justify-center rounded border text-base",style:m({color:e.hex}),onClick:s=>n.setForegroundColor(e)}," A ",12,F)]),_:2},1032,["text"]))),128))]),w,a("div",D,[(o(!0),d(h,null,u(n.backgroundColors,e=>(o(),l(i,{class:"flex",key:e.name,text:e.name},{default:r(()=>[a("button",{"aria-label":e.name,class:b(["flex h-5 w-5 items-center justify-center rounded border text-base text-gray-900",e.hex?"border-transparent":"border-gray-200"]),style:m({backgroundColor:e.hex}),onClick:s=>n.setBackgroundColor(e)}," A ",14,T)]),_:2},1032,["text"]))),128))])])]),_:3})}var G=x(v,[["render",z]]);export{G as default};
import{_ as x,R as g,S as _,N as l,w as r,g as d,o,T as p,U as C,V as b,m as a,e as c,z as u,W as m,F as h,G as k}from"./vendor.3e69a9be.js";const v={name:"FontColor",props:["editor"],components:{Popover:g,Tooltip:_},methods:{setBackgroundColor(t){t.name!="Default"?this.editor.chain().focus().toggleHighlight({color:t.hex}).run():this.editor.chain().focus().unsetHighlight().run()},setForegroundColor(t){t.name!="Default"?this.editor.chain().focus().setColor(t.hex).run():this.editor.chain().focus().unsetColor().run()}},computed:{foregroundColors(){return[{name:"Default",hex:"#1F272E"},{name:"Yellow",hex:"#ca8a04"},{name:"Orange",hex:"#ea580c"},{name:"Red",hex:"#dc2626"},{name:"Green",hex:"#16a34a"},{name:"Blue",hex:"#1579D0"},{name:"Purple",hex:"#9333ea"},{name:"Pink",hex:"#db2777"}]},backgroundColors(){return[{name:"Default",hex:null},{name:"Yellow",hex:"#fef9c3"},{name:"Orange",hex:"#ffedd5"},{name:"Red",hex:"#fee2e2"},{name:"Green",hex:"#dcfce7"},{name:"Blue",hex:"#D3E9FC"},{name:"Purple",hex:"#f3e8ff"},{name:"Pink",hex:"#fce7f3"}]}}},y={class:"p-2"},B=a("div",{class:"text-sm text-gray-700"},"Text Color",-1),P={class:"mt-1 grid grid-cols-8 gap-1"},F=["aria-label","onClick"],w=a("div",{class:"mt-2 text-sm text-gray-700"},"Background Color",-1),D={class:"mt-1 grid grid-cols-8 gap-1"},T=["aria-label","onClick"];function z(t,R,$,j,A,n){const i=d("Tooltip"),f=d("Popover");return o(),l(f,{transition:"default"},{target:r(({togglePopover:e,isOpen:s})=>[p(t.$slots,"default",C(b({onClick:()=>e(),isActive:s})))]),"body-main":r(()=>[a("div",y,[B,a("div",P,[(o(!0),c(h,null,u(n.foregroundColors,e=>(o(),l(i,{class:"flex",key:e.name,text:e.name},{default:r(()=>[a("button",{"aria-label":e.name,class:"flex h-5 w-5 items-center justify-center rounded border text-base",style:m({color:e.hex}),onClick:s=>n.setForegroundColor(e)}," A ",12,F)]),_:2},1032,["text"]))),128))]),w,a("div",D,[(o(!0),c(h,null,u(n.backgroundColors,e=>(o(),l(i,{class:"flex",key:e.name,text:e.name},{default:r(()=>[a("button",{"aria-label":e.name,class:k(["flex h-5 w-5 items-center justify-center rounded border text-base text-gray-900",e.hex?"border-transparent":"border-gray-200"]),style:m({backgroundColor:e.hex}),onClick:s=>n.setBackgroundColor(e)}," A ",14,T)]),_:2},1032,["text"]))),128))])])]),_:3})}var G=x(v,[["render",z]]);export{G as default};

View file

@ -1 +1 @@
import{_ as f,j as I,Y as _,$ as h,e as g,T as D,U as v,V as y,f as n,w as l,F as w,g as m,o as c,m as i,t as C,p as V,v as u}from"./vendor.99304cc5.js";const b={name:"InsertImage",props:["editor"],expose:["openDialog"],data(){return{addImageDialog:{url:"",file:null,show:!1}}},components:{Button:I,Dialog:_},methods:{openDialog(){this.addImageDialog.show=!0},onImageSelect(t){let e=t.target.files[0];!e||(this.addImageDialog.file=e,h(e).then(r=>{this.addImageDialog.url=r}))},addImage(t){this.editor.chain().focus().setImage({src:t}).run(),this.reset()},reset(){this.addImageDialog=this.$options.data().addImageDialog}}},k={class:"relative cursor-pointer rounded-lg bg-gray-100 py-1 focus-within:bg-gray-200 hover:bg-gray-200"},x={class:"absolute inset-0 select-none px-2 py-1 text-base"},B=["src"],S=u(" Insert Image "),N=u(" Cancel ");function A(t,e,r,T,a,o){const d=m("Button"),p=m("Dialog");return c(),g(w,null,[D(t.$slots,"default",v(y({onClick:o.openDialog}))),n(p,{options:{title:"Add Image"},modelValue:a.addImageDialog.show,"onUpdate:modelValue":e[2]||(e[2]=s=>a.addImageDialog.show=s),onAfterLeave:o.reset},{"body-content":l(()=>[i("label",k,[i("input",{type:"file",class:"w-full opacity-0",onChange:e[0]||(e[0]=(...s)=>o.onImageSelect&&o.onImageSelect(...s)),accept:"image/*"},null,32),i("span",x,C(a.addImageDialog.file?"Select another image":"Select an image"),1)]),a.addImageDialog.url?(c(),g("img",{key:0,src:a.addImageDialog.url,class:"mt-2 w-full rounded-lg"},null,8,B)):V("",!0)]),actions:l(()=>[n(d,{variant:"solid",onClick:e[1]||(e[1]=s=>o.addImage(a.addImageDialog.url))},{default:l(()=>[S]),_:1}),n(d,{onClick:o.reset},{default:l(()=>[N]),_:1},8,["onClick"])]),_:1},8,["modelValue","onAfterLeave"])],64)}var F=f(b,[["render",A]]);export{F as default};
import{_ as f,j as I,Y as _,$ as h,e as g,T as D,U as v,V as y,f as n,w as l,F as w,g as m,o as c,m as i,t as C,p as b,v as u}from"./vendor.3e69a9be.js";const V={name:"InsertImage",props:["editor"],expose:["openDialog"],data(){return{addImageDialog:{url:"",file:null,show:!1}}},components:{Button:I,Dialog:_},methods:{openDialog(){this.addImageDialog.show=!0},onImageSelect(t){let e=t.target.files[0];!e||(this.addImageDialog.file=e,h(e).then(r=>{this.addImageDialog.url=r}))},addImage(t){this.editor.chain().focus().setImage({src:t}).run(),this.reset()},reset(){this.addImageDialog=this.$options.data().addImageDialog}}},k={class:"relative cursor-pointer rounded-lg bg-gray-100 py-1 focus-within:bg-gray-200 hover:bg-gray-200"},x={class:"absolute inset-0 select-none px-2 py-1 text-base"},B=["src"],S=u(" Insert Image "),N=u(" Cancel ");function A(t,e,r,T,a,o){const d=m("Button"),p=m("Dialog");return c(),g(w,null,[D(t.$slots,"default",v(y({onClick:o.openDialog}))),n(p,{options:{title:"Add Image"},modelValue:a.addImageDialog.show,"onUpdate:modelValue":e[2]||(e[2]=s=>a.addImageDialog.show=s),onAfterLeave:o.reset},{"body-content":l(()=>[i("label",k,[i("input",{type:"file",class:"w-full opacity-0",onChange:e[0]||(e[0]=(...s)=>o.onImageSelect&&o.onImageSelect(...s)),accept:"image/*"},null,32),i("span",x,C(a.addImageDialog.file?"Select another image":"Select an image"),1)]),a.addImageDialog.url?(c(),g("img",{key:0,src:a.addImageDialog.url,class:"mt-2 w-full rounded-lg"},null,8,B)):b("",!0)]),actions:l(()=>[n(d,{variant:"solid",onClick:e[1]||(e[1]=s=>o.addImage(a.addImageDialog.url))},{default:l(()=>[S]),_:1}),n(d,{onClick:o.reset},{default:l(()=>[N]),_:1},8,["onClick"])]),_:1},8,["modelValue","onAfterLeave"])],64)}var F=f(V,[["render",A]]);export{F as default};

View file

@ -1 +1 @@
import{_ as d,j as g,X as m,Y as L,e as f,T as p,U as c,V as D,f as i,w as l,F as h,g as a,o as _,Z as v,v as w}from"./vendor.99304cc5.js";const V={name:"InsertLink",props:["editor"],components:{Button:g,FormControl:m,Dialog:L},data(){return{setLinkDialog:{url:"",show:!1}}},methods:{openDialog(){let t=this.editor.getAttributes("link").href;t&&(this.setLinkDialog.url=t),this.setLinkDialog.show=!0},setLink(t){t===""?this.editor.chain().focus().extendMarkRange("link").unsetLink().run():this.editor.chain().focus().extendMarkRange("link").setLink({href:t}).run(),this.setLinkDialog.show=!1,this.setLinkDialog.url=""},reset(){this.setLinkDialog=this.$options.data().setLinkDialog}}},x=w(" Save ");function C(t,e,B,F,n,s){const r=a("FormControl"),u=a("Button"),k=a("Dialog");return _(),f(h,null,[p(t.$slots,"default",c(D({onClick:s.openDialog}))),i(k,{options:{title:"Set Link"},modelValue:n.setLinkDialog.show,"onUpdate:modelValue":e[3]||(e[3]=o=>n.setLinkDialog.show=o),onAfterLeave:s.reset},{"body-content":l(()=>[i(r,{type:"text",label:"URL",modelValue:n.setLinkDialog.url,"onUpdate:modelValue":e[0]||(e[0]=o=>n.setLinkDialog.url=o),onKeydown:e[1]||(e[1]=v(o=>s.setLink(o.target.value),["enter"]))},null,8,["modelValue"])]),actions:l(()=>[i(u,{variant:"solid",onClick:e[2]||(e[2]=o=>s.setLink(n.setLinkDialog.url))},{default:l(()=>[x]),_:1})]),_:1},8,["modelValue","onAfterLeave"])],64)}var U=d(V,[["render",C]]);export{U as default};
import{_ as d,j as g,X as m,Y as L,e as f,T as p,U as D,V as c,f as i,w as l,F as h,g as a,o as _,Z as v,v as w}from"./vendor.3e69a9be.js";const V={name:"InsertLink",props:["editor"],components:{Button:g,FormControl:m,Dialog:L},data(){return{setLinkDialog:{url:"",show:!1}}},methods:{openDialog(){let t=this.editor.getAttributes("link").href;t&&(this.setLinkDialog.url=t),this.setLinkDialog.show=!0},setLink(t){t===""?this.editor.chain().focus().extendMarkRange("link").unsetLink().run():this.editor.chain().focus().extendMarkRange("link").setLink({href:t}).run(),this.setLinkDialog.show=!1,this.setLinkDialog.url=""},reset(){this.setLinkDialog=this.$options.data().setLinkDialog}}},x=w(" Save ");function C(t,e,B,F,n,s){const r=a("FormControl"),u=a("Button"),k=a("Dialog");return _(),f(h,null,[p(t.$slots,"default",D(c({onClick:s.openDialog}))),i(k,{options:{title:"Set Link"},modelValue:n.setLinkDialog.show,"onUpdate:modelValue":e[3]||(e[3]=o=>n.setLinkDialog.show=o),onAfterLeave:s.reset},{"body-content":l(()=>[i(r,{type:"text",label:"URL",modelValue:n.setLinkDialog.url,"onUpdate:modelValue":e[0]||(e[0]=o=>n.setLinkDialog.url=o),onKeydown:e[1]||(e[1]=v(o=>s.setLink(o.target.value),["enter"]))},null,8,["modelValue"])]),actions:l(()=>[i(u,{variant:"solid",onClick:e[2]||(e[2]=o=>s.setLink(n.setLinkDialog.url))},{default:l(()=>[x]),_:1})]),_:1},8,["modelValue","onAfterLeave"])],64)}var U=d(V,[["render",C]]);export{U as default};

View file

@ -1 +1 @@
import{_ as D,j as v,Y as h,a0 as C,e as u,T as k,U as w,V as x,f as t,w as i,F as B,g as r,o as c,m as U,v as n,t as y,N as F,p}from"./vendor.99304cc5.js";const N={name:"InsertImage",props:["editor"],expose:["openDialog"],data(){return{addVideoDialog:{url:"",file:null,show:!1}}},components:{Button:v,Dialog:h,FileUploader:C},methods:{openDialog(){this.addVideoDialog.show=!0},onVideoSelect(l){let o=l.target.files[0];!o||(this.addVideoDialog.file=o)},addVideo(l){this.editor.chain().focus().insertContent(`<video src="${l}"></video>`).run(),this.reset()},reset(){this.addVideoDialog=this.$options.data().addVideoDialog}}},I={class:"flex items-center space-x-2"},S=n(" Remove "),A=["src"],j=n(" Insert Video "),L=n("Cancel");function P(l,o,R,T,e,s){const a=r("Button"),V=r("FileUploader"),g=r("Dialog");return c(),u(B,null,[k(l.$slots,"default",w(x({onClick:s.openDialog}))),t(g,{options:{title:"Add Video"},modelValue:e.addVideoDialog.show,"onUpdate:modelValue":o[2]||(o[2]=d=>e.addVideoDialog.show=d),onAfterLeave:s.reset},{"body-content":i(()=>[t(V,{"file-types":"video/*",onSuccess:o[0]||(o[0]=d=>e.addVideoDialog.url=d.file_url)},{default:i(({file:d,progress:f,uploading:_,openFileSelector:m})=>[U("div",I,[t(a,{onClick:m},{default:i(()=>[n(y(_?`Uploading ${f}%`:e.addVideoDialog.url?"Change Video":"Upload Video"),1)]),_:2},1032,["onClick"]),e.addVideoDialog.url?(c(),F(a,{key:0,onClick:()=>{e.addVideoDialog.url=null,e.addVideoDialog.file=null}},{default:i(()=>[S]),_:2},1032,["onClick"])):p("",!0)])]),_:1}),e.addVideoDialog.url?(c(),u("video",{key:0,src:e.addVideoDialog.url,class:"mt-2 w-full rounded-lg",type:"video/mp4",controls:""},null,8,A)):p("",!0)]),actions:i(()=>[t(a,{variant:"solid",onClick:o[1]||(o[1]=d=>s.addVideo(e.addVideoDialog.url))},{default:i(()=>[j]),_:1}),t(a,{onClick:s.reset},{default:i(()=>[L]),_:1},8,["onClick"])]),_:1},8,["modelValue","onAfterLeave"])],64)}var z=D(N,[["render",P]]);export{z as default};
import{_ as D,j as v,Y as h,a0 as C,e as u,T as k,U as w,V as x,f as t,w as i,F as B,g as r,o as c,m as U,v as n,t as y,N as F,p}from"./vendor.3e69a9be.js";const N={name:"InsertImage",props:["editor"],expose:["openDialog"],data(){return{addVideoDialog:{url:"",file:null,show:!1}}},components:{Button:v,Dialog:h,FileUploader:C},methods:{openDialog(){this.addVideoDialog.show=!0},onVideoSelect(l){let o=l.target.files[0];!o||(this.addVideoDialog.file=o)},addVideo(l){this.editor.chain().focus().insertContent(`<video src="${l}"></video>`).run(),this.reset()},reset(){this.addVideoDialog=this.$options.data().addVideoDialog}}},I={class:"flex items-center space-x-2"},S=n(" Remove "),A=["src"],b=n(" Insert Video "),j=n("Cancel");function L(l,o,P,R,e,a){const s=r("Button"),V=r("FileUploader"),g=r("Dialog");return c(),u(B,null,[k(l.$slots,"default",w(x({onClick:a.openDialog}))),t(g,{options:{title:"Add Video"},modelValue:e.addVideoDialog.show,"onUpdate:modelValue":o[2]||(o[2]=d=>e.addVideoDialog.show=d),onAfterLeave:a.reset},{"body-content":i(()=>[t(V,{"file-types":"video/*",onSuccess:o[0]||(o[0]=d=>e.addVideoDialog.url=d.file_url)},{default:i(({file:d,progress:f,uploading:_,openFileSelector:m})=>[U("div",I,[t(s,{onClick:m},{default:i(()=>[n(y(_?`Uploading ${f}%`:e.addVideoDialog.url?"Change Video":"Upload Video"),1)]),_:2},1032,["onClick"]),e.addVideoDialog.url?(c(),F(s,{key:0,onClick:()=>{e.addVideoDialog.url=null,e.addVideoDialog.file=null}},{default:i(()=>[S]),_:2},1032,["onClick"])):p("",!0)])]),_:1}),e.addVideoDialog.url?(c(),u("video",{key:0,src:e.addVideoDialog.url,class:"mt-2 w-full rounded-lg",type:"video/mp4",controls:""},null,8,A)):p("",!0)]),actions:i(()=>[t(s,{variant:"solid",onClick:o[1]||(o[1]=d=>a.addVideo(e.addVideoDialog.url))},{default:i(()=>[b]),_:1}),t(s,{onClick:a.reset},{default:i(()=>[j]),_:1},8,["onClick"])]),_:1},8,["modelValue","onAfterLeave"])],64)}var z=D(N,[["render",L]]);export{z as default};

View file

@ -1 +1 @@
import{l as f,r as g,e as r,f as o,w as m,g as i,o as n,m as w,n as x,u as t,t as h,p as y,q as b,v}from"./vendor.99304cc5.js";import{s}from"./index.87704181.js";const V={class:"m-3 flex flex-row items-center justify-center"},A=["onSubmit"],C={key:0},D={key:1},S=v("Login"),k={key:2,class:"text-red-500"},N=f({setup(B){const a=g({forAdmin:!1});function p(d){let e=new FormData(d.target);a.forAdmin?s.login.submit({email:e.get("email"),password:e.get("password")}):s.supplier_login.submit({supplier_id:e.get("supplier_id")})}return(d,e)=>{const l=i("Input"),u=i("Button"),c=i("Card");return n(),r("div",V,[o(c,{title:"Welcome to Supplier Portal!",class:"w-full max-w-md mt-4"},{default:m(()=>[w("form",{class:"flex flex-col space-y-2 w-full",onSubmit:b(p,["prevent"])},[o(x,{modelValue:t(a).forAdmin,"onUpdate:modelValue":e[0]||(e[0]=_=>t(a).forAdmin=_),label:"Login as Admin"},null,8,["modelValue"]),t(a).forAdmin?(n(),r("div",C,[o(l,{required:"",name:"email",type:"text",placeholder:"username@email.com",label:"User ID"}),o(l,{required:"",name:"password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022",label:"Password"})])):(n(),r("div",D,[o(l,{required:"",name:"supplier_id",type:"text",placeholder:"Supplier ID",label:"Supplier ID"})])),o(u,{loading:t(s).login.loading,appearance:"primary"},{default:m(()=>[S]),_:1},8,["loading"]),t(s).login.error?(n(),r("div",k,h(t(s).login.error),1)):y("",!0)],40,A)]),_:1})])}}});export{N as default};
import{l as f,r as g,e as r,f as o,w as m,g as i,o as n,m as w,n as x,u as t,t as b,p as h,q as y,v}from"./vendor.3e69a9be.js";import{s}from"./index.a459834f.js";const V={class:"m-3 flex flex-row items-center justify-center"},A=["onSubmit"],C={key:0},D={key:1},S=v("Login"),k={key:2,class:"text-red-500"},N=f({setup(B){const a=g({forAdmin:!1});function p(d){let e=new FormData(d.target);a.forAdmin?s.login.submit({email:e.get("email"),password:e.get("password")}):s.supplier_login.submit({supplier_id:e.get("supplier_id")})}return(d,e)=>{const l=i("Input"),u=i("Button"),c=i("Card");return n(),r("div",V,[o(c,{title:"Welcome to Supplier Portal!",class:"w-full max-w-md mt-4"},{default:m(()=>[w("form",{class:"flex flex-col space-y-2 w-full",onSubmit:y(p,["prevent"])},[o(x,{modelValue:t(a).forAdmin,"onUpdate:modelValue":e[0]||(e[0]=_=>t(a).forAdmin=_),label:"Login as Admin"},null,8,["modelValue"]),t(a).forAdmin?(n(),r("div",C,[o(l,{required:"",name:"email",type:"text",placeholder:"username@email.com",label:"User ID"}),o(l,{required:"",name:"password",type:"password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022",label:"Password"})])):(n(),r("div",D,[o(l,{required:"",name:"supplier_id",type:"text",placeholder:"Supplier ID",label:"Supplier ID"})])),o(u,{loading:t(s).login.loading,appearance:"primary"},{default:m(()=>[S]),_:1},8,["loading"]),t(s).login.error?(n(),r("div",k,b(t(s).login.error),1)):h("",!0)],40,A)]),_:1})])}}});export{N as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
input.form-control-plaintext[data-v-7312333a]:focus,.currency-fmt[data-v-7312333a]{background-color:#fff;border-color:#fff;box-shadow:none}.currency-fmt+input.form-control[data-v-7312333a]{background-color:#fff;border-color:#fff;box-shadow:none}tr[data-v-7312333a]{vertical-align:middle}

View file

@ -0,0 +1 @@
input.form-control-plaintext[data-v-0c596e92]:focus,.currency-fmt[data-v-0c596e92]{background-color:#fff;border-color:#fff;box-shadow:none}.currency-fmt+input.form-control[data-v-0c596e92]{background-color:#fff;border-color:#fff;box-shadow:none}tr[data-v-0c596e92]{vertical-align:middle}

View file

@ -0,0 +1 @@
.vr-aligned[data-v-5c4ded13]{vertical-align:middle}button.accordion-button[aria-expanded=true][data-v-5c4ded13]{color:#000}input.form-control-plaintext[data-v-5c4ded13]:focus,.input-group>input.form-control[data-v-5c4ded13]:focus,input.form-control[data-v-5c4ded13],.input-group>span[data-v-5c4ded13]{background-color:#fff;border-color:#fff;box-shadow:none}.disabled-date[data-v-5c4ded13]{color:#000;background:transparent;border:none!important;border-bottom:1px solid #ced4da!important}a[data-v-5c4ded13]{text-decoration:none;color:inherit}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
.vr-aligned[data-v-145c3c9a]{vertical-align:middle}button.accordion-button[aria-expanded=true][data-v-145c3c9a]{color:#000}input.form-control-plaintext[data-v-145c3c9a]:focus,.input-group>input.form-control[data-v-145c3c9a]:focus,input.form-control[data-v-145c3c9a],.input-group>span[data-v-145c3c9a]{background-color:#fff;border-color:#fff;box-shadow:none}.disabled-date[data-v-145c3c9a]{color:#000;background:transparent;border:none!important;border-bottom:1px solid #ced4da!important}a[data-v-145c3c9a]{text-decoration:none;color:inherit}

View file

@ -0,0 +1 @@
a[data-v-570396b7]{text-decoration:none;color:inherit}

View file

@ -1 +0,0 @@
import{_ as y,x as k,y as h,e as a,m as t,f as i,w as l,u as s,F as I,z as w,p as b,A as B,B as S,g,o as c,v as r,t as p,D as N}from"./vendor.99304cc5.js";import{s as d}from"./index.87704181.js";const _=u=>(B("data-v-6f6873f7"),u=u(),S(),u),L={class:"container-fluid"},C={class:"container mx-auto mt-5"},P={class:"row"},V=_(()=>t("div",{class:"col"},[t("h1",{class:"text-gray-900 font-bold text-[32px]"},"Invoices"),t("div",{class:"d-flex"},[t("div",null,[t("div",{class:"btn-group",role:"group","aria-label":"Basic example"})])])],-1)),j={class:"col"},$={class:"d-flex"},A={class:"ms-auto d-flex",style:{gap:"2px"}},D=_(()=>t("button",{type:"button",class:"btn btn-primary btn-dark"},"New",-1)),F={key:0,class:"container mx-auto mb-3 mt-5"},z={class:"table"},E=_(()=>t("thead",null,[t("tr",null,[t("th",{scope:"col"},"Invoice Number"),t("th",{scope:"col"},"Supplier"),t("th",{scope:"col"},"Status"),t("th",{scope:"col"},"Amount")])],-1)),M={class:"table-group-divider"},R=_(()=>t("i",{class:"bi bi-currency-dollar"},null,-1)),T={key:0,class:"flex justify-between mt-4"},q=r(" Previous Page "),G=r(" Next Page "),H={setup(u){k(()=>{window.location.origin==="https://accounting.seahavenind.com"&&window.location.replace("https://accounting.seahavenind.com/app")});let v={doctype:"Invoices",fields:["*"],orderBy:"creation desc",start:0,pageLength:5,auto:!0},o=null;return d.supplier_id&&d.isLoggedIn?(v.filters=[["supplier","=",d.supplier_id]],o=h(v)):o=h(v),o.fetch(),(J,n)=>{const m=g("router-link"),f=g("Button");return c(),a("div",L,[t("div",C,[t("div",P,[V,t("div",j,[t("div",$,[t("div",A,[i(m,{to:"/invoices/new"},{default:l(()=>[D]),_:1}),t("button",{type:"button",class:"btn btn-primary btn-dark",onClick:n[0]||(n[0]=(...e)=>s(d).logout.submit&&s(d).logout.submit(...e))}," Logout ")])])])]),s(o).data?(c(),a("div",F,[t("table",z,[E,t("tbody",M,[(c(!0),a(I,null,w(s(o).data,(e,x)=>(c(),a("tr",{key:x},[t("td",null,[i(m,{to:{name:"SupplierInvoice",params:{supplierInvoiceNumber:e.name}}},{default:l(()=>[r(p(e.name),1)]),_:2},1032,["to"])]),t("td",null,p(e.supplier),1),t("td",null,[i(s(N),null,{default:l(()=>[r(p(e.status),1)]),_:2},1024)]),t("td",null,[R,r(" "+p(e.total_amount),1)])]))),128))])])])):b("",!0)]),s(o).length>10?(c(),a("div",T,[i(f,{onClick:n[1]||(n[1]=e=>s(o).previous())},{default:l(()=>[q]),_:1}),i(f,{onClick:n[2]||(n[2]=e=>s(o).next())},{default:l(()=>[G]),_:1})])):b("",!0)])}}};var Q=y(H,[["__scopeId","data-v-6f6873f7"]]);export{Q as default};

View file

@ -0,0 +1 @@
import{_ as y,x as k,y as h,e as a,m as t,f as i,w as l,u as o,F as I,z as w,p as f,A as B,B as S,g,o as c,v as r,t as p,D as N}from"./vendor.3e69a9be.js";import{s as d}from"./index.a459834f.js";const _=u=>(B("data-v-570396b7"),u=u(),S(),u),L={class:"container-fluid"},C={class:"container mx-auto mt-5"},P={class:"row"},V=_(()=>t("div",{class:"col"},[t("h1",{class:"text-gray-900 font-bold text-[32px]"},"Invoices"),t("div",{class:"d-flex"},[t("div",null,[t("div",{class:"btn-group",role:"group","aria-label":"Basic example"})])])],-1)),j={class:"col"},$={class:"d-flex"},A={class:"ms-auto d-flex",style:{gap:"2px"}},D=_(()=>t("button",{type:"button",class:"btn btn-primary btn-dark"},"New",-1)),F={key:0,class:"container mx-auto mb-3 mt-5"},z={class:"table"},E=_(()=>t("thead",null,[t("tr",null,[t("th",{scope:"col"},"Invoice Number"),t("th",{scope:"col"},"Supplier"),t("th",{scope:"col"},"Status"),t("th",{scope:"col"},"Amount")])],-1)),M={class:"table-group-divider"},R=_(()=>t("i",{class:"bi bi-currency-dollar"},null,-1)),T={key:0,class:"flex justify-between mt-4"},q=r(" Previous Page "),G=r(" Next Page "),H={setup(u){k(()=>{window.location.origin==="https://accounting.seahavenind.com"&&window.location.replace("https://accounting.seahavenind.com/app")});let v={doctype:"Purchase Invoice",fields:["*"],orderBy:"creation desc",start:0,pageLength:5,auto:!0},s=null;return d.supplier_id&&d.isLoggedIn?(v.filters=[["supplier","=",d.supplier_id]],s=h(v)):s=h(v),s.fetch(),(J,n)=>{const m=g("router-link"),b=g("Button");return c(),a("div",L,[t("div",C,[t("div",P,[V,t("div",j,[t("div",$,[t("div",A,[i(m,{to:"/invoices/new"},{default:l(()=>[D]),_:1}),t("button",{type:"button",class:"btn btn-primary btn-dark",onClick:n[0]||(n[0]=(...e)=>o(d).logout.submit&&o(d).logout.submit(...e))},"Logout")])])])]),o(s).data?(c(),a("div",F,[t("table",z,[E,t("tbody",M,[(c(!0),a(I,null,w(o(s).data,(e,x)=>(c(),a("tr",{key:x},[t("td",null,[i(m,{to:{name:"SupplierInvoice",params:{supplierInvoiceNumber:e.name}}},{default:l(()=>[r(p(e.name),1)]),_:2},1032,["to"])]),t("td",null,p(e.supplier),1),t("td",null,[i(o(N),null,{default:l(()=>[r(p(e.status),1)]),_:2},1024)]),t("td",null,[R,r(" "+p(e.grand_total),1)])]))),128))])])])):f("",!0)]),o(s).length>10?(c(),a("div",T,[i(b,{onClick:n[1]||(n[1]=e=>o(s).previous())},{default:l(()=>[q]),_:1}),i(b,{onClick:n[2]||(n[2]=e=>o(s).next())},{default:l(()=>[G]),_:1})])):f("",!0)])}}};var Q=y(H,[["__scopeId","data-v-570396b7"]]);export{Q as default};

View file

@ -1 +0,0 @@
a[data-v-6f6873f7]{text-decoration:none;color:inherit}

View file

@ -1 +0,0 @@
var h=(e,o,n)=>new Promise((s,r)=>{var t=p=>{try{a(n.next(p))}catch(g){r(g)}},c=p=>{try{a(n.throw(p))}catch(g){r(g)}},a=p=>p.done?s(p.value):Promise.resolve(p.value).then(t,c);a((n=n.apply(e,o)).next())});import{c as m,r as L,a as I,b as k,d as S,_ as y,e as E,f as P,g as b,o as C,h as R,s as T,i as w,j as $,C as U,I as j,k as O}from"./vendor.99304cc5.js";const A=function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const t of r)if(t.type==="childList")for(const c of t.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&s(c)}).observe(document,{childList:!0,subtree:!0});function n(r){const t={};return r.integrity&&(t.integrity=r.integrity),r.referrerpolicy&&(t.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?t.credentials="include":r.crossorigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function s(r){if(r.ep)return;r.ep=!0;const t=n(r);fetch(r.href,t)}};A();const x="modulepreload",v={},N="/assets/suppliers_portal/supplier-portal/",d=function(o,n){return!n||n.length===0?o():Promise.all(n.map(s=>{if(s=`${N}${s}`,s in v)return;v[s]=!0;const r=s.endsWith(".css"),t=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${t}`))return;const c=document.createElement("link");if(c.rel=r?"stylesheet":x,r||(c.as="script",c.crossOrigin=""),c.href=s,document.head.appendChild(c),r)return new Promise((a,p)=>{c.addEventListener("load",a),c.addEventListener("error",p)})})).then(()=>o())},_=m({url:"frappe.auth.get_logged_user",cache:"User",onError(e){e&&e.exc_type==="AuthenticationError"&&u.push({name:"LoginPage"})}});function f(){let o=new URLSearchParams(document.cookie.split("; ").join("&")).get("user_id");return o==="Guest"&&(o=null),o}function V(){return new URLSearchParams(document.cookie.split("; ").join("&")).get("supplier_id")}function D(){return new URLSearchParams(document.cookie.split("; ").join("&")).get("supplier_name")}const i=L({supplier_login:m({url:"suppliers_portal.suppliers_portal.api.validate_supplier_id",makeParams({supplier_id:e}){return{supplier_id:e}},onSuccess(e){e&&e.status==="success"&&(_.reload(),i.user=f(),document.cookie=`supplier_id=${e.supplier_id}`,document.cookie=`supplier_name=${e.supplier_name}`,i.supplier_id=e.supplier_id,i.supplier_name=e.supplier_name,i.login.reset(),u.replace({name:"SupplierInvoiceList"}))},onError(e){console.error("Login failed",e)}}),login:m({url:"login",makeParams({email:e,password:o}){return{usr:e,pwd:o}},onSuccess(e){e&&(_.reload(),i.user=f(),document.cookie=`supplier_id=${i.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,document.cookie=`supplier_id=${i.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,i.supplier_id="",i.supplier_name="",i.login.reset(),u.replace({name:"SupplierInvoiceList"}))},onError(e){console.error("Login failed",e)}}),logout:m({url:"logout",onSuccess(){document.cookie=`supplier_id=${i.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,document.cookie=`supplier_id=${i.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,i.supplier_id="",i.supplier_name="",_.reset(),i.user=f(),u.replace({name:"Login"})}}),user:f(),supplier_id:V(),supplier_name:D(),isLoggedIn:I(()=>!!i.user)}),J=[{name:"Login",path:"/login",component:()=>d(()=>import("./Login.14c1625b.js"),["assets/Login.14c1625b.js","assets/vendor.99304cc5.js","assets/vendor.52e2d7c1.css"])},{name:"SupplierInvoiceList",path:"/",component:()=>d(()=>import("./SupplierInvoiceList.bd20c4e8.js"),["assets/SupplierInvoiceList.bd20c4e8.js","assets/SupplierInvoiceList.e8de1e21.css","assets/vendor.99304cc5.js","assets/vendor.52e2d7c1.css"])},{name:"SupplierInvoice",path:"/invoices/:supplierInvoiceNumber",component:()=>d(()=>import("./SupplierInvoice.77908b92.js"),["assets/SupplierInvoice.77908b92.js","assets/SupplierInvoice.9dfb3ca8.css","assets/vendor.99304cc5.js","assets/vendor.52e2d7c1.css"]),props:!0},{name:"SupplierInvoiceCreate",path:"/invoices/new",component:()=>d(()=>import("./NewInvoice.632d4fad.js"),["assets/NewInvoice.632d4fad.js","assets/NewInvoice.67c196f0.css","assets/vendor.99304cc5.js","assets/vendor.52e2d7c1.css"])}];let u=k({history:S("/supplier-portal"),routes:J});u.beforeEach((e,o,n)=>h(void 0,null,function*(){let s=i.isLoggedIn;try{yield _.promise}catch(r){s=!1}console.log("isLoggedIn",s),console.log("to",e),console.log("from",o),e.name==="Login"&&s?n({name:"SupplierInvoiceList"}):e.name!=="Login"&&!s?n({name:"Login"}):n()}));const q={};function B(e,o){const n=b("router-view");return C(),E("div",null,[P(n)])}var F=y(q,[["render",B]]);let l=R(F);T("resourceFetcher",O);l.use(u);l.use(w);l.component("Button",$);l.component("Card",U);l.component("Input",j);l.mount("#app");export{f as a,V as b,D as c,u as r,i as s};

View file

@ -0,0 +1 @@
var h=(e,s,i)=>new Promise((n,r)=>{var t=c=>{try{l(i.next(c))}catch(g){r(g)}},p=c=>{try{l(i.throw(c))}catch(g){r(g)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(t,p);l((i=i.apply(e,s)).next())});import{c as m,r as L,a as k,b as I,d as S,_ as y,e as E,f as P,g as b,o as C,h as R,s as T,i as w,j as $,C as U,I as j,k as O}from"./vendor.3e69a9be.js";const A=function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const t of r)if(t.type==="childList")for(const p of t.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&n(p)}).observe(document,{childList:!0,subtree:!0});function i(r){const t={};return r.integrity&&(t.integrity=r.integrity),r.referrerpolicy&&(t.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?t.credentials="include":r.crossorigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function n(r){if(r.ep)return;r.ep=!0;const t=i(r);fetch(r.href,t)}};A();const x="modulepreload",v={},N="/assets/suppliers_portal/supplier-portal/",d=function(s,i){return!i||i.length===0?s():Promise.all(i.map(n=>{if(n=`${N}${n}`,n in v)return;v[n]=!0;const r=n.endsWith(".css"),t=r?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${n}"]${t}`))return;const p=document.createElement("link");if(p.rel=r?"stylesheet":x,r||(p.as="script",p.crossOrigin=""),p.href=n,document.head.appendChild(p),r)return new Promise((l,c)=>{p.addEventListener("load",l),p.addEventListener("error",c)})})).then(()=>s())},_=m({url:"frappe.auth.get_logged_user",cache:"User",onError(e){e&&e.exc_type==="AuthenticationError"&&u.push({name:"LoginPage"})}});function f(){let s=new URLSearchParams(document.cookie.split("; ").join("&")).get("user_id");return s==="Guest"&&(s=null),s}function V(){return new URLSearchParams(document.cookie.split("; ").join("&")).get("supplier_id")}function D(){return new URLSearchParams(document.cookie.split("; ").join("&")).get("supplier_name")}const o=L({supplier_login:m({url:"suppliers_portal.suppliers_portal.api.validate_supplier_id",makeParams({supplier_id:e}){return{supplier_id:e}},onSuccess(e){e&&e.status==="success"&&(_.reload(),o.user=f(),document.cookie=`supplier_id=${e.supplier_id}`,document.cookie=`supplier_name=${e.supplier_name}`,o.supplier_id=e.supplier_id,o.supplier_name=e.supplier_name,o.login.reset(),u.replace({name:"SupplierInvoiceList"}))},onError(e){console.error("Login failed",e)}}),login:m({url:"login",makeParams({email:e,password:s}){return{usr:e,pwd:s}},onSuccess(e){e&&(_.reload(),o.user=f(),document.cookie=`supplier_id=${o.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,document.cookie=`supplier_id=${o.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,o.supplier_id="",o.supplier_name="",o.login.reset(),u.replace({name:"SupplierInvoiceList"}))},onError(e){console.error("Login failed",e)}}),logout:m({url:"logout",onSuccess(){document.cookie=`supplier_id=${o.supplier_id}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,document.cookie=`supplier_id=${o.supplier_name}; expires=Thu, 01 Jan 1970 00:00:00 UTC'`,o.supplier_id="",o.supplier_name="",_.reset(),o.user=f(),u.replace({name:"Login"})}}),user:f(),supplier_id:V(),supplier_name:D(),isLoggedIn:k(()=>!!o.user)}),J=[{name:"Login",path:"/login",component:()=>d(()=>import("./Login.2ab92036.js"),["assets/Login.2ab92036.js","assets/vendor.3e69a9be.js","assets/vendor.43acabc4.css"])},{name:"SupplierInvoiceList",path:"/",component:()=>d(()=>import("./SupplierInvoiceList.d20068c5.js"),["assets/SupplierInvoiceList.d20068c5.js","assets/SupplierInvoiceList.0fe6f3df.css","assets/vendor.3e69a9be.js","assets/vendor.43acabc4.css"])},{name:"SupplierInvoice",path:"/invoices/:supplierInvoiceNumber",component:()=>d(()=>import("./SupplierInvoice.6fa41666.js"),["assets/SupplierInvoice.6fa41666.js","assets/SupplierInvoice.062d709e.css","assets/vendor.3e69a9be.js","assets/vendor.43acabc4.css"]),props:!0},{name:"SupplierInvoiceCreate",path:"/invoices/new",component:()=>d(()=>import("./NewInvoice.15ff173a.js"),["assets/NewInvoice.15ff173a.js","assets/NewInvoice.e56a66d4.css","assets/vendor.3e69a9be.js","assets/vendor.43acabc4.css"])}];let u=I({history:S("/supplier-portal"),routes:J});u.beforeEach((e,s,i)=>h(void 0,null,function*(){let n=o.isLoggedIn;try{yield _.promise}catch(r){n=!1}e.name==="Login"&&n?i({name:"SupplierInvoiceList"}):e.name!=="Login"&&!n?i({name:"Login"}):i()}));const q={};function B(e,s){const i=b("router-view");return C(),E("div",null,[P(i)])}var F=y(q,[["render",B]]);let a=R(F);T("resourceFetcher",O);a.use(u);a.use(w);a.component("Button",$);a.component("Card",U);a.component("Input",j);a.mount("#app");export{f as a,V as b,D as c,u as r,o as s};

View file

@ -5,9 +5,9 @@
<link rel="icon" href="/assets/suppliers_portal/supplier-portal/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Supplier Portal</title>
<script type="module" crossorigin src="/assets/suppliers_portal/supplier-portal/assets/index.87704181.js"></script>
<link rel="modulepreload" href="/assets/suppliers_portal/supplier-portal/assets/vendor.99304cc5.js">
<link rel="stylesheet" href="/assets/suppliers_portal/supplier-portal/assets/vendor.52e2d7c1.css">
<script type="module" crossorigin src="/assets/suppliers_portal/supplier-portal/assets/index.a459834f.js"></script>
<link rel="modulepreload" href="/assets/suppliers_portal/supplier-portal/assets/vendor.3e69a9be.js">
<link rel="stylesheet" href="/assets/suppliers_portal/supplier-portal/assets/vendor.43acabc4.css">
<link rel="stylesheet" href="/assets/suppliers_portal/supplier-portal/assets/index.e4753eeb.css">
</head>
<body>
@ -16,6 +16,6 @@
<div id="popovers"></div>
<script> window.csrf_token = '{{ csrf_token }}'; </script>
</body>
</html>

View file

@ -1,14 +0,0 @@
import frappe
def daily_invoice_status_update():
invoices = frappe.get_all(
"Invoices",
filters={"status": ["in", ["Unpaid", "Partially Paid", "Partially Paid and Overdue"]]},
fields=["name"],
)
for invoice in invoices:
invoice_doc = frappe.get_doc("Invoices", invoice.name)
invoice_doc.update_status()
invoice_doc.save()
frappe.db.commit()

View file

@ -5,9 +5,9 @@
<link rel="icon" href="/assets/suppliers_portal/supplier-portal/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Supplier Portal</title>
<script type="module" crossorigin src="/assets/suppliers_portal/supplier-portal/assets/index.87704181.js"></script>
<link rel="modulepreload" href="/assets/suppliers_portal/supplier-portal/assets/vendor.99304cc5.js">
<link rel="stylesheet" href="/assets/suppliers_portal/supplier-portal/assets/vendor.52e2d7c1.css">
<script type="module" crossorigin src="/assets/suppliers_portal/supplier-portal/assets/index.a459834f.js"></script>
<link rel="modulepreload" href="/assets/suppliers_portal/supplier-portal/assets/vendor.3e69a9be.js">
<link rel="stylesheet" href="/assets/suppliers_portal/supplier-portal/assets/vendor.43acabc4.css">
<link rel="stylesheet" href="/assets/suppliers_portal/supplier-portal/assets/index.e4753eeb.css">
</head>
<body>
@ -16,6 +16,6 @@
<div id="popovers"></div>
<script> window.csrf_token = '{{ csrf_token }}'; </script>
</body>
</html>