Merge Invoice and Bill into Document

This commit is contained in:
Burak Çakırel
2020-12-24 01:28:38 +03:00
parent 830cc05957
commit 0c1424db47
436 changed files with 31655 additions and 37350 deletions

View File

@@ -0,0 +1,242 @@
<template>
<div class="document-add-info-content-info-business fs-exclude">
<div class="table-responsive">
<table class="table table-borderless p-0">
<tbody>
<tr>
<th class="text-right p-0">
<strong class="text-strong">{{ company.name }}</strong>
</th>
</tr>
<tr v-if="company.address">
<th class="text-right p-0">
{{ company.address }}
</th>
</tr>
<tr v-if="company.tax_number">
<th class="text-right p-0">
{{ 'general.tax_number' }}: {{ company.tax_number }}
</th>
</tr>
<tr v-if="company.phone">
<th class="text-right p-0">
{{ company.phone }}
</th>
</tr>
<tr>
<th class="text-right p-0">
{{ company.email }}
</th>
</tr>
</tbody>
</table>
</div>
<button type="button" class="btn btn-link text-right" @click="onEditCompany">{{ buttonText }}</button>
<component v-bind:is="company_html" @submit="onSubmit" @cancel="onCancel"></component>
</div>
</template>
<script>
import Vue from 'vue';
import { Select, Option, OptionGroup, ColorPicker } from 'element-ui';
import AkauntingModalAddNew from './AkauntingModalAddNew';
import AkauntingModal from './AkauntingModal';
import AkauntingMoney from './AkauntingMoney';
import AkauntingRadioGroup from './forms/AkauntingRadioGroup';
import AkauntingSelect from './AkauntingSelect';
import AkauntingDate from './AkauntingDate';
import Form from './../plugins/form';
export default {
name: 'akaunting-company-edit',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
[ColorPicker.name]: ColorPicker,
AkauntingModalAddNew,
AkauntingModal,
AkauntingMoney,
AkauntingRadioGroup,
AkauntingSelect,
AkauntingDate,
},
props: {
buttonText: {
type: String,
default: 'Edit your business address ',
description: 'Input placeholder'
},
taxNumberTax: {
type: String,
default: 'Tax Number',
description: 'Input placeholder'
},
companyId: {
type: String,
default: '',
description: 'Contact search route'
},
company: {
type: Object,
default: {},
description: 'Company object'
},
companyForm: {
type: Object,
default: function () {
return {
text: 'Add New Item',
show: false,
buttons: {}
};
},
description: "Selectbox Add New Item Feature"
},
},
data() {
return {
form: {},
company_form: {
text: this.companyForm.text,
show: false,
path: url + '/modals/companies/' + this.companyId + '/edit',
buttons: this.companyForm.buttons,
},
company_html: '',
};
},
methods: {
// Edit Company information
onEditCompany() {
let company_form = this.company_form;
window.axios.get(company_form.path)
.then(response => {
company_form.show = true;
company_form.html = response.data.html;
this.company_html = Vue.component('add-new-component', function (resolve, reject) {
resolve({
template: '<div><akaunting-modal-add-new :show="company_form.show" @submit="onSubmit" @cancel="onCancel" :buttons="company_form.buttons" :title="company_form.text" :is_component=true :message="company_form.html"></akaunting-modal-add-new></div>',
components: {
AkauntingModalAddNew,
},
data: function () {
return {
company_form: company_form,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
},
onCancel(event) {
this.$emit('cancel', event);
}
}
})
}, this);
})
.catch(e => {
console.log(e);
})
.finally(function () {
// always executed
});
},
onSubmit(event) {
this.form = event;
this.loading = true;
let data = this.form.data();
FormData.prototype.appendRecursive = function(data, wrapper = null) {
for(var name in data) {
if (wrapper) {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], wrapper + '[' + name + ']');
} else {
this.append(wrapper + '[' + name + ']', data[name]);
}
} else {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
let form_data = new FormData();
form_data.appendRecursive(data);
window.axios({
method: this.form.method,
url: this.form.action,
data: form_data,
headers: {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
this.form.loading = false;
if (response.data.success) {
let data = this.form.data();
this.company.name = data.name;
this.company.email = data.email;
this.company.tax_number = data.tax_number;
this.company.phone = data.phone;
this.company.address = data.address;
this.company_form.show = false;
this.company_form.html = '';
this.company_html = null;
this.$emit('changed', data);
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
}
})
.catch(error => {
this.form.loading = false;
console.log(error);
this.company_html = error.message;
});
},
onCancel() {
this.company_form.show = false;
this.company_form.html = null;
this.company_html = null;
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
},
},
};
</script>

View File

@@ -0,0 +1,587 @@
<template>
<div :id="'select-contact-card-' + _uid" class="form-group col-md-12 invoice-add__body__top-form__customer">
<div class="invoice-customer" :class="[{'fs-exclude': show.contact_selected}]">
<div class="document-contact-without-contact">
<div v-if="!show.contact_selected" class="document-contact-without-contact-box__customer-select fs-exclude">
<div class="aka-select aka-select--medium is-open" tabindex="0">
<div>
<div class="aka-box aka-box--large">
<div class="aka-box__content">
<div class="document-contact-without-contact-box">
<button type="button" class="btn-aka-link aka-btn--fluid document-contact-without-contact-box-btn"
@click="onContactList">
<i class="far fa-user fa-2x"></i> Add a customer
</button>
</div>
</div>
</div>
</div>
<div class="aka-select-menu" v-if="show.contact_list">
<div class="aka-select-search-container">
<span class="aka-prefixed-input aka-prefixed-input--fluid">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fa fa-search"></i>
</span>
</div>
<input
type="text"
data-input="true"
class="form-control"
autocapitalize="default" autocorrect="ON"
:placeholder="placeholder"
:ref="'input-contact-field-' + _uid"
v-model="search"
@input="onInput"
@keyup.enter="onInput"
/>
</div>
</span>
</div>
<ul class="aka-select-menu-options">
<div class="aka-select-menu-option" v-for="(contact, index) in sortContacts" :key="index" @click="onContactSeleted(index, contact.id)">
<div>
<strong class="text-strong"><span>{{ contact.name }}</span></strong>
</div>
</div>
<div class="aka-select-menu-option" v-if="!sortContacts.length">
<div>
<strong class="text-strong" v-if="!contacts.length && !search"><span>{{ noDataText }}</span></strong>
<strong class="text-strong" v-else><span>{{ noMatchingDataText }}</span></strong>
</div>
</div>
</ul>
<div class="aka-select__footer" tabindex="0" @click="onContactCreate">
<span>
<i class="fas fa-plus"></i> Create a new customer
</span>
</div>
</div>
</div>
</div>
<div v-else class="invoice-customer__with-customer__bill-to">
<div>
<span class="aka-text aka-text--block-label">Bill to</span>
</div>
<div class="table-responsive">
<table class="table table-borderless p-0">
<tbody>
<tr>
<th class="p-0">
<strong class="d-block">{{ contact.name }}</strong>
</th>
</tr>
<tr>
<th class="p-0">
{{ contact.address }}
</th>
</tr>
<tr>
<th class="p-0">
general.tax_number: {{ contact.tax_number }}
</th>
</tr>
<tr>
<th class="p-0">
{{ contact.phone }}
</th>
</tr>
<tr v-if="contact.email">
<th class="p-0">
{{ contact.email }}
</th>
</tr>
</tbody>
</table>
</div>
<button type="button" class="btn btn-link" @click="onContactEdit">Edit Test Customer</button>&nbsp;&nbsp;<button type="button" class="btn btn-link" @click="onContactList">Choose a different customer</button>
</div>
</div>
<component v-bind:is="add_new_html" @submit="onSubmit" @cancel="onCancel"></component>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { Select, Option, OptionGroup, ColorPicker } from 'element-ui';
import AkauntingModalAddNew from './AkauntingModalAddNew';
import AkauntingModal from './AkauntingModal';
import AkauntingMoney from './AkauntingMoney';
import AkauntingRadioGroup from './forms/AkauntingRadioGroup';
import AkauntingSelect from './AkauntingSelect';
import AkauntingDate from './AkauntingDate';
import Form from './../plugins/form';
export default {
name: 'akaunting-contact-card',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
[ColorPicker.name]: ColorPicker,
AkauntingModalAddNew,
AkauntingModal,
AkauntingMoney,
AkauntingRadioGroup,
AkauntingSelect,
AkauntingDate,
},
props: {
placeholder: {
type: String,
default: 'Type a contact name',
description: 'Input placeholder'
},
searchRoute: {
type: String,
default: '',
description: 'Contact search route'
},
createRoute: {
type: String,
default: '',
description: 'Contact create route'
},
selected: {
type: Object,
default: function() {
return {
index: 0,
key: '',
value: '',
type: 'customer',
id: 0,
name: '',
email: '',
tax_number: '',
currency_code: '',
phone: '',
website: '',
address: '',
reference: ''
};
},
description: 'List of Contacts'
},
contacts: {
type: Array,
default: () => [],
description: 'List of Contacts'
},
addNew: {
type: Object,
default: function () {
return {
text: 'Add New Item',
status: false,
new_text: 'New',
buttons: {}
};
},
description: "Selectbox Add New Item Feature"
},
noDataText: {
type: String,
default: 'No Data',
description: "Selectbox empty options message"
},
noMatchingDataText: {
type: String,
default: 'No Matchign Data',
description: "Selectbox search option not found item message"
},
},
data() {
return {
contact_list: [],
contact: this.selected,
search: '', // search cloumn model
show: {
contact_selected: false,
contact_list: false,
},
form: {},
add_new: {
text: this.addNew.text,
show: false,
buttons: this.addNew.buttons,
},
add_new_html: '',
};
},
methods: {
onContactList() {
this.show.contact_list = true;
this.show.contact_selected = false;
this.contact = {};
this.$emit('change', {
index: 0,
key: '',
value: '',
type: 'customer',
id: 0,
name: '',
email: '',
tax_number: '',
currency_code: '',
phone: '',
website: '',
address: '',
reference: ''
});
},
onInput() {
window.axios.get(this.searchRoute + 'search="' + this.search + '" limit:10')
.then(response => {
this.contact_list = [];
let contacts = response.data.data;
contacts.forEach(function (contact, index) {
this.contact_list.push({
index: index,
key: contact.id,
value: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
type: (contact.type) ? contact.type : 'customer',
id: contact.id,
name: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
email: (contact.email) ? contact.email : '',
tax_number: (contact.tax_number) ? contact.tax_number : '',
currency_code: (contact.currency_code) ? contact.currency_code : '',
phone: (contact.phone) ? contact.phone : '',
website: (contact.website) ? contact.website : '',
address: (contact.address) ? contact.address : '',
reference: (contact.reference) ? contact.reference : ''
});
}, this);
})
.catch(error => {
});
this.$emit('input', this.search);
},
onContactSeleted(index, contact_id) {
this.contact = this.contact_list[index];
this.show.contact_list = false;
this.show.contact_selected = true;
this.$emit('change', this.contact);
},
onContactCreate() {
let add_new = this.add_new;
window.axios.get(this.createRoute)
.then(response => {
this.show.contact_selected = false;
this.show.contact_list = false;
add_new.show = true;
add_new.html = response.data.html;
this.add_new_html = Vue.component('add-new-component', function (resolve, reject) {
resolve({
template: '<div><akaunting-modal-add-new :show="add_new.show" @submit="onSubmit" @cancel="onCancel" :buttons="add_new.buttons" :title="add_new.text" :is_component=true :message="add_new.html"></akaunting-modal-add-new></div>',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
[ColorPicker.name]: ColorPicker,
AkauntingModalAddNew,
AkauntingModal,
AkauntingMoney,
AkauntingRadioGroup,
AkauntingSelect,
AkauntingDate,
},
data: function () {
return {
add_new: add_new,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
},
onCancel(event) {
this.$emit('cancel', event);
}
}
})
});
})
.catch(e => {
console.log(e);
})
.finally(function () {
// always executed
});
},
onContactEdit() {
let add_new = this.add_new;
let path = this.createRoute.replace('/create', '/');
path += this.contact.id + '/edit';
window.axios.get(path)
.then(response => {
this.show.contact_selected = false;
this.show.contact_list = false;
add_new.show = true;
add_new.html = response.data.html;
this.add_new_html = Vue.component('add-new-component', function (resolve, reject) {
resolve({
template: '<div><akaunting-modal-add-new :show="add_new.show" @submit="onSubmit" @cancel="onCancel" :buttons="add_new.buttons" :title="add_new.text" :is_component=true :message="add_new.html"></akaunting-modal-add-new></div>',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
[ColorPicker.name]: ColorPicker,
AkauntingModalAddNew,
AkauntingModal,
AkauntingMoney,
AkauntingRadioGroup,
AkauntingSelect,
AkauntingDate,
},
data: function () {
return {
add_new: add_new,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
},
onCancel(event) {
this.$emit('cancel', event);
}
}
})
});
})
.catch(e => {
console.log(e);
})
.finally(function () {
// always executed
});
},
onSubmit(event) {
this.form = event;
this.loading = true;
let data = this.form.data();
FormData.prototype.appendRecursive = function(data, wrapper = null) {
for(var name in data) {
if (wrapper) {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], wrapper + '[' + name + ']');
} else {
this.append(wrapper + '[' + name + ']', data[name]);
}
} else {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
let form_data = new FormData();
form_data.appendRecursive(data);
window.axios({
method: this.form.method,
url: this.form.action,
data: form_data,
headers: {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
this.form.loading = false;
if (response.data.success) {
let contact = response.data.data;
this.contact = contact;
this.show.contact_list = false;
this.show.contact_selected = true;
this.add_new.show = false;
this.add_new.html = '';
this.add_new_html = null;
this.$emit('new', contact);
this.$emit('change', this.contact);
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
}
})
.catch(error => {
this.form.loading = false;
console.log(error);
});
},
onCancel() {
this.add_new.show = false;
this.add_new.html = null;
this.add_new_html = null;
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
},
closeIfClickedOutside(event) {
if (!document.getElementById('select-contact-card-' + this._uid).contains(event.target) && event.target.className != 'btn btn-link') {
this.show.contact_list = false;
document.removeEventListener('click', this.closeIfClickedOutside);
}
},
},
created() {
// Option set sort_option data
if (!Array.isArray(this.contacts)) {
let index = 0;
for (const [key, value] of Object.entries(this.contacts)) {
this.contact_list.push({
index: index,
key: key,
value: value,
type: 'customer',
id: key,
name: value,
email: '',
tax_number: '',
currency_code: '',
phone: '',
website: '',
address: '',
reference: ''
});
index++;
}
} else {
this.contacts.forEach(function (contact, index) {
this.contact_list.push({
index: index,
key: contact.id,
value: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
type: (contact.type) ? contact.type : 'customer',
id: contact.id,
name: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
email: (contact.email) ? contact.email : '',
tax_number: (contact.tax_number) ? contact.tax_number : '',
currency_code: (contact.currency_code) ? contact.currency_code : '',
phone: (contact.phone) ? contact.phone : '',
website: (contact.website) ? contact.website : '',
address: (contact.address) ? contact.address : '',
reference: (contact.reference) ? contact.reference : ''
});
}, this);
}
if (this.selected.id) {
this.show.contact_list = false;
this.show.contact_selected = true;
this.$emit('change', this.contact);
}
} ,
computed: {
sortContacts() {
this.contact_list.sort(function (a, b) {
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
return this.contact_list.filter(contact => {
return contact.value.toLowerCase().includes(this.search.toLowerCase())
});
},
},
watch: {
show: {
handler: function(newValue) {
if (newValue) {
document.addEventListener('click', this.closeIfClickedOutside);
}
},
deep: true
}
},
};
</script>
<style>
</style>

View File

@@ -0,0 +1,194 @@
<template>
<div class="item-columns-edit">
<i class="fas fa-pencil-alt"></i>
<button
type="button"
class="btn-aka-link"
@click="onEditItemColumns">
Edit columns
</button>
<component v-bind:is="edit_html" @submit="onSubmit" @cancel="onCancel"></component>
</div>
</template>
<script>
import Vue from 'vue';
import AkauntingModalAddNew from './AkauntingModalAddNew';
import Form from './../plugins/form';
export default {
name: 'akaunting-edit-item-columns',
components: {
AkauntingModalAddNew,
},
props: {
placeholder: {
type: String,
default: 'Type an item name',
description: 'Input placeholder'
},
type: {
type: String,
default: 'sale',
description: 'Show item price'
},
editColumn: {
type: Object,
default: function () {
return {
text: 'Add New Item',
status: false,
new_text: 'New',
buttons: {}
};
},
description: "Selectbox Add New Item Feature"
},
},
data() {
return {
form: {},
edit_column: {
text: this.editColumn.text,
show: false,
buttons: this.editColumn.buttons,
},
edit_html: '',
};
},
methods: {
onEditItemColumns() {
let edit_column = this.edit_column;
window.axios.get(url + '/modals/invoices/item-columns/edit')
.then(response => {
edit_column.show = true;
edit_column.html = response.data.html;
this.edit_html = Vue.component('add-new-component', function (resolve, reject) {
resolve({
template: '<div><akaunting-modal-add-new :show="edit_column.show" @submit="onSubmit" @cancel="onCancel" :buttons="edit_column.buttons" :title="edit_column.text" :is_component=true :message="edit_column.html"></akaunting-modal-add-new></div>',
components: {
AkauntingModalAddNew,
},
data: function () {
return {
edit_column: edit_column,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
},
onCancel(event) {
this.$emit('cancel', event);
}
}
})
});
})
.catch(e => {
console.log(e);
})
.finally(function () {
// always executed
});
},
onSubmit(event) {
this.form = event;
this.loading = true;
let data = this.form.data();
FormData.prototype.appendRecursive = function(data, wrapper = null) {
for(var name in data) {
if (wrapper) {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], wrapper + '[' + name + ']');
} else {
this.append(wrapper + '[' + name + ']', data[name]);
}
} else {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
let form_data = new FormData();
form_data.appendRecursive(data);
window.axios({
method: this.form.method,
url: this.form.action,
data: form_data,
headers: {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
this.form.loading = false;
if (response.data.success) {
let contact = response.data.data;
this.contact_list.push({
key: contact.id,
value: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
type: (contact.type) ? contact.type : 'customer',
id: contact.id,
name: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
address: (contact.address) ? contact.address : ''
});
this.edit_column.show = false;
this.edit_column.html = '';
this.edit_html = null;
this.$emit('new', contact);
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
}
})
.catch(error => {
this.form.loading = false;
this.form.onFail(error);
this.method_show_html = error.message;
});
},
onCancel() {
this.edit_column.show = false;
this.edit_column.html = null;
this.edit_html = null;
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
},
},
};
</script>

View File

@@ -0,0 +1,532 @@
<template>
<div :id="'select-item-button-' + _uid" class="product-select">
<div class="aka-select aka-select--fluid" :class="[{'is-open': show.item_list}]" tabindex="-1">
<div>
<button type="button" class="btn btn-link w-100" @click="onItemList">
<i class="fas fa-plus-circle"></i> &nbsp; Add an item
</button>
</div>
<div class="aka-select-menu" v-if="show.item_list">
<div class="aka-select-search-container">
<span class="aka-prefixed-input aka-prefixed-input--fluid">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fa fa-search"></i>
</span>
</div>
<input
type="text"
data-input="true"
class="form-control"
autocapitalize="default" autocorrect="ON"
:placeholder="placeholder"
:ref="'input-contact-field-' + _uid"
v-model="search"
@input="onInput"
@keyup.enter="onInput"
/>
</div>
</span>
</div>
<ul class="aka-select-menu-options">
<div class="aka-select-menu-option" v-for="(item, index) in sortItems" :key="index" @click="onItemSeleted(index, item.id)">
<div class="product-select__product">
<div class="product-select__product__column product-select__product__info">
<b class="product-select__product__info__name"><span>{{ item.name }}</span></b>
</div>
<div class="product-select__product__column product-select__product__price">
{{ item.price }}
</div>
</div>
</div>
<div class="aka-select-menu-option" v-if="!sortItems.length">
<div>
<strong class="text-strong" v-if="!items.length && !search"><span>{{ noDataText }}</span></strong>
<strong class="text-strong" v-else><span>{{ noMatchingDataText }}</span></strong>
</div>
</div>
</ul>
<div class="aka-select__footer" tabindex="0" @click="onItemCreate">
<span>
<i class="fas fa-plus"></i> Create a new item
</span>
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { Select, Option, OptionGroup, ColorPicker } from 'element-ui';
import {Money} from 'v-money';
import AkauntingModalAddNew from './AkauntingModalAddNew';
import AkauntingModal from './AkauntingModal';
import AkauntingMoney from './AkauntingMoney';
import AkauntingRadioGroup from './forms/AkauntingRadioGroup';
import AkauntingSelect from './AkauntingSelect';
import AkauntingDate from './AkauntingDate';
import Form from './../plugins/form';
export default {
name: 'akaunting-item-button',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
[ColorPicker.name]: ColorPicker,
AkauntingModalAddNew,
AkauntingModal,
AkauntingMoney,
AkauntingRadioGroup,
AkauntingSelect,
AkauntingDate,
Money,
},
props: {
placeholder: {
type: String,
default: 'Type an item name',
description: 'Input placeholder'
},
type: {
type: String,
default: 'sale',
description: 'Show item price'
},
items: {
type: Array,
default: () => [],
description: 'List of Items'
},
addNew: {
type: Object,
default: function () {
return {
text: 'Add New Item',
status: false,
new_text: 'New',
buttons: {}
};
},
description: "Selectbox Add New Item Feature"
},
noDataText: {
type: String,
default: 'No Data',
description: "Selectbox empty options message"
},
noMatchingDataText: {
type: String,
default: 'No Matchign Data',
description: "Selectbox search option not found item message"
},
currency: {
type: Object,
default: function () {
return {
decimal_mark: '.',
thousands_separator: ',',
symbol_first: 1,
symbol: '$',
precision: 2,
};
},
description: "Default currency"
},
},
data() {
return {
item_list: [],
selected_items: [],
search: '', // search cloumn model
show: {
item_selected: false,
item_list: false,
},
form: {},
add_new: {
text: this.addNew.text,
show: false,
buttons: this.addNew.buttons,
},
add_new_html: '',
money: {
decimal: this.currency.decimal_mark,
thousands: this.currency.thousands_separator,
prefix: (this.currency.symbol_first) ? this.currency.symbol : '',
suffix: (!this.currency.symbol_first) ? this.currency.symbol : '',
precision: parseInt(this.currency.precision),
masked: this.masked
}
};
},
methods: {
onItemList() {
this.show.item_list = true;
},
onInput() {
window.axios.get(url + '/common/items?search="' + this.search + '" limit:10')
.then(response => {
this.item_list = [];
let items = response.data.data;
items.forEach(function (item, index) {
this.item_list.push({
index: index,
key: item.id,
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
type: this.type,
id: item.id,
name: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
price: (item.price) ? item.price : (this.type == 'sale') ? item.sale_price : item.purchase_price,
tax_ids: (item.tax_ids) ? item.tax_ids : [],
});
}, this);
})
.catch(error => {
});
this.$emit('input', this.search);
},
onItemSeleted(index, item_id) {
let item = this.item_list[index];
this.selected_items.push(item);
this.$emit('item', item);
this.$emit('items', this.selected_items);
this.show.item_selected = false;
this.show.item_list = false;
this.search = '';
},
onItemCreate() {
this.show.item_selected = false;
this.show.item_list = false;
let add_new = this.add_new;
window.axios.get(this.createRoute)
.then(response => {
add_new.show = true;
add_new.html = response.data.html;
this.add_new_html = Vue.component('add-new-component', function (resolve, reject) {
resolve({
template: '<div><akaunting-modal-add-new :show="add_new.show" @submit="onSubmit" @cancel="onCancel" :buttons="add_new.buttons" :title="add_new.text" :is_component=true :message="add_new.html"></akaunting-modal-add-new></div>',
components: {
[Select.name]: Select,
[Option.name]: Option,
[OptionGroup.name]: OptionGroup,
[ColorPicker.name]: ColorPicker,
AkauntingModalAddNew,
AkauntingModal,
AkauntingMoney,
AkauntingRadioGroup,
AkauntingSelect,
AkauntingDate,
},
data: function () {
return {
add_new: add_new,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
},
onCancel(event) {
this.$emit('cancel', event);
}
}
})
});
})
.catch(e => {
console.log(e);
})
.finally(function () {
// always executed
});
},
onSubmit(event) {
this.form = event;
this.loading = true;
let data = this.form.data();
FormData.prototype.appendRecursive = function(data, wrapper = null) {
for(var name in data) {
if (wrapper) {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], wrapper + '[' + name + ']');
} else {
this.append(wrapper + '[' + name + ']', data[name]);
}
} else {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
let form_data = new FormData();
form_data.appendRecursive(data);
window.axios({
method: this.form.method,
url: this.form.action,
data: form_data,
headers: {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
this.form.loading = false;
if (response.data.success) {
let contact = response.data.data;
this.contact_list.push({
key: contact.id,
value: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
type: (contact.type) ? contact.type : 'customer',
id: contact.id,
name: (contact.title) ? contact.title : (contact.display_name) ? contact.display_name : contact.name,
address: (contact.address) ? contact.address : ''
});
this.add_new.show = false;
this.add_new.html = '';
this.add_new_html = null;
this.$emit('new', contact);
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
}
})
.catch(error => {
this.form.loading = false;
this.form.onFail(error);
this.method_show_html = error.message;
});
},
onCancel() {
this.add_new.show = false;
this.add_new.html = null;
this.add_new_html = null;
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
},
closeIfClickedOutside(event) {
if (!document.getElementById('select-item-button-' + this._uid).contains(event.target)) {
this.show.item_selected = false;
this.show.item_list = false;
this.search = '';
document.removeEventListener('click', this.closeIfClickedOutside);
}
},
},
created() {
// Option set sort_option data
if (!Array.isArray(this.items)) {
let index = 0;
for (const [key, value] of Object.entries(this.items)) {
this.item_list.push({
index: index,
key: key,
value: value,
type: 'item',
id: key,
name: value,
price: 0,
tax_ids: [],
});
index++;
}
} else {
this.items.forEach(function (item, index) {
this.item_list.push({
index: index,
key: item.id,
value: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
type: this.type,
id: item.id,
name: (item.title) ? item.title : (item.display_name) ? item.display_name : item.name,
price: (item.price) ? item.price : (this.type == 'sale') ? item.sale_price : item.purchase_price,
tax_ids: (item.tax_ids) ? item.tax_ids : [],
});
}, this);
}
},
computed: {
sortItems() {
this.item_list.sort(function (a, b) {
var nameA = a.value.toUpperCase(); // ignore upper and lowercase
var nameB = b.value.toUpperCase(); // ignore upper and lowercase
if (nameA < nameB) {
return -1;
}
if (nameA > nameB) {
return 1;
}
// names must be equal
return 0;
});
return this.item_list.filter(item => {
return item.value.toLowerCase().includes(this.search.toLowerCase())
});
},
},
watch: {
show: {
handler: function(newValue) {
if (newValue) {
document.addEventListener('click', this.closeIfClickedOutside);
}
},
deep: true
}
},
};
</script>
<style>
.aka-select.aka-select--fluid {
min-width: 160px;
}
.aka-select.aka-select--fluid {
max-width: 96%;
min-width: 0;
}
.product-select .aka-select-menu {
width: 100%;
min-width: 0;
padding: 0;
top: 0;
overflow: hidden;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top-width: 0;
}
.aka-select-menu {
list-style: none;
box-sizing: border-box;
margin: 0;
padding: 0;
text-align: left;
display: block;
visibility: hidden;
position: absolute;
top: 110%;
z-index: 1000;
min-width: 100%;
padding: 8px 0;
border-radius: 4px;
color: #1c252c;
background-color: white;
box-shadow: 0 0 0 1px rgba(77,101,117,0.1), 0 3px 10px 0 rgba(77,101,117,0.2);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
height: 0;
-webkit-transform: translateY(4px);
transform: translateY(4px);
overflow: hidden;
padding: 0;
right: 0;
left: 0;
top: 100%;
border-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
-webkit-transform: translateY(0);
transform: translateY(0);
}
.product-select .aka-select.aka-select--fluid.is-open {
position: absolute;
display: block;
}
.product-select__product {
display: flex;
flex-flow: row nowrap;
}
.product-select__product__column {
white-space: nowrap;
overflow: hidden;
}
.product-select__product__price {
width: 135px;
text-align: right;
}
.product-select__product__info__description, .product-select__product__info__name {
width: 710px;
display: block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.product-select__product__column {
white-space: nowrap;
overflow: hidden;
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<div class="form-group"
<div v-if="!rowInput" class="form-group"
:class="[{'has-error': error}, {'required': required}, {'readonly': readonly}, {'disabled': disabled}, col]">
<label v-if="title" :for="name" class="form-control-label">{{ title }}</label>
@@ -15,6 +15,26 @@
<div class="invalid-feedback d-block" v-if="error" v-html="error"></div>
</div>
<div v-else
:class="[{'has-error': error}, {'required': required}, {'readonly': readonly}, {'disabled': disabled}, col]">
<label v-if="title" :for="name" class="form-control-label">{{ title }}</label>
<div v-if="icon" class="input-group input-group-merge" :class="group_class">
<div v-if="icon" class="input-group-prepend">
<span class="input-group-text">
<i :class="'fa fa-' + icon"></i>
</span>
</div>
<money :name="name" @input="input" :placeholder="placeholder" v-bind="money" :value="model" :disabled="disabled" :masked="masked" class="form-control"></money>
</div>
<money v-else :name="name" @input="input" :placeholder="placeholder" v-bind="money" :value="model" :disabled="disabled" :masked="masked" class="form-control"></money>
<div class="invalid-feedback d-block" v-if="error" v-html="error"></div>
</div>
</template>
<script>
@@ -109,6 +129,11 @@ export default {
default: false,
description: "Money result value"
},
rowInput: {
type: Boolean,
default: false,
description: "Money result value"
},
},
data() {

View File

@@ -747,6 +747,26 @@ export default {
},
},
watch: {
selected: function (selected) {
if (!this.multiple) {
this.selected = selected.toString();
}
},
value: function (selected) {
this.selected = selected;
this.change();
},
model: function (selected) {
this.selected = selected;
this.change();
},
},
}
</script>

View File

@@ -3,6 +3,10 @@ import Vue from 'vue';
import axios from 'axios';
import DropzoneFileUpload from './../components/Inputs/DropzoneFileUpload';
import AkauntingContactCard from './../components/AkauntingContactCard';
import AkauntingCompanyEdit from './../components/AkauntingCompanyEdit';
import AkauntingEditItemColumns from './../components/AkauntingEditItemColumns';
import AkauntingItemButton from './../components/AkauntingItemButton';
import AkauntingSearch from './../components/AkauntingSearch';
import AkauntingModal from './../components/AkauntingModal';
import AkauntingMoney from './../components/AkauntingMoney';
@@ -27,6 +31,10 @@ import { concat } from 'lodash';
export default {
components: {
DropzoneFileUpload,
AkauntingContactCard,
AkauntingCompanyEdit,
AkauntingEditItemColumns,
AkauntingItemButton,
AkauntingSearch,
AkauntingRadioGroup,
AkauntingSelect,
@@ -51,7 +59,7 @@ export default {
data: function () {
return {
component: '',
currency: null,
currency: null
}
},
@@ -391,5 +399,17 @@ export default {
})
});
},
// Change Contact Card set form fields..
onChangeContactCard(contact) {
this.form.contact_id = contact.id;
this.form.contact_name = contact.name;
this.form.contact_email = contact.email;
this.form.contact_tax_number = contact.tax_number;
this.form.contact_phone = contact.phone;
this.form.contact_address = contact.address;
this.form.currency_code = contact.currency_code;
}
}
}
}

View File

@@ -23,6 +23,43 @@ export default class Form {
continue;
}
/*
if (name != null && name.indexOf('.') != '-1') {
let partial_name = name.split('.');
switch(partial_name.length) {
case 2:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = '';
break;
case 3:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]] = '';
break;
case 4:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]][partial_name[3]] = '';
break;
case 5:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]][partial_name[3]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]][partial_name[3]][partial_name[4]] = '';
break;
}
continue;
}
*/
if (form_element.getAttribute('data-item')) {
if (!this['items']) {
var item = {};
@@ -121,6 +158,43 @@ export default class Form {
continue;
}
/*
if (name != null && name.indexOf('.') != '-1') {
let partial_name = name.split('.');
switch(partial_name.length) {
case 2:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = '';
break;
case 3:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]] = '';
break;
case 4:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]][partial_name[3]] = '';
break;
case 5:
this[partial_name[0]] = [];
this[partial_name[0]][partial_name[1]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]][partial_name[3]] = [];
this[partial_name[0]][partial_name[1]][partial_name[2]][partial_name[3]][partial_name[4]] = '';
break;
}
continue;
}
*/
if (form_element.getAttribute('data-item')) {
if (!this['items']) {
var item = {};
@@ -275,13 +349,13 @@ export default class Form {
FormData.prototype.appendRecursive = function(data, wrapper = null) {
for(var name in data) {
if (wrapper) {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
if ((typeof data[name] == 'object' || Array.isArray(data[name])) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], wrapper + '[' + name + ']');
} else {
this.append(wrapper + '[' + name + ']', data[name]);
}
} else {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
if ((typeof data[name] == 'object' || Array.isArray(data[name])) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);

View File

@@ -0,0 +1,796 @@
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./../../bootstrap');
import Vue from 'vue';
import DashboardPlugin from './../../plugins/dashboard-plugin';
import Global from './../../mixins/global';
import Form from './../../plugins/form';
import Error from './../../plugins/error';
import BulkAction from './../../plugins/bulk-action';
// plugin setup
Vue.use(DashboardPlugin);
const app = new Vue({
el: '#app',
mixins: [
Global
],
data: function () {
return {
form: new Form('document'),
bulk_action: new BulkAction('documents'),
totals: {
sub: 0,
item_discount: '',
discount: '',
discount_text: false,
taxes: [],
total: 0
},
transaction: [],
edit: {
status: false,
currency: false,
items: 0,
},
colspan: 6,
discount: false,
tax: false,
discounts: [],
tax_id: [],
items: [],
taxes: [],
}
},
mounted() {
if ((document.getElementById('items') != null) && (document.getElementById('items').rows)) {
this.colspan = document.getElementById("items").rows[0].cells.length - 1;
}
},
methods: {
onCalculateTotal() {
let global_discount = this.discount;
let discount_total = 0;
let line_item_discount_total = 0;
let taxes = document_taxes;
let sub_total = 0;
let totals_taxes = [];
let grand_total = 0;
// items calculate
this.items.forEach(function(item) {
let discount = 0;
item.total = item.price * item.quantity;
item.grand_total = item.price * item.quantity;
// item discount calculate.
let line_discount_amount = 0;
if (item.discount) {
line_discount_amount = item.total * (item.discount / 100);
item_discounted_total = item.total -= line_discount_amount;
discount = item.discount;
}
let item_discounted_total = item.total;
if (global_discount) {
item_discounted_total = item.total - (item.total * (global_discount / 100));
discount = global_discount;
}
// item tax calculate.
if (item.tax_ids) {
let inclusives = [];
let compounds = [];
item.tax_ids.forEach(function(item_tax, item_tax_index) {
for (var index_taxes = 0; index_taxes < taxes.length; index_taxes++) {
let tax = taxes[index_taxes];
if (item_tax.id != tax.id) {
continue;
}
switch (tax.type) {
case 'inclusive':
inclusives.push({
tax_index: item_tax_index,
tax_id: tax.id,
tax_name: tax.title,
tax_rate: tax.rate
});
break;
case 'compound':
compounds.push({
tax_index: item_tax_index,
tax_id: tax.id,
tax_name: tax.title,
tax_rate: tax.rate
});
break;
case 'fixed':
item_tax.price = tax.rate * item.quantity;
totals_taxes = this.calculateTotalsTax(totals_taxes, tax.id, tax.title, item_tax.price);
item.grand_total += item_tax.price;
break;
case 'withholding':
item_tax.price = 0 - item.total * (tax.rate / 100);
totals_taxes = this.calculateTotalsTax(totals_taxes, tax.id, tax.title, item_tax.price);
item.grand_total += item_tax.price;
break;
default:
item_tax.price = item.total * (tax.rate / 100);
totals_taxes = this.calculateTotalsTax(totals_taxes, tax.id, tax.title, item_tax.price);
item.grand_total += item_tax.price;
break;
}
}
}, this);
if (inclusives.length) {
let inclusive_total = 0;
inclusives.forEach(function(inclusive) {
inclusive_total += inclusive.tax_rate;
// tax price
item.tax_ids[inclusive.tax_index].price = item.grand_total / (1 + inclusive.tax_rate / 100);
totals_taxes = this.calculateTotalsTax(totals_taxes, inclusive.tax_id, inclusive.tax_name, item.tax_ids[inclusive.tax_index].price);
}, this);
let item_base_rate = item.grand_total / (1 + inclusive_total / 100);
item.grand_total = item.grand_total - item_base_rate;
item.total = item_base_rate + discount;
}
if (compounds.length) {
let price = 0;
compounds.forEach(function(compound) {
price = (item.grand_total / 100) * compound.tax_rate;
item.tax_ids[compound.tax_index].price = price;
totals_taxes = this.calculateTotalsTax(totals_taxes, compound.tax_id, compound.tax_name, price);
}, this);
item.grand_total += price;
}
}
sub_total += item.total;
grand_total += item.grand_total;
}, this);
this.totals.sub = sub_total;
this.totals.taxes = totals_taxes;
this.totals.total = grand_total;
},
onCalculateTotal2() {
let sub_total = 0;
let discount_total = 0;
let line_item_discount_total = 0;
let tax_total = 0;
let grand_total = 0;
let items = this.items;
let discount_in_totals = this.discount;
if (items.length) {
let index = 0;
// get all items.
for (index = 0; index < items.length; index++) {
let discount = 0;
// get row item and set item variable.
let item = items[index];
// item sub total calcute.
let item_total = item.price * item.quantity;
// item discount calculate.
let line_discount_amount = 0;
if (item.discount) {
line_discount_amount = item_total * (item.discount / 100);
item_discounted_total = item_total -= line_discount_amount;
discount = item.discount;
}
let item_discounted_total = item_total;
if (discount_in_totals) {
item_discounted_total = item_total - (item_total * (discount_in_totals / 100));
discount = discount_in_totals;
}
// item tax calculate.
let item_tax_total = 0;
if (item.tax_ids) {
let inclusives = [];
let compounds = [];
let index_taxes = 0;
let taxes = document_taxes;
item.tax_ids.forEach(function(item_tax, item_tax_index) {
for (index_taxes = 0; index_taxes < taxes.length; index_taxes++) {
let tax = taxes[index_taxes];
if (item_tax.id != tax.id) {
continue;
}
switch (tax.type) {
case 'inclusive':
inclusives.push(tax);
break;
case 'compound':
compounds.push(tax);
break;
case 'fixed':
item_tax_total = tax.rate * item.quantity;
break;
case 'withholding':
item_tax_total = 0 - item.price * item.quantity * (tax.rate / 100);
break;
default:
item_tax_total = item.price * item.quantity * (tax.rate / 100);
break;
}
this.items[index].tax_ids[item_tax_index].price = item_tax_total;
}
}, this);
if (inclusives.length) {
let item_sub_and_tax_total = item_discounted_total + item_tax_total;
let inclusive_total = 0;
inclusives.forEach(function(inclusive) {
inclusive_total += inclusive.rate;
});
let item_base_rate = item_sub_and_tax_total / (1 + inclusive_total / 100);
item_tax_total = item_sub_and_tax_total - item_base_rate;
item_total = item_base_rate + discount;
}
if (compounds.length) {
compounds.forEach(function(compound) {
item_tax_total += ((item_discounted_total + item_tax_total) / 100) * compound.rate;
});
}
}
// set item total
if (item.discount) {
items[index].total = item_discounted_total;
} else {
items[index].total = item_total;
}
// calculate sub, tax, discount all items.
line_item_discount_total += line_discount_amount;
sub_total += item_total;
tax_total += item_tax_total;
}
}
// set global total variable.
this.totals.sub = sub_total;
//this.totals.taxes = Math.abs(tax_total);
this.totals.item_discount = line_item_discount_total;
// Apply discount to total
if (discount_in_totals) {
discount_total = sub_total * (discount_in_totals / 100);
this.totals.discount = discount_total;
sub_total = sub_total - (sub_total * (discount_in_totals / 100));
}
// set all item grand total.
grand_total = sub_total + tax_total;
this.totals.total = grand_total;
},
onCalculateTaxes() {
let taxes = document_taxes;
this.items.forEach(function (item, index) {
let inclusives = [];
let compounds = [];
let index_taxes = 0;
item.tax_ids.forEach(function(item_tax, item_tax_index) {
item_tax_total = 0;
for (index_taxes = 0; index_taxes < taxes.length; index_taxes++) {
let tax = taxes[index_taxes];
if (item_tax.id != tax.id) {
continue;
}
switch (tax.type) {
case 'inclusive':
inclusives.push(tax);
break;
case 'compound':
compounds.push(tax);
break;
case 'fixed':
item_tax_total += tax.rate * item.quantity;
break;
case 'withholding':
item_tax_total += 0 - item.price * (tax.rate / 100);
break;
default:
item_tax_total += item.price * (tax.rate / 100);
break;
}
}
this.items[index].tax_ids[item_tax_index].price = item_tax_total;
}, this);
if (inclusives.length) {
let item_sub_and_tax_total = item_discounted_total + item_tax_total;
let inclusive_total = 0;
inclusives.forEach(function(inclusive) {
inclusive_total += inclusive.rate;
}, this);
let item_base_rate = item_sub_and_tax_total / (1 + inclusive_total / 100);
item_tax_total = item_sub_and_tax_total - item_base_rate;
item_total = item_base_rate + discount;
}
if (compounds.length) {
compounds.forEach(function(compound) {
item_tax_total += ((item_discounted_total + item_tax_total) / 100) * compound.rate;
}, this);
}
}, this);
},
calculateTotalsTax(totals_taxes, id, name, price) {
let total_tax_index = totals_taxes.findIndex(total_tax => {
if (total_tax.id === id) {
return true;
}
}, this);
if (total_tax_index === -1) {
totals_taxes.push({
id: id,
name: name,
total: price,
});
} else {
totals_taxes[total_tax_index].total = parseFloat(totals_taxes[total_tax_index].total) + parseFloat(price);
}
return totals_taxes;
},
getItemByTaxes(item) {
let item_tax_ids = [];
let taxes = document_taxes;
let inclusives = [];
let compounds = [];
let index_taxes = 0;
let item_tax_total = 0;
item.tax_ids.forEach(function(item_tax, item_tax_index) {
item_tax_total = 0;
for (index_taxes = 0; index_taxes < taxes.length; index_taxes++) {
let tax = taxes[index_taxes];
if (item_tax.id != tax.id) {
continue;
}
switch (tax.type) {
case 'inclusive':
inclusives.push(tax);
break;
case 'compound':
compounds.push(tax);
break;
case 'fixed':
item_tax_total += tax.rate * item.quantity;
break;
case 'withholding':
item_tax_total += 0 - item.price * (tax.rate / 100);
break;
default:
item_tax_total += item.price * (tax.rate / 100);
break;
}
}
item_tax_ids.push({
id: item_tax.id,
price: item_tax_total
});
}, this);
if (inclusives.length) {
let item_sub_and_tax_total = item_discounted_total + item_tax_total;
let inclusive_total = 0;
inclusives.forEach(function(inclusive) {
inclusive_total += inclusive.rate;
}, this);
let item_base_rate = item_sub_and_tax_total / (1 + inclusive_total / 100);
item_tax_total = item_sub_and_tax_total - item_base_rate;
item_total = item_base_rate + discount;
}
if (compounds.length) {
compounds.forEach(function(compound) {
item_tax_total += ((item_discounted_total + item_tax_total) / 100) * compound.rate;
}, this);
}
return item_tax_ids;
},
// Select Item added form
onSelectedItem(item) {
let total = 1 * item.price;
let item_taxes = [];
if (item.tax_ids) {
item.tax_ids.forEach(function (tax_id, index) {
if (this.taxes.includes(tax_id)) {
this.taxes[tax_id].push(item.id);
} else {
this.taxes.push(tax_id);
this.taxes[tax_id] = [];
this.taxes[tax_id].push(item.id);
}
item_taxes.push({
id: tax_id,
price: 10,
});
}, this);
}
this.form.items.push({
item_id: item.id,
name: item.name,
description: item.description,
quantity: 1,
price: item.price,
tax_ids: item.tax_ids,
discount: 0,
total: total,
});
this.items.push({
item_id: item.id,
name: item.name,
description: item.description,
quantity: 1,
price: item.price,
add_tax: (item_taxes.length) ? true : false,
tax_ids: item_taxes,
add_discount: false,
discount: 0,
total: total,
});
this.onCalculateTotal();
},
onSelectedTax(item_index) {
if (!this.tax_id) {
return;
}
let selected_tax;
document_taxes.forEach(function(tax) {
if (tax.id == this.tax_id) {
selected_tax = tax;
}
}, this);
this.items[item_index].tax_ids.push({
id: selected_tax.id,
name: selected_tax.title,
price: 0
});
this.form.items[item_index].tax_ids.push(this.tax_id);
if (this.taxes.includes(this.tax_id)) {
this.taxes[this.tax_id].push(this.items[item_index].item_id);
} else {
this.taxes[this.tax_id] = [];
this.taxes[this.tax_id].push(this.items[item_index].item_id);
}
this.tax_id = '';
this.onCalculateTotal();
},
// remove document item row => row_id = index
onDeleteItem(index) {
this.items.splice(index, 1);
this.form.items.splice(index, 1);
this.onCalculateTotal();
},
onAddDiscount(item_index) {
this.items[item_index].add_discount = true;
},
onDeleteDiscount(item_index) {
this.items[item_index].add_discount = false;
},
onAddTax(item_index) {
this.items[item_index].add_tax = true;
},
onDeleteTax(item_index, tax_index) {
this.items[item_index].tax_ids.splice(tax_index, 1);
this.form.items[item_index].tax_ids.splice(tax_index, 1);
if (!this.items[item_index].tax_ids.length) {
this.items[item_index].add_tax = false;
}
this.onCalculateTotal();
},
async onPayment() {
let document_id = document.getElementById('document_id').value;
let payment = {
modal: false,
url: url + '/modals/documents/' + document_id + '/transactions/create',
title: '',
html: '',
buttons:{}
};
let payment_promise = Promise.resolve(window.axios.get(payment.url));
payment_promise.then(response => {
payment.modal = true;
payment.title = response.data.data.title;
payment.html = response.data.html;
payment.buttons = response.data.data.buttons;
this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-payment-component"><akaunting-modal-add-new modal-dialog-class="modal-md" :show="payment.modal" @submit="onSubmit" @cancel="onCancel" :buttons="payment.buttons" :title="payment.title" :is_component=true :message="payment.html"></akaunting-modal-add-new></div>',
mixins: [
Global
],
data: function () {
return {
form:{},
payment: payment,
}
},
methods: {
onSubmit(event) {
this.form = event;
this.form.response = {};
this.loading = true;
let data = this.form.data();
FormData.prototype.appendRecursive = function(data, wrapper = null) {
for(var name in data) {
if (wrapper) {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], wrapper + '[' + name + ']');
} else {
this.append(wrapper + '[' + name + ']', data[name]);
}
} else {
if ((typeof data[name] == 'object' || data[name].constructor === Array) && ((data[name] instanceof File != true ) && (data[name] instanceof Blob != true))) {
this.appendRecursive(data[name], name);
} else {
this.append(name, data[name]);
}
}
}
};
let form_data = new FormData();
form_data.appendRecursive(data);
window.axios({
method: this.form.method,
url: this.form.action,
data: form_data,
headers: {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'multipart/form-data'
}
})
.then(response => {
if (response.data.success) {
if (response.data.redirect) {
this.form.loading = true;
window.location.href = response.data.redirect;
}
}
if (response.data.error) {
this.form.loading = false;
this.form.response = response.data;
}
})
.catch(error => {
this.form.loading = false;
this.form.onFail(error);
this.method_show_html = error.message;
});
},
onCancel() {
this.payment.modal = false;
this.payment.html = null;
let documentClasses = document.body.classList;
documentClasses.remove("modal-open");
},
}
})
});
})
.catch(error => {
})
.finally(function () {
// always executed
});
},
},
created() {
this.form.items = [];
if (typeof document_items !== 'undefined' && document_items) {
this.edit.status = true;
document_items.forEach(function(item) {
// form set item
this.form.items.push({
item_id: item.item_id,
name: item.name,
description: item.description,
quantity: item.quantity,
price: (item.price).toFixed(2),
tax_ids: item.tax_ids,
discount: item.discount_rate,
total: (item.total).toFixed(2)
});
if (item.tax_ids) {
item.tax_ids.forEach(function (tax_id, index) {
if (this.taxes.includes(tax_id)) {
this.taxes[tax_id].push(item.id);
} else {
this.taxes.push(tax_id);
this.taxes[tax_id] = [];
this.taxes[tax_id].push(item.id);
}
}, this);
}
let item_taxes = [];
item.taxes.forEach(function(item_tax) {
item_taxes.push({
id: item_tax.tax_id,
name: item_tax.name,
price: (item_tax.amount).toFixed(2),
});
});
this.items.push({
item_id: item.item_id,
name: item.name,
description: item.description,
quantity: item.quantity,
price: (item.price).toFixed(2),
add_tax: (item_taxes.length) ? true : false,
tax_ids: item_taxes,
add_discount: (item_taxes.length) ? true : false,
discount: item.discount_rate,
total: (item.total).toFixed(2)
});
}, this);
this.items.forEach(function(item) {
item.tax_ids.forEach(function(tax) {
let total_tax_index = this.totals.taxes.findIndex(total_tax => {
if (total_tax.id === tax.id) {
return true;
}
}, this);
if (total_tax_index === -1) {
this.totals.taxes.push({
id: tax.id,
name: tax.name,
total: tax.price,
});
} else {
this.totals.taxes[total_tax_index].total = parseFloat(this.totals.taxes[total_tax_index].total) + parseFloat(tax.price);
}
}, this);
}, this);
}
}
});

View File

@@ -54,11 +54,20 @@ const app = new Vue({
let method = payment_method.split('.');
let path = url + '/portal/invoices/' + this.form.invoice_id + '/' + method[0];
let path = url + '/portal/invoices/' + this.form.document_id + '/' + method[0];
//this.method_show_html = '<div id="loading" class="text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>';
this.method_show_html = Vue.component('payment-method-confirm', function (resolve, reject) {
resolve({
template:'<div id="loading" class="description text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>'
})
});
axios.get(path)
axios.get(path, {
params: {
payment_method: payment_method
}
})
.then(response => {
this.method_show_html = '';
@@ -130,6 +139,13 @@ const app = new Vue({
let payment_action = payment_action_path[payment_method];
this.method_show_html = Vue.component('payment-method-confirm', function (resolve, reject) {
resolve({
template:'<div id="loading" class="description text-center"><i class="fa fa-spinner fa-spin fa-5x checkout-spin"></i></div>'
})
});
axios.get(payment_action)
.then(response => {
this.method_show_html = '';

View File

@@ -104,6 +104,8 @@ return [
'from' => 'From',
'to' => 'To',
'print' => 'Print',
'download_pdf' => 'Download PDF',
'customize' => 'Customize',
'search' => 'Search',
'search_text' => 'Search for this text',
'search_placeholder' => 'Type to search..',
@@ -155,6 +157,9 @@ return [
'go_to_dashboard' => 'Go to dashboard',
'is' => 'is',
'isnot' => 'is not',
'recurring_and_more' => 'Recurring and more..',
'due_on' => 'Due on',
'amount_due' => 'Amount due',
'card' => [
'name' => 'Name on Card',
@@ -187,6 +192,8 @@ return [
'placeholder' => [
'search' => 'Type to search..',
'search_and_filter' => 'Search or filter results..',
'contact_search' => 'Type a :type name',
'item_search' => 'Type an item name',
],
'date_range' => [

View File

@@ -0,0 +1,29 @@
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-recurring-and-more-header" data-toggle="collapse" data-target="#accordion-recurring-and-more-body" aria-expanded="false" aria-controls="accordion-recurring-and-more-body">
<h4 class="mb-0">{{ trans('general.recurring_and_more') }}</h4>
</div>
<div id="accordion-recurring-and-more-body" class="collapse hide" aria-labelledby="accordion-recurring-and-more-header">
<div class="card-body">
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
@if (!$hideRecurring)
{{ Form::recurring('create') }}
@endif
</div>
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
@if (!$hideCategory)
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.' . $category_type . '_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=' . $category_type, 'remote_action' => route('categories.index'). '?type=' . $category_type], 'col-md-12') }}
@endif
@if (!$hideAttachment)
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
@endif
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,8 @@
<div class="card">
<div class="card-footer">
<div class="row save-buttons">
{{ Form::saveButtons('invoices.index') }}
</div>
</div>
</div>

View File

@@ -0,0 +1,51 @@
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-company-header" data-toggle="collapse" data-target="#accordion-company-body" aria-expanded="false" aria-controls="accordion-company-body">
<h4 class="mb-0">{{ trans_choice('general.companies', 1) }}</h4>
</div>
<div id="accordion-company-body" class="collapse hide" aria-labelledby="accordion-company-header">
<div class="card-body">
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
@if (!$hideLogo)
{{ Form::fileGroup('company_logo', trans('settings.company.logo'), 'file-image-o', [], setting('company.logo')) }}
@endif
</div>
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
@if (!$hideDocumentTitle)
{{ Form::textGroup($inputNameType . '_title', trans('settings.' . $type . '.title'), 'font', [], setting($type . '.title'), 'col-md-12') }}
@endif
@if (!$hideDocumentSubheading)
{{ Form::textGroup($inputNameType . '_subheading', trans('settings.' . $type . '.subheading'), 'font', [], setting($type . '.subheading'), 'col-md-12') }}
@endif
@if (!$hideCompanyEdit)
<akaunting-company-edit company-id="{{ session('company_id') }}"
button-text="{{ trans('Edit your business address') }}"
taxt-number-text="{{ trans('general.tax_number') }}"
:company="{{ json_encode($company) }}"
:company-form="{{ json_encode([
'show' => true,
'text' => trans('Edit your business address'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
></akaunting-company-edit>
@endif
</div>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,74 @@
@if (empty($document))
{!! Form::open([
'route' => $formRoute,
'id' => $formId,
'@submit.prevent' => $formSubmit,
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
@else
{!! Form::model($document, [
'route' => [$formRoute, $document->id],
'id' => $formId,
'method' => 'PATCH',
'@submit.prevent' => $formSubmit,
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
@endif
@if (!$hideCompany)
<x-documents.form.company
type="{{ $type }}"
hide-logo="{{ $hideLogo }}"
hide-document-title="{{ $hideDocumentTitle }}"
hide-document-subheading="{{ $hideDocumentSubheading }}"
hide-company-edit="{{ $hideCompanyEdit }}"
/>
@endif
<x-documents.form.main
type="{{ $type }}"
:document="$document"
hide-contact="{{ $hideContact }}"
contact-type="{{ $contactType }}"
hide-issue-at="{{ $hideIssuedAt }}"
text-issue-at="{{ $textIssuedAt }}"
hide-document-number="{{ $hideDocumentNumber }}"
text-document-number="{{ $textDocumentNumber }}"
hide-due-at="{{ $hideDueAt }}"
text-due-at="{{ $textDueAt }}"
hide-order-number="{{ $hideOrderNumber }}"
text-order-number="{{ $textOrderNumber }}"
/>
@if (!$hideFooter)
<x-documents.form.footer type="{{ $type }}" :document="$document" />
@endif
@if (!$hideAdvanced)
<x-documents.form.advanced
type="{{ $type }}"
:document="$document"
hide-recurring="{{ $hideRecurring }}"
hide-category="{{ $hideCategory }}"
hide-attachment="{{ $hideAttachment }}"
/>
@endif
@if (!$hideButtons)
<x-documents.form.buttons
type="{{ $type }}"
:document="$document"
/>
@endif
{{ Form::hidden('type', old('type', $type), ['id' => 'type', 'v-model' => 'form.type']) }}
{{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
{!! Form::close() !!}

View File

@@ -0,0 +1,12 @@
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-footer-header" data-toggle="collapse" data-target="#accordion-footer-body" aria-expanded="false" aria-controls="accordion-footer-body">
<h4 class="mb-0">{{ trans('general.footer') }}</h4>
</div>
<div id="accordion-footer-body" class="collapse hide" aria-labelledby="accordion-footer-header">
{{ Form::textareaGroup('footer', '', '', setting($type . '.footer'), ['rows' => '3'], 'embed-acoordion-textarea') }}
</div>
</div>
</div>

View File

@@ -0,0 +1,81 @@
<div class="row document-item-body">
<div class="col-sm-12 p-0" style="table-layout: fixed;">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
@if (!$hideEditItemColumns)
<x-edit-item-columns type="{{ $type }}" />
@endif
<div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table" id="items" style="table-layout: fixed">
<colgroup>
<col style="width: 40px;">
<col style="width: 25%;">
<col style="width: 30%;">
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 250px;">
<col style="width: 40px;">
</colgroup>
<thead class="thead-light">
<tr>
@stack('move_th_start')
<th class="text-left border-top-0 border-right-0 border-bottom-0"></th>
@stack('move_th_end')
@if (!$hideItems)
@stack('name_th_start')
<th class="text-left border-top-0 border-right-0 border-bottom-0">{{ $textItems }}</th>
@stack('name_th_end')
@stack('move_th_start')
<th class="text-left border-top-0 border-right-0 border-bottom-0"></th>
@stack('move_th_end')
@endif
@stack('quantity_th_start')
@if (!$hideQuantity)
<th class="text-center border-top-0 border-right-0 border-bottom-0" style="padding-right: 5px;">{{ $textQuantity }}</th>
@endif
@stack('quantity_th_end')
@stack('price_th_start')
@if (!$hidePrice)
<th class="text-right border-top-0 border-right-0 border-bottom-0" style="padding-left: 5px;">{{ $textPrice }}</th>
@endif
@stack('price_th_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="text-right border-top-0 border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@endif
@stack('total_th_start')
@if (!$hideAmount)
<th class="text-right border-top-0 border-bottom-0 item-total">{{ $textAmount }}</th>
@endif
@stack('total_th_end')
@stack('remove_th_start')
<th class="text-left border-top-0 border-right-0 border-bottom-0"></th>
@stack('remove_th_end')
</tr>
</thead>
<tbody id="invoice-item-rows">
@include('components.documents.form.line-item')
@stack('add_item_td_start')
<tr id="addItem">
<td class="text-right border-bottom-0" colspan="{{ '7' }}">
<x-select-item-button type="{{ $type }}" />
</td>
</tr>
@stack('add_item_td_end')
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,318 @@
<tr v-for="(row, index) in items"
:index="index">
@stack('name_td_start')
<td class="border-right-0 border-bottom-0 p-0"
:class="[{'has-error': form.errors.has('items.' + index + '.name') }]"
colspan="7">
<table class="w-100">
<colgroup>
<col style="width: 40px;">
<col style="width: 25%;">
<col style="width: 30%;">
<col style="width: 100px;">
<col style="width: 100px;">
<col style="width: 250px;">
<col style="width: 40px;">
</colgroup>
<tbody>
<tr>
@stack('move_td_start')
<td class="pb-4 align-middle" colspan="1" style="color: #8898aa;">
<div draggable="true">
<i class="fas fa-grip-vertical"></i>
</div>
</td>
@stack('move_td_end')
@stack('items_td_start')
@if (!$hideItems || (!$hideName && !$hideDescription))
@stack('name_td_start')
@if (!$hideName)
<td class="pb-4 align-middle" colspan="1">
<span class="aka-text aka-text--body" tabindex="0" v-html="row.name"></span>
</td>
@endif
@stack('name_td_end')
@stack('description_td_start')
@if (!$hideDescription)
<td class="pb-4" colspan="1">
<textarea
class="form-control"
placeholder="Enter item description"
style="height: 38px;"
:name="'items.' + index + '.description'"
v-model="row.description"
data-item="description"
resize="none"
></textarea>
</td>
@endif
@stack('description_td_end')
@endif
@stack('items_td_end')
@stack('quantity_td_start')
@if (!$hideQuantity)
<td colspan="1" class="pb-4" style="padding-right: 5px; padding-left: 5px;">
<div>
@stack('quantity_input_start')
<input type="text"
class="form-control text-center p-0"
:name="'items.' + index + '.quantity'"
autocomplete="off"
required="required"
data-item="quantity"
v-model="row.quantity"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.quantity')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.quantity')"
v-html="form.errors.get('items.' + index + '.quantity')">
</div>
@stack('quantity_input_end')
</div>
</td>
@endif
@stack('quantity_td_end')
@stack('price_td_start')
@if (!$hidePrice)
<td colspan="1" class="pb-4" style="padding-right: 5px; padding-left: 5px;">
<div>
@stack('price_input_start')
{{ Form::moneyGroup('price', '', '', ['required' => 'required', 'row-input' => 'true', 'v-model' => 'row.price', 'v-error' => 'form.errors.get(\'items.\' + index + \'.price\')', 'v-error-message' => 'form.errors.get(\'items.\' + index + \'.price\')' , 'data-item' => 'price', 'currency' => $currency, 'dynamic-currency' => 'currency', 'change' => 'row.price = $event; form.errors.clear(\'items.\' + index + \'.price\'); onCalculateTotal'], 0.00, 'text-right input-price p-0') }}
@stack('price_input_end')
</div>
</td>
@endif
@stack('price_td_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td colspan="1" class="pb-4"
:class="[{'has-error': form.errors.has('items.' + index + '.discount') }]">
@stack('discount_input_start')
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
<input type="number"
max="100"
min="0"
class="form-control text-center p-0"
:name="'items.' + index + '.discount'"
autocomplete="off"
required="required"
data-item="discount"
v-model="row.discount"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.discount')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.discount')"
v-html="form.errors.get('items.' + index + '.discount')">
</div>
</div>
@stack('discount_input_end')
</td>
@stack('discount_td_end')
@endif
@endif
@stack('total_td_start')
@if (!$hideAmount)
<td colspan="1" class="text-right long-texts pb-4">
<div>
{{ Form::moneyGroup('total', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row.total', 'data-item' => 'total', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
</div>
</td>
@endif
@stack('total_td_end')
@stack('delete_td_start')
<td colspan="1" class="pb-4 align-middle">
<div>
<button type="button" @click="onDeleteItem(index)" class="btn btn-link btn-delete p-0">
<i class="far fa-trash-alt"></i>
</button>
</div>
</td>
@stack('delete_td_end')
</tr>
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
<tr v-if="!row.add_tax || !row.add_discount">
<td colspan="3" style="border: 0;">
</td>
<td colspan="1" style="border: 0;">
<div>
<button type="button" class="btn btn-link btn-sm p-0" @click="onAddDiscount(index)" v-if="!discount">Add Discount</button>
</div>
</td>
<td colspan="1" style="border: 0;">
<div>
<button type="button" class="btn btn-link btn-sm p-0" @click="onAddTax(index)" v-if="!tax">Add Tax</button>
</div>
</td>
<td colspan="1" style="border: 0;" class="text-right total-column border-bottom-0 long-texts">
</td>
<td colspan="1" style="border: 0;" class="w-1">
</td>
</tr>
<tr v-if="row.add_discount">
<td colspan="3" style="border: 0;"></td>
<td colspan="2" style="border: 0;">
<div>
@stack('tax_id_input_start')
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount-rate">
<i class="fa fa-percent"></i>
</span>
</div>
<input type="number"
max="100"
min="0"
class="form-control text-center"
:name="'items.' + index + '.discount-rate'"
autocomplete="off"
required="required"
data-item="discount_rate"
v-model="row.discount_rate"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.discount_rate')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.discount_rate')"
v-html="form.errors.get('items.' + index + '.discount_rate')">
</div>
</div>
@stack('tax_id_input_end')
</div>
</td>
<td colspan="1" style="border: 0;" class="text-right total-column border-bottom-0 long-texts">
<div>
{{ Form::moneyGroup('discount', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row.discount', 'data-item' => 'discount', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
</div>
</td>
<td colspan="1" style="border: 0;" class="w-1">
<button type="button" @click="onDeleteDiscount(index)" class="btn btn-link btn-sm p-0">
<i class="far fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="row.add_tax" v-for="(row_tax, row_tax_index) in row.tax_ids"
:index="row_tax_index">
@else
<tr v-for="(row_tax, row_tax_index) in row.tax_ids"
:index="row_tax_index">
@endif
<td class="pb-0" colspan="2" style="border: 0;">
</td>
<td class="pb-0 pr-0 align-middle text-right long-texts" colspan="1" style="border: 0;">
<span class="invoice-item-row-tax-section__tax__add__label">{{ trans_choice('general.taxes', 1) }}</span>
</td>
<td class="pb-0" colspan="2" style="border: 0; padding-right: 5px; padding-left: 5px;" >
<div>
@stack('taxes_input_start')
<akaunting-select
class="mb-0 select-tax"
:form-classes="[{'has-error': form.errors.has('items.' + index + '.taxes') }]"
:icon="''"
:title="''"
:placeholder="'{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}'"
:name="'items.' + index + '.taxes.' + row_tax_index"
:options="{{ json_encode($taxes->pluck('title', 'id')) }}"
:disabled-options="form.items[index].tax_ids"
:value="row_tax.id"
@interface="row_tax.id = $event"
@change="onCalculateTotal()"
@new="taxes.push($event)"
:form-error="form.errors.get('items.' + index + '.taxes')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select>
@stack('taxes_input_end')
</div>
</td>
<td colspan="1" style="border: 0;" class="pb-0 text-right long-texts">
<div>
{{ Form::moneyGroup('tax', '', '', ['required' => 'required', 'disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'row_tax.price', 'data-item' => 'total', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right input-price disabled-money') }}
</div>
</td>
<td colspan="1" style="border: 0;" class="pb-0 align-middle">
<button type="button" @click="onDeleteTax(index, row_tax_index)" class="btn btn-link btn-delete p-0">
<i class="far fa-trash-alt"></i>
</button>
</td>
</tr>
<tr v-if="row.add_tax">
<td class="pb-0" colspan="2" style="border: 0;">
</td>
<td class="pb-0 pr-0 align-middle text-right long-texts" colspan="1" style="border: 0;">
<span class="invoice-item-row-tax-section__tax__add__label">{{ trans_choice('general.taxes', 1) }}</span>
</td>
<td colspan="2" style="border: 0; padding-right: 5px; padding-left: 5px;">
<div>
@stack('taxes_input_start')
<akaunting-select
class="mb-0 select-tax"
:form-classes="[{'has-error': form.errors.has('items.' + index + '.taxes') }]"
:icon="''"
:title="''"
:placeholder="'{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}'"
:name="'items.' + index + '.taxes.999'"
:options="{{ json_encode($taxes->pluck('title', 'id')) }}"
:disabled-options="form.items[index].tax_ids"
:value="tax_id"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => route('modals.taxes.create'),
'type' => 'modal',
'field' => [
'key' => 'id',
'value' => 'title'
],
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
@interface="tax_id = $event"
@visible-change="onSelectedTax(index)"
@new="taxes.push($event)"
:form-error="form.errors.get('items.' + index + '.taxes')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select>
@stack('taxes_input_end')
</div>
</td>
<td colspan="1" style="border: 0;" class="text-right long-texts align-middle">
<div>
__
</div>
</td>
<td colspan="1" style="border: 0;">
</td>
</tr>
</tbody>
</table>
</td>
@stack('name_td_end')
</tr>

View File

@@ -0,0 +1,33 @@
<div class="card">
<div class="card-body">
<x-documents.form.metadata
type="{{ $type }}"
:document="$document"
hide-contact="{{ $hideContact }}"
contact-type="{{ $contactType }}"
hide-issue-at="{{ $hideIssuedAt }}"
text-issue-at="{{ $textIssuedAt }}"
hide-document-number="{{ $hideDocumentNumber }}"
text-document-number="{{ $textDocumentNumber }}"
hide-due-at="{{ $hideDueAt }}"
text-due-at="{{ $textDueAt }}"
hide-order-number="{{ $hideOrderNumber }}"
text-order-number="{{ $textOrderNumber }}"
/>
<x-documents.form.items
type="{{ $type }}"
:document="$document"
/>
<x-documents.form.totals
type="{{ $type }}"
:document="$document"
/>
<x-documents.form.note
type="{{ $type }}"
:document="$document"
/>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
@if (!$hideContact)
<div class="row">
<x-select-contact-card type="{{ $contactType }}" :contact="($document) ? $document->contact : new stdClass()"/>
</div>
@endif
</div>
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="row">
@if (!$hideIssuedAt)
{{ Form::dateGroup('issued_at', $textIssuedAt, 'calendar', ['id' => 'issued_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], $issuedAt) }}
@endif
@if (!$hideDocumentNumber)
{{ Form::textGroup('document_number', $textDocumentNumber, 'file', ['required' => 'required'], $documentNumber) }}
@endif
@if (!$hideDueAt)
{{ Form::dateGroup('due_at', $textDueAt, 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], $dueAt) }}
@endif
@if (!$hideOrderNumber)
{{ Form::textGroup('order_number', $textOrderNumber, 'shopping-cart', [], $orderNumber) }}
@endif
</div>
</div>
</div>

View File

@@ -0,0 +1,3 @@
<div class="row embed-card-body-footer">
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2), '', setting($type . '.notes'), ['rows' => '3', 'class' => 'form-control embed-card-body-footer-textarea'], 'col-md-12 embed-acoordion-textarea') }}
</div>

View File

@@ -0,0 +1,135 @@
<div class="row document-item-body">
<div class="col-sm-12 mb-4 p-0">
<div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table" id="totals">
<colgroup>
<col style="width: 60%;">
<col style="width: 30%;">
<col style="width: 20%;">
<col style="width: 40px;">
</colgroup>
<tbody id="invoice-item-rows">
@stack('sub_total_td_start')
<tr id="tr-subtotal">
<td class="border-bottom-0 pb-0"></td>
<td class="text-right border-right-0 border-bottom-0 align-middle pb-0">
<strong>{{ trans('invoices.sub_total') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts pb-0">
<div>
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'totals.sub', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right disabled-money') }}
</div>
</td>
<td class="border-bottom-0 pb-0"></td>
</tr>
@stack('sub_total_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('item_discount_td_start')
<tr id="tr-subtotal">
<td class="border-top-0 pb-0"></td>
<td class="text-right border-top-0 border-right-0 border-bottom-0 align-middle pb-0">
<strong>{{ trans('invoices.item_discount') }}</strong>
</td>
<td class="text-right border-top-0 border-bottom-0 long-texts pb-0">
<div>
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right disabled-money') }}
</div>
</td>
<td class="border-top-0 pb-0"></td>
</tr>
@stack('item_discount_td_end')
@endif
@if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="border-top-0 pb-0"></td>
<td class="text-right border-top-0 border-right-0 border-bottom-0 align-middle pb-0">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control', 'v-model' => 'form.discount']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td>
<td class="text-right border-top-0 border-bottom-0 pb-0">
<div>
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'totals.discount', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right disabled-money') }}
</div>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
<td class="border-top-0 pb-0"></td>
</tr>
@stack('add_discount_td_end')
@endif
@stack('tax_total_td_start')
<tr v-for="(tax, tax_index) in totals.taxes"
:index="tax_index">
<td class="border-top-0 pb-0"></td>
<td class="text-right border-top-0 border-right-0 border-bottom-0 align-middle pb-0">
<strong v-html="tax.name"></strong>
</td>
<td class="text-right border-top-0 border-bottom-0 long-texts pb-0">
<div>
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'tax.total', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right disabled-money') }}
</div>
</td>
<td class="border-top-0 pb-0"></td>
</tr>
@stack('tax_total_td_end')
@stack('grand_total_td_start')
<tr id="tr-total">
<td class="border-top-0 pb-0"></td>
<td class="text-right border-top-0 border-right-0 align-middle pb-0">
<strong class="document-total-span">{{ trans('invoices.total') }}</strong>
{{ Form::selectGroup('currency_code', '', 'exchange-alt', $currencies, setting('default.currency'), ['required' => 'required', 'model' => 'form.currency_code', 'change' => 'onChangeCurrency'], 'document-total-currency') }}
</td>
<td class="text-right border-top-0 long-texts pb-0">
<div>
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => 'true' , 'row-input' => 'true', 'v-model' => 'totals.total', 'currency' => $currency, 'dynamic-currency' => 'currency'], 0.00, 'text-right disabled-money') }}
</div>
</td>
<td class="border-top-0"></td>
</tr>
@stack('grand_total_td_end')
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,261 @@
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
<tr class="row table-head-line">
@if (!$hideBulkAction)
<th class="{{ $classBulkAction }}">
{{ Form::bulkActionAllGroup() }}
</th>
@endif
@stack('document_number_th_start')
@if (!$hideDocumentNumber)
<th class="{{ $classDocumentNumber }}">
@stack('document_number_th_inside_start')
@sortablelink('document_number', $textDocumentNumber, ['filter' => 'active, visible'], ['class' => 'col-aka', 'rel' => 'nofollow'])
@stack('document_number_th_inside_end')
</th>
@endif
@stack('document_number_th_end')
@stack('contact_name_th_start')
@if (!$hideContactName)
<th class="{{ $classContactName }}">
@stack('contact_name_th_inside_start')
@sortablelink('contact_name', $textContactName)
@stack('contact_name_th_inside_end')
</th>
@endif
@stack('contact_name_th_end')
@stack('amount_th_start')
@if (!$hideAmount)
<th class="{{ $classAmount }}">
@stack('amount_th_inside_start')
@sortablelink('amount', trans('general.amount'))
@stack('amount_th_inside_end')
</th>
@endif
@stack('amount_th_end')
@stack('issued_at_th_start')
@if (!$hideIssuedAt)
<th class="{{ $classIssuedAt }}">
@stack('issued_at_th_inside_start')
@sortablelink('issued_at', $textIssueAt)
@stack('issued_at_th_inside_end')
</th>
@endif
@stack('issued_at_th_end')
@stack('due_at_th_start')
@if (!$hideDueAt)
<th class="{{ $classDueAt }}">
@stack('due_at_th_inside_start')
@sortablelink('due_at', $textDueAt)
@stack('due_at_th_inside_end')
</th>
@endif
@stack('due_at_th_end')
@stack('status_th_start')
@if (!$hideStatus)
<th class="{{ $classStatus }}">
@stack('status_th_inside_start')
@sortablelink('status', trans_choice('general.statuses', 1))
@stack('status_th_inside_end')
</th>
@endif
@stack('status_th_end')
@if (!$hideActions)
<th class="{{ $classActions }}">
<a>{{ trans('general.actions') }}</a>
</th>
@endif
</tr>
</thead>
<tbody>
@foreach($documents as $item)
@php $paid = $item->paid; @endphp
<tr class="row align-items-center border-top-1">
@if (!$hideBulkAction)
<td class="{{ $classBulkAction }}">
{{ Form::bulkActionGroup($item->id, $item->document_number) }}
</td>
@endif
@stack('document_number_td_start')
@if (!$hideDocumentNumber)
<td class="{{ $classDocumentNumber }}">
@stack('document_number_td_inside_start')
<a class="col-aka" href="{{ route($routeButtonShow , $item->id) }}">{{ $item->document_number }}</a>
@stack('document_number_td_inside_end')
</td>
@endif
@stack('document_number_td_end')
@stack('contact_name_td_start')
@if (!$hideContactName)
<td class="{{ $classContactName }}">
@stack('contact_name_td_inside_start')
{{ $item->contact_name }}
@stack('contact_name_td_inside_end')
</td>
@endif
@stack('contact_name_td_end')
@stack('amount_td_start')
@if (!$hideAmount)
<td class="{{ $classAmount }}">
@stack('amount_td_inside_start')
@money($item->amount, $item->currency_code, true)
@stack('amount_td_inside_end')
</td>
@endif
@stack('amount_td_end')
@stack('issued_at_td_start')
@if (!$hideIssuedAt)
<td class="{{ $classIssuedAt }}">
@stack('issued_at_td_inside_start')
@date($item->issued_at)
@stack('issued_at_td_inside_end')
</td>
@endif
@stack('issued_at_td_end')
@stack('due_at_td_start')
@if (!$hideDueAt)
<td class="{{ $classDueAt }}">
@stack('due_at_td_inside_start')
@date($item->due_at)
@stack('due_at_td_inside_end')
</td>
@endif
@stack('due_at_td_end')
@stack('status_td_start')
@if (!$hideStatus)
<td class="{{ $classStatus }}">
@stack('status_td_inside_start')
<span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans($textDocumentStatus . $item->status) }}</span>
@stack('status_td_inside_end')
</td>
@endif
@stack('status_td_end')
@if (!$hideActions)
<td class="{{ $classActions }}">
<div class="dropdown">
<a class="btn btn-neutral btn-sm text-light items-align-center py-2" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-h text-muted"></i>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
@stack('show_button_start')
@if (!$hideButtonShow)
<a class="dropdown-item" href="{{ route($routeButtonShow, $item->id) }}">{{ trans('general.show') }}</a>
@endif
@stack('show_button_end')
@stack('edit_button_start')
@if (!$hideButtonEdit)
@if ($checkButtonReconciled)
@if (!$item->reconciled)
<a class="dropdown-item" href="{{ route($routeButtonEdit, $item->id) }}">{{ trans('general.edit') }}</a>
@endif
@else
<a class="dropdown-item" href="{{ route($routeButtonEdit, $item->id) }}">{{ trans('general.edit') }}</a>
@endif
@endif
@stack('edit_button_end')
<div class="dropdown-divider"></div>
@if ($checkButtonCancelled)
@if ($item->status != 'cancelled')
@stack('duplicate_button_start')
@if (!$hideButtonDuplicate)
@can($permissionDocumentCreate)
<a class="dropdown-item" href="{{ route($routeButtonDuplicate, $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div>
@endcan
@endif
@stack('duplicate_button_end')
@stack('cancel_button_start')
@if (!$hideButtonCancel)
@can($permissionDocumentUpdate)
<a class="dropdown-item" href="{{ route($routeButtonCancelled, $item->id) }}">{{ trans('general.cancel') }}</a>
@endcan
@endif
@stack('cancel_button_end')
@endif
@else
@stack('duplicate_button_start')
@if (!$hideButtonDuplicate)
@can($permissionDocumentCreate)
<a class="dropdown-item" href="{{ route($routeButtonDuplicate, $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div>
@endcan
@endif
@stack('duplicate_button_end')
@stack('cancel_button_start')
@if (!$hideButtonCancel)
@can($permissionDocumentUpdate)
<a class="dropdown-item" href="{{ route($routeButtonCancelled, $item->id) }}">{{ trans('general.cancel') }}</a>
@endcan
@endif
@stack('cancel_button_end')
@endif
@stack('delete_button_start')
@if (!$hideButtonDelete)
@can($permissionDocumentDelete)
@if ($checkButtonReconciled)
@if (!$item->reconciled)
{!! Form::deleteLink($item, $routeButtonDelete) !!}
@endif
@else
{!! Form::deleteLink($item, $routeButtonDelete) !!}
@endif
@endcan
@endif
@stack('delete_button_end')
</div>
</div>
</td>
@endif
</tr>
@endforeach
</tbody>
</table>
</div>

View File

@@ -0,0 +1,5 @@
<div class="card-footer table-action">
<div class="row">
@include('partials.admin.pagination', ['items' => $documents])
</div>
</div>

View File

@@ -0,0 +1,33 @@
@if (!$hideBulkAction)
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
'method' => 'GET',
'route' => $formCardHeaderRoute,
'role' => 'form',
'class' => 'mb-0'
]) !!}
@if (!$hideSearchString)
<div class="align-items-center" v-if="!bulk_action.show">
<x-search-string model="{{ $searchStringModel }}" />
</div>
@endif
{{ Form::bulkActionRowGroup($textBulkAction, $bulkActions, $bulkActionRouteParameters) }}
{!! Form::close() !!}
</div>
@else
@if (!$hideSearchString)
<div class="card-header border-bottom-0">
{!! Form::open([
'method' => 'GET',
'route' => $formCardHeaderRoute,
'role' => 'form',
'class' => 'mb-0'
]) !!}
<div class="align-items-center">
<x-search-string model="{{ $searchStringModel }}" />
</div>
{!! Form::close() !!}
</div>
@endif
@endif

View File

@@ -0,0 +1,67 @@
@if ($hideEmptyPage || ($documents->count() || request()->get('search', false)))
<div class="card">
<x-documents.index.card-header
type="{{ $type }}"
hide-bulk-action="{{ $hideBulkAction }}"
:form-card-header-route="$formCardHeaderRoute"
hide-search-string="{{ $hideSearchString }}"
search-string-model="{{ $searchStringModel }}"
text-bulk-action="{{ $textBulkAction }}"
bulk-action-class="{{ $bulkActionClass }}"
:bulk-actions="$bulkActions"
:bulk-action-route-parameters="$bulkActionRouteParameters"
/>
<x-documents.index.card-body
type="{{ $type }}"
:documents="$documents"
hide-bulk-action="{{ $hideBulkAction }}"
class-bulk-action="{{ $classBulkAction }}"
hide-document-number="{{ $hideDocumentNumber }}"
text-document-number="{{ $textDocumentNumber }}"
class-document-number="{{ $classDocumentNumber }}"
hide-contact-name="{{ $hideContactName }}"
text-contact-name="{{ $textContactName }}"
class-contact-name="{{ $classContactName }}"
hide-amount="{{ $hideAmount }}"
class-amount="{{ $classAmount }}"
hide-issued-at="{{ $hideIssuedAt }}"
text-issued-at="{{ $textIssueAt }}"
class-issued-at="{{ $classIssuedAt }}"
hide-due-at="{{ $hideDueAt }}"
class-due-at="{{ $classDueAt }}"
text-due-at="{{ $textDueAt }}"
hide-status="{{ $hideStatus }}"
class-status="{{ $classStatus }}"
hide-actions="{{ $hideActions }}"
class-actions="{{ $classActions }}"
text-document-status="{{ $textDocumentStatus }}"
hide-button-show="{{ $hideButtonShow }}"
route-button-show="{{ $routeButtonShow }}"
hide-button-edit="{{ $hideButtonEdit }}"
check-button-reconciled="{{ $checkButtonReconciled }}"
route-button-edit="{{ $routeButtonEdit }}"
check-button-cancelled="{{ $checkButtonCancelled }}"
hide-button-duplicate="{{ $hideButtonDuplicate }}"
permission-document-create="{{ $permissionDocumentCreate }}"
route-button-duplicate="{{ $routeButtonDuplicate }}"
hide-button-cancel="{{ $hideButtonCancel }}"
permission-document-update="{{ $permissionDocumentUpdate }}"
route-button-called="{{ $routeButtonCancelled }}"
hide-button-delete="{{ $hideButtonDelete }}"
permission-document-delete="{{ $permissionDocumentDelete }}"
route-button-delete="{{ $routeButtonDelete }}"
/>
<x-documents.index.card-footer
type="{{ $type }}"
:documents="$documents"
/>
</div>
@else
<x-documents.index.empty-page
type="{{ $type }}"
page="{{ $page }}"
docs-path="{{ $docsPath }}"
/>
@endif

View File

@@ -0,0 +1 @@
@include('partials.admin.empty_page', ['page' => $page, 'docs_path' => $docsPath])

View File

@@ -0,0 +1,19 @@
@if ($checkCreatePermission)
@can($createPermission)
@endif
@if (!$hideCreate)
<a href="{{ route($createRoute) }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endif
@if (!$hideImport)
<a href="{{ route($importRoute, $importRouteParameters) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endif
@if ($checkCreatePermission)
@endcan
@endif
@if (!$hideExport)
<a href="{{ route($exportRoute, request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
@endif

View File

@@ -0,0 +1,17 @@
@php
$document_items = 'false';
if ($items) {
$document_items = json_encode($items);
} else if (old('items')) {
$document_items = json_encode(old('items'));
}
@endphp
<script type="text/javascript">
var document_items = {!! $document_items !!};
var document_currencies = {!! $currencies !!};
var document_taxes = {!! $taxes !!};
</script>
<script src="{{ asset( $scriptFile . '?v=' . version('short')) }}"></script>

View File

@@ -0,0 +1,11 @@
@if ($attachment)
<div class="row align-items-center">
<div class="col-xs-12 col-sm-4">
@php
$file = $attachment;
@endphp
@include('partials.media.file')
</div>
</div>
@endif

View File

@@ -0,0 +1,152 @@
@stack('content_header_start')
@if (!$hideHeader)
<x-documents.show.header
type="{{ $type }}"
:document="$document"
hide-header-status="{{ $hideHeaderStatus }}"
text-history-status="{{ $textHistoryStatus }}"
class-header-status="{{ $classHeaderStatus }}"
hide-header-contact="{{ $hideHeaderContact }}"
text-header-contact="{{ $textHeaderContact }}"
class-header-contact="{{ $classHeaderContact }}"
hide-header-amount="{{ $hideHeaderAmount }}"
text-header-amount="{{ $textHeaderAmount }}"
class-header-amount="{{ $classHeaderAmount }}"
hide-header-due-at="{{ $hideHeaderDueAt }}"
text-header-due-at="{{ $textHeaderDueAt }}"
class-header-due-at="{{ $classHeaderDueAt }}"
/>
@endif
@stack('content_header_end')
@stack('recurring_message_start')
@if (!$hideRecurringMessage)
<x-documents.show.recurring-message
type="{{ $type }}"
:document="$document"
text-recurring-type="{{ $textRecurringType }}"
/>
@endif
@stack('recurring_message_end')
@stack('status_message_start')
@if (!$hideStatusMessage)
<x-documents.show.status-message
type="{{ $type }}"
:document="$document"
text-status-message="{{ $textStatusMessage }}"
/>
@endif
@stack('status_message_end')
@stack('timeline_start')
@if (!$hideTimeline)
<x-documents.show.timeline
type="{{ $type }}"
:document="$document"
:hide-timeline-statuses="$hideTimelineStatuses"
hide-timeline-create="{{ $hideTimelineCreate }}"
hide-timeline-create-title="{{ $textTimelineCreateTitle }}"
text-timeline-create-message="{{ $textTimelineCreateMessage }}"
hide-button-edit="{{ $hideButtonEdit }}"
permission-document-update="{{ $permissionDocumentUpdate }}"
route-button-edit="{{ $routeButtonEdit }}"
hide-timeline-sent="{{ $hideTimelineSent }}"
text-timeline-sent-title="{{ $textTimelineSentTitle }}"
text-timeline-sent-status-draft="{{ $textTimelineSentStatusDraft }}"
hide-button-sent="{{ $hideButtonSent }}"
permission-document-update="{{ $permissionDocumentUpdate }}"
route-button-sent="{{ $routeButtonSent }}"
text-timeline-sent-status-mark-sent="{{ $textTimelineSentStatusMarkSent }}"
hide-button-received="{{ $hideButtonReceived }}"
route-button-received="{{ $routeButtonReceived }}"
text-timeline-sent-status-received="{{ $textTimelineSentStatusReceived }}"
hide-button-email="{{ $hideButtonEmail }}"
route-button-email="{{ $routeButtonEmail }}"
text-timeline-send-status-mail="{{ $textTimelineSendStatusMail }}"
hide-button-share="{{ $hideButtonShare }}"
signed-url="{{ $signedUrl }}"
hide-timeline-sent="{{ $hideTimelineSent }}"
text-timeline-get-paid-title="{{ $textTimelineGetPaidTitle }}"
text-timeline-get-paid-status-await="{{ $textTimelineGetPaidStatusAwait }}"
text-timeline-get-paid-status-partially-paid="{{ $textTimelineGetPaidStatusPartiallyPaid }}"
hide-button-paid="{{ $hideButtonPaid }}"
route-button-paid="{{ $routeButtonPaid }}"
text-timeline-get-paid-mark-paid="{{ $textTimelineGetPaidMarkPaid }}"
hide-button-add-payment="{{ $hideButtonAddPayment }}"
text-timeline-get-paid-add-payment="{{ $textTimelineGetPaidAddPayment }}"
/>
@endif
@stack('timeline_end')
@stack('invoice_start')
<x-documents.show.document
type="{{ $type }}"
:document="$document"
document-template="{{ $documentTemplate }}"
logo="{{ $logo }}"
back-ground-color="{{ $backGroundColor }}"
hide-footer="{{ $hideFooter }}"
hide-company-logo="{{ $hideCompanyLogo }}"
hide-company-details="{{ $hideCompanyDetails }}"
hide-company-name="{{ $hideCompanyName }}"
hide-company-address="{{ $hideCompanyAddress }}"
hide-company-tax-number="{{ $hideCompanyTaxNumber }}"
hide-company-phone="{{ $hideCompanyPhone }}"
hide-company-email="{{ $hideCompanyEmail }}"
hide-contact-info="{{ $hideContactInfo }}"
hide-contact-name="{{ $hideContactName }}"
hide-contact-address="{{ $hideContactAddress }}"
hide-contact-tax-number="{{ $hideContactTaxNumber }}"
hide-contact-phone="{{ $hideContactPhone }}"
hide-contact-email="{{ $hideContactEmail }}"
hide-order-number="{{ $hideOrderNumber }}"
hide-document-number="{{ $hideDocumentNumber }}"
hide-issued-at="{{ $hideIssuedAt }}"
hide-due-at="{{ $hideDueAt }}"
text-contact-info="{{ $textContactInfo }}"
text-issued-at="{{ $textIssuedAt }}"
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"
hide-quantity="{{ $hideQuantity }}"
hide-price="{{ $hidePrice }}"
hide-amount="{{ $hideAmount }}"
hide-note="{{ $hideNote }}"
text-items="{{ $textItems }}"
text-quantity="{{ $textQuantity }}"
text-price="{{ $textPrice }}"
text-amount="{{ $textAmount }}"
/>
@stack('invoice_end')
@stack('attachment_start')
@if (!$hideAttachment)
<x-documents.show.attachment
type="{{ $type }}"
:document="$document"
:attachment="$attachment"
/>
@endif
@stack('attachment_end')
@stack('row_footer_start')
@if (!$hideFooter)
<x-documents.show.footer
type="{{ $type }}"
:document="$document"
:histories="$histories"
:transactions="$transactions"
hide-footer-histories="{{ $hideFooterHistories }}"
text-histories="{{ $textHistories }}"
text-history-status="{{ $textHistoryStatus }}"
hide-footer-transactions="{{ $hideFooterTransactions }}"
/>
@endif
@stack('row_footer_end')
{{ Form::hidden('document_id', $document->id, ['id' => 'document_id']) }}
{{ Form::hidden($type . '_id', $document->id, ['id' => $type . '_id']) }}

View File

@@ -0,0 +1,141 @@
<div class="card" style="padding: 0; padding-left: 15px; padding-right: 15px; border-radius: 0; box-shadow: 0 4px 16px rgba(0,0,0,.2);">
<div class="card-body">
@if ($documentTemplate)
@switch($documentTemplate)
@case('classic')
<x-documents.template.classic
type="{{ $type }}"
:document="$document"
document-template="{{ $documentTemplate }}"
logo="{{ $logo }}"
back-ground-color="{{ $backGroundColor }}"
hide-footer="{{ $hideFooter }}"
hide-company-logo="{{ $hideCompanyLogo }}"
hide-company-details="{{ $hideCompanyDetails }}"
hide-company-name="{{ $hideCompanyName }}"
hide-company-address="{{ $hideCompanyAddress }}"
hide-company-tax-number="{{ $hideCompanyTaxNumber }}"
hide-company-phone="{{ $hideCompanyPhone }}"
hide-company-email="{{ $hideCompanyEmail }}"
hide-contact-info="{{ $hideContactInfo }}"
hide-contact-name="{{ $hideContactName }}"
hide-contact-address="{{ $hideContactAddress }}"
hide-contact-tax-number="{{ $hideContactTaxNumber }}"
hide-contact-phone="{{ $hideContactPhone }}"
hide-contact-email="{{ $hideContactEmail }}"
hide-order-number="{{ $hideOrderNumber }}"
hide-document-number="{{ $hideDocumentNumber }}"
hide-issued-at="{{ $hideIssuedAt }}"
hide-due-at="{{ $hideDueAt }}"
text-contact-info="{{ $textContactInfo }}"
text-issued-at="{{ $textIssuedAt }}"
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"
hide-quantity="{{ $hideQuantity }}"
hide-price="{{ $hidePrice }}"
hide-amount="{{ $hideAmount }}"
hide-note="{{ $hideNote }}"
text-items="{{ $textItems }}"
text-quantity="{{ $textQuantity }}"
text-price="{{ $textPrice }}"
text-amount="{{ $textAmount }}"
/>
@break
@case('modern')
<x-documents.template.modern
type="{{ $type }}"
:document="$document"
document-template="{{ $documentTemplate }}"
logo="{{ $logo }}"
back-ground-color="{{ $backGroundColor }}"
hide-footer="{{ $hideFooter }}"
hide-company-logo="{{ $hideCompanyLogo }}"
hide-company-details="{{ $hideCompanyDetails }}"
hide-company-name="{{ $hideCompanyName }}"
hide-company-address="{{ $hideCompanyAddress }}"
hide-company-tax-number="{{ $hideCompanyTaxNumber }}"
hide-company-phone="{{ $hideCompanyPhone }}"
hide-company-email="{{ $hideCompanyEmail }}"
hide-contact-info="{{ $hideContactInfo }}"
hide-contact-name="{{ $hideContactName }}"
hide-contact-address="{{ $hideContactAddress }}"
hide-contact-tax-number="{{ $hideContactTaxNumber }}"
hide-contact-phone="{{ $hideContactPhone }}"
hide-contact-email="{{ $hideContactEmail }}"
hide-order-number="{{ $hideOrderNumber }}"
hide-document-number="{{ $hideDocumentNumber }}"
hide-issued-at="{{ $hideIssuedAt }}"
hide-due-at="{{ $hideDueAt }}"
text-contact-info="{{ $textContactInfo }}"
text-issued-at="{{ $textIssuedAt }}"
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"
hide-quantity="{{ $hideQuantity }}"
hide-price="{{ $hidePrice }}"
hide-amount="{{ $hideAmount }}"
hide-note="{{ $hideNote }}"
text-items="{{ $textItems }}"
text-quantity="{{ $textQuantity }}"
text-price="{{ $textPrice }}"
text-amount="{{ $textAmount }}"
/>
@break
@default
<x-documents.template.ddefault
type="{{ $type }}"
:document="$document"
document-template="{{ $documentTemplate }}"
logo="{{ $logo }}"
back-ground-color="{{ $backGroundColor }}"
hide-footer="{{ $hideFooter }}"
hide-company-logo="{{ $hideCompanyLogo }}"
hide-company-details="{{ $hideCompanyDetails }}"
hide-company-name="{{ $hideCompanyName }}"
hide-company-address="{{ $hideCompanyAddress }}"
hide-company-tax-number="{{ $hideCompanyTaxNumber }}"
hide-company-phone="{{ $hideCompanyPhone }}"
hide-company-email="{{ $hideCompanyEmail }}"
hide-contact-info="{{ $hideContactInfo }}"
hide-contact-name="{{ $hideContactName }}"
hide-contact-address="{{ $hideContactAddress }}"
hide-contact-tax-number="{{ $hideContactTaxNumber }}"
hide-contact-phone="{{ $hideContactPhone }}"
hide-contact-email="{{ $hideContactEmail }}"
hide-order-number="{{ $hideOrderNumber }}"
hide-document-number="{{ $hideDocumentNumber }}"
hide-issued-at="{{ $hideIssuedAt }}"
hide-due-at="{{ $hideDueAt }}"
text-contact-info="{{ $textContactInfo }}"
text-issued-at="{{ $textIssuedAt }}"
text-document-number="{{ $textDocumentNumber }}"
text-due-at="{{ $textDueAt }}"
text-order-number="{{ $textOrderNumber }}"
hide-items="{{ $hideItems }}"
hide-name="{{ $hideName }}"
hide-description="{{ $hideDescription }}"
hide-quantity="{{ $hideQuantity }}"
hide-discount="{{ $hideDiscount }}"
hide-price="{{ $hidePrice }}"
hide-amount="{{ $hideAmount }}"
hide-note="{{ $hideNote }}"
text-items="{{ $textItems }}"
text-quantity="{{ $textQuantity }}"
text-price="{{ $textPrice }}"
text-amount="{{ $textAmount }}"
/>
@endswitch
@else
@include($documentTemplate)
@endif
</div>
</div>

View File

@@ -0,0 +1,27 @@
<div class="row">
@stack('row_footer_histories_start')
@if (!$hideFooterHistories)
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<x-documents.show.histories
type="{{ $type }}"
:document="$document"
:histories="$histories"
text-histories="{{ $textHistories }}"
text-history-status="{{ $textHistoryStatus }}"
/>
</div>
@endif
@stack('row_footer_histories_end')
@stack('row_footer_transactions_start')
@if (!$hideFooterTransactions)
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<x-documents.show.transactions
type="{{ $type }}"
:document="$document"
:transactions="$transactions"
/>
</div>
@endif
@stack('row_footer_transactions_end')
</div>

View File

@@ -0,0 +1,59 @@
<div class="row" style="font-size: inherit !important">
@if (!$hideHeaderStatus)
<div class="{{ $classHeaderStatus }}">
{{ trans_choice('general.statuses', 1) }}
<br>
<strong>
<span class="float-left">
<span class="badge badge-{{ $document->status_label }}">
{{ trans($textHistoryStatus . $document->status) }}
</span>
</span>
</strong>
<br><br>
</div>
@endif
@if (!$hideHeaderContact)
<div class="{{ $classHeaderContact }}">
{{ trans_choice($textHeaderContact, 1) }}
<br>
<strong>
<span class="float-left">
{{ $document->contact_name }}
</span>
</strong>
<br><br>
</div>
@endif
@if (!$hideHeaderAmount)
<div class="{{ $classHeaderAmount }}">
{{ trans($textHeaderAmount) }}
<br>
<strong>
<span class="float-left">
@money($document->amount - $document->paid, $document->currency_code, true)
</span>
</strong>
<br><br>
</div>
@endif
@if (!$hideHeaderDueAt)
<div class="{{ $classHeaderDueAt }}">
{{ trans($textHeaderDueAt) }}
<br>
<strong>
<span class="float-left">
@date($document->due_at)
</span>
</strong>
<br><br>
</div>
@endif
</div>

View File

@@ -0,0 +1,51 @@
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-histories-header" data-toggle="collapse" data-target="#accordion-histories-body" aria-expanded="false" aria-controls="accordion-histories-body">
<h4 class="mb-0">{{ trans($textHistories) }}</h4>
</div>
<div id="accordion-histories-body" class="collapse hide" aria-labelledby="accordion-histories-header">
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
@stack('row_footer_histories_head_tr_start')
<tr class="row table-head-line">
@stack('row_footer_histories_head_start')
<th class="col-xs-4 col-sm-3">
{{ trans('general.date') }}
</th>
<th class="col-xs-4 col-sm-3 text-left">
{{ trans_choice('general.statuses', 1) }}
</th>
<th class="col-xs-4 col-sm-6 text-left long-texts">
{{ trans('general.description') }}
</th>
@stack('row_footer_histories_head_end')
</tr>
@stack('row_footer_histories_head_tr_end')
</thead>
<tbody>
@stack('row_footer_histories_body_tr_start')
@foreach($histories as $history)
<tr class="row align-items-center border-top-1 tr-py">
@stack('row_footer_histories_body_td_start')
<td class="col-xs-4 col-sm-3">
@date($history->created_at)
</td>
<td class="col-xs-4 col-sm-3 text-left">
{{ trans($textHistoryStatus . $history->status) }}
</td>
<td class="col-xs-4 col-sm-6 text-left long-texts">
{{ $history->description }}
</td>
@stack('row_footer_histories_body_td_end')
</tr>
@endforeach
@stack('row_footer_histories_body_tr_end')
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,27 @@
@stack('recurring_message_start')
@if (($recurring = $document->recurring) && ($next = $recurring->getNextRecurring()))
<div class="row mb-3">
<div class="col-sm-12">
<div class="media">
<div class="media-body">
<div class="media-comment-text">
<div class="d-flex">
@stack('recurring_message_head_start')
<h5 class="mt-0">{{ trans('recurring.recurring') }}</h5>
@stack('recurring_message_head_end')
</div>
@stack('recurring_message_body_start')
<p class="text-sm lh-160 mb-0">{{ trans('recurring.message', [
'type' => mb_strtolower(trans_choice($textRecurringType, 1)),
'date' => $next->format($date_format)
]) }}
</p>
@stack('recurring_message_body_end')
</div>
</div>
</div>
</div>
</div>
@endif
@stack('recurring_message_end')

View File

@@ -0,0 +1,15 @@
@stack('status_message_start')
@if ($document->status == 'draft')
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger fade show" role="alert">
@stack('status_message_body_start')
<span class="alert-text">
<strong>{!! trans($textStatusMessage) !!}</strong>
</span>
@stack('status_message_body_end')
</div>
</div>
</div>
@endif
@stack('status_message_end')

View File

@@ -0,0 +1,208 @@
@if (!in_array($document->status, $hideTimelineStatuses))
@stack('timeline_body_start')
<div class="card">
<div class="card-body">
<div class="timeline timeline-one-side" data-timeline-content="axis" data-timeline-axis-style="dashed">
@stack('timeline_create_start')
@if (!$hideTimelineCreate)
<div class="timeline-block">
<span class="timeline-step badge-primary">
<i class="fas fa-plus"></i>
</span>
<div class="timeline-content">
@stack('timeline_create_head_start')
<h2 class="font-weight-500">
{{ trans($textTimelineCreateTitle) }}
</h2>
@stack('timeline_create_head_end')
@stack('timeline_create_body_start')
@stack('timeline_create_body_message_start')
<small>
{{ trans_choice('general.statuses', 1) . ':' }}
</small>
<small>
{{ trans($textTimelineCreateMessage, ['date' => Date::parse($document->created_at)->format($date_format)]) }}
</small>
@stack('timeline_create_body_message_end')
<div class="mt-3">
@stack('timeline_create_body_button_edit_start')
@if (!$hideButtonEdit)
@can($permissionDocumentUpdate)
<a href="{{ route($routeButtonEdit, $document->id) }}" class="btn btn-primary btn-sm btn-alone">
{{ trans('general.edit') }}
</a>
@endcan
@endif
@stack('timeline_create_body_button_edit_end')
</div>
@stack('timeline_create_body_end')
</div>
</div>
@endif
@stack('timeline_create_end')
@stack('timeline_sent_start')
@if (!$hideTimelineSent)
<div class="timeline-block">
<span class="timeline-step badge-danger">
<i class="far fa-envelope"></i>
</span>
<div class="timeline-content">
@stack('timeline_sent_head_start')
<h2 class="font-weight-500">
{{ trans($textTimelineSentTitle) }}
</h2>
@stack('timeline_sent_head_end')
@stack('timeline_sent_body_start')
@if ($document->status != 'sent' && $document->status != 'partial' && $document->status != 'viewed')
@stack('timeline_sent_body_message_start')
<small>
{{ trans_choice('general.statuses', 1) . ':' }}
</small>
<small>
{{ trans($textTimelineSentStatusDraft) }}
</small>
@stack('timeline_sent_body_message_end')
<div class="mt-3">
@stack('timeline_sent_body_button_sent_start')
@if (!$hideButtonSent)
@can($permissionDocumentUpdate)
@if($document->status == 'draft')
<a href="{{ route($routeButtonSent, $document->id) }}" class="btn btn-white btn-sm">
{{ trans($textTimelineSentStatusMarkSent) }}
</a>
@else
<button type="button" class="btn btn-secondary btn-sm" disabled="disabled">
<span class="text-disabled">{{ trans($textTimelineSentStatusMarkSent) }}</span>
</button>
@endif
@endcan
@endif
@stack('timeline_sent_body_button_sent_end')
@stack('timeline_receive_body_button_received_start')
@if (!$hideButtonReceived)
@can($permissionDocumentUpdate)
<a href="{{ route($routeButtonReceived, $document->id) }}" class="btn btn-danger btn-sm btn-alone">
{{ trans($textTimelineSentStatusReceived) }}
</a>
@endcan
@endif
@stack('timeline_receive_body_button_received_end')
</div>
@elseif($document->status == 'viewed')
@stack('timeline_viewed_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.viewed') }}</small>
@stack('timeline_viewed_invoice_body_message_end')
@else
@stack('timeline_sent_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.send.sent', ['date' => Date::parse($document->sent_at)->format($date_format)]) }}</small>
@stack('timeline_sent_body_message_end')
@endif
<div class="mt-3">
@stack('timeline_sent_body_button_email_start')
@if (!$hideButtonEmail)
@if($document->contact_email)
<a href="{{ route($routeButtonEmail, $document->id) }}" class="btn btn-danger btn-sm">
{{ trans($textTimelineSendStatusMail) }}
</a>
@else
<button type="button" class="btn btn-white btn-sm green-tooltip" disabled="disabled" data-toggle="tooltip" data-placement="right" title="{{ trans('invoices.messages.email_required') }}">
<span class="text-disabled">{{ trans($textTimelineSendStatusMail) }}</span>
</button>
@endif
@endif
@stack('timeline_sent_body_button_email_end')
@stack('timeline_sent_body_button_share_start')
@if (!$hideButtonShare)
@if ($document->status != 'cancelled')
<a href="{{ $signedUrl }}" target="_blank" class="btn btn-white btn-sm">
{{ trans('general.share') }}
</a>
@endif
@endif
@stack('timeline_sent_body_button_share_end')
</div>
@stack('timeline_sent_body_end')
</div>
</div>
@endif
@stack('timeline_sent_end')
@stack('timeline_get_paid_start')
@if (!$hideTimelineSent)
<div class="timeline-block">
<span class="timeline-step badge-success">
<i class="far fa-money-bill-alt"></i>
</span>
<div class="timeline-content">
@stack('timeline_get_paid_head_start')
<h2 class="font-weight-500">
{{ trans($textTimelineGetPaidTitle) }}
</h2>
@stack('timeline_get_paid_head_end')
@stack('timeline_get_paid_body_start')
@stack('timeline_get_paid_body_message_start')
@if($document->status != 'paid' && empty($document->transactions->count()))
<small>
{{ trans_choice('general.statuses', 1) . ':' }}
</small>
<small>
{{ trans($textTimelineGetPaidStatusAwait) }}
</small>
@else
<small>
{{ trans_choice('general.statuses', 1) . ':' }}
</small>
<small>
{{ trans($textTimelineGetPaidStatusPartiallyPaid) }}
</small>
@endif
@stack('timeline_get_paid_body_message_end')
<div class="mt-3">
@stack('timeline_get_paid_body_button_pay_start')
@if (!$hideButtonPaid)
@can('update-sales-invoices')
<a href="{{ route($routeButtonPaid, $document->id) }}" class="btn btn-white btn-sm header-button-top">
{{ trans($textTimelineGetPaidMarkPaid) }}
</a>
@endcan
@endif
@stack('timeline_get_paid_body_button_pay_end')
@stack('timeline_get_paid_body_button_payment_start')
@if (!$hideButtonAddPayment)
@if(empty($document->transactions->count()) || (!empty($document->transactions->count()) && $document->paid != $document->amount))
<button @click="onPayment" id="button-payment" class="btn btn-success btn-sm header-button-bottom">
{{ trans($textTimelineGetPaidAddPayment) }}
</button>
@endif
@endif
@stack('timeline_get_paid_body_button_payment_end')
</div>
@stack('timeline_get_paid_body_end')
</div>
</div>
@endif
@stack('timeline_get_paid_end')
</div>
</div>
</div>
@stack('timeline_get_paid_end')
@endif

View File

@@ -0,0 +1,121 @@
@stack('button_group_start')
@if (!$hideButtonMoreActions)
<div class="dropup header-drop-top">
<button type="button" class="btn btn-white btn-sm" data-toggle="dropdown" aria-expanded="false">
<i class="fa fa-chevron-down"></i>&nbsp; {{ trans('general.more_actions') }}
</button>
<div class="dropdown-menu" role="menu">
@stack('button_dropdown_start')
@stack('duplicate_button_start')
@if (!$hideButtonDuplicate)
@can($permissionDocumentCreate)
<a class="dropdown-item" href="{{ route($routeButtonDuplicate, $document->id) }}">
{{ trans('general.duplicate') }}
</a>
@endcan
@endif
@stack('duplicate_button_end')
@stack('button_dropdown_divider_1_start')
@if (!$hideButtonGroupDivider1)
<div class="dropdown-divider"></div>
@endif
@stack('button_dropdown_divider_1_end')
@if (!$hideButtonPrint)
@if ($checkButtonCancelled)
@if ($document->status != 'cancelled')
@stack('button_print_start')
<a class="dropdown-item" href="{{ route($routeButtonPrint, $document->id) }}" target="_blank">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
@endif
@else
@stack('button_print_start')
<a class="dropdown-item" href="{{ route($routeButtonPrint, $document->id) }}" target="_blank">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
@endif
@endif
@stack('button_pdf_start')
@if (!$hideButtonPdf)
<a class="dropdown-item" href="{{ route($routeButtonPdf, $document->id) }}">
{{ trans('general.download_pdf') }}
</a>
@endif
@stack('button_pdf_end')
@if (!$hideButtonCancel)
@can($permissionDocumentUpdate)
@if ($checkButtonCancelled)
@if ($document->status != 'cancelled')
@stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route($routeButtonCancelled, $document->id) }}">
{{ trans('general.cancel') }}
</a>
@stack('button_cancelled_end')
@endif
@else
@stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route($routeButtonCancelled, $document->id) }}">
{{ trans('general.cancel') }}
</a>
@stack('button_cancelled_end')
@endif
@endcan
@endif
@stack('button_dropdown_divider_2_start')
@if (!$hideButtonGroupDivider2)
<div class="dropdown-divider"></div>
@endif
@stack('button_dropdown_divider_2_end')
@if (!$hideButtonCustomize)
@can($permissionButtonCustomize)
@stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route($routeButtonCustomize) }}">
{{ trans('general.customize') }}
</a>
@stack('button_cancelled_end')
@endcan
@endif
@stack('button_dropdown_divider_3_start')
@if (!$hideButtonGroupDivider3)
<div class="dropdown-divider"></div>
@endif
@stack('button_dropdown_divider_3_end')
@stack('delete_button_start')
@if (!$hideButtonDelete)
@can($permissionDocumentDelete)
@if ($checkButtonReconciled)
@if (!$document->reconciled)
{!! Form::deleteLink($document, $routeButtonDelete) !!}
@endif
@else
{!! Form::deleteLink($document, $routeButtonDelete) !!}
@endif
@endcan
@endif
@stack('delete_button_end')
@stack('button_dropdown_end')
</div>
</div>
@endif
@stack('button_group_end')
@stack('add_new_button_start')
@if (!$hideButtonAddNew)
@can($permissionDocumentCreate)
<a href="{{ route($routeButtonAddNew) }}" class="btn btn-white btn-sm">
{{ trans('general.add_new') }}
</a>
@endcan
@endif
@stack('add_new_button_end')

View File

@@ -0,0 +1,83 @@
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-transactions-header" data-toggle="collapse" data-target="#accordion-transactions-body" aria-expanded="false" aria-controls="accordion-transactions-body">
<h4 class="mb-0">{{ trans_choice('general.transactions', 2) }}</h4>
</div>
<div id="accordion-transactions-body" class="collapse hide" aria-labelledby="accordion-transactions-header">
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
@stack('row_footer_transactions_head_tr_start')
<tr class="row table-head-line">
@stack('row_footer_transactions_head_td_start')
<th class="col-xs-4 col-sm-3">
{{ trans('general.date') }}
</th>
<th class="col-xs-4 col-sm-3">
{{ trans('general.amount') }}
</th>
<th class="col-sm-3 d-none d-sm-block">
{{ trans_choice('general.accounts', 1) }}
</th>
<th class="col-xs-4 col-sm-3">
{{ trans('general.actions') }}
</th>
@stack('row_footer_transactions_head_td_end')
</tr>
@stack('row_footer_transactions_head_tr_end')
</thead>
<tbody>
@stack('row_footer_transactions_body_tr_start')
@if ($transactions->count())
@foreach($transactions as $transaction)
<tr class="row align-items-center border-top-1 tr-py">
@stack('row_footer_transactions_body_td_start')
<td class="col-xs-4 col-sm-3">
@date($transaction->paid_at)
</td>
<td class="col-xs-4 col-sm-3">
@money($transaction->amount, $transaction->currency_code, true)
</td>
<td class="col-sm-3 d-none d-sm-block">
{{ $transaction->account->name }}
</td>
<td class="col-xs-4 col-sm-3 py-0">
@if ($transaction->reconciled)
<button type="button" class="btn btn-default btn-sm">
{{ trans('reconciliations.reconciled') }}
</button>
@else
@php $message = trans('general.delete_confirm', [
'name' => '<strong>' . Date::parse($transaction->paid_at)->format($date_format) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
'type' => strtolower(trans_choice('general.transactions', 1))
]);
@endphp
{!! Form::button(trans('general.delete'), array(
'type' => 'button',
'class' => 'btn btn-danger btn-sm',
'title' => trans('general.delete'),
'@click' => 'confirmDelete("' . route('transactions.destroy', $transaction->id) . '", "' . trans_choice('general.transactions', 2) . '", "' . $message. '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
)) !!}
@endif
</td>
@stack('row_footer_transactions_body_td_end')
</tr>
@endforeach
@else
<tr>
<td colspan="4">
<div class="text-muted nr-py" id="datatable-basic_info" role="status" aria-live="polite">
{{ trans('general.no_records') }}
</div>
</td>
</tr>
@endif
@stack('row_footer_transactions_body_tr_end')
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,267 @@
<div class="row">
<div class="col-58">
<div class="text company">
@stack('company_logo_start')
@if (!$hideCompanyLogo)
@if (!empty($document->contact->logo) && !empty($document->contact->logo->id))
<img class="c-logo" src="{{ Storage::url($document->contact->logo->id) }}" height="128" width="128" alt="{{ $document->contact_name }}"/>
@else
<img class="c-logo" src="{{ $logo }}" alt="{{ setting('company.name') }}" />
@endif
@endif
@stack('company_logo_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('company_details_start')
@if (!$hideCompanyDetails)
@if (!$hideCompanyName)
<strong>{{ setting('company.name') }}</strong><br>
@endif
@if (!$hideCompanyAddress)
<p>{!! nl2br(setting('company.address')) !!}</p>
@endif
@if (!$hideCompanyTaxNumber)
<p>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</p>
@endif
@if (!$hideCompanyPhone)
<p>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</p>
@endif
@if (!$hideCompanyEmail)
<p>{{ setting('company.email') }}</p>
@endif
@endif
@stack('company_details_end')
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-33">
<hr class="invoice-classic-line mb-1 mt-4" style="background-color:{{ $backGroundColor }};">
<hr class="invoice-classic-line" style="background-color:{{ $backGroundColor }};">
</div>
<div class="col-33">
<div class="invoice-classic-frame ml-1">
<div class="invoice-classic-inline-frame text-center">
@stack('invoice_number_input_start')
@if (!$hideDocumentNumber)
<div class="text company">
<strong>{{ $textDocumentNumber }}:</strong><br>
{{ $document->document_number }}
</div>
@endif
@stack('invoice_number_input_end')
</div>
</div>
</div>
<div class="col-33">
<hr class="invoice-classic-line mb-1 mt-4" style="background-color:{{ $backGroundColor }};">
<hr class="invoice-classic-line" style="background-color:{{ $backGroundColor }};">
</div>
</div>
<div class="row mt-2">
<div class="col-58">
<div class="text company">
@if (!$hideContactInfo)
<strong>{{ $textContactInfo }}</strong><br>
@endif
@stack('name_input_start')
@if (!$hideContactName)
<strong>{{ $document->contact_name }}</strong><br>
@endif
@stack('name_input_end')
@stack('address_input_start')
@if (!$hideContactAddress)
<p>{!! nl2br($document->contact_address) !!}</p>
@endif
@stack('address_input_end')
@stack('tax_number_input_start')
@if (!$hideContactTaxNumber)
<p>
@if ($document->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $document->contact_tax_number }}
@endif
</p>
@endif
@stack('tax_number_input_end')
@stack('phone_input_start')
@if (!$hideContactPhone)
<p>
@if ($document->contact_phone)
{{ $document->contact_phone }}
@endif
</p>
@endif
@stack('phone_input_end')
@stack('email_start')
@if (!$hideContactEmail)
<p>{{ $document->contact_email }}</p>
@endif
@stack('email_input_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('order_number_input_start')
@if (!$hideOrderNumber)
@if ($document->order_number)
<strong>{{ $textOrderNumber }}:</strong>
<span class="float-right">{{ $document->order_number }}</span><br><br>
@endif
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
@if (!$hideIssuedAt)
<strong>{{ $textIssuedAt }}:</strong>
<span class="float-right">@date($document->issued_at)</span><br><br>
@endif
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
@if (!$hideDueAt)
<strong>{{ $textDueAt }}:</strong>
<span class="float-right">@date($document->due_at)</span><br><br>
@endif
@stack('due_at_input_end')
@foreach ($document->totals_sorted as $total)
@if ($total->code == 'total')
<strong>{{ trans($total->name) }}:</strong>
<span class="float-right">@money($total->amount - $document->paid, $document->currency_code, true)</span><br><br>
@endif
@endforeach
</div>
</div>
</div>
<div class="row">
<div class="col-100">
<div class="text">
<table class="c-lines">
<thead>
<tr>
@stack('name_th_start')
@if (!$hideItems || (!$hideName && !$hideDescription))
<th class="text-left item">{{ $textItems }}</th>
@endif
@stack('name_th_end')
@stack('quantity_th_start')
@if (!$hideQuantity)
<th class="quantity">{{ $textQuantity }}</th>
@endif
@stack('quantity_th_end')
@stack('price_th_start')
@if (!$hidePrice)
<th class="price">{{ $textPrice }}</th>
@endif
@stack('price_th_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="discount">{{ $item->discount }}</td>
@stack('discount_td_end')
@endif
@endif
@stack('total_th_start')
@if (!$hideAmount)
<th class="total">{{ $textAmount }}</th>
@endif
@stack('total_th_end')
</tr>
</thead>
<tbody>
@foreach($document->items as $item)
@include('partials.documents.item.print', ['document' => $document])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-58">
<div class="text company">
@stack('notes_input_start')
@if($hideNote)
@if ($document->notes)
<strong>{{ trans_choice('general.notes', 2) }}</strong><br><br>
{!! nl2br($document->notes) !!}
@endif
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-42 float-right text-right">
<div class="text company pr-2">
@foreach ($document->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<div class="border-top-dashed py-2">
<strong class="float-left">{{ trans($total->title) }}:</strong>
<span>@money($total->amount, $document->currency_code, true)</span>
</div>
@stack($total->code . '_total_tr_end')
@else
@if ($document->paid)
@stack('paid_total_tr_start')
<div class="border-top-dashed py-2">
<strong class="float-left">{{ trans('invoices.paid') }}:</strong>
<span>- @money($document->paid, $document->currency_code, true)</span>
</div>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<div class="border-top-dashed py-2">
<strong class="float-left">{{ trans($total->name) }}:</strong>
<span>@money($total->amount - $document->paid, $document->currency_code, true)</span>
</div>
@stack('grand_total_tr_end')
@endif
@endforeach
</div>
</div>
</div>
@if (!$hideFooter)
@if ($document->footer)
<div class="row mt-1">
<div class="col-100">
<div class="text company">
<strong>{!! nl2br($document->footer) !!}</strong>
</div>
</div>
</div>
@endif
@endif

View File

@@ -0,0 +1,252 @@
<div class="row border-bottom-1">
<div class="col-58">
<div class="text company">
@stack('company_logo_start')
@if (!$hideCompanyLogo)
@if (!empty($document->contact->logo) && !empty($document->contact->logo->id))
<img class="d-logo" src="{{ Storage::url($document->contact->logo->id) }}" height="128" width="128" alt="{{ $document->contact_name }}"/>
@else
<img class="d-logo" src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
@endif
@endif
@stack('company_logo_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('company_details_start')
@if (!$hideCompanyDetails)
@if (!$hideCompanyName)
<strong>{{ setting('company.name') }}</strong><br>
@endif
@if (!$hideCompanyAddress)
<p>{!! nl2br(setting('company.address')) !!}</p>
@endif
@if (!$hideCompanyTaxNumber)
<p>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</p>
@endif
@if (!$hideCompanyPhone)
<p>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</p>
@endif
@if (!$hideCompanyEmail)
<p>{{ setting('company.email') }}</p>
@endif
@endif
@stack('company_details_end')
</div>
</div>
</div>
<div class="row">
<div class="col-58">
<div class="text company">
<br>
@if ($hideContactInfo)
<strong>{{ $textContactInfo }}</strong><br>
@endif
@stack('name_input_start')
@if (!$hideContactName)
<strong>{{ $document->contact_name }}</strong><br>,
@endif
@stack('name_input_end')
@stack('address_input_start')
@if (!$hideContactAddress)
<p>{!! nl2br($document->contact_address) !!}</p>
@endif
@stack('address_input_end')
@stack('tax_number_input_start')
@if (!$hideContactTaxNumber)
<p>
@if ($document->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $document->contact_tax_number }}
@endif
</p>
@endif
@stack('tax_number_input_end')
@stack('phone_input_start')
@if (!$hideContactPhone)
<p>
@if ($document->contact_phone)
{{ $document->contact_phone }}
@endif
</p>
@endif
@stack('phone_input_end')
@stack('email_start')
@if (!$hideContactEmail)
<p>
{{ $document->contact_email }}
</p>
@endif
@stack('email_input_end')
</div>
</div>
<div class="col-42">
<div class="text company">
<br>
@stack('document_number_input_start')
@if (!$hideDocumentNumber)
<strong>
{{ $textDocumentNumber }}:
</strong>
<span class="float-right">{{ $document->document_number }}</span><br><br>
@endif
@stack('document_number_input_end')
@stack('order_number_input_start')
@if (!$hideOrderNumber)
@if ($document->order_number)
<strong>
{{ $textOrderNumber }}:
</strong>
<span class="float-right">{{ $document->order_number }}</span><br><br>
@endif
@endif
@stack('order_number_input_end')
@stack('issued_at_input_start')
@if (!$hideIssuedAt)
<strong>
{{ $textIssuedAt }}:
</strong>
<span class="float-right">@date($document->issued_at)</span><br><br>
@endif
@stack('issueed_at_input_end')
@stack('due_at_input_start')
@if (!$hideDueAt)
<strong>
{{ $textDueAt }}:
</strong>
<span class="float-right">@date($document->due_at)</span><br><br>
@endif
@stack('due_at_input_end')
</div>
</div>
</div>
<div class="row">
<div class="col-100">
<div class="text">
<table class="lines">
@foreach($document as $item)
<thead style="background-color:{{ $backGroundColor }} !important; -webkit-print-color-adjust: exact;">
@endforeach
<tr>
@stack('name_th_start')
@if ($hideItems || (!$hideName && !$hideDescription))
<th class="item text-left text-white">{{ $textItems }}</th>
@endif
@stack('name_th_end')
@stack('quantity_th_start')
@if (!$hideQuantity)
<th class="quantity text-white">{{ $textQuantity }}</th>
@endif
@stack('quantity_th_end')
@stack('price_th_start')
@if (!$hidePrice)
<th class="price text-white">{{ $textPrice }}</th>
@endif
@stack('price_th_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="discount text-white">{{ $item->discount }}</td>
@stack('discount_td_end')
@endif
@endif
@stack('total_th_start')
@if (!$hideAmount)
<th class="total text-white">{{ $textAmount }}</th>
@endif
@stack('total_th_end')
</tr>
</thead>
<tbody>
@foreach($document->items as $item)
@include('partials.documents.item.print', ['document' => $document])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-9">
<div class="col-58">
<div class="text company">
@stack('notes_input_start')
@if ($document->notes)
<br>
<strong>{{ trans_choice('general.notes', 2) }}</strong><br><br>
{!! nl2br($document->notes) !!}
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-42 float-right text-right">
<div class="text company">
@foreach ($document->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<div class="border-top-1 py-2">
<strong class="float-left">{{ trans($total->title) }}:</strong>
<span>@money($total->amount, $document->currency_code, true)</span><br>
</div>
@stack($total->code . '_total_tr_end')
@else
@if ($document->paid)
@stack('paid_total_tr_start')
<div class="border-top-1 py-2">
<strong class="float-left">{{ trans('invoices.paid') }}:</strong>
<span>- @money($document->paid, $document->currency_code, true)</span><br>
</div>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<div class="border-top-1 py-2">
<strong class="float-left">{{ trans($total->name) }}:</strong>
<span>@money($total->amount - $document->paid, $document->currency_code, true)</span>
</div>
@stack('grand_total_tr_end')
@endif
@endforeach
</div>
</div>
</div>
@if (!$hideFooter)
@if ($document->footer)
<div class="row mt-4">
<div class="col-100 text-left">
<div class="text company">
<strong>{!! nl2br($document->footer) !!}<strong>
</div>
</div>
</div>
@endif
@endif

View File

@@ -0,0 +1,235 @@
<div class="row" style="background-color:{{ $backGroundColor }} !important; -webkit-print-color-adjust: exact;">
<div class="col-58">
<div class="text company pl-2 mb-1 d-flex align-items-center">
@stack('company_logo_start')
@if (!$hideCompanyLogo)
@if (!empty($document->contact->logo) && !empty($document->contact->logo->id))
<img src="{{ Storage::url($document->contact->logo->id) }}" height="128" width="128" alt="{{ $document->contact_name }}"/>
@else
<img src="{{ $logo }}" alt="{{ setting('company.name') }}" />
@endif
@if (!$hideCompanyName)
<strong class="pl-2 text-white">{{ setting('company.name') }}</strong>
@endif
@endif
@stack('company_logo_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('company_details_start')
@if (!$hideCompanyDetails)
@if (!$hideCompanyAddress)
<strong class="text-white">{!! nl2br(setting('company.address')) !!}</strong><br><br>
@endif
@if (!$hideCompanyTaxNumber)
<strong class="text-white">
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</strong><br><br>
@endif
@if (!$hideCompanyPhone)
<strong class="text-white">
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</strong><br><br>
@endif
@if (!$hideCompanyEmail)
<strong class="text-white">{{ setting('company.email') }}</strong><br><br>
@endif
@endif
@stack('company_details_end')
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-58">
<div class="text company">
@if (!$hideContactInfo)
<strong>{{ $textContactInfo }}</strong>
<br>
@endif
@stack('name_input_start')
@if (!$hideContactName)
<strong>{{ $document->contact_name }}</strong>
<br><br>
@endif
@stack('name_input_end')
@stack('address_input_start')
@if (!$hideContactAddress)
{!! nl2br($document->contact_address) !!}
<br><br>
@endif
@stack('address_input_end')
@stack('tax_number_input_start')
@if (!$hideContactTaxNumber)
@if ($document->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $document->contact_tax_number }}
<br><br>
@endif
@endif
@stack('tax_number_input_end')
@stack('phone_input_start')
@if (!$hideContactPhone)
@if ($document->contact_phone)
{{ $document->contact_phone }}
<br><br>
@endif
@endif
@stack('phone_input_end')
@stack('email_start')
@if (!$hideContactEmail)
{{ $document->contact_email }}
<br><br>
@endif
@stack('email_input_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('order_number_input_start')
@if (!$hideOrderNumber)
@if ($document->order_number)
<strong>{{ $textOrderNumber }}:</strong>
<span class="float-right">{{ $document->order_number }}</span><br><br>
@endif
@endif
@stack('order_number_input_end')
@stack('invoice_number_input_start')
@if (!$hideDocumentNumber)
<strong>{{ $textDocumentNumber }}:</strong>
<span class="float-right">{{ $document->document_number }}</span><br><br>
@endif
@stack('invoice_number_input_end')
@stack('invoiced_at_input_start')
@if (!$hideIssuedAt)
<strong>{{ $textIssuedAt }}:</strong>
<span class="float-right">@date($document->issued_at)</span><br><br>
@endif
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
@if (!$hideDueAt)
<strong>{{ $textDueAt }}:</strong>
<span class="float-right">@date($document->due_at)</span>
@endif
@stack('due_at_input_end')
</div>
</div>
</div>
<div class="row">
<div class="col-100">
<div class="text">
<table class="m-lines">
<thead style="background-color:{{ $backGroundColor }} !important; -webkit-print-color-adjust: exact;">
<tr>
@stack('name_th_start')
@if (!$hideItems || (!$hideName && !$hideDescription))
<th class="item text-left text-white">{{ $textItems }}</th>
@endif
@stack('name_th_end')
@stack('quantity_th_start')
@if (!$hideQuantity)
<th class="quantity text-white">{{ $textQuantity }}</th>
@endif
@stack('quantity_th_end')
@stack('price_th_start')
@if (!$hidePrice)
<th class="price text-white">{{ $textPrice }}</th>
@endif
@stack('price_th_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="discount text-white">{{ $item->discount }}</td>
@stack('discount_td_end')
@endif
@endif
@stack('total_th_start')
@if (!$hideAmount)
<th class="total text-white">{{ $textAmount }}</th>
@endif
@stack('total_th_end')
</tr>
</thead>
<tbody>
@foreach($document->items as $item)
@include('partials.documents.item.print', ['document' => $document])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-7">
<div class="col-58">
<div class="text company">
@stack('notes_input_start')
@if($hideNote)
@if ($document->notes)
<strong>{{ trans_choice('general.notes', 2) }}</strong><br><br>
{!! nl2br($document->notes) !!}
@endif
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-42 float-right text-right">
<div class="text company pr-2">
@foreach ($document->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<strong class="float-left">{{ trans($total->title) }}:</strong>
<span>@money($total->amount, $document->currency_code, true)</span><br><br>
@stack($total->code . '_total_tr_end')
@else
@if ($document->paid)
@stack('paid_total_tr_start')
<strong class="float-left">{{ trans('invoices.paid') }}:</strong>
<span>- @money($document->paid, $document->currency_code, true)</span><br><br>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<strong class="float-left">{{ trans($total->name) }}:</strong>
<span>@money($total->amount - $document->paid, $document->currency_code, true)</span>
@stack('grandtotal_tr_end')
@endif
@endforeach
</div>
</div>
</div>
@if (!$hideFooter)
@if ($document->footer)
<div class="row mt-7">
<div class="col-100 py-2" style="background-color:{{ $backGroundColor }} !important; -webkit-print-color-adjust: exact;">
<div class="text pl-2">
<strong class="text-white">{!! nl2br($document->footer) !!}</strong>
</div>
</div>
</div>
@endif
@endif

View File

@@ -0,0 +1,19 @@
<akaunting-edit-item-columns
placeholder="{{ (!empty($filters)) ? trans('general.placeholder.search_and_filter') : trans('general.search_placeholder')}}"
search-text="{{ trans('general.search_text') }}"
:edit-column="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
></akaunting-edit-item-columns>

View File

@@ -0,0 +1,27 @@
<akaunting-contact-card
placeholder="{{ $placeholder }}"
no-data-text="{{ trans('general.no_data') }}"
no-matching-data-text="{{ trans('general.no_matching_data') }}"
search-route="{{ $search_route }}"
create-route="{{ $create_route }}"
:contacts="{{ json_encode($contacts) }}"
:selected="{{ json_encode($contact) }}"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
@change="onChangeContactCard"
></akaunting-contact-card>

View File

@@ -0,0 +1,9 @@
<akaunting-item-button
placeholder="{{ trans('general.placeholder.item_search') }}"
no-data-text="{{ trans('general.no_data') }}"
no-matching-data-text="{{ trans('general.no_matching_data') }}"
type="{{ $type }}"
price="{{ $price }}"
:items="{{ json_encode($items) }}"
@item="onSelectedItem($event)"
></akaunting-item-button>

View File

@@ -0,0 +1,25 @@
{!! Form::open([
'id' => 'setting',
'method' => 'PATCH',
'route' => 'settings.update',
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="row">
{{ Form::textGroup('name', trans('settings.company.name'), 'building', ['required' => 'required'], setting('company.name')) }}
{{ Form::textGroup('email', trans('settings.company.email'), 'envelope', ['required' => 'required'], setting('company.email')) }}
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', [], setting('company.tax_number')) }}
{{ Form::textGroup('phone', trans('settings.company.phone'), 'phone', [], setting('company.phone')) }}
{{ Form::textareaGroup('address', trans('settings.company.address'), null, setting('company.address')) }}
{!! Form::hidden('_prefix', 'company') !!}
</div>
{!! Form::close() !!}

View File

@@ -0,0 +1,27 @@
{!! Form::model($customer, [
'id' => 'form-edit-customer',
'method' => 'PATCH',
'route' => ['customers.update', $customer->id],
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="row">
{{ Form::textGroup('name', trans('general.name'), 'font') }}
{{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', [], $customer->tax_number) }}
{{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $customer->currency_code) }}
{{ Form::textareaGroup('address', trans('general.address'), $customer->address) }}
{{ Form::hidden('type', 'customer') }}
{!! Form::hidden('enabled', '1', []) !!}
</div>
{!! Form::close() !!}

View File

@@ -0,0 +1,31 @@
{!! Form::open([
'id' => 'form-item-column',
'method' => 'PATCH',
'route' => 'modals.invoices.item-columns.update',
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true,
]) !!}
<div class="row">
{{ Form::invoice_text('item_name', trans('settings.invoice.item_name'), 'font', $item_names, setting('invoice.item_name'), [], 'item_name_input', setting('invoice.item_name_input', null), 'col-md-12') }}
{{ Form::invoice_text('price_name', trans('settings.invoice.price_name'), 'font', $price_names, setting('invoice.price_name'), [], 'price_name_input', setting('invoice.price_name_input', null), 'col-md-12') }}
{{ Form::invoice_text('quantity_name', trans('settings.invoice.quantity_name'), 'font', $quantity_names, setting('invoice.quantity_name'), [], 'quantity_name_input', setting('invoice.quantity_name_input', null), 'col-md-12') }}
{{ Form::radioGroup('hide_item_name', trans('settings.invoice.hide.item_name'), setting('invoice.hide_item_name', null)) }}
{{ Form::radioGroup('hide_item_description', trans('settings.invoice.hide.item_description'), setting('invoice.hide_item_description', null)) }}
{{ Form::radioGroup('hide_quantity', trans('settings.invoice.hide.quantity'), setting('invoice.hide_quantity', null)) }}
{{ Form::radioGroup('hide_price', trans('settings.invoice.hide.price'), setting('invoice.hide_price', null)) }}
{{ Form::radioGroup('hide_amount', trans('settings.invoice.hide.amount'), setting('invoice.hide_amount', null)) }}
{!! Form::hidden('_prefix', 'invoice') !!}
</div>
{!! Form::close() !!}

View File

@@ -0,0 +1,27 @@
{!! Form::model($vendor, [
'id' => 'form-edit-vendor',
'method' => 'PATCH',
'route' => ['vendors.update', $vendor->id],
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="row">
{{ Form::textGroup('name', trans('general.name'), 'font') }}
{{ Form::textGroup('email', trans('general.email'), 'envelope', []) }}
{{ Form::textGroup('tax_number', trans('general.tax_number'), 'percent', []) }}
{{ Form::selectGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $vendor->currency_code) }}
{{ Form::textareaGroup('address', trans('general.address')) }}
{{ Form::hidden('type', 'vendor') }}
{!! Form::hidden('enabled', '1', []) !!}
</div>
{!! Form::close() !!}

View File

@@ -11,7 +11,9 @@
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-search"></i></span>
</div>
<input type="text" name="search" v-model="keyword" @input="onChange" v-click-outside="closeResult" class="form-control" autocomplete="off" placeholder="{{ trans('general.search') }}">
<div class="dropdown-menu dropdown-menu-xl dropdown-menu-center" ref="menu" :class="[{show: show}]">
<div class="list-group list-group-flush">
<a class="list-group-item list-group-item-action" :href="item.href" v-for="(item, index) in items">
@@ -32,6 +34,7 @@
</div>
</div>
</div>
<button type="button" class="close" data-action="search-close" data-target="#navbar-search-main" aria-label="Close">
<span aria-hidden="true">×</span>
</button>

View File

@@ -1,22 +1,43 @@
<tr>
@stack('name_td_start')
<td class="item">
{{ $item->name }}
@if (!empty($item->item->description))
<br><small>{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!}</small>
@endif
</td>
@if (!$hideItems || (!$hideName && !$hideDescription))
<td class="item">
@if (!$hideName)
{{ $item->name }}
@endif
@if (!$hideDescription)
@if (!empty($item->item->description))
<br><small>{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!}</small>
@endif
@endif
</td>
@endif
@stack('name_td_end')
@stack('quantity_td_start')
<td class="quantity">{{ $item->quantity }}</td>
@if (!$hideQuantity)
<td class="quantity">{{ $item->quantity }}</td>
@endif
@stack('quantity_td_end')
@stack('price_td_start')
<td class="price">@money($item->price, $document->currency_code, true)</td>
@if (!$hidePrice)
<td class="price">@money($item->price, $document->currency_code, true)</td>
@endif
@stack('price_td_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="discount">{{ $item->discount }}</td>
@stack('discount_td_end')
@endif
@endif
@stack('total_td_start')
<td class="total">@money($item->total, $document->currency_code, true)</td>
@if (!$hideAmount)
<td class="total">@money($item->total, $document->currency_code, true)</td>
@endif
@stack('total_td_end')
</tr>

View File

@@ -1,28 +1,43 @@
<tr class="d-flex flex-nowrap">
@stack('name_td_start')
<td class="col-xs-4 col-sm-5 pl-5">
{{ $item->name }}
@if (!empty($item->item->description))
<br><small class="text-pre-nowrap">{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!}<small>
@endif
</td>
@if (!$hideItems || (!$hideName && !$hideDescription))
<td class="col-xs-4 col-sm-5 pl-5">
@if (!$hideName)
{{ $item->name }}
@endif
@if (!$hideDescription)
@if (!empty($item->item->description))
<br><small class="text-pre-nowrap">{!! \Illuminate\Support\Str::limit($item->item->description, 500) !!}<small>
@endif
@endif
</td>
@endif
@stack('name_td_end')
@stack('quantity_td_start')
<td class="col-xs-4 col-sm-1 text-center">{{ $item->quantity }}</td>
@if (!$hideQuantity)
<td class="col-xs-4 col-sm-1 text-center">{{ $item->quantity }}</td>
@endif
@stack('quantity_td_end')
@stack('price_td_start')
<td class="col-sm-3 text-right d-none d-sm-block">@money($item->price, $document->currency_code, true)</td>
@if (!$hidePrice)
<td class="col-sm-3 text-right d-none d-sm-block">@money($item->price, $document->currency_code, true)</td>
@endif
@stack('price_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="col-sm-1 text-center d-none d-sm-block">{{ $item->discount }}</td>
@stack('discount_td_end')
@if (!$hideDiscount)
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="col-sm-1 text-center d-none d-sm-block">{{ $item->discount }}</td>
@stack('discount_td_end')
@endif
@endif
@stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $document->currency_code, true)</td>
@if (!$hideAmount)
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($item->total, $document->currency_code, true)</td>
@endif
@stack('total_td_end')
</tr>

View File

@@ -110,7 +110,7 @@
</template>
</akaunting-modal>
@else
<div class="text-white" :class="[{'show': bulk_action.show}]">{{ trans('bulk_actions.no_action') }}</div>
<div class="text-white d-none" :class="[{'show': bulk_action.show}]">{{ trans('bulk_actions.no_action') }}</div>
@endif
@stack('bulk_action_row_input_end')

View File

@@ -66,6 +66,10 @@
@else
:form-error="form.errors.get('{{ $name }}')"
@endif
@if (isset($attributes['row-input']))
:row-input="{{ $attributes['row-input'] }}"
@endif
></akaunting-money>
@stack($name . '_input_end')

View File

@@ -3,57 +3,21 @@
@section('title', trans_choice('general.invoices', 2))
@section('content')
<div class="card">
<div class="card-header border-bottom-0">
{!! Form::open([
'route' => 'portal.invoices.index',
'role' => 'form',
'method' => 'GET',
'class' => 'mb-0'
]) !!}
<div class="row">
<div class="col-12 d-flex align-items-center">
<span class="font-weight-400 d-none d-lg-block mr-2">{{ trans('general.search') }}:</span>
<akaunting-search></akaunting-search>
</div>
</div>
{!! Form::close() !!}
</div>
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
<tr class="row table-head-line">
<th class="col-xs-4 col-sm-4 col-md-3">@sortablelink('invoice_number', trans('invoices.invoice_number'))</th>
<th class="col-xs-4 col-sm-2 col-md-2 text-right">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-sm-3 col-md-3 d-none d-sm-block">@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th>
<th class="col-md-2 d-none d-md-block">@sortablelink('due_at', trans('invoices.due_date'))</th>
<th class="col-xs-4 col-sm-3 col-md-2 text-center">@sortablelink('status', trans_choice('general.statuses', 1))</th>
</tr>
</thead>
<tbody>
@foreach($invoices as $item)
<tr class="row align-items-center border-top-1 tr-py">
<td class="col-xs-4 col-sm-4 col-md-3"><a href="{{ route('portal.invoices.show', $item->id) }}">{{ $item->invoice_number }}</a></td>
<td class="col-xs-4 col-sm-2 col-md-2 text-right">@money($item->amount, $item->currency_code, true)</td>
<td class="col-sm-3 col-md-3 d-none d-sm-block">@date($item->invoiced_at)</td>
<td class="col-md-2 d-none d-md-block">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-3 col-md-2 text-center"><span class="badge badge-pill badge-{{ $item->status_label }} my--2">{{ trans('invoices.statuses.' . $item->status) }}</span></td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-footer table-action">
<div class="row">
@include('partials.admin.pagination', ['items' => $invoices])
</div>
</div>
</div>
<x-documents.index.content
type="invoice"
:documents="$invoices"
hide-bulk-action
hide-contact-name
hide-actions
hide-empty-page
form-card-header-route="portal.invoices.index"
route-button-show="portal.invoices.show"
class-document-number="col-xs-4 col-sm-4 col-md-3 disabled-col-aka"
class-amount="col-xs-4 col-sm-2 col-md-2 text-right"
class-issued-at="col-sm-3 col-md-3 d-none d-sm-block"
class-due-at="col-md-2 d-none d-md-block"
class-status="col-xs-4 col-sm-3 col-md-2 text-center"
/>
@endsection
@push('scripts_start')

View File

@@ -1,317 +1,89 @@
@extends('layouts.portal')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('title', setting('invoice.title', trans_choice('general.invoices', 1)) . ': ' . $invoice->document_number)
@section('new_button')
@stack('button_print_start')
<a href="{{ route('portal.invoices.print', $invoice->id) }}" target="_blank" class="btn btn-success btn-sm">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
@stack('button_pdf_start')
<a href="{{ route('portal.invoices.pdf', $invoice->id) }}" class="btn btn-white btn-sm">
{{ trans('general.download') }}
</a>
@stack('button_pdf_end')
@endsection
@section('content')
@stack('invoice_start')
<div class="card">
@stack('invoice_status_start')
<div class="card-header status-{{ $invoice->status_label }}">
<h3 class="text-white mb-0 float-right">{{ trans('invoices.statuses.' . $invoice->status) }}</h3>
</div>
@stack('invoice_status_end')
<x-documents.show.header
type="invoice"
:document="$invoice"
hide-header-contact
class-header-status="col-md-8"
/>
<div class="card-body">
@stack('invoice_header_start')
<div class="row mx--4">
<div class="col-md-7 border-bottom-1">
<div class="table-responsive mt-2">
<table class="table table-borderless">
<tbody>
<tr>
<th>
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5 border-bottom-1">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ setting('company.name') }}
</th>
</tr>
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}<br>
@endif
</th>
</tr>
<tr>
<th>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</th>
</tr>
<tr>
<th>
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_header_end')
@if (!empty($payment_methods) && !in_array($invoice->status, ['paid', 'cancelled']))
<div class="row">
<div class="col-md-12">
{!! Form::open([
'id' => 'invoice-payment',
'role' => 'form',
'autocomplete' => "off",
'novalidate' => 'true',
'class' => 'mb-0'
]) !!}
{{ Form::selectGroup('payment_method', '', 'money el-icon-money', $payment_methods, array_key_first($payment_methods) , ['change' => 'onChangePaymentMethod', 'id' => 'payment-method', 'class' => 'form-control d-none', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'col-sm-12 d-none') }}
{!! Form::hidden('document_id', $invoice->id, ['v-model' => 'form.document_id']) !!}
{!! Form::close() !!}
@stack('invoice_information_start')
<div class="row">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ trans('invoices.bill_to') }}
@stack('name_input_start')
<strong class="d-block">{{ $invoice->contact_name }}</strong>
@stack('name_input_end')
</th>
</tr>
<tr>
<th>
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}
@stack('address_input_end')
</th>
</tr>
<tr>
<th>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br>
@endif
@stack('tax_number_input_end')
</th>
</tr>
<tr>
<th>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
<tr>
<th>
@stack('email_start')
{{ $invoice->contact_email }}
@stack('email_input_end')
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('invoice_number_input_start')
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@stack('invoice_number_input_end')
<div class="nav-wrapper">
<ul class="nav nav-pills nav-fill flex-column flex-md-row" id="tabs-payment-method" role="tablist">
@php $is_active = true; @endphp
@stack('order_number_input_start')
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_tab_start')
<li class="nav-item">
<a @click="onChangePaymentMethod('{{ $key }}')" class="nav-link mb-sm-3 mb-md-0{{ ($is_active) ? ' active': '' }}" id="tabs-payment-method-{{ $key }}-tab" data-toggle="tab" href="#tabs-payment-method-{{ $key }}" role="tab" aria-controls="tabs-payment-method-{{ $key }}" aria-selected="true">
{{ $name }}
</a>
</li>
@stack('invoice_{{ $key }}_tab_end')
@stack('invoiced_at_input_start')
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
@stack('due_at_input_end')
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_information_end')
@stack('invoice_item_start')
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped">
<tbody>
<tr class="row">
@stack('name_th_start')
<th class="col-xs-4 col-sm-5 pl-5">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-1 text-center">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-right d-none d-sm-block">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($invoice->items as $invoice_item)
<tr class="row">
@stack('name_td_start')
<td class="col-xs-4 col-sm-5 pl-5">
{{ $invoice_item->name }}
@if (!empty($invoice_item->item->description))
<br><small class="text-pre-nowrap">{!! \Illuminate\Support\Str::limit($invoice_item->item->description, 500) !!}<small>
@endif
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="col-xs-4 col-sm-1 text-center">{{ $invoice_item->quantity }}</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="col-sm-3 text-right d-none d-sm-block">@money($invoice_item->price, $invoice->currency_code, true)</td>
@stack('price_td_end')
@stack('total_td_start')
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($invoice_item->total, $invoice->currency_code, true)</td>
@stack('total_td_end')
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_item_end')
@stack('invoice_total_start')
<div class="row mt-5">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('notes_input_start')
<tr>
<th>
@if ($invoice->notes)
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="text-muted long-texts">{!! nl2br($invoice->notes) !!}</p>
@endif
</th>
</tr>
@stack('notes_input_end')
</tbody>
</table>
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<tr>
<th>{{ trans($total->title) }}:</th>
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
</tr>
@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')
<tr>
<th class="text-success">
{{ trans('invoices.paid') }}:
</th>
<td class="text-right">- @money($invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<tr>
<th>{{ trans($total->name) }}:</th>
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('grand_total_tr_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_total_end')
@php $is_active = false; @endphp
@endforeach
</ul>
</div>
@stack('card_footer_start')
<div class="card-footer">
<div class="row">
<div class="col-xs-12 col-sm-6">
@if (!empty($payment_methods) && !in_array($invoice->status, ['paid', 'cancelled']))
{!! Form::open([
'id' => 'invoice-payment',
'role' => 'form',
'autocomplete' => "off",
'novalidate' => 'true',
'class' => 'mb-0'
]) !!}
{{ Form::selectGroup('payment_method', '', 'money el-icon-money', $payment_methods, '', ['change' => 'onChangePaymentMethod', 'id' => 'payment-method', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'col-sm-12') }}
{!! Form::hidden('invoice_id', $invoice->id, ['v-model' => 'form.invoice_id']) !!}
{!! Form::close() !!}
@endif
</div>
<div class="col-xs-12 col-sm-6 text-right">
@stack('button_print_start')
<a href="{{ route('portal.invoices.print', $invoice->id) }}" target="_blank" class="btn btn-success">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
<div class="card shadow">
<div class="card-body">
<div class="tab-content" id="myTabContent">
@php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_content_start')
<div class="tab-pane fade{{ ($is_active) ? ' show active': '' }}" id="tabs-payment-method-{{ $key }}" role="tabpanel" aria-labelledby="tabs-payment-method-{{ $key }}-tab">
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
@stack('invoice_{{ $key }}_content_end')
@stack('button_pdf_start')
<a href="{{ route('portal.invoices.pdf', $invoice->id) }}" class="btn btn-white">
{{ trans('general.download') }}
</a>
@stack('button_pdf_end')
</div>
<div id="confirm" class="col-sm-12">
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
@php $is_active = false; @endphp
@endforeach
</div>
</div>
@stack('card_footer_end')
</div>
</div>
@stack('invoice_end')
</div>
@endif
<x-documents.show.document
type="invoice"
:document="$invoice"
/>
@endsection
@push('scripts_start')
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
<script src="{{ asset('public/js/portal/invoices.js?v=' . version('short')) }}"></script>
@endpush

View File

@@ -1,257 +1,96 @@
@extends('layouts.signed')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('title', setting('invoice.title', trans_choice('general.invoices', 1)) . ': ' . $invoice->document_number)
@section('new_button')
<a href="{{ route('portal.dashboard') }}" class="btn btn-success btn-sm">{{ trans('invoices.all_invoices') }}</a>
@stack('button_print_start')
<a href="{{ $print_action }}" target="_blank" class="btn btn-white btn-sm">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
@stack('button_pdf_start')
<a href="{{ $pdf_action }}" class="btn btn-white btn-sm">
{{ trans('general.download') }}
</a>
@stack('button_pdf_end')
@stack('button_dashboard_start')
<a href="{{ route('portal.dashboard') }}" class="btn btn-white btn-sm">
{{ trans('invoices.all_invoices') }}
</a>
@stack('button_dashboard_end')
@endsection
@section('content')
<div class="card">
<div class="card-header status-{{ $invoice->status_label }}">
<h3 class="text-white mb-0 float-right pr-4">{{ trans('invoices.statuses.' . $invoice->status) }}</h3>
</div>
<x-documents.show.header
type="invoice"
:document="$invoice"
hide-header-contact
class-header-status="col-md-8"
/>
<div class="card-body">
<div class="row mx--4">
<div class="col-md-7 border-bottom-1">
<div class="table-responsive mt-2">
<table class="table table-borderless">
<tbody>
<tr>
<th>
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>
</table>
</div>
</div>
@if (!empty($payment_methods) && !in_array($invoice->status, ['paid', 'cancelled']))
<div class="row">
<div class="col-md-12">
{!! Form::open([
'id' => 'invoice-payment',
'role' => 'form',
'autocomplete' => "off",
'novalidate' => 'true',
'class' => 'mb-0'
]) !!}
{{ Form::selectGroup('payment_method', '', 'money el-icon-money', $payment_methods, array_key_first($payment_methods) , ['change' => 'onChangePaymentMethodSigned', 'id' => 'payment-method', 'class' => 'form-control d-none', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'col-sm-12 d-none') }}
{!! Form::hidden('document_id', $invoice->id, ['v-model' => 'form.document_id']) !!}
{!! Form::close() !!}
<div class="col-md-5 border-bottom-1">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ setting('company.name') }}
</th>
</tr>
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
<tr>
<th>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}<br>
@endif
</th>
</tr>
<tr>
<th>
@if (setting('company.phone'))
{{ setting('company.phone') }}<br>
@endif
</th>
</tr>
<tr>
<th>
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="nav-wrapper">
<ul class="nav nav-pills nav-fill flex-column flex-md-row" id="tabs-payment-method" role="tablist">
@php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_tab_start')
<li class="nav-item">
<a @click="onChangePaymentMethodSigned('{{ $key }}')" class="nav-link mb-sm-3 mb-md-0{{ ($is_active) ? ' active': '' }}" id="tabs-payment-method-{{ $key }}-tab" data-toggle="tab" href="#tabs-payment-method-{{ $key }}" role="tab" aria-controls="tabs-payment-method-{{ $key }}" aria-selected="true">
{{ $name }}
</a>
</li>
@stack('invoice_{{ $key }}_tab_end')
@php $is_active = false; @endphp
@endforeach
</ul>
</div>
<div class="row">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ trans('invoices.bill_to') }}
<strong class="d-block">{{ $invoice->contact_name }}</strong>
</th>
</tr>
<tr>
<th>
{!! nl2br($invoice->contact_address) !!}
</th>
</tr>
<tr>
<th>
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif
</th>
</tr>
<tr>
<th>
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}<br>
@endif
</th>
</tr>
<tr>
<th>
{{ $invoice->contact_email }}
</th>
</tr>
</tbody>
</table>
<div class="card shadow">
<div class="card-body">
<div class="tab-content" id="myTabContent">
@php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_content_start')
<div class="tab-pane fade{{ ($is_active) ? ' show active': '' }}" id="tabs-payment-method-{{ $key }}" role="tabpanel" aria-labelledby="tabs-payment-method-{{ $key }}-tab">
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
@stack('invoice_{{ $key }}_content_end')
@php $is_active = false; @endphp
@endforeach
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->due_at)</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="row show-table">
<div class="col-md-12 table-responsive">
<table class="table table-striped">
<tbody>
<tr class="row">
<th class="col-xs-4 col-sm-5 pl-5">{{ trans_choice('general.items', 1) }}</th>
<th class="col-xs-4 col-sm-1 text-center">{{ trans('invoices.quantity') }}</th>
<th class="col-sm-3 text-right d-none d-sm-block">{{ trans('invoices.price') }}</th>
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th>
</tr>
@foreach($invoice->items as $invoice_item)
<tr class="row">
<td class="col-xs-4 col-sm-5 pl-5">
{{ $invoice_item->name }}
@if (!empty($invoice_item->item->description))
<br><small class="text-pre-nowrap">{!! \Illuminate\Support\Str::limit($invoice_item->item->description, 500) !!}<small>
@endif
</td>
<td class="col-xs-4 col-sm-1 text-center">{{ $invoice_item->quantity }}</td>
<td class="col-sm-3 text-right d-none d-sm-block">@money($invoice_item->price, $invoice->currency_code, true)</td>
<td class="col-xs-4 col-sm-3 text-right pr-5">@money($invoice_item->total, $invoice->currency_code, true)</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div class="row mt-5">
<div class="col-md-7">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
@if ($invoice->notes)
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="text-muted long-texts">{!! nl2br($invoice->notes) !!}</p>
@endif
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach($invoice->totals_sorted as $total)
@if($total->code != 'total')
@stack($total->code . '_total_tr_start')
<tr>
<th>{{ trans($total['name']) }}:</th>
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
</tr>
@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')
<tr class="text-success">
<th>{{ trans('invoices.paid') }}:</th>
<td class="text-right">- @money($invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<tr>
<th>{{ trans($total['name']) }}:</th>
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('grand_total_tr_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-md-4">
@if (!empty($payment_methods) && !in_array($invoice->status, ['paid', 'cancelled']))
{!! Form::open([
'id' => 'invoice-payment',
'role' => 'form',
'autocomplete' => "off",
'novalidate' => 'true',
'class' => 'mb-0',
]) !!}
{{ Form::selectGroup('payment_method', '', 'fas fa-wallet', $payment_methods, '', ['change' => 'onChangePaymentMethodSigned', 'id' => 'payment-method', 'class' => 'form-control', 'placeholder' => trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)])], 'mb-0') }}
{!! Form::hidden('invoice_id', $invoice->id, ['v-model' => 'form.invoice_id']) !!}
{!! Form::close() !!}
@endif
</div>
<div class="col-md-8 text-right">
<a href="{{ $print_action }}" target="_blank" class="btn btn-success">
{{ trans('general.print') }}
</a>
<a href="{{ $pdf_action }}" class="btn btn-white" data-toggle="tooltip" title="{{ trans('invoices.download_pdf') }}">
{{ trans('general.download') }}
</a>
</div>
<div class="col-md-12" id="confirm">
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
</div>
</div>
</div>
@endif
<x-documents.show.document
type="invoice"
:document="$invoice"
/>
@endsection
@push('footer_start')
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
<script src="{{ asset('public/js/portal/invoices.js?v=' . version('short')) }}"></script>
<script type="text/javascript">

View File

@@ -1,229 +1,11 @@
@extends('layouts.admin')
@section('title', trans('general.title.new', ['type' => trans_choice('general.bills', 1)]))
@section('title', trans('general.title.new', ['type' => setting('bill.title', trans_choice('general.bills', 1))]))
@section('content')
<div class="card">
{!! Form::open([
'route' => 'bills.store',
'id' => 'bill',
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="card-body">
<div class="row">
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, setting('default.contact'), ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.vendors.create'), 'remote_action' => route('vendors.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, setting('default.currency'), ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
{{ Form::dateGroup('billed_at', trans('bills.bill_date'), 'calendar', ['id' => 'billed_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], request()->get('billed_at', Date::now()->toDateString())) }}
{{ Form::dateGroup('due_at', trans('bills.due_date'), 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], request()->get('due_at', request()->get('billed_at', Date::now()->toDateString()))) }}
{{ Form::textGroup('bill_number', trans('bills.bill_number'), 'file', ['required' => 'required'], $number) }}
{{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }}
<div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice('general.items', 2), ['class' => 'form-control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden ">
<table class="table table-bordered" id="items">
<thead class="thead-light">
<tr>
@stack('actions_th_start')
<th class="text-center border-right-0 border-bottom-0">{{ trans('general.actions') }}</th>
@stack('actions_th_end')
@stack('name_th_start')
<th class="text-left border-right-0 border-bottom-0">{{ trans('general.name') }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="text-center border-right-0 border-bottom-0 w-10">{{ trans('bills.quantity') }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.price') }}</th>
@stack('price_th_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@stack('taxes_th_end')
@stack('total_th_start')
<th class="text-right border-bottom-0 item-total">{{ trans('bills.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody id="bill-item-rows">
@include('purchases.bills.item')
@stack('add_item_td_start')
<tr id="addItem">
<td class="text-center border-right-0 border-bottom-0">
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button>
</td>
<td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr>
@stack('add_item_td_end')
@stack('sub_total_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.sub_total') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.sub', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="sub-total" v-if="totals.sub" v-html="totals.sub"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('sub_total_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('item_discount_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.item_discount') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('item_discount_td_end')
@endif
@if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control', 'v-model' => 'form.discount']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@endif
@stack('tax_total_td_start')
<tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.tax', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="tax-total" v-if="totals.tax" v-html="totals.tax"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('tax_total_td_end')
@stack('grand_total_td_start')
<tr id="tr-total">
<td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.total') }}</strong>
</td>
<td class="text-right long-texts">
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.total', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="grand-total" v-if="totals.total" v-html="totals.total"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('grand_total_td_end')
</tbody>
</table>
</div>
</div>
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.expense_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense', 'remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::recurring('create') }}
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
{{ Form::hidden('contact_name', old('contact_name'), ['id' => 'contact_name', 'v-model' => 'form.contact_name']) }}
{{ Form::hidden('contact_email', old('contact_email'), ['id' => 'contact_email', 'v-model' => 'form.contact_email']) }}
{{ Form::hidden('contact_tax_number', old('contact_tax_number'), ['id' => 'contact_tax_number', 'v-model' => 'form.contact_tax_number']) }}
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div>
</div>
<div class="card-footer">
<div class="row save-buttons">
{{ Form::saveButtons('bills.index') }}
</div>
</div>
{!! Form::close() !!}
</div>
<x-documents.form.content type="bill" hide-company hide-footer hide-edit-item-columns />
@endsection
@push('scripts_start')
<script type="text/javascript">
var bill_items = {!! (old('items')) ? json_encode(old('items')) : 'false' !!};
</script>
<script src="{{ asset('public/js/purchases/bills.js?v=' . version('short')) }}"></script>
<x-documents.script type="bill" />
@endpush

View File

@@ -3,230 +3,9 @@
@section('title', trans('general.title.edit', ['type' => trans_choice('general.bills', 1)]))
@section('content')
<div class="card">
{!! Form::model($bill, [
'id' => 'bill',
'method' => 'PATCH',
'route' => ['bills.update', $bill->id],
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="card-body">
<div class="row">
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.vendors', 1), 'user', $vendors, $bill->contact_id, ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.vendors.create'), 'remote_action' => route('vendors.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $bill->currency_code, ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
{{ Form::dateGroup('billed_at', trans('bills.bill_date'), 'calendar', ['id' => 'billed_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], Date::parse($bill->billed_at)->toDateString()) }}
{{ Form::dateGroup('due_at', trans('bills.due_date'), 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], Date::parse($bill->due_at)->toDateString()) }}
{{ Form::textGroup('bill_number', trans('bills.bill_number'), 'file-text-o') }}
{{ Form::textGroup('order_number', trans('bills.order_number'), 'shopping-cart',[]) }}
<div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice('general.items', 2), ['class' => 'control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table table-bordered" id="items">
<thead class="thead-light">
<tr>
@stack('actions_th_start')
<th class="text-center border-right-0 border-bottom-0">{{ trans('general.actions') }}</th>
@stack('actions_th_end')
@stack('name_th_start')
<th class="text-left border-right-0 border-bottom-0">{{ trans('general.name') }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="text-center border-right-0 border-bottom-0 w-10">{{ trans('bills.quantity') }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.price') }}</th>
@stack('price_th_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans('bills.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@stack('taxes_th_end')
@stack('total_th_start')
<th class="text-right border-bottom-0 item-total">{{ trans('bills.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody id="bill-item-rows">
@include('purchases.bills.item')
@stack('add_item_td_start')
<tr id="addItem">
<td class="text-center border-right-0 border-bottom-0">
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button>
</td>
<td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr>
@stack('add_item_td_end')
@stack('sub_total_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.sub_total') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.sub', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="sub-total" v-if="totals.sub" v-html="totals.sub"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('sub_total_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('item_discount_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.item_discount') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('item_discount_td_end')
@endif
@if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control', 'v-model' => 'form.discount']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('bills.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('bills.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@endif
@stack('tax_total_td_start')
<tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.tax', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="tax-total" v-if="totals.tax" v-html="totals.tax"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('tax_total_td_end')
@stack('grand_total_td_start')
<tr id="tr-total">
<td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('bills.total') }}</strong>
</td>
<td class="text-right long-texts">
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.total', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="grand-total" v-if="totals.total" v-html="totals.total"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('grand_total_td_end')
</tbody>
</table>
</div>
</div>
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2)) }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $bill->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=expense', 'remote_action' => route('categories.index'). '?type=expense']) }}
{{ Form::recurring('edit', $bill) }}
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
{{ Form::hidden('contact_name', old('contact_name'), ['id' => 'contact_name', 'v-model' => 'form.contact_name']) }}
{{ Form::hidden('contact_email', old('contact_email'), ['id' => 'contact_email', 'v-model' => 'form.contact_email']) }}
{{ Form::hidden('contact_tax_number', old('contact_tax_number'), ['id' => 'contact_tax_number', 'v-model' => 'form.contact_tax_number']) }}
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div>
</div>
@can('update-purchases-bills')
<div class="card-footer">
<div class="row save-buttons">
{{ Form::saveButtons('bills.index') }}
</div>
</div>
@endcan
{!! Form::close() !!}
</div>
<x-documents.form.content type="bill" :document="$bill" hide-company hide-footer hide-edit-item-columns />
@endsection
@push('scripts_start')
<script type="text/javascript">
var bill_items = {!! json_encode(old('items', $bill->items()->get())) !!};
</script>
<script src="{{ asset('public/js/purchases/bills.js?v=' . version('short')) }}"></script>
<x-documents.script :items="$bill->items()->get()" />
@endpush

View File

@@ -3,108 +3,13 @@
@section('title', trans_choice('general.bills', 2))
@section('new_button')
@can('create-purchases-bills')
<a href="{{ route('bills.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'purchases', 'type' => 'bills']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endcan
<a href="{{ route('bills.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
<x-documents.index.top-buttons type="bill" />
@endsection
@section('content')
@if ($bills->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
'method' => 'GET',
'route' => 'bills.index',
'role' => 'form',
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<x-search-string model="App\Models\Purchase\Bill" />
</div>
{{ Form::bulkActionRowGroup('general.bills', $bulk_actions, ['group' => 'purchases', 'type' => 'bills']) }}
{!! Form::close() !!}
</div>
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
<tr class="row table-head-line">
<th class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionAllGroup() }}</th>
<th class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block">@sortablelink('bill_number', trans_choice('general.numbers', 1), ['filter' => 'active, visible'], ['class' => 'col-aka', 'rel' => 'nofollow'])</th>
<th class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-left">@sortablelink('contact_name', trans_choice('general.vendors', 1))</th>
<th class="col-md-2 col-lg-2 col-xl-2 d-none d-md-block text-right">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@sortablelink('billed_at', trans('bills.bill_date'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@sortablelink('due_at', trans('bills.due_date'))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">@sortablelink('status', trans_choice('general.statuses', 1))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">{{ trans('general.actions') }}</th>
</tr>
</thead>
<tbody>
@foreach($bills as $item)
@php $paid = $item->paid; @endphp
<tr class="row align-items-center border-top-1">
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionGroup($item->id, $item->bill_number) }}</td>
<td class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block"><a class="col-aka" href="{{ route('bills.show', $item->id) }}">{{ $item->bill_number }}</a></td>
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-left">{{ $item->contact_name }}</td>
<td class="col-md-2 col-lg-2 col-xl-2 d-none d-md-block text-right">@money($item->amount, $item->currency_code, true)</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@date($item->billed_at)</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">
<span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('bills.statuses.' . $item->status) }}</span>
</td>
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">
<div class="dropdown">
<a class="btn btn-neutral btn-sm text-light items-align-center py-2" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-h text-muted"></i>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('bills.show', $item->id) }}">{{ trans('general.show') }}</a>
@if (!$item->reconciled)""
<a class="dropdown-item" href="{{ route('bills.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@endif
<div class="dropdown-divider"></div>
@if ($item->status != 'cancelled')
@can('create-purchases-bills')
<a class="dropdown-item" href="{{ route('bills.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
@endcan
@can('update-purchases-bills')
<a class="dropdown-item" href="{{ route('bills.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a>
@endcan
@endif
@can('delete-purchases-bills')
<div class="dropdown-divider"></div>
@if (!$item->reconciled)
{!! Form::deleteLink($item, 'bills.destroy') !!}
@endif
@endcan
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-footer table-action">
<div class="row">
@include('partials.admin.pagination', ['items' => $bills])
</div>
</div>
</div>
@else
@include('partials.admin.empty_page', ['page' => 'bills', 'docs_path' => 'purchases/bills'])
@endif
<x-documents.index.content type="bill" :documents="$bills" />
@endsection
@push('scripts_start')
<script src="{{ asset('public/js/purchases/bills.js?v=' . version('short')) }}"></script>
<x-documents.script />
@endpush

View File

@@ -1,204 +0,0 @@
<tr v-for="(row, index) in form.items"
:index="index">
@stack('actions_td_start')
<td class="text-center border-right-0 border-bottom-0">
@stack('actions_button_start')
<button type="button"
@click="onDeleteItem(index)"
data-toggle="tooltip"
title="{{ trans('general.delete') }}"
class="btn btn-icon btn-outline-danger btn-lg">
<i class="fa fa-trash"></i>
</button>
@stack('actions_button_end')
</td>
@stack('actions_td_end')
@stack('name_td_start')
<td class="border-right-0 border-bottom-0"
:class="[{'has-error': form.errors.has('items.' + index + '.name') }]">
@stack('name_input_start')
<akaunting-select-remote
:form-classes="[{'has-error': form.errors.has('items.' + index + '.name')}]"
:placeholder="'{{ trans('general.type_item_name') }}'"
:name="'item_id'"
:options="{{ json_encode($items) }}"
:value="form.items[index].item_id"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => route('modals.items.store'),
'type' => 'inline',
'field' => [
'key' => 'id',
'value' => 'name'
],
'new_text' => trans('modules.new'),
])}}"
@interface="row.item_id = $event"
@label="row.name = $event"
@option="onSelectItem($event, index)"
@change="form.errors.clear('items.' + index + '.name')"
:remote-action="'{{ route('items.autocomplete') }}'"
remote-type="bill"
:currency-code="form.currency_code"
:form-error="form.errors.get('items.' + index + '.name')"
:loading-text="'{{ trans('general.loading') }}'"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select-remote>
<input type="hidden"
data-item="name"
v-model="row.name"
@input="onCalculateTotal"
name="item[][name]">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.name')"
v-html="form.errors.get('items.' + index + '.name')">
</div>
@stack('name_input_end')
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="border-right-0 border-bottom-0 w-10"
:class="[{'has-error': form.errors.has('items.' + index + '.quantity') }]">
@stack('quantity_input_start')
<input type="text"
class="form-control text-center"
:name="'items.' + index + '.quantity'"
autocomplete="off"
required="required"
data-item="quantity"
v-model="row.quantity"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.quantity')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.quantity')"
v-html="form.errors.get('items.' + index + '.quantity')">
</div>
@stack('quantity_input_end')
</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="border-right-0 border-bottom-0 pb-0"
:class="[{'has-error': form.errors.has('items.' + index + '.price') }]">
@stack('price_input_start')
{{ Form::moneyGroup('price', '', '', ['required' => 'required', 'v-model' => 'row.price', 'v-error' => 'form.errors.get(\'items.\' + index + \'.price\')', 'v-error-message' => 'form.errors.get(\'items.\' + index + \'.price\')' , 'data-item' => 'price', 'currency' => $currency, 'dynamic-currency' => 'currency', 'change' => 'row.price = $event; form.errors.clear(\'items.\' + index + \'.price\'); onCalculateTotal'], 0.00, 'text-right input-price') }}
<input :name="'items.' + index + '.currency'"
data-item="currency"
v-model="row.currency"
@input="onCalculateTotal"
type="hidden">
@stack('price_input_end')
</td>
@stack('price_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="border-right-0 border-bottom-0 w-12"
:class="[{'has-error': form.errors.has('items.' + index + '.discount') }]">
@stack('discount_input_start')
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
<input type="number"
max="100"
min="0"
class="form-control text-center"
:name="'items.' + index + '.discount'"
autocomplete="off"
required="required"
data-item="quantity"
v-model="row.discount"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.discount')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.discount')"
v-html="form.errors.get('items.' + index + '.discount')">
</div>
</div>
@stack('discount_input_end')
</td>
@stack('discount_td_end')
@endif
@stack('taxes_td_start')
<td class="border-right-0 border-bottom-0"
:class="[{'has-error': form.errors.has('items.' + index + '.tax_id') }]">
@stack('tax_id_input_start')
<akaunting-select
class="mb-0 select-tax"
:form-classes="[{'has-error': form.errors.has('items.' + index + '.tax_id') }]"
:icon="''"
:title="''"
:placeholder="'{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}'"
:name="'tax_id'"
:options="{{ json_encode($taxes->pluck('title', 'id')) }}"
:value="row.tax_id"
:multiple="true"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => route('modals.taxes.create'),
'type' => 'modal',
'field' => [
'key' => 'id',
'value' => 'title'
],
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
:collapse="true"
@interface="row.tax_id = $event"
@change="onCalculateTotal()"
@new="taxes.push($event)"
:form-error="form.errors.get('items.' + index + '.tax_id')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select>
<input id="taxes" name="taxes" type="hidden" data-value="{{ json_encode($taxes) }}" v-model="taxes">
@stack('tax_id_input_end')
</td>
@stack('taxes_td_end')
@stack('total_td_start')
<td class="text-right total-column border-bottom-0 long-texts">
<akaunting-money :col="'d-none'"
:masked="true"
:error="{{ 'form.errors.get("total")' }}"
:name="'total'"
:currency="{{ json_encode($currency) }}"
:dynamic-currency="currency"
v-model="row.total"
@interface="row.total = $event"
></akaunting-money>
@stack('total_input_start')
<span id="item-total" v-if="row.total" v-html="row.total"></span>
@if (empty($item) || !isset($item->total))
<span id="item-total" v-else>@money(0, $currency->code, true)</span>
@else
<span id="item-total" v-else>@money($item->total, $bill->currency_code, true)</span>
@endif
@stack('total_input_end')
</td>
@stack('total_td_end')
</tr>

View File

@@ -1,6 +1,6 @@
@extends('layouts.print')
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->bill_number)
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->document_number)
@section('content')
<div class="row border-bottom-1">
@@ -78,7 +78,7 @@
<br>
@stack('bill_number_input_start')
<strong>{{ trans('bills.bill_number') }}:</strong>
<span class="float-right">{{ $bill->bill_number }}</span><br><br>
<span class="float-right">{{ $bill->document_number }}</span><br><br>
@stack('bill_number_input_end')
@stack('order_number_input_start')
@@ -90,7 +90,7 @@
@stack('billed_at_input_start')
<strong>{{ trans('bills.bill_date') }}:</strong>
<span class="float-right">@date($bill->billed_at)</span><br><br>
<span class="float-right">@date($bill->issued_at)</span><br><br>
@stack('billed_at_input_end')
@stack('due_at_input_start')

View File

@@ -1,651 +1,28 @@
@extends('layouts.admin')
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->bill_number)
@section('title', trans_choice('general.bills', 1) . ': ' . $bill->document_number)
@section('new_button')
<x-documents.show.top-buttons
type="bill"
:document="$bill"
hide-button-group-divider2
hide-button-customize
/>
@endsection
@section('content')
@stack('recurring_message_start')
@if (($recurring = $bill->recurring) && ($next = $recurring->getNextRecurring()))
<div class="row mb-3">
<div class="col-sm-12">
<div class="media">
<div class="media-body">
<div class="media-comment-text">
<div class="d-flex">
@stack('recurring_message_head_start')
<h5 class="mt-0">{{ trans('recurring.recurring') }}</h5>
@stack('recurring_message_head_end')
</div>
@stack('recurring_message_body_start')
<p class="text-sm lh-160 mb-0">{{ trans('recurring.message', [
'type' => mb_strtolower(trans_choice('general.bills', 1)),
'date' => $next->format($date_format)
]) }}
</p>
@stack('recurring_message_body_end')
</div>
</div>
</div>
</div>
</div>
@endif
@stack('recurring_message_end')
@stack('status_message_start')
@if ($bill->status == 'draft')
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-12 col-xl-12">
<div class="alert alert-danger fade show" role="alert">
@stack('status_message_body_start')
<span class="alert-text">
<strong>{!! trans('bills.messages.draft') !!}</strong>
</span>
@stack('status_message_body_end')
</div>
</div>
</div>
@endif
@stack('status_message_end')
@stack('timeline_start')
@if (!in_array($bill->status, ['paid', 'cancelled']))
@stack('timeline_body_start')
<div class="card">
<div class="card-body">
<div class="timeline timeline-one-side" data-timeline-content="axis" data-timeline-axis-style="dashed">
@stack('timeline_body_create_bill_start')
<div class="timeline-block">
<span class="timeline-step badge-primary">
<i class="fas fa-plus"></i>
</span>
<div class="timeline-content">
@stack('timeline_body_create_bill_head_start')
<h2 class="font-weight-500">{{ trans('bills.create_bill') }}</h2>
@stack('timeline_body_create_bill_head_end')
@stack('timeline_body_create_bill_body_start')
@stack('timeline_body_create_bill_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('bills.messages.status.created', ['date' => Date::parse($bill->created_at)->format($date_format)]) }}</small>
@stack('timeline_body_create_bill_body_message_end')
<div class="mt-3">
@stack('timeline_body_create_bill_body_button_edit_start')
<a href="{{ route('bills.edit', $bill->id) }}" class="btn btn-primary btn-sm btn-alone">
{{ trans('general.edit') }}
</a>
@stack('timeline_body_create_bill_body_button_edit_end')
</div>
@stack('timeline_body_create_bill_body_end')
</div>
</div>
@stack('timeline_body_create_bill_end')
@stack('timeline_body_receive_bill_start')
<div class="timeline-block">
<span class="timeline-step badge-danger">
<i class="far fa-envelope"></i>
</span>
<div class="timeline-content">
@stack('timeline_body_receive_bill_head_start')
<h2 class="font-weight-500">{{ trans('bills.receive_bill') }}</h2>
@stack('timeline_body_receive_bill_head_end')
@stack('timeline_body_receive_bill_body_start')
@if ($bill->status == 'draft')
@stack('timeline_body_receive_bill_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('bills.messages.status.receive.draft') }}</small>
@stack('timeline_body_receive_bill_body_message_end')
<div class="mt-3">
@stack('timeline_body_receive_bill_body_button_received_start')
@can('update-purchases-bills')
<a href="{{ route('bills.received', $bill->id) }}" class="btn btn-danger btn-sm btn-alone">{{ trans('bills.mark_received') }}</a>
@endcan
@stack('timeline_body_receive_bill_body_button_received_end')
</div>
@else
@stack('timeline_body_receive_bill_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('bills.messages.status.receive.received', ['date' => Date::parse($bill->received_at)->format($date_format)]) }}</small>
@stack('timeline_body_receive_bill_body_message_end')
@endif
@stack('timeline_body_receive_bill_body_end')
</div>
</div>
@stack('timeline_body_receive_bill_end')
@stack('timeline_body_make_payment_start')
<div class="timeline-block">
<span class="timeline-step badge-success">
<i class="far fa-money-bill-alt"></i>
</span>
<div class="timeline-content">
@stack('timeline_body_make_payment_head_start')
<h2 class="font-weight-500">{{ trans('bills.make_payment') }}</h2>
@stack('timeline_body_make_payment_head_end')
@stack('timeline_body_make_payment_body_start')
@stack('timeline_body_get_paid_body_message_start')
@if($bill->status != 'paid' && empty($bill->transactions->count()))
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('bills.messages.status.paid.await') }}</small>
@else
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('general.partially_paid') }}</small>
@endif
@stack('timeline_body_make_payment_body_message_end')
<div class="mt-3">
@stack('timeline_body_get_paid_body_button_pay_start')
@can('update-purchases-bills')
<a href="{{ route('bills.paid', $bill->id) }}" class="btn btn-white btn-sm">{{ trans('bills.mark_paid') }}</a>
@endcan
@stack('timeline_body_get_paid_body_button_pay_end')
@stack('timeline_body_make_payment_body_button_payment_start')
@if(empty($bill->transactions->count()) || (!empty($bill->transactions->count()) && $bill->paid != $bill->amount))
<button @click="onPayment" id="button-payment" class="btn btn-success btn-sm header-button-bottom">{{ trans('bills.add_payment') }}</button>
@endif
@stack('timeline_body_make_payment_body_button_payment_end')
</div>
@stack('timeline_body_make_payment_body_end')
</div>
</div>
@stack('timeline_body_make_payment_end')
</div>
</div>
</div>
@stack('timeline_body_end')
@endif
@stack('timeline_end')
@stack('bill_start')
<div class="card">
@stack('bill_status_start')
<div class="card-header status-{{ $bill->status_label }}">
<h3 class="text-white mb-0 float-right">{{ trans('bills.statuses.' . $bill->status) }}</h3>
</div>
@stack('bill_status_end')
<div class="card-body">
@stack('bill_header_start')
<div class="row mx--4">
<div class="col-md-7 border-bottom-1">
<div class="table-responsive mt-2">
<table class="table table-borderless">
<tbody>
<tr>
<th>
@if (!empty($bill->contact->logo) && !empty($bill->contact->logo->id))
<img src="{{ Storage::url($bill->contact->logo->id) }}" height="128" width="128" alt="{{ $bill->contact_name }}"/>
@else
<img src="{{ $logo }}" alt="{{ $bill->contact_name }}"/>
@endif
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5 border-bottom-1">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ setting('company.name') }}
</th>
</tr>
@if (setting('company.address'))
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
@endif
@if (setting('company.tax_number'))
<tr>
<th>
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
</th>
</tr>
@endif
@if (setting('company.phone'))
<tr>
<th>
{{ setting('company.phone') }}
</th>
</tr>
@endif
<tr>
<th>
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@stack('bill_header_end')
@stack('bill_information_start')
<div class="row">
<div class="col-md-7 long-texts">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ trans('bills.bill_from') }}
@stack('name_input_start')
<strong class="d-block">{{ $bill->contact_name }}</strong>
@stack('name_input_end')
</th>
</tr>
@if ($bill->contact_address || $__env->hasStack('address_input_start', 'address_input_end'))
<tr>
<th>
@stack('address_input_start')
@if ($bill->contact_address)
{!! nl2br($bill->contact_address) !!}
@endif
@stack('address_input_end')
</th>
</tr>
@endif
@if ($bill->contact_tax_number || $__env->hasStack('tax_number_input_start', 'tax_number_input_end'))
<tr>
<th>
@stack('tax_number_input_start')
@if ($bill->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $bill->contact_tax_number }}
@endif
@stack('tax_number_input_end')
</th>
</tr>
@endif
@if ($bill->contact_phone || $__env->hasStack('phone_input_start', 'phone_input_end'))
<tr>
<th>
@stack('phone_input_start')
@if ($bill->contact_phone)
{{ $bill->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
@endif
@if ($bill->contact_email || $__env->hasStack('email_start', 'email_input_end'))
<tr>
<th>
@stack('email_start')
@if ($bill->contact_email)
{{ $bill->contact_email }}
@endif
@stack('email_input_end')
</th>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-5 long-texts">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('bill_number_input_start')
<tr>
<th>{{ trans('bills.bill_number') }}:</th>
<td class="text-right">{{ $bill->bill_number }}</td>
</tr>
@stack('bill_number_input_end')
@stack('order_number_input_start')
@if ($bill->order_number)
<tr>
<th>{{ trans('bills.order_number') }}:</th>
<td class="text-right">{{ $bill->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@stack('billed_at_input_start')
<tr>
<th>{{ trans('bills.bill_date') }}:</th>
<td class="text-right">@date($bill->billed_at)</td>
</tr>
@stack('billed_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('bills.payment_due') }}:</th>
<td class="text-right">@date($bill->due_at)</td>
</tr>
@stack('due_at_input_end')
</tbody>
</table>
</div>
</div>
</div>
@stack('bill_information_end')
@stack('bill_item_start')
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive overflow-y-hidden">
<table class="table table-striped">
<tbody>
<tr class="d-flex flex-nowrap">
@stack('name_th_start')
<th class="col-xs-4 col-sm-5 pl-5">{{ trans_choice('general.items', 1) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-1 text-center">{{ trans('bills.quantity') }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-right d-none d-sm-block">{{ trans('bills.price') }}</th>
@stack('price_th_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="col-sm-1 text-center d-none d-sm-block">{{ trans('bills.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('bills.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($bill->items as $item)
@include('partials.documents.item.show', ['document' => $bill])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@stack('bill_item_end')
@stack('bill_total_start')
<div class="row mt-5">
<div class="col-md-7">
@stack('notes_input_start')
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@if ($bill->notes)
<tr>
<th>
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="text-muted long-texts">{!! nl2br($bill->notes) !!}</p>
</th>
</tr>
@endif
</tbody>
</table>
</div>
@stack('notes_input_end')
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($bill->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<tr>
<th>{{ trans($total->title) }}:</th>
<td class="text-right">@money($total->amount, $bill->currency_code, true)</td>
</tr>
@stack($total->code . '_total_tr_end')
@else
@if ($bill->paid)
@stack('paid_total_tr_start')
<tr>
<th class="text-success">
{{ trans('bills.paid') }}:
</th>
<td class="text-success text-right">- @money($bill->paid, $bill->currency_code, true)</td>
</tr>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<tr>
<th>{{ trans($total->name) }}:</th>
<td class="text-right">@money($total->amount - $bill->paid, $bill->currency_code, true)</td>
</tr>
@stack('grand_total_tr_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@stack('bill_total_end')
</div>
@stack('box_footer_start')
<div class="card-footer">
<div class="row align-items-center">
<div class="col-xs-12 col-sm-4">
@if($bill->attachment)
@php $file = $bill->attachment; @endphp
@include('partials.media.file')
@endif
</div>
<div class="col-xs-12 col-sm-8 text-right">
@stack('button_edit_start')
@if(!$bill->reconciled)
<a href="{{ route('bills.edit', $bill->id) }}" class="btn btn-info">
{{ trans('general.edit') }}
</a>
@endif
@stack('button_edit_end')
@stack('button_print_start')
<a href="{{ route('bills.print', $bill->id) }}" target="_blank" class="btn btn-success">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
@stack('button_group_start')
<div class="dropup header-drop-top">
<button type="button" class="btn btn-primary" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>&nbsp; {{ trans('general.more_actions') }}</button>
<div class="dropdown-menu" role="menu">
@stack('button_dropdown_start')
@if ($bill->status != 'cancelled')
@if ($bill->status != 'paid')
@stack('button_pay_start')
@can('update-purchases-bills')
<a class="dropdown-item" href="{{ route('bills.paid', $bill->id) }}">{{ trans('bills.mark_paid') }}</a>
@endcan
@if (empty($bill->paid) || ($bill->paid != $bill->amount))
<button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('bills.add_payment') }}</button>
@endif
@stack('button_pay_end')
<div class="dropdown-divider"></div>
@endif
@stack('button_dropdown_divider_1')
@can('update-purchases-bills')
@stack('button_received_start')
@if ($bill->status == 'draft')
<a class="dropdown-item" href="{{ route('bills.received', $bill->id) }}">{{ trans('bills.mark_received') }}</a></a>
@else
<button type="button" class="dropdown-item" disabled="disabled">{{ trans('bills.mark_received') }}</button>
@endif
@stack('button_received_end')
@endcan
@endif
@stack('button_pdf_start')
<a class="dropdown-item" href="{{ route('bills.pdf', $bill->id) }}">{{ trans('bills.download_pdf') }}</a>
@stack('button_pdf_end')
@can('update-purchases-bills')
@if ($bill->status != 'cancelled')
@stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route('bills.cancelled', $bill->id) }}">{{ trans('general.cancel') }}</a>
@stack('button_cancelled_end')
@endif
@endcan
@stack('button_dropdown_divider_2')
@can('delete-purchases-bills')
@if (!$bill->reconciled)
@stack('button_delete_start')
{!! Form::deleteLink($bill, 'purchases/bills') !!}
@stack('button_delete_end')
@endif
@endcan
@stack('button_dropdown_end')
</div>
</div>
@stack('button_group_end')
</div>
</div>
</div>
@stack('box_footer_end')
</div>
@stack('bill_end')
@stack('row_footer_start')
<div class="row">
@stack('row_footer_histories_start')
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-histories-header" data-toggle="collapse" data-target="#accordion-histories-body" aria-expanded="false" aria-controls="accordion-histories-body">
<h4 class="mb-0">{{ trans('bills.histories') }}</h4>
</div>
<div id="accordion-histories-body" class="collapse hide" aria-labelledby="accordion-histories-header">
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
@stack('row_footer_histories_head_tr_start')
<tr class="row table-head-line">
@stack('row_footer_histories_head_td_start')
<th class="col-xs-4 col-sm-3">{{ trans('general.date') }}</th>
<th class="col-xs-4 col-sm-3 text-left">{{ trans_choice('general.statuses', 1) }}</th>
<th class="col-xs-4 col-sm-6 text-left long-texts">{{ trans('general.description') }}</th>
@stack('row_footer_histories_head_td_end')
</tr>
@stack('row_footer_histories_head_tr_end')
</thead>
<tbody>
@stack('row_footer_histories_body_tr_start')
@foreach($bill->histories as $history)
<tr class="row align-items-center border-top-1 tr-py">
@stack('row_footer_histories_body_td_start')
<td class="col-xs-4 col-sm-3">@date($history->created_at)</td>
<td class="col-xs-4 col-sm-3 text-left">{{ trans('bills.statuses.' . $history->status) }}</td>
<td class="col-xs-4 col-sm-6 text-left long-texts">{{ $history->description }}</td>
@stack('row_footer_histories_body_td_end')
</tr>
@endforeach
@stack('row_footer_histories_body_tr_end')
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@stack('row_footer_histories_end')
@stack('row_footer_transactions_start')
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-transactions-header" data-toggle="collapse" data-target="#accordion-transactions-body" aria-expanded="false" aria-controls="accordion-transactions-body">
<h4 class="mb-0">{{ trans_choice('general.transactions', 2) }}</h4>
</div>
<div id="accordion-transactions-body" class="collapse hide" aria-labelledby="accordion-transactions-header">
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
@stack('row_footer_transactions_head_tr_start')
<tr class="row table-head-line">
@stack('row_footer_transactions_head_td_start')
<th class="col-xs-4 col-sm-3">{{ trans('general.date') }}</th>
<th class="col-xs-4 col-sm-3">{{ trans('general.amount') }}</th>
<th class="col-sm-3 d-none d-sm-block">{{ trans_choice('general.accounts', 1) }}</th>
<th class="col-xs-4 col-sm-3">{{ trans('general.actions') }}</th>
@stack('row_footer_transactions_head_td_end')
</tr>
@stack('row_footer_transactions_head_tr_end')
</thead>
<tbody>
@stack('row_footer_transactions_body_tr_start')
@if ($bill->transactions->count())
@foreach($bill->transactions as $transaction)
<tr class="row align-items-center border-top-1 tr-py">
@stack('row_footer_transactions_body_td_start')
<td class="col-xs-4 col-sm-3">@date($transaction->paid_at)</td>
<td class="col-xs-4 col-sm-3">@money($transaction->amount, $transaction->currency_code, true)</td>
<td class="col-sm-3 d-none d-sm-block">{{ $transaction->account->name }}</td>
<td class="col-xs-4 col-sm-3 py-0">
@if ($transaction->reconciled)
<button type="button" class="btn btn-default btn-sm">
{{ trans('reconciliations.reconciled') }}
</button>
@else
@php $message = trans('general.delete_confirm', [
'name' => '<strong>' . Date::parse($transaction->paid_at)->format($date_format) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
'type' => strtolower(trans_choice('general.transactions', 1))
]);
@endphp
{!! Form::button(trans('general.delete'), array(
'type' => 'button',
'class' => 'btn btn-danger btn-sm',
'title' => trans('general.delete'),
'@click' => 'confirmDelete("' . route('transactions.destroy', $transaction->id) . '", "' . trans_choice('general.transactions', 2) . '", "' . $message. '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
)) !!}
@endif
</td>
@stack('row_footer_transactions_body_td_end')
</tr>
@endforeach
@else
<tr>
<td colspan="4">
<div class="text-muted nr-py" id="datatable-basic_info" role="status" aria-live="polite">
{{ trans('general.no_records') }}
</div>
</td>
</tr>
@endif
@stack('row_footer_transactions_body_tr_end')
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@stack('row_footer_transactions_end')
</div>
@stack('row_footer_end')
{{ Form::hidden('bill_id', $bill->id, ['id' => 'bill_id']) }}
<x-documents.show.content
type="bill"
:document="$bill"
hide-button-sent
hide-button-email
hide-button-share
/>
@endsection
@push('scripts_start')
<script src="{{ asset('public/js/purchases/bills.js?v=' . version('short')) }}"></script>
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
<x-documents.script />
@endpush

View File

@@ -67,7 +67,7 @@
@endif
@if ($payment->bill)
{{ Form::textGroup('document', trans_choice('general.bills', 1), 'file-invoice', ['disabled' => 'true'], $payment->bill->bill_number) }}
{{ Form::textGroup('document', trans_choice('general.bills', 1), 'file-invoice', ['disabled' => 'true'], $payment->bill->document_number) }}
{{ Form::hidden('document_id', $payment->bill->id) }}
@endif
</div>

View File

@@ -57,7 +57,7 @@
@if($item->bill)
@if ($item->bill->status == 'paid')
<el-tooltip content="{{ $item->bill->bill_number }} / {{ trans('bills.statuses.paid') }}"
<el-tooltip content="{{ $item->bill->document_number }} / {{ trans('bills.statuses.paid') }}"
effect="success"
:open-delay="100"
placement="top">
@@ -66,7 +66,7 @@
</span>
</el-tooltip>
@elseif ($item->bill->status == 'partial')
<el-tooltip content="{{ $item->bill->bill_number }} / {{ trans('bills.statuses.partial') }}"
<el-tooltip content="{{ $item->bill->document_number }} / {{ trans('bills.statuses.partial') }}"
effect="info"
:open-delay="100"
placement="top">

View File

@@ -190,9 +190,9 @@
<tbody>
@foreach($bills as $item)
<tr class="row align-items-center border-top-1 tr-py">
<td class="col-xs-4 col-sm-1"><a href="{{ route('bills.show', $item->id) }}">{{ $item->bill_number }}</a></td>
<td class="col-xs-4 col-sm-1"><a href="{{ route('bills.show', $item->id) }}">{{ $item->document_number }}</a></td>
<td class="col-xs-4 col-sm-3 text-right">@money($item->amount, $item->currency_code, true)</td>
<td class="col-sm-3 d-none d-sm-block text-left">@date($item->billed_at)</td>
<td class="col-sm-3 d-none d-sm-block text-left">@date($item->issued_at)</td>
<td class="col-sm-3 d-none d-sm-block text-left">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-2"><span class="badge badge-pill badge-{{ $item->status_label }} my--2">{{ trans('bills.statuses.' . $item->status) }}</span></td>
</tr>

View File

@@ -190,9 +190,9 @@
<tbody>
@foreach($invoices as $item)
<tr class="row align-items-center border-top-1 tr-py">
<td class="col-xs-4 col-sm-1"><a href="{{ route('invoices.show', $item->id) }}">{{ $item->invoice_number }}</a></td>
<td class="col-xs-4 col-sm-1"><a href="{{ route('invoices.show', $item->id) }}">{{ $item->document_number }}</a></td>
<td class="col-xs-4 col-sm-3 text-right">@money($item->amount, $item->currency_code, true)</td>
<td class="col-sm-3 d-none d-sm-block text-left">@date($item->invoiced_at)</td>
<td class="col-sm-3 d-none d-sm-block text-left">@date($item->issued_at)</td>
<td class="col-sm-3 d-none d-sm-block text-left">@date($item->due_at)</td>
<td class="col-xs-4 col-sm-2"><span class="badge badge-pill badge-{{ $item->status_label }} my--2">{{ trans('invoices.statuses.' . $item->status) }}</span></td>
</tr>

View File

@@ -1,231 +1,11 @@
@extends('layouts.admin')
@section('title', trans('general.title.new', ['type' => trans_choice('general.invoices', 1)]))
@section('title', trans('general.title.new', ['type' => setting('invoice.title', trans_choice('general.invoices', 1))]))
@section('content')
<div class="card">
{!! Form::open([
'route' => 'invoices.store',
'id' => 'invoice',
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="card-body">
<div class="row">
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, setting('default.contact'), ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.customers.create'), 'remote_action' => route('customers.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, setting('default.currency'), ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
{{ Form::dateGroup('invoiced_at', trans('invoices.invoice_date'), 'calendar', ['id' => 'invoiced_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], request()->get('invoiced_at', Date::now()->toDateString())) }}
{{ Form::dateGroup('due_at', trans('invoices.due_date'), 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], request()->get('due_at', Date::parse(request()->get('invoiced_at', Date::now()->toDateString()))->addDays(setting('invoice.payment_terms', 0))->toDateString())) }}
{{ Form::textGroup('invoice_number', trans('invoices.invoice_number'), 'file', ['required' => 'required'], $number) }}
{{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart', []) }}
<div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'form-control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table table-bordered" id="items">
<thead class="thead-light">
<tr>
@stack('actions_th_start')
<th class="text-center border-right-0 border-bottom-0">{{ trans('general.actions') }}</th>
@stack('actions_th_end')
@stack('name_th_start')
<th class="text-left border-right-0 border-bottom-0">{{ trans('general.name') }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="text-center border-right-0 border-bottom-0 w-10">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@stack('taxes_th_end')
@stack('total_th_start')
<th class="text-right border-bottom-0 item-total">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody id="invoice-item-rows">
@include('sales.invoices.item')
@stack('add_item_td_start')
<tr id="addItem">
<td class="text-center border-right-0 border-bottom-0">
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button>
</td>
<td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr>
@stack('add_item_td_end')
@stack('sub_total_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.sub_total') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.sub', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="sub-total" v-if="totals.sub" v-html="totals.sub"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('sub_total_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('item_discount_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.item_discount') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('item_discount_td_end')
@endif
@if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control', 'v-model' => 'form.discount']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@endif
@stack('tax_total_td_start')
<tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.tax', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="tax-total" v-if="totals.tax" v-html="totals.tax"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('tax_total_td_end')
@stack('grand_total_td_start')
<tr id="tr-total">
<td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.total') }}</strong>
</td>
<td class="text-right long-texts">
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.total', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="grand-total" v-if="totals.total" v-html="totals.total"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('grand_total_td_end')
</tbody>
</table>
</div>
</div>
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2), '', setting('invoice.notes'), ['rows' => '3'], 'col-md-6') }}
{{ Form::textareaGroup('footer', trans('general.footer'), '', setting('invoice.footer'), ['rows' => '3'], 'col-md-6') }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, setting('default.income_category'), ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income', 'remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::recurring('create') }}
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
{{ Form::hidden('contact_name', old('contact_name'), ['id' => 'contact_name', 'v-model' => 'form.contact_name']) }}
{{ Form::hidden('contact_email', old('contact_email'), ['id' => 'contact_email', 'v-model' => 'form.contact_email']) }}
{{ Form::hidden('contact_tax_number', old('contact_tax_number'), ['id' => 'contact_tax_number', 'v-model' => 'form.contact_tax_number']) }}
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div>
</div>
<div class="card-footer">
<div class="row save-buttons">
{{ Form::saveButtons('invoices.index') }}
</div>
</div>
{!! Form::close() !!}
</div>
<x-documents.form.content type="invoice" />
@endsection
@push('scripts_start')
<script type="text/javascript">
var invoice_items = {!! (old('items')) ? json_encode(old('items')) : 'false' !!};
</script>
<script src="{{ asset('public/js/sales/invoices.js?v=' . version('short')) }}"></script>
<x-documents.script />
@endpush

View File

@@ -3,232 +3,9 @@
@section('title', trans('general.title.edit', ['type' => trans_choice('general.invoices', 1)]))
@section('content')
<div class="card">
{!! Form::model($invoice, [
'id' => 'invoice',
'method' => 'PATCH',
'route' => ['invoices.update', $invoice->id],
'@submit.prevent' => 'onSubmit',
'@keydown' => 'form.errors.clear($event.target.name)',
'files' => true,
'role' => 'form',
'class' => 'form-loading-button',
'novalidate' => true
]) !!}
<div class="card-body">
<div class="row">
{{ Form::selectRemoteAddNewGroup('contact_id', trans_choice('general.customers', 1), 'user', $customers, $invoice->contact_id, ['required' => 'required', 'change' => 'onChangeContact', 'path' => route('modals.customers.create'), 'remote_action' => route('customers.index')]) }}
{{ Form::selectAddNewGroup('currency_code', trans_choice('general.currencies', 1), 'exchange-alt', $currencies, $invoice->currency_code, ['required' => 'required', 'model' => 'form.currency_code', 'path' => route('modals.currencies.create'), 'field' => ['key' => 'code', 'value' => 'name'], 'change' => 'onChangeCurrency']) }}
{{ Form::dateGroup('invoiced_at', trans('invoices.invoice_date'), 'calendar', ['id' => 'invoiced_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], Date::parse($invoice->invoiced_at)->toDateString()) }}
{{ Form::dateGroup('due_at', trans('invoices.due_date'), 'calendar', ['id' => 'due_at', 'class' => 'form-control datepicker', 'required' => 'required', 'date-format' => 'Y-m-d', 'autocomplete' => 'off'], Date::parse($invoice->due_at)->toDateString()) }}
{{ Form::textGroup('invoice_number', trans('invoices.invoice_number'), 'file') }}
{{ Form::textGroup('order_number', trans('invoices.order_number'), 'shopping-cart', []) }}
<div class="col-sm-12 mb-4">
@php $item_colspan = in_array(setting('localisation.discount_location', 'total'), ['item', 'both']) ? '6' : '5' @endphp
{!! Form::label('items', trans_choice($text_override['items'], 2), ['class' => 'control-label']) !!}
<div class="table-responsive overflow-x-scroll overflow-y-hidden">
<table class="table table-bordered" id="items">
<thead class="thead-light">
<tr>
@stack('actions_th_start')
<th class="text-center border-right-0 border-bottom-0">{{ trans('general.actions') }}</th>
@stack('actions_th_end')
@stack('name_th_start')
<th class="text-left border-right-0 border-bottom-0">{{ trans('general.name') }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="text-center border-right-0 border-bottom-0 w-10">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('taxes_th_start')
<th class="text-right border-right-0 border-bottom-0">{{ trans_choice('general.taxes', 1) }}</th>
@stack('taxes_th_end')
@stack('total_th_start')
<th class="text-right border-bottom-0 item-total">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody id="invoice-item-rows">
@include('sales.invoices.item')
@stack('add_item_td_start')
<tr id="addItem">
<td class="text-center border-right-0 border-bottom-0">
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button>
</td>
<td class="text-right border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan"></td>
</tr>
@stack('add_item_td_end')
@stack('sub_total_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.sub_total') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.sub', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="sub-total" v-if="totals.sub" v-html="totals.sub"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('sub_total_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('item_discount_td_start')
<tr id="tr-subtotal">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.item_discount') }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('item_discount', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.item_discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="item-discount" v-if="totals.item_discount" v-html="totals.item_discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('item_discount_td_end')
@endif
@if (in_array(setting('localisation.discount_location', 'total'), ['total', 'both']))
@stack('add_discount_td_start')
<tr id="tr-discount">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<el-popover
popper-class="p-0 h-0"
placement="bottom"
width="300"
v-model="discount">
<div class="card d-none" :class="[{'show' : discount}]">
<div class="discount card-body">
<div class="row align-items-center">
<div class="col-sm-6">
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
{!! Form::number('pre_discount', null, ['id' => 'pre-discount', 'class' => 'form-control', 'v-model' => 'form.discount']) !!}
</div>
</div>
<div class="col-sm-6">
<div class="discount-description">
<strong>{{ trans('invoices.discount_desc') }}</strong>
</div>
</div>
</div>
</div>
<div class="discount card-footer">
<div class="row float-right">
<div class="col-xs-12 col-sm-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-outline-secondary" @click="closePayment">
{{ trans('general.cancel') }}
</a>
{!! Form::button(trans('general.save'), ['type' => 'button', 'id' => 'save-discount', '@click' => 'onAddDiscount', 'class' => 'btn btn-success']) !!}
</div>
</div>
</div>
</div>
<el-link class="cursor-pointer text-info" slot="reference" type="primary" v-if="!totals.discount_text">{{ trans('invoices.add_discount') }}</el-link>
<el-link slot="reference" type="primary" v-if="totals.discount_text" v-html="totals.discount_text"></el-link>
</el-popover>
</td>
<td class="text-right border-bottom-0">
{{ Form::moneyGroup('discount_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.discount', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="discount-total" v-if="totals.discount" v-html="totals.discount"></span>
<span v-else>@money(0, $currency->code, true)</span>
{!! Form::hidden('discount', null, ['id' => 'discount', 'class' => 'form-control text-right', 'v-model' => 'form.discount']) !!}
</td>
</tr>
@stack('add_discount_td_end')
@endif
@stack('tax_total_td_start')
<tr id="tr-tax">
<td class="text-right border-right-0 border-bottom-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td>
<td class="text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.tax', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="tax-total" v-if="totals.tax" v-html="totals.tax"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('tax_total_td_end')
@stack('grand_total_td_start')
<tr id="tr-total">
<td class="text-right border-right-0" colspan="{{ $item_colspan }}" :colspan="colspan">
<strong>{{ trans('invoices.total') }}</strong>
</td>
<td class="text-right long-texts">
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => true, 'required' => 'required', 'v-model' => 'totals.total', 'currency' => $currency, 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="grand-total" v-if="totals.total" v-html="totals.total"></span>
<span v-else>@money(0, $currency->code, true)</span>
</td>
</tr>
@stack('grand_total_td_end')
</tbody>
</table>
</div>
</div>
{{ Form::textareaGroup('notes', trans_choice('general.notes', 2), '', null, ['rows' => '3'], 'col-md-6') }}
{{ Form::textareaGroup('footer', trans('general.footer'), '', null, ['rows' => '3'], 'col-md-6') }}
{{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $invoice->category_id, ['required' => 'required', 'path' => route('modals.categories.create') . '?type=income', 'remote_action' => route('categories.index'). '?type=income']) }}
{{ Form::recurring('edit', $invoice) }}
{{ Form::fileGroup('attachment', trans('general.attachment')) }}
{{ Form::hidden('contact_name', old('contact_name'), ['id' => 'contact_name', 'v-model' => 'form.contact_name']) }}
{{ Form::hidden('contact_email', old('contact_email'), ['id' => 'contact_email', 'v-model' => 'form.contact_email']) }}
{{ Form::hidden('contact_tax_number', old('contact_tax_number'), ['id' => 'contact_tax_number', 'v-model' => 'form.contact_tax_number']) }}
{{ Form::hidden('contact_phone', old('contact_phone'), ['id' => 'contact_phone', 'v-model' => 'form.contact_phone']) }}
{{ Form::hidden('contact_address', old('contact_address'), ['id' => 'contact_address', 'v-model' => 'form.contact_address']) }}
{{ Form::hidden('currency_rate', old('currency_rate', 1), ['id' => 'currency_rate', 'v-model' => 'form.contact_rate']) }}
{{ Form::hidden('status', old('status', 'draft'), ['id' => 'status', 'v-model' => 'form.status']) }}
{{ Form::hidden('amount', old('amount', '0'), ['id' => 'amount', 'v-model' => 'form.amount']) }}
</div>
</div>
@can('update-sales-invoices')
<div class="card-footer">
<div class="row save-buttons">
{{ Form::saveButtons('invoices.index') }}
</div>
</div>
@endcan
{!! Form::close() !!}
</div>
<x-documents.form.content type="invoice" :document="$invoice" />
@endsection
@push('scripts_start')
<script type="text/javascript">
var invoice_items = {!! json_encode(old('items', $invoice->items()->get())) !!};
</script>
<script src="{{ asset('public/js/sales/invoices.js?v=' . version('short')) }}"></script>
<x-documents.script :items="$invoice->items()->get()" />
@endpush

View File

@@ -3,107 +3,13 @@
@section('title', trans_choice('general.invoices', 2))
@section('new_button')
@can('create-sales-invoices')
<a href="{{ route('invoices.create') }}" class="btn btn-primary btn-sm btn-success">{{ trans('general.add_new') }}</a>
<a href="{{ route('import.create', ['group' => 'sales', 'type' => 'invoices']) }}" class="btn btn-white btn-sm">{{ trans('import.import') }}</a>
@endcan
<a href="{{ route('invoices.export', request()->input()) }}" class="btn btn-white btn-sm">{{ trans('general.export') }}</a>
<x-documents.index.top-buttons type="invoice" />
@endsection
@section('content')
@if ($invoices->count() || request()->get('search', false))
<div class="card">
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
{!! Form::open([
'method' => 'GET',
'route' => 'invoices.index',
'role' => 'form',
'class' => 'mb-0'
]) !!}
<div class="align-items-center" v-if="!bulk_action.show">
<x-search-string model="App\Models\Sale\Invoice" />
</div>
{{ Form::bulkActionRowGroup('general.invoices', $bulk_actions, ['group' => 'sales', 'type' => 'invoices']) }}
{!! Form::close() !!}
</div>
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
<tr class="row table-head-line">
<th class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionAllGroup() }}</th>
<th class="col-md-2 col-lg-1 col-xl-1 d-none d-md-block">@sortablelink('invoice_number', trans_choice('general.numbers', 1), ['filter' => 'active, visible'], ['class' => 'col-aka', 'rel' => 'nofollow'])</th>
<th class="col-xs-4 col-sm-4 col-md-4 col-lg-2 col-xl-2 text-left">@sortablelink('contact_name', trans_choice('general.customers', 1))</th>
<th class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-right">@sortablelink('amount', trans('general.amount'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@sortablelink('invoiced_at', trans('invoices.invoice_date'))</th>
<th class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@sortablelink('due_at', trans('invoices.due_date'))</th>
<th class="col-lg-1 col-xl-1 d-none d-lg-block text-center">@sortablelink('status', trans_choice('general.statuses', 1))</th>
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center"><a>{{ trans('general.actions') }}</a></th>
</tr>
</thead>
<tbody>
@foreach($invoices as $item)
@php $paid = $item->paid; @endphp
<tr class="row align-items-center border-top-1">
<td class="col-sm-2 col-md-1 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionGroup($item->id, $item->invoice_number) }}</td>
<td class="col-md-2 col-lg-1 col-xl-1 d-none d-md-block"><a class="col-aka" href="{{ route('invoices.show' , $item->id) }}">{{ $item->invoice_number }}</a></td>
<td class="col-xs-4 col-sm-4 col-md-4 col-lg-2 col-xl-2 text-left">{{ $item->contact_name }}</td>
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-right">@money($item->amount, $item->currency_code, true)</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@date($item->invoiced_at)</td>
<td class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@date($item->due_at)</td>
<td class="col-lg-1 col-xl-1 d-none d-lg-block text-center">
<span class="badge badge-pill badge-{{ $item->status_label }}">{{ trans('invoices.statuses.' . $item->status) }}</span>
</td>
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-1 col-xl-1 text-center">
<div class="dropdown">
<a class="btn btn-neutral btn-sm text-light items-align-center py-2" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-h text-muted"></i>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
<a class="dropdown-item" href="{{ route('invoices.show', $item->id) }}">{{ trans('general.show') }}</a>
@if (!$item->reconciled)
<a class="dropdown-item" href="{{ route('invoices.edit', $item->id) }}">{{ trans('general.edit') }}</a>
@endif
<div class="dropdown-divider"></div>
@if ($item->status != 'cancelled')
@can('create-sales-invoices')
<a class="dropdown-item" href="{{ route('invoices.duplicate', $item->id) }}">{{ trans('general.duplicate') }}</a>
<div class="dropdown-divider"></div>
@endcan
@can('update-sales-invoices')
<a class="dropdown-item" href="{{ route('invoices.cancelled', $item->id) }}">{{ trans('general.cancel') }}</a>
@endcan
@endif
@can('delete-sales-invoices')
@if (!$item->reconciled)
{!! Form::deleteLink($item, 'invoices.destroy') !!}
@endif
@endcan
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="card-footer table-action">
<div class="row">
@include('partials.admin.pagination', ['items' => $invoices])
</div>
</div>
</div>
@else
@include('partials.admin.empty_page', ['page' => 'invoices', 'docs_path' => 'sales/invoices'])
@endif
<x-documents.index.content type="invoice" :documents="$invoices" />
@endsection
@push('scripts_start')
<script src="{{ asset('public/js/sales/invoices.js?v=' . version('short')) }}"></script>
<x-documents.script />
@endpush

View File

@@ -1,203 +0,0 @@
<tr v-for="(row, index) in form.items"
:index="index">
@stack('actions_td_start')
<td class="text-center border-right-0 border-bottom-0">
@stack('actions_button_start')
<button type="button"
@click="onDeleteItem(index)"
data-toggle="tooltip"
title="{{ trans('general.delete') }}"
class="btn btn-icon btn-outline-danger btn-lg">
<i class="fa fa-trash"></i>
</button>
@stack('actions_button_end')
</td>
@stack('actions_td_end')
@stack('name_td_start')
<td class="border-right-0 border-bottom-0"
:class="[{'has-error': form.errors.has('items.' + index + '.name') }]">
@stack('name_input_start')
<akaunting-select-remote
:form-classes="[{'has-error': form.errors.has('items.' + index + '.name')}]"
:placeholder="'{{ trans('general.type_item_name') }}'"
:name="'item_id'"
:options="{{ json_encode($items) }}"
:value="form.items[index].item_id"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => route('modals.items.store'),
'type' => 'inline',
'field' => [
'key' => 'id',
'value' => 'name'
],
'new_text' => trans('modules.new'),
])}}"
@interface="row.item_id = $event"
@label="row.name = $event"
@option="onSelectItem($event, index)"
@change="form.errors.clear('items.' + index + '.name')"
:remote-action="'{{ route('items.autocomplete') }}'"
remote-type="invoice"
:currency-code="form.currency_code"
:form-error="form.errors.get('items.' + index + '.name')"
:loading-text="'{{ trans('general.loading') }}'"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select-remote>
<input type="hidden"
data-item="name"
v-model="row.name"
@input="onCalculateTotal"
name="item[][name]">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.name')"
v-html="form.errors.get('items.' + index + '.name')">
</div>
@stack('name_input_end')
</td>
@stack('name_td_end')
@stack('quantity_td_start')
<td class="border-right-0 border-bottom-0 w-10"
:class="[{'has-error': form.errors.has('items.' + index + '.quantity') }]">
@stack('quantity_input_start')
<input type="text"
class="form-control text-center"
:name="'items.' + index + '.quantity'"
autocomplete="off"
required="required"
data-item="quantity"
v-model="row.quantity"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.quantity')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.quantity')"
v-html="form.errors.get('items.' + index + '.quantity')">
</div>
@stack('quantity_input_end')
</td>
@stack('quantity_td_end')
@stack('price_td_start')
<td class="border-right-0 border-bottom-0 pb-0"
:class="[{'has-error': form.errors.has('items.' + index + '.price') }]">
@stack('price_input_start')
{{ Form::moneyGroup('price', '', '', ['required' => 'required', 'v-model' => 'row.price', 'v-error' => 'form.errors.get(\'items.\' + index + \'.price\')', 'v-error-message' => 'form.errors.get(\'items.\' + index + \'.price\')' , 'data-item' => 'price', 'currency' => $currency, 'dynamic-currency' => 'currency', 'change' => 'row.price = $event; form.errors.clear(\'items.\' + index + \'.price\'); onCalculateTotal'], 0.00, 'text-right input-price') }}
<input :name="'items.' + index + '.currency'"
data-item="currency"
v-model="row.currency"
@input="onCalculateTotal"
type="hidden">
@stack('price_input_end')
</td>
@stack('price_td_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_td_start')
<td class="border-right-0 border-bottom-0 w-12"
:class="[{'has-error': form.errors.has('items.' + index + '.discount') }]">
@stack('discount_input_start')
<div class="input-group input-group-merge">
<div class="input-group-prepend">
<span class="input-group-text" id="input-discount">
<i class="fa fa-percent"></i>
</span>
</div>
<input type="number"
max="100"
min="0"
class="form-control text-center"
:name="'items.' + index + '.discount'"
autocomplete="off"
required="required"
data-item="quantity"
v-model="row.discount"
@input="onCalculateTotal"
@change="form.errors.clear('items.' + index + '.discount')">
<div class="invalid-feedback d-block"
v-if="form.errors.has('items.' + index + '.discount')"
v-html="form.errors.get('items.' + index + '.discount')">
</div>
</div>
@stack('discount_input_end')
</td>
@stack('discount_td_end')
@endif
@stack('taxes_td_start')
<td class="border-right-0 border-bottom-0"
:class="[{'has-error': form.errors.has('items.' + index + '.tax_id') }]">
@stack('tax_id_input_start')
<akaunting-select
class="mb-0 select-tax"
:form-classes="[{'has-error': form.errors.has('items.' + index + '.tax_id') }]"
:icon="''"
:title="''"
:placeholder="'{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}'"
:name="'tax_id'"
:options="{{ json_encode($taxes->pluck('title', 'id')) }}"
:value="row.tax_id"
:multiple="true"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => route('modals.taxes.create'),
'type' => 'modal',
'field' => [
'key' => 'id',
'value' => 'title'
],
'new_text' => trans('modules.new'),
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'class' => 'btn-success'
]
]
])}}"
:collapse="true"
@interface="row.tax_id = $event"
@change="onCalculateTotal()"
@new="taxes.push($event)"
:form-error="form.errors.get('items.' + index + '.tax_id')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select>
<input id="taxes" name="taxes" type="hidden" data-value="{{ json_encode($taxes) }}" v-model="taxes">
@stack('tax_id_input_end')
</td>
@stack('taxes_td_end')
@stack('total_td_start')
<td class="text-right total-column border-bottom-0 long-texts">
<akaunting-money :col="'d-none'"
:masked="true"
:error="{{ 'form.errors.get("total")' }}"
:name="'total'"
:currency="{{ json_encode($currency) }}"
:dynamic-currency="currency"
v-model="row.total"
@interface="row.total = $event"
></akaunting-money>
@stack('total_input_start')
<span id="item-total" v-if="row.total" v-html="row.total"></span>
@if (empty($item) || !isset($item->total))
<span id="item-total" v-else>@money(0, $currency->code, true)</span>
@else
<span id="item-total" v-else>@money($item->total, $invoice->currency_code, true)</span>
@endif
@stack('total_input_end')
</td>
@stack('total_td_end')
</tr>

View File

@@ -1,209 +1,10 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->document_number)
@section('content')
<div class="row">
<div class="col-58">
<div class="text company">
<img src="{{ $logo }}" class="c-logo" alt="{{ setting('company.name') }}"/>
</div>
</div>
<div class="col-42">
<div class="text company">
<strong>{{ setting('company.name') }}</strong><br>
<p>{!! nl2br(setting('company.address')) !!}</p>
<p>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</p>
<p>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</p>
<p>{{ setting('company.email') }}</p>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-33">
<hr class="invoice-classic-line mb-1 mt-4" style="background-color:{{ setting('invoice.color') }};">
<hr class="invoice-classic-line" style="background-color:{{ setting('invoice.color') }};">
</div>
<div class="col-33">
<div class="invoice-classic-frame ml-1">
<div class="invoice-classic-inline-frame text-center">
@stack('invoice_number_input_start')
<div class="text company">
<strong>{{ trans('invoices.invoice_number') }}:</strong><br>
{{ $invoice->invoice_number }}
</div>
@stack('invoice_number_input_end')
</div>
</div>
</div>
<div class="col-33">
<hr class="invoice-classic-line mb-1 mt-4" style="background-color:{{ setting('invoice.color') }};">
<hr class="invoice-classic-line" style="background-color:{{ setting('invoice.color') }};">
</div>
</div>
<div class="row mt-2">
<div class="col-58">
<div class="text company">
<strong>{{ trans('invoices.bill_to') }}</strong><br>
@stack('name_input_start')
<strong>{{ $invoice->contact_name }}</strong><br>
@stack('name_input_end')
@stack('address_input_start')
<p>{!! nl2br($invoice->contact_address) !!}</p>
@stack('address_input_end')
@stack('tax_number_input_start')
<p>
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif
</p>
@stack('tax_number_input_end')
@stack('phone_input_start')
<p>
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
</p>
@stack('phone_input_end')
@stack('email_start')
<p>{{ $invoice->contact_email }}</p>
@stack('email_input_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('order_number_input_start')
@if ($invoice->order_number)
<strong>{{ trans('invoices.order_number') }}:</strong>
<span class="float-right">{{ $invoice->order_number }}</span><br><br>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<strong>{{ trans('invoices.invoice_date') }}:</strong>
<span class="float-right">@date($invoice->invoiced_at)</span><br><br>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<strong>{{ trans('invoices.payment_due') }}:</strong>
<span class="float-right">@date($invoice->due_at)</span><br><br>
@stack('due_at_input_end')
@foreach ($invoice->totals_sorted as $total)
@if ($total->code == 'total')
<strong>{{ trans($total->name) }}:</strong>
<span class="float-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span><br><br>
@endif
@endforeach
</div>
</div>
</div>
<div class="row">
<div class="col-100">
<div class="text">
<table class="c-lines">
<thead>
<tr>
@stack('name_th_start')
<th class="text-left item">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="quantity">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="price">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="total">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody>
@foreach($invoice->items as $item)
@include('partials.documents.item.print', ['document' => $invoice])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-58">
<div class="text company">
@stack('notes_input_start')
@if ($invoice->notes)
<strong>{{ trans_choice('general.notes', 2) }}</strong><br><br>
{!! nl2br($invoice->notes) !!}
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-42 float-right text-right">
<div class="text company pr-2">
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<div class="border-top-dashed py-2">
<strong class="float-left">{{ trans($total->title) }}:</strong>
<span>@money($total->amount, $invoice->currency_code, true)</span>
</div>
@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')
<div class="border-top-dashed py-2">
<strong class="float-left">{{ trans('invoices.paid') }}:</strong>
<span>- @money($invoice->paid, $invoice->currency_code, true)</span>
</div>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<div class="border-top-dashed py-2">
<strong class="float-left">{{ trans($total->name) }}:</strong>
<span>@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span>
</div>
@stack('grand_total_tr_end')
@endif
@endforeach
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row mt-1">
<div class="col-100">
<div class="text company">
<strong>{!! nl2br($invoice->footer) !!}</strong>
</div>
</div>
</div>
@endif
<x-documents.template.classic
type="invoice"
:document="$invoice"
/>
@endsection

View File

@@ -1,197 +1,10 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->document_number)
@section('content')
<div class="row border-bottom-1">
<div class="col-58">
<div class="text company">
<img class="d-logo" src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</div>
</div>
<div class="col-42">
<div class="text company">
<strong>{{ setting('company.name') }}</strong><br>
<p>{!! nl2br(setting('company.address')) !!}</p>
<p>
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</p>
<p>
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</p>
<p>{{ setting('company.email') }}</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-58">
<div class="text company">
<br>
<strong>{{ trans('invoices.bill_to') }}</strong><br>
@stack('name_input_start')
<strong>{{ $invoice->contact_name }}</strong><br>
@stack('name_input_end')
@stack('address_input_start')
<p>{!! nl2br($invoice->contact_address) !!}</p>
@stack('address_input_end')
@stack('tax_number_input_start')
<p>
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif
</p>
@stack('tax_number_input_end')
@stack('phone_input_start')
<p>
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
</p>
@stack('phone_input_end')
@stack('email_start')
<p>
{{ $invoice->contact_email }}
</p>
@stack('email_input_end')
</div>
</div>
<div class="col-42">
<div class="text company">
<br>
@stack('invoice_number_input_start')
<strong>
{{ trans('invoices.invoice_number') }}:
</strong>
<span class="float-right">{{ $invoice->invoice_number }}</span><br><br>
@stack('invoice_number_input_end')
@stack('order_number_input_start')
@if ($invoice->order_number)
<strong>
{{ trans('invoices.order_number') }}:
</strong>
<span class="float-right">{{ $invoice->order_number }}</span><br><br>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<strong>
{{ trans('invoices.invoice_date') }}:
</strong>
<span class="float-right">@date($invoice->invoiced_at)</span><br><br>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<strong>
{{ trans('invoices.payment_due') }}:
</strong>
<span class="float-right">@date($invoice->due_at)</span><br><br>
@stack('due_at_input_end')
</div>
</div>
</div>
<div class="row">
<div class="col-100">
<div class="text">
<table class="lines">
@foreach($invoice as $item)
<thead style="background-color:{{ setting('invoice.color') }} !important; -webkit-print-color-adjust: exact;">
@endforeach
<tr>
@stack('name_th_start')
<th class="item text-left text-white">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="quantity text-white">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="price text-white">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="total text-white">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody>
@foreach($invoice->items as $item)
@include('partials.documents.item.print', ['document' => $invoice])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-9">
<div class="col-58">
<div class="text company">
@stack('notes_input_start')
@if ($invoice->notes)
<br>
<strong>{{ trans_choice('general.notes', 2) }}</strong><br><br>
{!! nl2br($invoice->notes) !!}
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-42 float-right text-right">
<div class="text company">
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<div class="border-top-1 py-2">
<strong class="float-left">{{ trans($total->title) }}:</strong>
<span>@money($total->amount, $invoice->currency_code, true)</span><br>
</div>
@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')
<div class="border-top-1 py-2">
<strong class="float-left">{{ trans('invoices.paid') }}:</strong>
<span>- @money($invoice->paid, $invoice->currency_code, true)</span><br>
</div>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<div class="border-top-1 py-2">
<strong class="float-left">{{ trans($total->name) }}:</strong>
<span>@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span>
</div>
@stack('grand_total_tr_end')
@endif
@endforeach
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row mt-4">
<div class="col-100 text-left">
<div class="text company">
<strong>{!! nl2br($invoice->footer) !!}<strong>
</div>
</div>
</div>
@endif
<x-documents.template.ddefault
type="invoice"
:document="$invoice"
/>
@endsection

View File

@@ -1,172 +1,10 @@
@extends('layouts.print')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->document_number)
@section('content')
<div class="row" style="background-color:{{ setting('invoice.color') }} !important; -webkit-print-color-adjust: exact;">
<div class="col-58">
<div class="text company pl-2 mb-1 d-flex align-items-center">
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
<strong class="pl-2 text-white">{{ setting('company.name') }}</strong>
</div>
</div>
<div class="col-42">
<div class="text company">
<strong class="text-white">{!! nl2br(setting('company.address')) !!}</strong><br><br>
<strong class="text-white">
@if (setting('company.tax_number'))
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
@endif
</strong><br><br>
<strong class="text-white">
@if (setting('company.phone'))
{{ setting('company.phone') }}
@endif
</strong><br><br>
<strong class="text-white">{{ setting('company.email') }}</strong><br><br>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-58">
<div class="text company">
<strong>{{ trans('invoices.bill_to') }}</strong><br>
@stack('name_input_start')
<strong>{{ $invoice->contact_name }}</strong><br><br>
@stack('name_input_end')
@stack('address_input_start')
{!! nl2br($invoice->contact_address) !!}<br><br>
@stack('address_input_end')
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}<br><br>
@endif
@stack('tax_number_input_end')
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}<br><br>
@endif
@stack('phone_input_end')
@stack('email_start')
{{ $invoice->contact_email }}<br><br>
@stack('email_input_end')
</div>
</div>
<div class="col-42">
<div class="text company">
@stack('order_number_input_start')
@if ($invoice->order_number)
<strong>{{ trans('invoices.order_number') }}:</strong>
<span class="float-right">{{ $invoice->order_number }}</span><br><br>
@endif
@stack('order_number_input_end')
@stack('invoice_number_input_start')
<strong>{{ trans('invoices.invoice_number') }}:</strong>
<span class="float-right">{{ $invoice->invoice_number }}</span><br><br>
@stack('invoice_number_input_end')
@stack('invoiced_at_input_start')
<strong>{{ trans('invoices.invoice_date') }}:</strong>
<span class="float-right">@date($invoice->invoiced_at)</span><br><br>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<strong>{{ trans('invoices.payment_due') }}:</strong>
<span class="float-right">@date($invoice->due_at)</span>
@stack('due_at_input_end')
</div>
</div>
</div>
<div class="row">
<div class="col-100">
<div class="text">
<table class="m-lines">
<thead style="background-color:{{ setting('invoice.color') }} !important; -webkit-print-color-adjust: exact;">
<tr>
@stack('name_th_start')
<th class="item text-left text-white">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="quantity text-white">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="price text-white">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@stack('total_th_start')
<th class="total text-white">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
</thead>
<tbody>
@foreach($invoice->items as $item)
@include('partials.documents.item.print', ['document' => $invoice])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="row mt-7">
<div class="col-58">
<div class="text company">
@stack('notes_input_start')
@if ($invoice->notes)
<strong>{{ trans_choice('general.notes', 2) }}</strong><br><br>
{!! nl2br($invoice->notes) !!}
@endif
@stack('notes_input_end')
</div>
</div>
<div class="col-42 float-right text-right">
<div class="text company pr-2">
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<strong class="float-left">{{ trans($total->title) }}:</strong>
<span>@money($total->amount, $invoice->currency_code, true)</span><br><br>
@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')
<strong class="float-left">{{ trans('invoices.paid') }}:</strong>
<span>- @money($invoice->paid, $invoice->currency_code, true)</span><br><br>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<strong class="float-left">{{ trans($total->name) }}:</strong>
<span>@money($total->amount - $invoice->paid, $invoice->currency_code, true)</span>
@stack('grandtotal_tr_end')
@endif
@endforeach
</div>
</div>
</div>
@if ($invoice->footer)
<div class="row mt-7">
<div class="col-100 py-2" style="background-color:{{ setting('invoice.color') }} !important; -webkit-print-color-adjust: exact;">
<div class="text pl-2">
<strong class="text-white">{!! nl2br($invoice->footer) !!}</strong>
</div>
</div>
</div>
@endif
<x-documents.template.modern
type="invoice"
:document="$invoice"
/>
@endsection

View File

@@ -1,683 +1,17 @@
@extends('layouts.admin')
@section('title', trans_choice('general.invoices', 1) . ': ' . $invoice->invoice_number)
@section('title', setting('invoice.title', trans_choice('general.invoices', 1)) . ': ' . $invoice->document_number)
@section('new_button')
<x-documents.show.top-buttons type="invoice" :document="$invoice" />
@endsection
@section('content')
@stack('recurring_message_start')
@if (($recurring = $invoice->recurring) && ($next = $recurring->getNextRecurring()))
<div class="row mb-3">
<div class="col-sm-12">
<div class="media">
<div class="media-body">
<div class="media-comment-text">
<div class="d-flex">
@stack('recurring_message_head_start')
<h5 class="mt-0">{{ trans('recurring.recurring') }}</h5>
@stack('recurring_message_head_end')
</div>
@stack('recurring_message_body_start')
<p class="text-sm lh-160 mb-0">{{ trans('recurring.message', [
'type' => mb_strtolower(trans_choice('general.invoices', 1)),
'date' => $next->format($date_format)
]) }}
</p>
@stack('recurring_message_body_end')
</div>
</div>
</div>
</div>
</div>
@endif
@stack('recurring_message_end')
@stack('status_message_start')
@if ($invoice->status == 'draft')
<div class="row">
<div class="col-sm-12">
<div class="alert alert-danger fade show" role="alert">
@stack('status_message_body_start')
<span class="alert-text">
<strong>{!! trans('invoices.messages.draft') !!}</strong>
</span>
@stack('status_message_body_end')
</div>
</div>
</div>
@endif
@stack('status_message_end')
@stack('timeline_start')
@if (!in_array($invoice->status, ['paid', 'cancelled']))
@stack('timeline_body_start')
<div class="card">
<div class="card-body">
<div class="timeline timeline-one-side" data-timeline-content="axis" data-timeline-axis-style="dashed">
@stack('timeline_body_create_invoice_start')
<div class="timeline-block">
<span class="timeline-step badge-primary">
<i class="fas fa-plus"></i>
</span>
<div class="timeline-content">
@stack('timeline_body_create_invoice_head_start')
<h2 class="font-weight-500">{{ trans('invoices.create_invoice') }}</h2>
@stack('timeline_body_create_invoice_head_end')
@stack('timeline_body_create_invoice_body_start')
@stack('timeline_body_create_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.created', ['date' => Date::parse($invoice->created_at)->format($date_format)]) }}</small>
@stack('timeline_body_create_invoice_body_message_end')
<div class="mt-3">
@stack('timeline_body_create_invoice_body_button_edit_start')
<a href="{{ route('invoices.edit', $invoice->id) }}" class="btn btn-primary btn-sm btn-alone">
{{ trans('general.edit') }}
</a>
@stack('timeline_body_create_invoice_body_button_edit_end')
</div>
@stack('timeline_body_create_invoice_body_end')
</div>
</div>
@stack('timeline_body_create_invoice_end')
@stack('timeline_body_send_invoice_start')
<div class="timeline-block">
<span class="timeline-step badge-danger">
<i class="far fa-envelope"></i>
</span>
<div class="timeline-content">
@stack('timeline_body_send_invoice_head_start')
<h2 class="font-weight-500">{{ trans('invoices.send_invoice') }}</h2>
@stack('timeline_body_send_invoice_head_end')
@stack('timeline_body_send_invoice_body_start')
@if ($invoice->status != 'sent' && $invoice->status != 'partial' && $invoice->status != 'viewed')
@stack('timeline_body_send_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.send.draft') }}</small>
@stack('timeline_body_send_invoice_body_message_end')
<div class="mt-3">
@stack('timeline_body_send_invoice_body_button_sent_start')
@can('update-sales-invoices')
@if($invoice->status == 'draft')
<a href="{{ route('invoices.sent', $invoice->id) }}" class="btn btn-white btn-sm">{{ trans('invoices.mark_sent') }}</a>
@else
<button type="button" class="btn btn-secondary btn-sm" disabled="disabled">
<span class="text-disabled">{{ trans('invoices.mark_sent') }}</span>
</button>
@endif
@endcan
@stack('timeline_body_send_invoice_body_button_sent_end')
@stack('timeline_body_send_invoice_body_button_email_start')
@if($invoice->contact_email)
<a href="{{ route('invoices.email', $invoice->id) }}" class="btn btn-danger btn-sm">{{ trans('invoices.send_mail') }}</a>
@else
<button type="button" class="btn btn-white btn-sm green-tooltip" disabled="disabled" data-toggle="tooltip" data-placement="right" title="{{ trans('invoices.messages.email_required') }}">
<span class="text-disabled">{{ trans('invoices.send_mail') }}</span>
</button>
@endif
@stack('timeline_body_send_invoice_body_button_email_end')
</div>
@elseif($invoice->status == 'viewed')
@stack('timeline_body_viewed_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.viewed') }}</small>
@stack('timeline_body_viewed_invoice_body_message_end')
@else
@stack('timeline_body_send_invoice_body_message_start')
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.send.sent', ['date' => Date::parse($invoice->sent_at)->format($date_format)]) }}</small>
@stack('timeline_body_send_invoice_body_message_end')
@endif
@stack('timeline_body_send_invoice_body_end')
</div>
</div>
@stack('timeline_body_send_invoice_end')
@stack('timeline_body_get_paid_start')
<div class="timeline-block">
<span class="timeline-step badge-success">
<i class="far fa-money-bill-alt"></i>
</span>
<div class="timeline-content">
@stack('timeline_body_get_paid_head_start')
<h2 class="font-weight-500">{{ trans('invoices.get_paid') }}</h2>
@stack('timeline_body_get_paid_head_end')
@stack('timeline_body_get_paid_body_start')
@stack('timeline_body_get_paid_body_message_start')
@if($invoice->status != 'paid' && empty($invoice->transactions->count()))
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('invoices.messages.status.paid.await') }}</small>
@else
<small>{{ trans_choice('general.statuses', 1) . ':' }}</small>
<small>{{ trans('general.partially_paid') }}</small>
@endif
@stack('timeline_body_get_paid_body_message_end')
<div class="mt-3">
@stack('timeline_body_get_paid_body_button_pay_start')
@can('update-sales-invoices')
<a href="{{ route('invoices.paid', $invoice->id) }}" class="btn btn-white btn-sm header-button-top">{{ trans('invoices.mark_paid') }}</a>
@endcan
@stack('timeline_body_get_paid_body_button_pay_end')
@stack('timeline_body_get_paid_body_button_payment_start')
@if(empty($invoice->transactions->count()) || (!empty($invoice->transactions->count()) && $invoice->paid != $invoice->amount))
<button @click="onPayment" id="button-payment" class="btn btn-success btn-sm header-button-bottom">{{ trans('invoices.add_payment') }}</button>
@endif
@stack('timeline_body_get_paid_body_button_payment_end')
</div>
@stack('timeline_body_get_paid_body_end')
</div>
</div>
@stack('timeline_body_get_paid_end')
</div>
</div>
</div>
@stack('timeline_body_get_paid_end')
@endif
@stack('timeline_end')
@stack('invoice_start')
<div class="card">
@stack('invoice_status_start')
<div class="card-header status-{{ $invoice->status_label }}">
<h3 class="text-white mb-0 float-right">{{ trans('invoices.statuses.' . $invoice->status) }}</h3>
</div>
@stack('invoice_status_end')
<div class="card-body">
@stack('invoice_header_start')
<div class="row mx--4">
<div class="col-md-7 border-bottom-1">
<div class="table-responsive mt-2">
<table class="table table-borderless">
<tbody>
<tr>
<th>
<img src="{{ $logo }}" alt="{{ setting('company.name') }}"/>
</th>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-md-5 border-bottom-1">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ setting('company.name') }}
</th>
</tr>
@if (setting('company.address'))
<tr>
<th>
{!! nl2br(setting('company.address')) !!}
</th>
</tr>
@endif
@if (setting('company.tax_number'))
<tr>
<th>
{{ trans('general.tax_number') }}: {{ setting('company.tax_number') }}
</th>
</tr>
@endif
@if (setting('company.phone'))
<tr>
<th>
{{ setting('company.phone') }}
</th>
</tr>
@endif
<tr>
<th>
{{ setting('company.email') }}
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_header_end')
@stack('invoice_information_start')
<div class="row">
<div class="col-md-7 long-texts">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<th>
{{ trans('invoices.bill_to') }}
@stack('name_input_start')
<strong class="d-block">{{ $invoice->contact_name }}</strong>
@stack('name_input_end')
</th>
</tr>
@if ($invoice->contact_address || $__env->hasStack('address_input_start', 'address_input_end'))
<tr>
<th>
@stack('address_input_start')
@if ($invoice->contact_address)
{!! nl2br($invoice->contact_address) !!}
@endif
@stack('address_input_end')
</th>
</tr>
@endif
@if ($invoice->contact_tax_number || $__env->hasStack('tax_number_input_start', 'tax_number_input_end'))
<tr>
<th>
@stack('tax_number_input_start')
@if ($invoice->contact_tax_number)
{{ trans('general.tax_number') }}: {{ $invoice->contact_tax_number }}
@endif
@stack('tax_number_input_end')
</th>
</tr>
@endif
@if ($invoice->contact_phone || $__env->hasStack('phone_input_start', 'phone_input_end'))
<tr>
<th>
@stack('phone_input_start')
@if ($invoice->contact_phone)
{{ $invoice->contact_phone }}
@endif
@stack('phone_input_end')
</th>
</tr>
@endif
@if ($invoice->contact_email || $__env->hasStack('email_start', 'email_input_end'))
<tr>
<th>
@stack('email_start')
@if ($invoice->contact_email)
{{ $invoice->contact_email }}
@endif
@stack('email_input_end')
</th>
</tr>
@endif
</tbody>
</table>
</div>
</div>
<div class="col-md-5 long-texts">
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@stack('invoice_number_input_start')
<tr>
<th>{{ trans('invoices.invoice_number') }}:</th>
<td class="text-right">{{ $invoice->invoice_number }}</td>
</tr>
@stack('invoice_number_input_end')
@stack('order_number_input_start')
@if ($invoice->order_number)
<tr>
<th>{{ trans('invoices.order_number') }}:</th>
<td class="text-right">{{ $invoice->order_number }}</td>
</tr>
@endif
@stack('order_number_input_end')
@stack('invoiced_at_input_start')
<tr>
<th>{{ trans('invoices.invoice_date') }}:</th>
<td class="text-right">@date($invoice->invoiced_at)</td>
</tr>
@stack('invoiced_at_input_end')
@stack('due_at_input_start')
<tr>
<th>{{ trans('invoices.payment_due') }}:</th>
<td class="text-right">@date($invoice->due_at)</td>
</tr>
@stack('due_at_input_end')
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_information_end')
@stack('invoice_item_start')
<div class="row show-table">
<div class="col-md-12">
<div class="table-responsive overflow-y-hidden">
<table class="table table-striped">
<tbody>
<tr class="d-flex flex-nowrap">
@stack('name_th_start')
<th class="col-xs-4 col-sm-5 pl-5">{{ trans_choice($text_override['items'], 2) }}</th>
@stack('name_th_end')
@stack('quantity_th_start')
<th class="col-xs-4 col-sm-1 text-center">{{ trans($text_override['quantity']) }}</th>
@stack('quantity_th_end')
@stack('price_th_start')
<th class="col-sm-3 text-right d-none d-sm-block">{{ trans($text_override['price']) }}</th>
@stack('price_th_end')
@if (in_array(setting('localisation.discount_location', 'total'), ['item', 'both']))
@stack('discount_th_start')
<th class="col-sm-1 text-center d-none d-sm-block">{{ trans('invoices.discount') }}</th>
@stack('discount_th_end')
@endif
@stack('total_th_start')
<th class="col-xs-4 col-sm-3 text-right pr-5">{{ trans('invoices.total') }}</th>
@stack('total_th_end')
</tr>
@foreach($invoice->items as $item)
@include('partials.documents.item.show', ['document' => $invoice])
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_item_end')
@stack('invoice_total_start')
<div class="row mt-5">
<div class="col-md-7">
@stack('notes_input_start')
<div class="table-responsive">
<table class="table table-borderless">
<tbody>
@if ($invoice->notes)
<tr>
<th>
<p class="form-control-label">{{ trans_choice('general.notes', 2) }}</p>
<p class="text-muted long-texts">{!! nl2br($invoice->notes) !!}</p>
</th>
</tr>
@endif
</tbody>
</table>
</div>
@stack('notes_input_end')
</div>
<div class="col-md-5">
<div class="table-responsive">
<table class="table">
<tbody>
@foreach ($invoice->totals_sorted as $total)
@if ($total->code != 'total')
@stack($total->code . '_total_tr_start')
<tr>
<th>{{ trans($total->title) }}:</th>
<td class="text-right">@money($total->amount, $invoice->currency_code, true)</td>
</tr>
@stack($total->code . '_total_tr_end')
@else
@if ($invoice->paid)
@stack('paid_total_tr_start')
<tr>
<th class="text-success">
{{ trans('invoices.paid') }}:
</th>
<td class="text-success text-right">- @money($invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('paid_total_tr_end')
@endif
@stack('grand_total_tr_start')
<tr>
<th>{{ trans($total->name) }}:</th>
<td class="text-right">@money($total->amount - $invoice->paid, $invoice->currency_code, true)</td>
</tr>
@stack('grand_total_tr_end')
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@stack('invoice_total_end')
</div>
@stack('card_footer_start')
<div class="card-footer">
<div class="row align-items-center">
<div class="col-xs-12 col-sm-4">
@if ($invoice->attachment)
@php $file = $invoice->attachment; @endphp
@include('partials.media.file')
@endif
</div>
<div class="col-xs-12 col-sm-8 text-right">
@stack('button_edit_start')
@if(!$invoice->reconciled)
<a href="{{ route('invoices.edit', $invoice->id) }}" class="btn btn-info">
{{ trans('general.edit') }}
</a>
@endif
@stack('button_edit_end')
@stack('button_print_start')
<a href="{{ route('invoices.print', $invoice->id) }}" target="_blank" class="btn btn-success">
{{ trans('general.print') }}
</a>
@stack('button_print_end')
@if ($invoice->status != 'cancelled')
@stack('button_share_start')
<a href="{{ $signed_url }}" target="_blank" class="btn btn-white">
{{ trans('general.share') }}
</a>
@stack('button_share_end')
@endif
@stack('button_group_start')
<div class="dropup header-drop-top">
<button type="button" class="btn btn-primary" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-chevron-up"></i>&nbsp; {{ trans('general.more_actions') }}</button>
<div class="dropdown-menu" role="menu">
@stack('button_dropdown_start')
@if ($invoice->status != 'cancelled')
@if ($invoice->status != 'paid')
@stack('button_pay_start')
@can('update-sales-invoices')
<a class="dropdown-item" href="{{ route('invoices.paid', $invoice->id) }}">{{ trans('invoices.mark_paid') }}</a>
@endcan
@if (empty($invoice->paid) || ($invoice->paid != $invoice->amount))
<button class="dropdown-item" id="button-payment" @click="onPayment">{{ trans('invoices.add_payment') }}</button>
@endif
@stack('button_pay_end')
<div class="dropdown-divider"></div>
@endif
@stack('button_dropdown_divider_1')
@can('update-sales-invoices')
@stack('button_sent_start')
@if ($invoice->status == 'draft')
<a class="dropdown-item" href="{{ route('invoices.sent', $invoice->id) }}">{{ trans('invoices.mark_sent') }}</a>
@else
<button type="button" class="dropdown-item" disabled="disabled"><span class="text-disabled">{{ trans('invoices.mark_sent') }}</span></button>
@endif
@stack('button_sent_end')
@endcan
@stack('button_email_start')
@if ($invoice->contact_email)
<a class="dropdown-item" href="{{ route('invoices.email', $invoice->id) }}">{{ trans('invoices.send_mail') }}</a>
@else
<button type="button" class="dropdown-item" disabled="disabled" data-toggle="tooltip" data-placement="right" title="{{ trans('invoices.messages.email_required') }}">
<span class="text-disabled">{{ trans('invoices.send_mail') }}</span>
</button>
@endif
@stack('button_email_end')
@endif
@stack('button_pdf_start')
<a class="dropdown-item" href="{{ route('invoices.pdf', $invoice->id) }}">{{ trans('invoices.download_pdf') }}</a>
@stack('button_pdf_end')
@can('update-sales-invoices')
@if ($invoice->status != 'cancelled')
@stack('button_cancelled_start')
<a class="dropdown-item" href="{{ route('invoices.cancelled', $invoice->id) }}">{{ trans('general.cancel') }}</a>
@stack('button_cancelled_end')
@endif
@endcan
@stack('button_dropdown_divider_2')
@can('delete-sales-invoices')
@if (!$invoice->reconciled)
@stack('button_delete_start')
{!! Form::deleteLink($invoice, 'sales/invoices') !!}
@stack('button_delete_end')
@endif
@endcan
@stack('button_dropdown_end')
</div>
</div>
@stack('button_group_end')
</div>
</div>
</div>
@stack('card_footer_end')
</div>
@stack('invoice_end')
@stack('row_footer_start')
<div class="row">
@stack('row_footer_histories_start')
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-histories-header" data-toggle="collapse" data-target="#accordion-histories-body" aria-expanded="false" aria-controls="accordion-histories-body">
<h4 class="mb-0">{{ trans('invoices.histories') }}</h4>
</div>
<div id="accordion-histories-body" class="collapse hide" aria-labelledby="accordion-histories-header">
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
@stack('row_footer_histories_head_tr_start')
<tr class="row table-head-line">
@stack('row_footer_histories_head_start')
<th class="col-xs-4 col-sm-3">{{ trans('general.date') }}</th>
<th class="col-xs-4 col-sm-3 text-left">{{ trans_choice('general.statuses', 1) }}</th>
<th class="col-xs-4 col-sm-6 text-left long-texts">{{ trans('general.description') }}</th>
@stack('row_footer_histories_head_end')
</tr>
@stack('row_footer_histories_head_tr_end')
</thead>
<tbody>
@stack('row_footer_histories_body_tr_start')
@foreach($invoice->histories as $history)
<tr class="row align-items-center border-top-1 tr-py">
@stack('row_footer_histories_body_td_start')
<td class="col-xs-4 col-sm-3">@date($history->created_at)</td>
<td class="col-xs-4 col-sm-3 text-left">{{ trans('invoices.statuses.' . $history->status) }}</td>
<td class="col-xs-4 col-sm-6 text-left long-texts">{{ $history->description }}</td>
@stack('row_footer_histories_body_td_end')
</tr>
@endforeach
@stack('row_footer_histories_body_tr_end')
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@stack('row_footer_histories_end')
@stack('row_footer_transactions_start')
<div class="col-sm-6 col-md-6 col-lg-6 col-xl-6">
<div class="accordion">
<div class="card">
<div class="card-header" id="accordion-transactions-header" data-toggle="collapse" data-target="#accordion-transactions-body" aria-expanded="false" aria-controls="accordion-transactions-body">
<h4 class="mb-0">{{ trans_choice('general.transactions', 2) }}</h4>
</div>
<div id="accordion-transactions-body" class="collapse hide" aria-labelledby="accordion-transactions-header">
<div class="table-responsive">
<table class="table table-flush table-hover">
<thead class="thead-light">
@stack('row_footer_transactions_head_tr_start')
<tr class="row table-head-line">
@stack('row_footer_transactions_head_td_start')
<th class="col-xs-4 col-sm-3">{{ trans('general.date') }}</th>
<th class="col-xs-4 col-sm-3">{{ trans('general.amount') }}</th>
<th class="col-sm-3 d-none d-sm-block">{{ trans_choice('general.accounts', 1) }}</th>
<th class="col-xs-4 col-sm-3">{{ trans('general.actions') }}</th>
@stack('row_footer_transactions_head_td_end')
</tr>
@stack('row_footer_transactions_head_tr_end')
</thead>
<tbody>
@stack('row_footer_transactions_body_tr_start')
@if ($invoice->transactions->count())
@foreach($invoice->transactions as $transaction)
<tr class="row align-items-center border-top-1 tr-py">
@stack('row_footer_transactions_body_td_start')
<td class="col-xs-4 col-sm-3">@date($transaction->paid_at)</td>
<td class="col-xs-4 col-sm-3">@money($transaction->amount, $transaction->currency_code, true)</td>
<td class="col-sm-3 d-none d-sm-block">{{ $transaction->account->name }}</td>
<td class="col-xs-4 col-sm-3 py-0">
@if ($transaction->reconciled)
<button type="button" class="btn btn-default btn-sm">
{{ trans('reconciliations.reconciled') }}
</button>
@else
@php $message = trans('general.delete_confirm', [
'name' => '<strong>' . Date::parse($transaction->paid_at)->format($date_format) . ' - ' . money($transaction->amount, $transaction->currency_code, true) . ' - ' . $transaction->account->name . '</strong>',
'type' => strtolower(trans_choice('general.transactions', 1))
]);
@endphp
{!! Form::button(trans('general.delete'), array(
'type' => 'button',
'class' => 'btn btn-danger btn-sm',
'title' => trans('general.delete'),
'@click' => 'confirmDelete("' . route('transactions.destroy', $transaction->id) . '", "' . trans_choice('general.transactions', 2) . '", "' . $message. '", "' . trans('general.cancel') . '", "' . trans('general.delete') . '")'
)) !!}
@endif
</td>
@stack('row_footer_transactions_body_td_end')
</tr>
@endforeach
@else
<tr>
<td colspan="4">
<div class="text-muted nr-py" id="datatable-basic_info" role="status" aria-live="polite">
{{ trans('general.no_records') }}
</div>
</td>
</tr>
@endif
@stack('row_footer_transactions_body_tr_end')
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@stack('row_footer_transactions_end')
</div>
@stack('row_footer_end')
{{ Form::hidden('invoice_id', $invoice->id, ['id' => 'invoice_id']) }}
<x-documents.show.content type="invoice" :document="$invoice" hide-button-received />
@endsection
@push('scripts_start')
<script src="{{ asset('public/js/sales/invoices.js?v=' . version('short')) }}"></script>
<link rel="stylesheet" href="{{ asset('public/css/print.css?v=' . version('short')) }}" type="text/css">
<x-documents.script />
@endpush

View File

@@ -67,7 +67,7 @@
@endif
@if ($revenue->invoice)
{{ Form::textGroup('document', trans_choice('general.invoices', 1), 'file-invoice', ['disabled' => 'true'], $revenue->invoice->invoice_number) }}
{{ Form::textGroup('document', trans_choice('general.invoices', 1), 'file-invoice', ['disabled' => 'true'], $revenue->invoice->document_number) }}
{{ Form::hidden('document_id', $revenue->invoice->id) }}
@endif
</div>

View File

@@ -57,7 +57,7 @@
@if($item->invoice)
@if ($item->invoice->status == 'paid')
<el-tooltip content="{{ $item->invoice->invoice_number }} / {{ trans('invoices.statuses.paid') }}"
<el-tooltip content="{{ $item->invoice->document_number }} / {{ trans('invoices.statuses.paid') }}"
effect="success"
:open-delay="100"
placement="top">
@@ -66,7 +66,7 @@
</span>
</el-tooltip>
@elseif ($item->invoice->status == 'partial')
<el-tooltip content="{{ $item->invoice->invoice_number }} / {{ trans('invoices.statuses.partial') }}"
<el-tooltip content="{{ $item->invoice->document_number }} / {{ trans('invoices.statuses.partial') }}"
effect="info"
:open-delay="100"
placement="top">