feat: import customers/vendors

This commit is contained in:
Ahmed Bouhuolia
2024-03-28 00:05:02 +02:00
parent fc1d123c6b
commit 7a3e121942
12 changed files with 437 additions and 48 deletions

View File

@@ -6,6 +6,17 @@ export default {
sortField: 'createdAt',
},
fields: {
customerType: {
name: 'Customer Type',
column: 'contact_type',
fieldType: 'enumeration',
options: [
{ key: 'business', label: 'Business' },
{ key: 'individual', label: 'Individual' },
],
importable: true,
required: true,
},
firstName: {
name: 'customer.field.first_name',
column: 'first_name',
@@ -52,7 +63,7 @@ export default {
website: {
name: 'customer.field.website',
column: 'website',
fieldType: 'text',
fieldType: 'url',
importable: true,
},
balance: {
@@ -85,6 +96,18 @@ export default {
fieldType: 'text',
importable: true,
},
note: {
name: 'Note',
column: 'note',
fieldType: 'text',
importable: true,
},
active: {
name: 'Active',
column: 'active',
fieldType: 'boolean',
importable: true,
},
status: {
name: 'customer.field.status',
fieldType: 'enumeration',
@@ -95,7 +118,6 @@ export default {
{ key: 'unpaid', label: 'customer.field.status.unpaid' },
],
filterCustomQuery: statusFieldFilterQuery,
importable: true,
},
// Billing Address
billingAddress1: {

View File

@@ -1,51 +1,59 @@
export default {
importable: true,
defaultFilterField: 'name',
defaultSort: {
sortField: 'name',
sortOrder: 'DESC',
},
fields: {
'type': {
type: {
name: 'item.field.type',
column: 'type',
fieldType: 'enumeration',
options: [
{ key: 'inventory', label: 'item.field.type.inventory', },
{ key: 'inventory', label: 'item.field.type.inventory' },
{ key: 'service', label: 'item.field.type.service' },
{ key: 'non-inventory', label: 'item.field.type.non-inventory', },
{ key: 'non-inventory', label: 'item.field.type.non-inventory' },
],
importable: true,
},
'name': {
name: {
name: 'item.field.name',
column: 'name',
fieldType: 'text',
importable: true,
},
'code': {
code: {
name: 'item.field.code',
column: 'code',
fieldType: 'text',
importable: true,
},
'sellable': {
sellable: {
name: 'item.field.sellable',
column: 'sellable',
fieldType: 'boolean',
importable: true,
},
'purchasable': {
purchasable: {
name: 'item.field.purchasable',
column: 'purchasable',
fieldType: 'boolean',
importable: true,
},
'sell_price': {
sellPrice: {
name: 'item.field.cost_price',
column: 'sell_price',
fieldType: 'number',
importable: true,
},
'cost_price': {
costPrice: {
name: 'item.field.cost_account',
column: 'cost_price',
fieldType: 'number',
importable: true,
},
'cost_account': {
costAccount: {
name: 'item.field.sell_account',
column: 'cost_account_id',
fieldType: 'relation',
@@ -55,8 +63,10 @@ export default {
relationEntityLabel: 'name',
relationEntityKey: 'slug',
importable: true,
},
'sell_account': {
sellAccount: {
name: 'item.field.sell_description',
column: 'sell_account_id',
fieldType: 'relation',
@@ -66,8 +76,10 @@ export default {
relationEntityLabel: 'name',
relationEntityKey: 'slug',
importable: true,
},
'inventory_account': {
inventoryAccount: {
name: 'item.field.inventory_account',
column: 'inventory_account_id',
@@ -76,28 +88,34 @@ export default {
relationEntityLabel: 'name',
relationEntityKey: 'slug',
importable: true,
},
'sell_description': {
sellDescription: {
name: 'Sell description',
column: 'sell_description',
fieldType: 'text',
importable: true,
},
'purchase_description': {
purchaseDescription: {
name: 'Purchase description',
column: 'purchase_description',
fieldType: 'text',
importable: true,
},
'quantity_on_hand': {
quantityOnHand: {
name: 'item.field.quantity_on_hand',
column: 'quantity_on_hand',
fieldType: 'number',
importable: true,
},
'note': {
note: {
name: 'item.field.note',
column: 'note',
fieldType: 'text',
importable: true,
},
'category': {
category: {
name: 'item.field.category',
column: 'category_id',
@@ -106,14 +124,15 @@ export default {
relationEntityLabel: 'name',
relationEntityKey: 'id',
importable: true,
},
'active': {
active: {
name: 'item.field.active',
column: 'active',
fieldType: 'boolean',
filterable: false,
importable: true,
},
'created_at': {
createdAt: {
name: 'item.field.created_at',
column: 'created_at',
columnType: 'date',

View File

@@ -38,7 +38,7 @@ export default {
importable: true,
},
personalPhone: {
name: 'vendor.field.personal_pone',
name: 'vendor.field.personal_phone',
column: 'personal_phone',
fieldType: 'text',
importable: true,
@@ -84,6 +84,18 @@ export default {
fieldType: 'text',
importable: true,
},
note: {
name: 'Note',
column: 'note',
fieldType: 'text',
importable: true,
},
active: {
name: 'Active',
column: 'active',
fieldType: 'boolean',
importable: true,
},
status: {
name: 'vendor.field.status',
type: 'enumeration',
@@ -101,7 +113,6 @@ export default {
break;
}
},
importable: true,
},
// Billing Address
billingAddress1: {