From 1ab13b46d5ecf84769332b59116de7dbd638d461 Mon Sep 17 00:00:00 2001
From: Hartanto119 <80240259+Hartanto119@users.noreply.github.com>
Date: Thu, 21 Apr 2022 19:22:28 +0700
Subject: [PATCH 1/4] asd
---
app/Http/Controllers/CommonController.php | 6 +-
app/Http/Requests/CapitalGroupRequest.php | 5 +-
app/Http/Requests/CapitalRequest.php | 7 +-
app/Http/Requests/CustomerGroupRequest.php | 39 +++++--
app/Http/Requests/CustomerRequest.php | 19 +++-
app/Http/Requests/ExpenseGroupRequest.php | 13 +--
app/Http/Requests/ExpenseRequest.php | 20 ++--
app/Http/Requests/IncomeGroupRequest.php | 13 +--
app/Http/Requests/IncomeRequest.php | 20 ++--
app/Http/Requests/InvestorRequest.php | 7 +-
app/Http/Resources/CapitalGroupResource.php | 24 ++++
app/Http/Resources/CapitalResource.php | 30 +++++
app/Http/Resources/CustomerGroupResource.php | 39 +++++++
app/Http/Resources/CustomerResource.php | 34 ++++++
app/Http/Resources/ExpenseGroupResource.php | 24 ++++
app/Http/Resources/ExpenseResource.php | 32 ++++++
app/Http/Resources/IncomeGroupResource.php | 24 ++++
app/Http/Resources/IncomeResource.php | 32 ++++++
app/Http/Resources/InvestorResource.php | 30 +++++
app/Http/Resources/ProfileResource.php | 4 +-
app/Models/Profile.php | 7 +-
app/Rules/uniqueCode.php | 107 +++++++++++++++++-
app/Services/CapitalGroupService.php | 34 ++++++
app/Services/CapitalService.php | 46 ++++++++
app/Services/CustomerGroupService.php | 61 ++++++++++
app/Services/CustomerService.php | 44 +++++++
app/Services/ExpenseGroupService.php | 44 +++++++
app/Services/ExpenseService.php | 44 +++++++
.../Impls/CapitalGroupServiceImpl.php | 0
app/Services/Impls/CapitalServiceImpl.php | 0
.../Impls/CustomerGroupServiceImpl.php | 0
app/Services/Impls/CustomerServiceImpl.php | 0
.../Impls/ExpenseGroupServiceImpl.php | 0
app/Services/Impls/ExpenseServiceImpl.php | 0
app/Services/Impls/IncomeGroupServiceImpl.php | 0
app/Services/Impls/IncomeServiceImpl.php | 0
app/Services/Impls/InvestorServiceImpl.php | 0
app/Services/IncomeGroupService.php | 44 +++++++
app/Services/IncomeService.php | 44 +++++++
app/Services/InvestorService.php | 44 +++++++
.../js/midone/views/administrator/User.vue | 41 +------
41 files changed, 878 insertions(+), 104 deletions(-)
create mode 100644 app/Http/Resources/CapitalGroupResource.php
create mode 100644 app/Http/Resources/CapitalResource.php
create mode 100644 app/Http/Resources/CustomerGroupResource.php
create mode 100644 app/Http/Resources/CustomerResource.php
create mode 100644 app/Http/Resources/ExpenseGroupResource.php
create mode 100644 app/Http/Resources/ExpenseResource.php
create mode 100644 app/Http/Resources/IncomeGroupResource.php
create mode 100644 app/Http/Resources/IncomeResource.php
create mode 100644 app/Http/Resources/InvestorResource.php
create mode 100644 app/Services/CapitalGroupService.php
create mode 100644 app/Services/CapitalService.php
create mode 100644 app/Services/CustomerGroupService.php
create mode 100644 app/Services/CustomerService.php
create mode 100644 app/Services/ExpenseGroupService.php
create mode 100644 app/Services/ExpenseService.php
create mode 100644 app/Services/Impls/CapitalGroupServiceImpl.php
create mode 100644 app/Services/Impls/CapitalServiceImpl.php
create mode 100644 app/Services/Impls/CustomerGroupServiceImpl.php
create mode 100644 app/Services/Impls/CustomerServiceImpl.php
create mode 100644 app/Services/Impls/ExpenseGroupServiceImpl.php
create mode 100644 app/Services/Impls/ExpenseServiceImpl.php
create mode 100644 app/Services/Impls/IncomeGroupServiceImpl.php
create mode 100644 app/Services/Impls/IncomeServiceImpl.php
create mode 100644 app/Services/Impls/InvestorServiceImpl.php
create mode 100644 app/Services/IncomeGroupService.php
create mode 100644 app/Services/IncomeService.php
create mode 100644 app/Services/InvestorService.php
diff --git a/app/Http/Controllers/CommonController.php b/app/Http/Controllers/CommonController.php
index 0c64aba..210e536 100644
--- a/app/Http/Controllers/CommonController.php
+++ b/app/Http/Controllers/CommonController.php
@@ -25,8 +25,8 @@ public function getCountries()
public function getStatus()
{
return [
- ['name' => 'components.dropdown.values.statusDDL.active', 'code' => '1'],
- ['name' => 'components.dropdown.values.statusDDL.inactive', 'code' => '0'],
+ ['name' => 'components.dropdown.values.statusDDL.active', 'code' => 'ACTIVE'],
+ ['name' => 'components.dropdown.values.statusDDL.inactive', 'code' => 'INACTIVE'],
];
}
@@ -35,4 +35,4 @@ public function getRandGenerator(Request $request)
{
}
-}
+}
\ No newline at end of file
diff --git a/app/Http/Requests/CapitalGroupRequest.php b/app/Http/Requests/CapitalGroupRequest.php
index 3a8907f..97191ef 100644
--- a/app/Http/Requests/CapitalGroupRequest.php
+++ b/app/Http/Requests/CapitalGroupRequest.php
@@ -8,7 +8,7 @@
use Illuminate\Foundation\Http\FormRequest;
use Vinkla\Hashids\Facades\Hashids;
-class BranchRequest extends FormRequest
+class CapitalGroupRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
@@ -27,9 +27,6 @@ public function authorize()
*/
public function rules()
{
- $investorId = $this->has('investor_id') ? Hashids::decode($this['investor_id'])[0]:null;
- $groupId = $this->has('group_id') ? Hashids::decode($this['group_id'])[0]:null;
- $cashId = $this->has('cash_id') ? Hashids::decode($this['cash_id'])[0]:null;
$nullableArr = [
'date' => 'nullable',
diff --git a/app/Http/Requests/CapitalRequest.php b/app/Http/Requests/CapitalRequest.php
index a8cba58..a4bca7d 100644
--- a/app/Http/Requests/CapitalRequest.php
+++ b/app/Http/Requests/CapitalRequest.php
@@ -41,9 +41,10 @@ public function rules()
case 'store':
$rules_store = [
'company_id' => ['required', 'bail'],
- 'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'ref_number' => 'required|integer|digits_between:1,255',
+ 'group_id' => 'required',
+ 'capital_status' => 'required',
+ 'amount' => 'required|integer|digits_between:1,29',
];
return array_merge($rules_store, $nullableArr);
case 'update':
diff --git a/app/Http/Requests/CustomerGroupRequest.php b/app/Http/Requests/CustomerGroupRequest.php
index 746242d..57a68a3 100644
--- a/app/Http/Requests/CustomerGroupRequest.php
+++ b/app/Http/Requests/CustomerGroupRequest.php
@@ -30,9 +30,8 @@ public function rules()
$companyId = $this->has('company_id') ? Hashids::decode($this['company_id'])[0]:null;
$nullableArr = [
- 'address' => 'nullable',
- 'city' => 'nullable',
- 'contact' => 'nullable',
+ 'sell_at_cost' => 'nullable',
+ 'round_on' => 'nullable',
'remarks' => 'nullable',
];
@@ -40,18 +39,38 @@ public function rules()
switch($currentRouteMethod) {
case 'store':
$rules_store = [
- 'company_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'name' => 'required|min:3|max:255',
+ 'max_open_invoice' => 'required|integer|digits_between:1,11',
+ 'max_outstanding_invoice' => 'required|integer|digits_between:1,16',
+ 'max_invoice_age' => 'required|integer|digits_between:1,11',
+ 'payment_term' => 'required|integer|digits_between:1,11',
+ 'selling_point' => 'required|integer|digits_between:1,8',
+ 'selling_point_multiple' => 'required|integer|digits_between:1,16',
+ 'price_markup_percent' => 'required|integer|digits_between:1,16',
+ 'price_markup_nominal' => 'required|integer|digits_between:1,16',
+ 'price_markdown_percent' => 'required|integer|digits_between:1,16',
+ 'price_markdown_nominal' => 'required|integer|digits_between:1,16',
+ 'round_digit' => 'required|integer|digits_between:1,11',
+ 'cash_id' => ['required', 'bail'],
];
return array_merge($rules_store, $nullableArr);
case 'update':
- $rules_update = [
- 'company_id' => ['required', 'bail'],
+ $rules_update = [
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'name' => 'required|min:3|max:255',
+ 'max_open_invoice' => 'required|integer|digits_between:1,11',
+ 'max_outstanding_invoice' => 'required|integer|digits_between:1,16',
+ 'max_invoice_age' => 'required|integer|digits_between:1,11',
+ 'payment_term' => 'required|integer|digits_between:1,11',
+ 'selling_point' => 'required|integer|digits_between:1,8',
+ 'selling_point_multiple' => 'required|integer|digits_between:1,16',
+ 'price_markup_percent' => 'required|integer|digits_between:1,16',
+ 'price_markup_nominal' => 'required|integer|digits_between:1,16',
+ 'price_markdown_percent' => 'required|integer|digits_between:1,16',
+ 'price_markdown_nominal' => 'required|integer|digits_between:1,16',
+ 'round_digit' => 'required|integer|digits_between:1,11',
+ 'cash_id' => ['required', 'bail'],
];
return array_merge($rules_update, $nullableArr);
default:
diff --git a/app/Http/Requests/CustomerRequest.php b/app/Http/Requests/CustomerRequest.php
index a9dbc8b..9a740bb 100644
--- a/app/Http/Requests/CustomerRequest.php
+++ b/app/Http/Requests/CustomerRequest.php
@@ -34,23 +34,34 @@ public function rules()
'city' => 'nullable',
'contact' => 'nullable',
'remarks' => 'nullable',
+ 'is_member' => 'nullable',
+ 'zone' => 'nullable',
+ 'tax_id' => 'nullable',
];
$currentRouteMethod = $this->route()->getActionMethod();
switch($currentRouteMethod) {
case 'store':
$rules_store = [
- 'company_id' => ['required', 'bail'],
+ 'customer_group_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
- 'name' => 'required|max:255',
+ 'name' => 'required|min:3|max:255',
+ 'max_open_invoice' => 'required|integer|digits_between:1,11',
+ 'max_outstanding_invoice' => 'required|numeric|min:0|max:999999999999999',
+ 'max_invoice_age' => 'required|integer|digits_between:1,11',
+ 'payment_term' => 'required|integer|digits_between:1,11',
'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
return array_merge($rules_store, $nullableArr);
case 'update':
$rules_update = [
- 'company_id' => ['required', 'bail'],
+ 'customer_group_id' => ['required', 'bail'],
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
- 'name' => 'required|max:255',
+ 'name' => 'required|min:3|max:255',
+ 'max_open_invoice' => 'required|integer|digits_between:1,11',
+ 'max_outstanding_invoice' => 'required|numeric|min:0|max:999999999999999',
+ 'max_invoice_age' => 'required|integer|digits_between:1,11',
+ 'payment_term' => 'required|integer|digits_between:1,11',
'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
return array_merge($rules_update, $nullableArr);
diff --git a/app/Http/Requests/ExpenseGroupRequest.php b/app/Http/Requests/ExpenseGroupRequest.php
index dd28037..92e7a03 100644
--- a/app/Http/Requests/ExpenseGroupRequest.php
+++ b/app/Http/Requests/ExpenseGroupRequest.php
@@ -29,13 +29,6 @@ public function rules()
{
$companyId = $this->has('company_id') ? Hashids::decode($this['company_id'])[0]:null;
- $nullableArr = [
- 'address' => 'nullable',
- 'city' => 'nullable',
- 'contact' => 'nullable',
- 'remarks' => 'nullable',
- ];
-
$currentRouteMethod = $this->route()->getActionMethod();
switch($currentRouteMethod) {
case 'store':
@@ -43,17 +36,15 @@ public function rules()
'company_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
- return array_merge($rules_store, $nullableArr);
+ return array_merge($rules_store);
case 'update':
$rules_update = [
'company_id' => ['required', 'bail'],
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
- return array_merge($rules_update, $nullableArr);
+ return array_merge($rules_update);
default:
return [
'' => 'required'
diff --git a/app/Http/Requests/ExpenseRequest.php b/app/Http/Requests/ExpenseRequest.php
index 89c5419..c540828 100644
--- a/app/Http/Requests/ExpenseRequest.php
+++ b/app/Http/Requests/ExpenseRequest.php
@@ -30,10 +30,8 @@ public function rules()
$companyId = $this->has('company_id') ? Hashids::decode($this['company_id'])[0]:null;
$nullableArr = [
- 'address' => 'nullable',
- 'city' => 'nullable',
- 'contact' => 'nullable',
'remarks' => 'nullable',
+ 'posted' => 'nullable',
];
$currentRouteMethod = $this->route()->getActionMethod();
@@ -41,17 +39,25 @@ public function rules()
case 'store':
$rules_store = [
'company_id' => ['required', 'bail'],
+ 'branch_id' => ['required', 'bail'],
+ 'expense_group_id' => ['required', 'bail'],
+ 'cash_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'payment_term_type' => 'required|integer|digits_between:1,11',
+ 'amount' => 'required|integer|digits_between:1,19',
+ 'amount_owed' => 'required|integer|digits_between:1,19',
];
return array_merge($rules_store, $nullableArr);
case 'update':
$rules_update = [
'company_id' => ['required', 'bail'],
+ 'branch_id' => ['required', 'bail'],
+ 'expense_group_id' => ['required', 'bail'],
+ 'cash_id' => ['required', 'bail'],
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'payment_term_type' => 'required|integer|digits_between:1,11',
+ 'amount' => 'required|integer|digits_between:1,19',
+ 'amount_owed' => 'required|integer|digits_between:1,19',
];
return array_merge($rules_update, $nullableArr);
default:
diff --git a/app/Http/Requests/IncomeGroupRequest.php b/app/Http/Requests/IncomeGroupRequest.php
index 3b3c101..af46ef6 100644
--- a/app/Http/Requests/IncomeGroupRequest.php
+++ b/app/Http/Requests/IncomeGroupRequest.php
@@ -29,13 +29,6 @@ public function rules()
{
$companyId = $this->has('company_id') ? Hashids::decode($this['company_id'])[0]:null;
- $nullableArr = [
- 'address' => 'nullable',
- 'city' => 'nullable',
- 'contact' => 'nullable',
- 'remarks' => 'nullable',
- ];
-
$currentRouteMethod = $this->route()->getActionMethod();
switch($currentRouteMethod) {
case 'store':
@@ -43,17 +36,15 @@ public function rules()
'company_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
- return array_merge($rules_store, $nullableArr);
+ return array_merge($rules_store);
case 'update':
$rules_update = [
'company_id' => ['required', 'bail'],
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
- return array_merge($rules_update, $nullableArr);
+ return array_merge($rules_update);
default:
return [
'' => 'required'
diff --git a/app/Http/Requests/IncomeRequest.php b/app/Http/Requests/IncomeRequest.php
index 64e8fba..f604143 100644
--- a/app/Http/Requests/IncomeRequest.php
+++ b/app/Http/Requests/IncomeRequest.php
@@ -30,10 +30,8 @@ public function rules()
$companyId = $this->has('company_id') ? Hashids::decode($this['company_id'])[0]:null;
$nullableArr = [
- 'address' => 'nullable',
- 'city' => 'nullable',
- 'contact' => 'nullable',
'remarks' => 'nullable',
+ 'posted' => 'nullable',
];
$currentRouteMethod = $this->route()->getActionMethod();
@@ -41,17 +39,25 @@ public function rules()
case 'store':
$rules_store = [
'company_id' => ['required', 'bail'],
+ 'branch_id' => ['required', 'bail'],
+ 'income_group_id' => ['required', 'bail'],
+ 'cash_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'payment_term_type' => 'required|integer|digits_between:1,11',
+ 'amount' => 'required|integer|digits_between:1,19',
+ 'amount_owed' => 'required|integer|digits_between:1,19',
];
return array_merge($rules_store, $nullableArr);
case 'update':
$rules_update = [
'company_id' => ['required', 'bail'],
+ 'branch_id' => ['required', 'bail'],
+ 'income_group_id' => ['required', 'bail'],
+ 'cash_id' => ['required', 'bail'],
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
- 'name' => 'required|max:255',
- 'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
+ 'payment_term_type' => 'required|integer|digits_between:1,11',
+ 'amount' => 'required|integer|digits_between:1,19',
+ 'amount_owed' => 'required|integer|digits_between:1,19',
];
return array_merge($rules_update, $nullableArr);
default:
diff --git a/app/Http/Requests/InvestorRequest.php b/app/Http/Requests/InvestorRequest.php
index 244df4b..6958f9f 100644
--- a/app/Http/Requests/InvestorRequest.php
+++ b/app/Http/Requests/InvestorRequest.php
@@ -42,15 +42,16 @@ public function rules()
$rules_store = [
'company_id' => ['required', 'bail'],
'code' => ['required', 'max:255', new uniqueCode(table: 'branches', companyId: $companyId)],
- 'name' => 'required|max:255',
+ 'name' => 'required|min:3|max:255',
+ 'tax_number' => 'required|integer|digits_between:1,255',
'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
return array_merge($rules_store, $nullableArr);
case 'update':
$rules_update = [
- 'company_id' => ['required', 'bail'],
'code' => new uniqueCode(table: 'branches', companyId: $companyId, exceptId: $this->route('id')),
- 'name' => 'required|max:255',
+ 'name' => 'required|min:3|max:255',
+ 'tax_number' => 'required|integer|digits_between:1,255',
'status' => ['required', new validDropDownValue('ACTIVE_STATUS')]
];
return array_merge($rules_update, $nullableArr);
diff --git a/app/Http/Resources/CapitalGroupResource.php b/app/Http/Resources/CapitalGroupResource.php
new file mode 100644
index 0000000..fbc3d39
--- /dev/null
+++ b/app/Http/Resources/CapitalGroupResource.php
@@ -0,0 +1,24 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'code' => $this->code,
+ 'name' => $this->name,
+ ];
+ }
+}
diff --git a/app/Http/Resources/CapitalResource.php b/app/Http/Resources/CapitalResource.php
new file mode 100644
index 0000000..33a9e1a
--- /dev/null
+++ b/app/Http/Resources/CapitalResource.php
@@ -0,0 +1,30 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'ref_number' => $this->ref_number,
+ 'investor' => new InvestorResource($this->investor),
+ 'group' => new CustomerGroupResource($this->group),
+ 'cash' => new CashResource($this->cash),
+ 'date' => $this->date,
+ 'capital_status' => $this->capital_status,
+ 'amount' => $this->amount,
+ 'remarks' => $this->remarks,
+ ];
+ }
+}
diff --git a/app/Http/Resources/CustomerGroupResource.php b/app/Http/Resources/CustomerGroupResource.php
new file mode 100644
index 0000000..b92d671
--- /dev/null
+++ b/app/Http/Resources/CustomerGroupResource.php
@@ -0,0 +1,39 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'code' => $this->code,
+ 'name' => $this->name,
+ 'max_open_invoice' => $this->max_open_invoice,
+ 'max_outstanding_invoice' => $this->max_outstanding_invoice,
+ 'max_invoice_age' => $this->max_invoice_age,
+ 'payment_term' => $this->payment_term,
+ 'selling_point' => $this->selling_point,
+ 'selling_point_multiple' => $this->selling_point_multiple,
+ 'sell_at_cost' => $this->sell_at_cost,
+ 'price_markup_percent' => $this->price_markup_percent,
+ 'price_markup_nominal' => $this->price_markup_nominal,
+ 'price_markdown_percent' => $this->price_markdown_percent,
+ 'price_markdown_nominal' => $this->price_markdown_nominal,
+ 'round_on' => $this->round_on,
+ 'round_digit' => $this->round_digit,
+ 'remarks' => $this->remarks,
+ 'cash' => new CashResource($this->cash)
+ ];
+ }
+}
diff --git a/app/Http/Resources/CustomerResource.php b/app/Http/Resources/CustomerResource.php
new file mode 100644
index 0000000..4686a84
--- /dev/null
+++ b/app/Http/Resources/CustomerResource.php
@@ -0,0 +1,34 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'code' => $this->code,
+ 'name' => $this->name,
+ 'is_member' => $this->is_member,
+ 'customer_group' => new CustomerGroupResource($this->customer_group),
+ 'zone' => $this->zone,
+ 'max_open_invoice' => $this->max_open_invoice,
+ 'max_outstanding_invoice' => $this->max_outstanding_invoice,
+ 'max_invoice_age' => $this->max_invoice_age,
+ 'payment_term' => $this->payment_term,
+ 'tax_id' => $this->tax_id,
+ 'remarks' => $this->remarks,
+ 'status' => $this->status
+ ];
+ }
+}
diff --git a/app/Http/Resources/ExpenseGroupResource.php b/app/Http/Resources/ExpenseGroupResource.php
new file mode 100644
index 0000000..7afc81c
--- /dev/null
+++ b/app/Http/Resources/ExpenseGroupResource.php
@@ -0,0 +1,24 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'code' => $this->code,
+ 'name' => $this->name,
+ ];
+ }
+}
diff --git a/app/Http/Resources/ExpenseResource.php b/app/Http/Resources/ExpenseResource.php
new file mode 100644
index 0000000..3d22725
--- /dev/null
+++ b/app/Http/Resources/ExpenseResource.php
@@ -0,0 +1,32 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'branch' => new BranchResource($this->branch),
+ 'code' => $this->code,
+ 'date' => $this->date,
+ 'payment_term_type' => $this->payment_term_type,
+ 'expense_group_id' => $this->expense_group_id,
+ 'cash_id' => $this->cash_id,
+ 'amount' => $this->amount,
+ 'amount_owed' => $this->amount_owed,
+ 'remarks' => $this->remarks,
+ 'posted' => $this->posted,
+ ];
+ }
+}
diff --git a/app/Http/Resources/IncomeGroupResource.php b/app/Http/Resources/IncomeGroupResource.php
new file mode 100644
index 0000000..830a1ee
--- /dev/null
+++ b/app/Http/Resources/IncomeGroupResource.php
@@ -0,0 +1,24 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'code' => $this->code,
+ 'name' => $this->name,
+ ];
+ }
+}
diff --git a/app/Http/Resources/IncomeResource.php b/app/Http/Resources/IncomeResource.php
new file mode 100644
index 0000000..10f92cd
--- /dev/null
+++ b/app/Http/Resources/IncomeResource.php
@@ -0,0 +1,32 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'branch' => new BranchResource($this->branch),
+ 'code' => $this->code,
+ 'date' => $this->date,
+ 'payment_term_type' => $this->payment_term_type,
+ 'income_group' => new IncomeGroupResource($this->income_group),
+ 'cash' => new CashResource($this->cash),
+ 'amount' => $this->amount,
+ 'amount_owed' => $this->amount_owed,
+ 'remarks' => $this->remarks,
+ 'posted' => $this->posted,
+ ];
+ }
+}
diff --git a/app/Http/Resources/InvestorResource.php b/app/Http/Resources/InvestorResource.php
new file mode 100644
index 0000000..487ac26
--- /dev/null
+++ b/app/Http/Resources/InvestorResource.php
@@ -0,0 +1,30 @@
+ $this->hId,
+ 'company' => new CompanyResource($this->company),
+ 'code' => $this->code,
+ 'name' => $this->name,
+ 'contact' => $this->contact,
+ 'address' => $this->address,
+ 'city' => $this->city,
+ 'tax_number' => $this->tax_number,
+ 'remarks' => $this->remarks,
+ 'status' => $this->status
+ ];
+ }
+}
diff --git a/app/Http/Resources/ProfileResource.php b/app/Http/Resources/ProfileResource.php
index a2cf5b0..77a1c71 100644
--- a/app/Http/Resources/ProfileResource.php
+++ b/app/Http/Resources/ProfileResource.php
@@ -21,11 +21,11 @@ public function toArray($request)
'city' => $this->city,
'postal_code' => $this->postal_code,
'country' => $this->country,
- 'status' => $this->status,
+ 'status' => $this->status->name,
'tax_id' => $this->tax_id,
'ic_num' => $this->ic_num,
'img_path' => $this->img_path,
'remarks' => $this->remarks
];
}
-}
+}
\ No newline at end of file
diff --git a/app/Models/Profile.php b/app/Models/Profile.php
index aba7ada..3afa41f 100644
--- a/app/Models/Profile.php
+++ b/app/Models/Profile.php
@@ -2,6 +2,7 @@
namespace App\Models;
+use App\Enums\ActiveStatus;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -57,6 +58,10 @@ class Profile extends Model
'deleted_at',
];
+ protected $casts = [
+ 'status' => ActiveStatus::class
+ ];
+
public function hId() : Attribute
{
return Attribute::make(
@@ -73,4 +78,4 @@ public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults();
}
-}
+}
\ No newline at end of file
diff --git a/app/Rules/uniqueCode.php b/app/Rules/uniqueCode.php
index 62d1c13..09a5ad6 100644
--- a/app/Rules/uniqueCode.php
+++ b/app/Rules/uniqueCode.php
@@ -8,8 +8,21 @@
use Illuminate\Support\Facades\Config;
use App\Services\BranchService;
+use App\Services\BrandService;
+use App\Services\CapitalGroupService;
+use App\Services\CapitalService;
+use App\Services\CashService;
+use App\Services\CustomerGroupService;
+use App\Services\CustomerService;
+use App\Services\ExpenseGroupService;
+use App\Services\ExpenseService;
+use App\Services\IncomeGroupService;
+use App\Services\IncomeService;
+use App\Services\InvestorService;
+use App\Services\ProductGroupService;
use App\Services\ProductService;
use App\Services\SupplierService;
+use App\Services\UnitService;
use App\Services\WarehouseService;
class uniqueCode implements Rule
@@ -22,6 +35,19 @@ class uniqueCode implements Rule
private WarehouseService $warehouseService;
private SupplierService $supplierService;
private ProductService $productService;
+ private CashService $cashService;
+ private InvestorService $investorService;
+ private CapitalService $capitalService;
+ private CapitalGroupService $capitalGroupService;
+ private IncomeGroupService $incomeGroupService;
+ private IncomeService $incomeService;
+ private ExpenseService $expenseService;
+ private ExpenseGroupService $expenseGroupService;
+ private ProductGroupService $productGroupService;
+ private BrandService $brandService;
+ private UnitService $unitService;
+ private CustomerGroupService $customerGroupService;
+ private CustomerService $customerService;
/**
* Create a new rule instance.
@@ -47,6 +73,45 @@ public function __construct(string $table, int $companyId, ?int $exceptId = null
case 'products':
$this->productService = Container::getInstance()->make(ProductService::class);
break;
+ case 'cashes':
+ $this->cashService = Container::getInstance()->make(CashService::class);
+ break;
+ case 'investors':
+ $this->investorService = Container::getInstance()->make(InvestorService::class);
+ break;
+ case 'capitals':
+ $this->capitalService = Container::getInstance()->make(CapitalService::class);
+ break;
+ case 'capitalgroups':
+ $this->capitalGroupService = Container::getInstance()->make(CapitalGroupService::class);
+ break;
+ case 'incomegroups':
+ $this->incomeGroupService = Container::getInstance()->make(IncomeGroupService::class);
+ break;
+ case 'incomes':
+ $this->incomeService = Container::getInstance()->make(IncomeService::class);
+ break;
+ case 'expensegroups':
+ $this->expenseGroupService = Container::getInstance()->make(ExpenseGroupService::class);
+ break;
+ case 'expenses':
+ $this->expenseService = Container::getInstance()->make(ExpenseService::class);
+ break;
+ case 'productgroups':
+ $this->productGroupService = Container::getInstance()->make(ProductGroupService::class);
+ break;
+ case 'brands':
+ $this->brandService = Container::getInstance()->make(BrandService::class);
+ break;
+ case 'units':
+ $this->unitService = Container::getInstance()->make(UnitService::class);
+ break;
+ case 'customergroups':
+ $this->customerGroupService = Container::getInstance()->make(CustomerGroupService::class);
+ break;
+ case 'customers':
+ $this->customerService = Container::getInstance()->make(CustomerService::class);
+ break;
default:
break;
}
@@ -71,16 +136,54 @@ public function passes($attribute, $value)
break;
case 'warehouses':
$is_duplicate = $this->warehouseService->isUniqueCode($value, $this->companyId, $this->exceptId);
- break;
+ break;
case 'suppliers':
$is_duplicate = $this->supplierService->isUniqueCode($value, $this->companyId, $this->exceptId);
break;
case 'products':
$is_duplicate = $this->productService->isUniqueCodeForProduct($value, $this->companyId, $this->exceptId);
+ break;
+ case 'cashes':
+ $is_duplicate = $this->cashService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'investors':
+ $is_duplicate = $this->investorService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'capitals':
+ $is_duplicate = $this->capitalService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'capitalgroups':
+ $is_duplicate = $this->capitalGroupService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'incomegroups':
+ $is_duplicate = $this->incomeGroupService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'incomes':
+ $is_duplicate = $this->incomeService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'expensegroups':
+ $is_duplicate = $this->expenseGroupService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'expenses':
+ $is_duplicate = $this->expenseService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'productgroups':
+ $is_duplicate = $this->productGroupService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'brands':
+ $is_duplicate = $this->brandService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'units':
+ $is_duplicate = $this->unitService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'customergroups':
+ $is_duplicate = $this->customerGroupService->isUniqueCode($value, $this->companyId, $this->exceptId);
+ break;
+ case 'customers':
+ $is_duplicate = $this->customerService->isUniqueCode($value, $this->companyId, $this->exceptId);
default:
break;
}
-
return $is_duplicate;
}
diff --git a/app/Services/CapitalGroupService.php b/app/Services/CapitalGroupService.php
new file mode 100644
index 0000000..d8687a5
--- /dev/null
+++ b/app/Services/CapitalGroupService.php
@@ -0,0 +1,34 @@
+
{{ t('views.user.fields.status') }}
- {{ t('components.dropdown.values.statusDDL.active') }}
- {{ t('components.dropdown.values.statusDDL.inactive') }}
+ {{ t('components.dropdown.values.statusDDL.active') }}
+ {{ t('components.dropdown.values.statusDDL.inactive') }}
@@ -250,11 +250,9 @@ import dom from "@left4code/tw-starter/dist/js/dom";
import DataList from "@/global-components/data-list/Main"
import AlertPlaceholder from "@/global-components/alert-placeholder/Main"
//#endregion
-
//#region Declarations
const { t } = useI18n();
//#endregion
-
//#region Data - UI
const mode = ref('list');
const loading = ref(false);
@@ -263,14 +261,13 @@ const deleteId = ref('');
const deleteModalShow = ref(false);
const expandDetail = ref(null);
//#endregion
-
//#region Data - Views
const user = ref({
roles: [],
selected_roles: [],
profile: {
country: '',
- status: 1,
+ status: 'ACTIVE',
img_path: ''
},
selected_settings: {
@@ -284,46 +281,36 @@ const rolesDDL = ref([]);
const statusDDL = ref([]);
const countriesDDL = ref([]);
//#endregion
-
//#region onMounted
onMounted(() => {
getUser({ page: 1 });
getDDL();
-
loading.value = false;
});
//#endregion
-
//#region Methods
const getUser = (args) => {
userList.value = {};
if (args.pageSize === undefined) args.pageSize = 10;
if (args.search === undefined) args.search = '';
-
axios.get(route('api.get.db.admin.users.read', { "page": args.page, "perPage": args.pageSize, "search": args.search })).then(response => {
userList.value = response.data;
});
}
-
const getDDL = () => {
axios.get(route('api.get.db.common.ddl.list.countries')).then(response => {
countriesDDL.value = response.data;
});
-
axios.get(route('api.get.db.common.ddl.list.statuses')).then(response => {
statusDDL.value = response.data;
});
-
axios.get(route('api.get.db.admin.users.roles.read')).then(response => {
rolesDDL.value = response.data;
});
}
-
const onSubmit = (values, actions) => {
loading.value = true;
-
var formData = new FormData(dom('#userForm')[0]);
-
if (mode.value === 'create') {
axios.post(route('api.post.db.admin.users.save'), formData, {
headers: {
@@ -351,7 +338,6 @@ const onSubmit = (values, actions) => {
});
} else { }
}
-
const handleError = (e, actions) => {
//Laravel Validations
if (e.response.data.errors !== undefined && Object.keys(e.response.data.errors).length > 0) {
@@ -368,15 +354,12 @@ const handleError = (e, actions) => {
};
}
}
-
const invalidSubmit = (e) => {
alertErrors.value = e.errors;
}
-
const reValidate = (errors) => {
alertErrors.value = errors;
}
-
const emptyUser = () => {
return {
roles: [],
@@ -384,7 +367,7 @@ const emptyUser = () => {
profile: {
img_path: '',
country: '',
- status: 1,
+ status: 'ACTIVE',
},
selected_settings: {
theme: 'side-menu-light-full',
@@ -393,45 +376,36 @@ const emptyUser = () => {
}
}
}
-
const resetAlertErrors = () => {
alertErrors.value = [];
}
-
const createNew = () => {
mode.value = 'create';
user.value = emptyUser();
}
-
const onDataListChange = ({page, pageSize, search}) => {
getUser({page, pageSize, search});
}
-
const editSelected = (index) => {
mode.value = 'edit';
user.value = userList.value.data[index];
}
-
const deleteSelected = (index) => {
deleteId.value = userList.value.data[index].hId;
deleteModalShow.value = true;
}
-
const confirmDelete = () => {
deleteModalShow.value = false;
if (deleteId.value) console.log('Data ' + deleteId.value + ' deleted.');
}
-
const showSelected = (index) => {
toggleDetail(index);
}
-
const backToList = () => {
resetAlertErrors();
mode.value = 'list';
getUser({ page: userList.value.current_page, pageSize: userList.value.per_page });
}
-
const toggleDetail = (idx) => {
if (expandDetail.value === idx) {
expandDetail.value = null;
@@ -439,12 +413,9 @@ const toggleDetail = (idx) => {
expandDetail.value = idx;
}
}
-
const handleUpload = (e) => {
const files = e.target.files;
-
let filename = files[0].name;
-
const fileReader = new FileReader()
fileReader.addEventListener('load', () => {
user.value.profile.img_path = fileReader.result
@@ -452,7 +423,6 @@ const handleUpload = (e) => {
fileReader.readAsDataURL(files[0])
}
//#endregion
-
//#region Computed
const retrieveImage = computed(() => {
if (user.value.profile.img_path && user.value.profile.img_path !== '') {
@@ -466,7 +436,6 @@ const retrieveImage = computed(() => {
}
});
//#endregion
-
//#region Watcher
//#endregion
-
+
\ No newline at end of file
From 5778151781456ffb8b7a6b06d1c8950518301384 Mon Sep 17 00:00:00 2001
From: Hartanto119 <80240259+Hartanto119@users.noreply.github.com>
Date: Fri, 22 Apr 2022 17:30:14 +0700
Subject: [PATCH 2/4] asd
---
app/Services/CapitalService.php | 16 +-
app/Services/CustomerGroupService.php | 18 +-
app/Services/CustomerService.php | 22 +-
app/Services/ExpenseGroupService.php | 8 -
app/Services/ExpenseService.php | 26 ++-
.../Impls/CapitalGroupServiceImpl.php | 152 +++++++++++++
app/Services/Impls/CapitalServiceImpl.php | 168 ++++++++++++++
.../Impls/CustomerGroupServiceImpl.php | 207 ++++++++++++++++++
app/Services/Impls/CustomerServiceImpl.php | 192 ++++++++++++++++
.../Impls/ExpenseGroupServiceImpl.php | 156 +++++++++++++
app/Services/Impls/ExpenseServiceImpl.php | 184 ++++++++++++++++
app/Services/Impls/IncomeGroupServiceImpl.php | 156 +++++++++++++
app/Services/Impls/IncomeServiceImpl.php | 184 ++++++++++++++++
app/Services/Impls/InvestorServiceImpl.php | 176 +++++++++++++++
app/Services/IncomeGroupService.php | 8 -
app/Services/IncomeService.php | 26 ++-
app/Services/InvestorService.php | 2 +
17 files changed, 1643 insertions(+), 58 deletions(-)
diff --git a/app/Services/CapitalService.php b/app/Services/CapitalService.php
index 805f018..da7b3d9 100644
--- a/app/Services/CapitalService.php
+++ b/app/Services/CapitalService.php
@@ -11,10 +11,10 @@ public function create(
int $investor_id,
int $group_id,
int $cash_id,
- ?int $ref_number,
- ?string $date,
- int $capial_status = null,
- int $amount = null,
+ ?int $ref_number = null,
+ ?string $date = null,
+ int $capial_status,
+ int $amount,
?string $remarks = null,
): ?Capital;
@@ -31,10 +31,10 @@ public function update(
int $investor_id,
int $group_id,
int $cash_id,
- ?int $ref_number,
- ?string $date,
- int $capial_status = null,
- int $amount = null,
+ ?int $ref_number = null,
+ ?string $date = null,
+ int $capial_status,
+ int $amount,
?string $remarks = null,
): ?Capital;
diff --git a/app/Services/CustomerGroupService.php b/app/Services/CustomerGroupService.php
index 8eec777..e349a8b 100644
--- a/app/Services/CustomerGroupService.php
+++ b/app/Services/CustomerGroupService.php
@@ -8,6 +8,7 @@
interface CustomerGroupService
{
public function create(
+ int $company_id,
int $cash_id,
string $code,
string $name,
@@ -35,20 +36,21 @@ public function read(
public function update(
int $id,
+ int $company_id,
int $cash_id,
string $code,
string $name,
- int $max_open_invoice = null,
- int $max_outstanding_invoice = null,
- int $max_invoice_age = null,
- int $payment_term = null,
+ int $max_open_invoice,
+ int $max_outstanding_invoice,
+ int $max_invoice_age,
+ int $payment_term,
int $selling_point,
- string $selling_point_multiple = null,
+ string $selling_point_multiple,
?int $sell_at_cost = null,
- int $price_markup_percent = null,
- int $price_markup_nominal = null,
+ int $price_markup_percent,
+ int $price_markup_nominal,
int $price_markdown_nominal,
- int $round_on = null,
+ int $round_on,
?int $round_digit = null,
?int $remarks = null,
): ?CustomerGroup;
diff --git a/app/Services/CustomerService.php b/app/Services/CustomerService.php
index a4df208..f3574ca 100644
--- a/app/Services/CustomerService.php
+++ b/app/Services/CustomerService.php
@@ -8,11 +8,16 @@ interface CustomerService
{
public function create(
int $company_id,
+ int $customer_group_id,
string $code,
+ int $is_member,
string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
+ ?string $zone = null,
+ int $max_open_invoice,
+ int $max_outstanding_invoice,
+ int $max_invoice_age,
+ int $payment_term,
+ int $tax_id,
?string $remarks = null,
int $status,
): ?Customer;
@@ -27,11 +32,16 @@ public function read(
public function update(
int $id,
int $company_id,
+ int $customer_group_id,
string $code,
+ int $is_member,
string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
+ ?string $zone = null,
+ int $max_open_invoice,
+ int $max_outstanding_invoice,
+ int $max_invoice_age,
+ int $payment_term,
+ int $tax_id,
?string $remarks = null,
int $status,
): ?Customer;
diff --git a/app/Services/ExpenseGroupService.php b/app/Services/ExpenseGroupService.php
index 06b3fb0..3ae9a1b 100644
--- a/app/Services/ExpenseGroupService.php
+++ b/app/Services/ExpenseGroupService.php
@@ -10,10 +10,6 @@ public function create(
int $company_id,
string $code,
string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
- ?string $remarks = null,
int $status,
): ?ExpenseGroup;
@@ -29,10 +25,6 @@ public function update(
int $company_id,
string $code,
string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
- ?string $remarks = null,
int $status,
): ?ExpenseGroup;
diff --git a/app/Services/ExpenseService.php b/app/Services/ExpenseService.php
index 16dc5d4..5b0fa6f 100644
--- a/app/Services/ExpenseService.php
+++ b/app/Services/ExpenseService.php
@@ -8,13 +8,16 @@ interface ExpenseService
{
public function create(
int $company_id,
+ int $branch_id,
+ int $expense_group_id,
+ ?int $cash_id = null,
string $code,
- string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
+ ?string $date = null,
+ string $payment_term_type,
+ string $amount,
+ string $amount_owed,
?string $remarks = null,
- int $status,
+ int $posted,
): ?Expense;
public function read(
@@ -27,13 +30,16 @@ public function read(
public function update(
int $id,
int $company_id,
+ int $branch_id,
+ int $expense_group_id,
+ ?int $cash_id = null,
string $code,
- string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
+ ?string $date = null,
+ string $payment_term_type,
+ string $amount,
+ string $amount_owed,
?string $remarks = null,
- int $status,
+ int $posted,
): ?Expense;
public function delete(int $id): bool;
diff --git a/app/Services/Impls/CapitalGroupServiceImpl.php b/app/Services/Impls/CapitalGroupServiceImpl.php
index e69de29..965e270 100644
--- a/app/Services/Impls/CapitalGroupServiceImpl.php
+++ b/app/Services/Impls/CapitalGroupServiceImpl.php
@@ -0,0 +1,152 @@
+generateUniqueCode($company_id);
+ }
+
+ $capitalGroup = new CapitalGroup();
+ $capitalGroup->company_id = $company_id;
+ $capitalGroup->code = $code;
+ $capitalGroup->name = $name;
+
+ $capitalGroup->save();
+
+ DB::commit();
+
+ return $capitalGroup;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $capitalGroup = CapitalGroup::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $capitalGroup = $capitalGroup->latest();
+ } else {
+ $capitalGroup = $capitalGroup->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $capitalGroup->paginate($perPage);
+ } else {
+ return $capitalGroup->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ string $code,
+ string $name,
+ ): ?CapitalGroup
+ {
+ DB::beginTransaction();
+
+ try {
+ $capitalGroup = CapitalGroup::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $capitalGroup->update([
+ 'company_id' => $company_id,
+ 'code' => $code,
+ 'name' => $name,
+ ]);
+
+ DB::commit();
+
+ return $capitalGroup->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $capitalGroup = CapitalGroup::find($id);
+
+ if ($capitalGroup) {
+ $retval = $capitalGroup->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = CapitalGroup::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/CapitalServiceImpl.php b/app/Services/Impls/CapitalServiceImpl.php
index e69de29..1d1c5a3 100644
--- a/app/Services/Impls/CapitalServiceImpl.php
+++ b/app/Services/Impls/CapitalServiceImpl.php
@@ -0,0 +1,168 @@
+company_id = $company_id;
+ $capital->investor_id = $investor_id;
+ $capital->group_id = $group_id;
+ $capital->cash_id = $cash_id;
+ $capital->ref_number = $ref_number;
+ $capital->date = $date;
+ $capital->capial_status = $capial_status;
+ $capital->amount = $amount;
+ $capital->remarks = $remarks;
+
+ $capital->save();
+
+ DB::commit();
+
+ return $capital;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $capital = Capital::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $capital = $capital->latest();
+ } else {
+ $capital = $capital->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $capital->paginate($perPage);
+ } else {
+ return $capital->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ int $investor_id,
+ int $group_id,
+ int $cash_id,
+ ?int $ref_number = null,
+ ?string $date = null,
+ int $capial_status,
+ int $amount,
+ ?string $remarks = null,
+ ): ?Capital
+ {
+ DB::beginTransaction();
+
+ try {
+ $capital = Capital::find($id);
+
+ $capital->update([
+ 'company_id' => $company_id,
+ 'investor_id' => $investor_id,
+ 'group_id' => $group_id,
+ 'cash_id' => $cash_id,
+ 'ref_number' => $ref_number,
+ 'date' => $date,
+ 'capial_status' => $capial_status,
+ 'amount' => $amount,
+ 'remarks' => $remarks,
+ ]);
+
+ DB::commit();
+
+ return $capital->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $capital = Capital::find($id);
+
+ if ($capital) {
+ $retval = $capital->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = Capital::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/CustomerGroupServiceImpl.php b/app/Services/Impls/CustomerGroupServiceImpl.php
index e69de29..113501b 100644
--- a/app/Services/Impls/CustomerGroupServiceImpl.php
+++ b/app/Services/Impls/CustomerGroupServiceImpl.php
@@ -0,0 +1,207 @@
+generateUniqueCode($company_id);
+ }
+
+ $customerGroup = new CustomerGroup();
+ $customerGroup->company_id = $company_id;
+ $customerGroup->cash_id = $cash_id;
+ $customerGroup->code = $code;
+ $customerGroup->name = $name;
+ $customerGroup->max_open_invoice = $max_open_invoice;
+ $customerGroup->max_outstanding_invoice = $max_outstanding_invoice;
+ $customerGroup->max_invoice_age = $max_invoice_age;
+ $customerGroup->selling_point = $selling_point;
+ $customerGroup->selling_point_multiple = $selling_point_multiple;
+ $customerGroup->sell_at_cost = $sell_at_cost;
+ $customerGroup->price_markup_percent = $price_markup_percent;
+ $customerGroup->price_markup_nominal = $price_markup_nominal;
+ $customerGroup->price_markdown_nominal = $price_markdown_nominal;
+ $customerGroup->round_on = $round_on;
+ $customerGroup->round_digit = $round_digit;
+ $customerGroup->remarks = $remarks;
+
+ $customerGroup->save();
+
+ DB::commit();
+
+ return $customerGroup;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $customerGroup = CustomerGroup::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $customerGroup = $customerGroup->latest();
+ } else {
+ $customerGroup = $customerGroup->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $customerGroup->paginate($perPage);
+ } else {
+ return $customerGroup->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ int $cash_id,
+ string $code,
+ string $name,
+ int $max_open_invoice = null,
+ int $max_outstanding_invoice = null,
+ int $max_invoice_age = null,
+ int $payment_term = null,
+ int $selling_point,
+ string $selling_point_multiple = null,
+ ?int $sell_at_cost = null,
+ int $price_markup_percent = null,
+ int $price_markup_nominal = null,
+ int $price_markdown_nominal,
+ int $round_on = null,
+ ?int $round_digit = null,
+ ?int $remarks = null,
+ ): ?CustomerGroup
+ {
+ DB::beginTransaction();
+
+ try {
+ $customerGroup = CustomerGroup::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $customerGroup->update([
+ 'company_id' => $company_id,
+ 'cash_id' => $cash_id,
+ 'code' => $code,
+ 'name' => $name,
+ 'max_open_invoice' => $max_open_invoice,
+ 'max_outstanding_invoice' => $max_outstanding_invoice,
+ 'max_invoice_age' => $max_invoice_age,
+ 'payment_term' => $payment_term,
+ 'selling_point' => $selling_point,
+ 'selling_point_multiple' => $selling_point_multiple,
+ 'sell_at_cost' => $sell_at_cost,
+ 'price_markup_percent' => $price_markup_percent,
+ 'price_markup_nominal' => $price_markup_nominal,
+ 'price_markdown_nominal' => $price_markdown_nominal,
+ 'round_on' => $round_on,
+ 'round_digit' => $round_digit,
+ 'remarks' => $remarks,
+ ]);
+
+ DB::commit();
+
+ return $customerGroup->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $customerGroup = CustomerGroup::find($id);
+
+ if ($customerGroup) {
+ $retval = $customerGroup->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = CustomerGroup::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/CustomerServiceImpl.php b/app/Services/Impls/CustomerServiceImpl.php
index e69de29..e47ab57 100644
--- a/app/Services/Impls/CustomerServiceImpl.php
+++ b/app/Services/Impls/CustomerServiceImpl.php
@@ -0,0 +1,192 @@
+generateUniqueCode($company_id);
+ }
+
+ $customer = new Customer();
+ $customer->company_id = $company_id;
+ $customer->customer_group_id = $customer_group_id;
+ $customer->code = $code;
+ $customer->is_member = $is_member;
+ $customer->name = $name;
+ $customer->zone = $zone;
+ $customer->max_open_invoice = $max_open_invoice;
+ $customer->max_outstanding_invoice = $max_outstanding_invoice;
+ $customer->max_invoice_age = $max_invoice_age;
+ $customer->payment_term = $payment_term;
+ $customer->tax_id = $tax_id;
+ $customer->remarks = $remarks;
+ $customer->status = $status;
+
+ $customer->save();
+
+ DB::commit();
+
+ return $customer;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $customer = Customer::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $customer = $customer->latest();
+ } else {
+ $customer = $customer->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $customer->paginate($perPage);
+ } else {
+ return $customer->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ int $customer_group_id,
+ string $code,
+ int $is_member,
+ string $name,
+ ?string $zone = null,
+ int $max_open_invoice,
+ int $max_outstanding_invoice,
+ int $max_invoice_age,
+ int $payment_term,
+ int $tax_id,
+ ?string $remarks = null,
+ int $status,
+ ): ?Customer
+ {
+ DB::beginTransaction();
+
+ try {
+ $customer = Customer::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $customer->update([
+ 'company_id' => $company_id,
+ 'customer_group_id' => $customer_group_id,
+ 'code' => $code,
+ 'is_member' => $is_member,
+ 'name' => $name,
+ 'zone' => $zone,
+ 'max_open_invoice' => $max_open_invoice,
+ 'max_outstanding_invoice' => $max_outstanding_invoice,
+ 'max_invoice_age' => $max_invoice_age,
+ 'payment_term' => $payment_term,
+ 'tax_id' => $tax_id,
+ 'remarks' => $remarks,
+ 'status' => $status,
+ ]);
+
+ DB::commit();
+
+ return $customer->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $customer = Customer::find($id);
+
+ if ($customer) {
+ $retval = $customer->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = Customer::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/ExpenseGroupServiceImpl.php b/app/Services/Impls/ExpenseGroupServiceImpl.php
index e69de29..fab08d7 100644
--- a/app/Services/Impls/ExpenseGroupServiceImpl.php
+++ b/app/Services/Impls/ExpenseGroupServiceImpl.php
@@ -0,0 +1,156 @@
+generateUniqueCode($company_id);
+ }
+
+ $expenseGroup = new ExpenseGroup();
+ $expenseGroup->company_id = $company_id;
+ $expenseGroup->code = $code;
+ $expenseGroup->name = $name;
+ $expenseGroup->status = $status;
+
+ $expenseGroup->save();
+
+ DB::commit();
+
+ return $expenseGroup;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $expenseGroup = ExpenseGroup::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $expenseGroup = $expenseGroup->latest();
+ } else {
+ $expenseGroup = $expenseGroup->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $expenseGroup->paginate($perPage);
+ } else {
+ return $expenseGroup->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ string $code,
+ string $name,
+ int $status,
+ ): ?ExpenseGroup
+ {
+ DB::beginTransaction();
+
+ try {
+ $expenseGroup = ExpenseGroup::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $expenseGroup->update([
+ 'company_id' => $company_id,
+ 'code' => $code,
+ 'name' => $name,
+ 'status' => $status,
+ ]);
+
+ DB::commit();
+
+ return $expenseGroup->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $expenseGroup = ExpenseGroup::find($id);
+
+ if ($expenseGroup) {
+ $retval = $expenseGroup->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = ExpenseGroup::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/ExpenseServiceImpl.php b/app/Services/Impls/ExpenseServiceImpl.php
index e69de29..83a4af0 100644
--- a/app/Services/Impls/ExpenseServiceImpl.php
+++ b/app/Services/Impls/ExpenseServiceImpl.php
@@ -0,0 +1,184 @@
+generateUniqueCode($company_id);
+ }
+
+ $expense = new Expense();
+ $expense->company_id = $company_id;
+ $expense->branch_id = $branch_id;
+ $expense->expense_group_id = $expense_group_id;
+ $expense->cash_id = $cash_id;
+ $expense->code = $code;
+ $expense->date = $date;
+ $expense->payment_term_type = $payment_term_type;
+ $expense->amount = $amount;
+ $expense->amount_owed = $amount_owed;
+ $expense->remarks = $remarks;
+ $expense->posted = $posted;
+
+ $expense->save();
+
+ DB::commit();
+
+ return $expense;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $expense = Expense::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $expense = $expense->latest();
+ } else {
+ $expense = $expense->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $expense->paginate($perPage);
+ } else {
+ return $expense->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ int $branch_id,
+ int $expense_group_id,
+ ?int $cash_id = null,
+ string $code,
+ ?string $date = null,
+ string $payment_term_type,
+ string $amount,
+ string $amount_owed,
+ ?string $remarks = null,
+ int $posted,
+ ): ?Expense
+ {
+ DB::beginTransaction();
+
+ try {
+ $expense = Expense::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $expense->update([
+ 'company_id' => $company_id,
+ 'branch_id' => $branch_id,
+ 'expense_group_id' => $expense_group_id,
+ 'cash_id' => $cash_id,
+ 'code' => $code,
+ 'date' => $date,
+ 'payment_term_type' => $payment_term_type,
+ 'amount' => $amount,
+ 'amount_owed' => $amount_owed,
+ 'remarks' => $remarks,
+ 'posted' => $posted,
+ ]);
+
+ DB::commit();
+
+ return $expense->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $expense = Expense::find($id);
+
+ if ($expense) {
+ $retval = $expense->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = Expense::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/IncomeGroupServiceImpl.php b/app/Services/Impls/IncomeGroupServiceImpl.php
index e69de29..72b7ea6 100644
--- a/app/Services/Impls/IncomeGroupServiceImpl.php
+++ b/app/Services/Impls/IncomeGroupServiceImpl.php
@@ -0,0 +1,156 @@
+generateUniqueCode($company_id);
+ }
+
+ $incomeGroup = new IncomeGroup();
+ $incomeGroup->company_id = $company_id;
+ $incomeGroup->code = $code;
+ $incomeGroup->name = $name;
+ $incomeGroup->status = $status;
+
+ $incomeGroup->save();
+
+ DB::commit();
+
+ return $incomeGroup;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $incomeGroup = IncomeGroup::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $incomeGroup = $incomeGroup->latest();
+ } else {
+ $incomeGroup = $incomeGroup->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $incomeGroup->paginate($perPage);
+ } else {
+ return $incomeGroup->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ string $code,
+ string $name,
+ int $status,
+ ): ?IncomeGroup
+ {
+ DB::beginTransaction();
+
+ try {
+ $incomeGroup = IncomeGroup::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $incomeGroup->update([
+ 'company_id' => $company_id,
+ 'code' => $code,
+ 'name' => $name,
+ 'status' => $status,
+ ]);
+
+ DB::commit();
+
+ return $incomeGroup->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $incomeGroup = IncomeGroup::find($id);
+
+ if ($incomeGroup) {
+ $retval = $incomeGroup->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = IncomeGroup::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/IncomeServiceImpl.php b/app/Services/Impls/IncomeServiceImpl.php
index e69de29..60ae85b 100644
--- a/app/Services/Impls/IncomeServiceImpl.php
+++ b/app/Services/Impls/IncomeServiceImpl.php
@@ -0,0 +1,184 @@
+generateUniqueCode($company_id);
+ }
+
+ $income = new Income();
+ $income->company_id = $company_id;
+ $income->branch_id = $branch_id;
+ $income->income_group_id = $income_group_id;
+ $income->cash_id = $cash_id;
+ $income->code = $code;
+ $income->date = $date;
+ $income->payment_term_type = $payment_term_type;
+ $income->amount = $amount;
+ $income->amount_owed = $amount_owed;
+ $income->remarks = $remarks;
+ $income->posted = $posted;
+
+ $income->save();
+
+ DB::commit();
+
+ return $income;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $income = Income::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $income = $income->latest();
+ } else {
+ $income = $income->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $income->paginate($perPage);
+ } else {
+ return $income->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ int $branch_id,
+ int $income_group_id,
+ ?int $cash_id = null,
+ string $code,
+ ?string $date = null,
+ string $payment_term_type,
+ string $amount,
+ string $amount_owed,
+ ?string $remarks = null,
+ int $posted,
+ ): ?Income
+ {
+ DB::beginTransaction();
+
+ try {
+ $income = Income::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $income->update([
+ 'company_id' => $company_id,
+ 'branch_id' => $branch_id,
+ 'income_group_id' => $income_group_id,
+ 'cash_id' => $cash_id,
+ 'code' => $code,
+ 'date' => $date,
+ 'payment_term_type' => $payment_term_type,
+ 'amount' => $amount,
+ 'amount_owed' => $amount_owed,
+ 'remarks' => $remarks,
+ 'posted' => $posted,
+ ]);
+
+ DB::commit();
+
+ return $income->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $income = Income::find($id);
+
+ if ($income) {
+ $retval = $income->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = Income::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/InvestorServiceImpl.php b/app/Services/Impls/InvestorServiceImpl.php
index e69de29..c4c2561 100644
--- a/app/Services/Impls/InvestorServiceImpl.php
+++ b/app/Services/Impls/InvestorServiceImpl.php
@@ -0,0 +1,176 @@
+generateUniqueCode($company_id);
+ }
+
+ $investor = new Investor();
+ $investor->company_id = $company_id;
+ $investor->code = $code;
+ $investor->name = $name;
+ $investor->address = $address;
+ $investor->city = $city;
+ $investor->contact = $contact;
+ $investor->tax_number = $tax_number;
+ $investor->remarks = $remarks;
+ $investor->status = $status;
+
+ $investor->save();
+
+ DB::commit();
+
+ return $investor;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $investor = Investor::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $investor = $investor->latest();
+ } else {
+ $investor = $investor->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $investor->paginate($perPage);
+ } else {
+ return $investor->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ string $code,
+ string $name,
+ ?string $address = null,
+ ?string $city = null,
+ ?string $contact = null,
+ ?string $tax_number = null,
+ ?string $remarks = null,
+ int $status,
+ ): ?Investor
+ {
+ DB::beginTransaction();
+
+ try {
+ $investor = Investor::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $investor->update([
+ 'company_id' => $company_id,
+ 'code' => $code,
+ 'name' => $name,
+ 'address' => $address,
+ 'city' => $city,
+ 'contact' => $contact,
+ 'tax_number' => $tax_number,
+ 'remarks' => $remarks,
+ 'status' => $status,
+ ]);
+
+ DB::commit();
+
+ return $investor->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $investor = Investor::find($id);
+
+ if ($investor) {
+ $retval = $investor->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = Investor::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/IncomeGroupService.php b/app/Services/IncomeGroupService.php
index aa6be77..f885820 100644
--- a/app/Services/IncomeGroupService.php
+++ b/app/Services/IncomeGroupService.php
@@ -10,10 +10,6 @@ public function create(
int $company_id,
string $code,
string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
- ?string $remarks = null,
int $status,
): ?IncomeGroup;
@@ -29,10 +25,6 @@ public function update(
int $company_id,
string $code,
string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
- ?string $remarks = null,
int $status,
): ?IncomeGroup;
diff --git a/app/Services/IncomeService.php b/app/Services/IncomeService.php
index 5176ce5..2271d9c 100644
--- a/app/Services/IncomeService.php
+++ b/app/Services/IncomeService.php
@@ -8,13 +8,16 @@ interface IncomeService
{
public function create(
int $company_id,
+ int $branch_id,
+ int $income_group_id,
+ ?int $cash_id = null,
string $code,
- string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
+ ?string $date = null,
+ string $payment_term_type,
+ string $amount,
+ string $amount_owed,
?string $remarks = null,
- int $status,
+ int $posted,
): ?Income;
public function read(
@@ -27,13 +30,16 @@ public function read(
public function update(
int $id,
int $company_id,
+ int $branch_id,
+ int $income_group_id,
+ ?int $cash_id = null,
string $code,
- string $name,
- ?string $address = null,
- ?string $city = null,
- ?string $contact = null,
+ ?string $date = null,
+ string $payment_term_type,
+ string $amount,
+ string $amount_owed,
?string $remarks = null,
- int $status,
+ int $posted,
): ?Income;
public function delete(int $id): bool;
diff --git a/app/Services/InvestorService.php b/app/Services/InvestorService.php
index 2aa3f53..8460135 100644
--- a/app/Services/InvestorService.php
+++ b/app/Services/InvestorService.php
@@ -13,6 +13,7 @@ public function create(
?string $address = null,
?string $city = null,
?string $contact = null,
+ ?string $tax_number = null,
?string $remarks = null,
int $status,
): ?Investor;
@@ -32,6 +33,7 @@ public function update(
?string $address = null,
?string $city = null,
?string $contact = null,
+ ?string $tax_number = null,
?string $remarks = null,
int $status,
): ?Investor;
From 0bf2671247a790b7e827cc1039218282042a8e30 Mon Sep 17 00:00:00 2001
From: Hartanto119 <80240259+Hartanto119@users.noreply.github.com>
Date: Sun, 24 Apr 2022 20:23:09 +0700
Subject: [PATCH 3/4] asd
---
app/Providers/AppServiceProvider.php | 75 ++++++++
app/Services/Impls/CashServiceImpl.php | 160 ++++++++++++++++++
app/Services/Impls/DashboardServiceImpl.php | 90 +++++++++-
resources/js/midone/router/index.js | 4 +
resources/js/midone/router/route-cash.js | 91 ++++++++++
resources/js/midone/router/route-customer.js | 31 ++++
resources/js/midone/views/capital/Capital.vue | 0
.../views/capitalgroup/CapitalGroup.vue | 0
resources/js/midone/views/cash/Cash.vue | 0
.../js/midone/views/customer/Customer.vue | 0
.../views/customergroup/CustomerGroup.vue | 0
resources/js/midone/views/expense/Expense.vue | 0
.../views/expensegroup/ExpenseGroup.vue | 0
resources/js/midone/views/income/Income.vue | 0
.../midone/views/incomegroup/IncomeGroup.vue | 0
.../js/midone/views/investor/Investor.vue | 0
16 files changed, 448 insertions(+), 3 deletions(-)
create mode 100644 app/Services/Impls/CashServiceImpl.php
create mode 100644 resources/js/midone/router/route-cash.js
create mode 100644 resources/js/midone/router/route-customer.js
create mode 100644 resources/js/midone/views/capital/Capital.vue
create mode 100644 resources/js/midone/views/capitalgroup/CapitalGroup.vue
create mode 100644 resources/js/midone/views/cash/Cash.vue
create mode 100644 resources/js/midone/views/customer/Customer.vue
create mode 100644 resources/js/midone/views/customergroup/CustomerGroup.vue
create mode 100644 resources/js/midone/views/expense/Expense.vue
create mode 100644 resources/js/midone/views/expensegroup/ExpenseGroup.vue
create mode 100644 resources/js/midone/views/income/Income.vue
create mode 100644 resources/js/midone/views/incomegroup/IncomeGroup.vue
create mode 100644 resources/js/midone/views/investor/Investor.vue
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index bb96a87..77bed2c 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -21,6 +21,15 @@
use App\Services\BranchService;
use App\Services\WarehouseService;
use App\Services\EmployeeService;
+use App\Services\CashService;
+use App\Services\InvestorService;
+use App\Services\CapitalService;
+use App\Services\CapitalGroupService;
+use App\Services\IncomeGroupService;
+use App\Services\ExpenseGroupService;
+use App\Services\ExpenseService;
+use App\Services\CustomerGroupService;
+use App\Services\CustomerService;
#endregion
use App\Services\Impls\DashboardServiceImpl;
@@ -39,6 +48,16 @@
use App\Services\Impls\BranchServiceImpl;
use App\Services\Impls\WarehouseServiceImpl;
use App\Services\Impls\EmployeeServiceImpl;
+use App\Services\Impls\CashServiceImpl;
+use App\Services\Impls\InvestorServiceImpl;
+use App\Services\Impls\CapitalServiceImpl;
+use App\Services\Impls\CapitalGroupServiceImpl;
+use App\Services\Impls\IncomeServiceImpl;
+use App\Services\Impls\IncomeGroupServiceImpl;
+use App\Services\Impls\ExpenseGroupServiceImpl;
+use App\Services\Impls\ExpenseServiceImpl;
+use App\Services\Impls\CustomerGroupServiceImpl;
+use App\Services\Impls\CustomerServiceImpl;
#endregion
class AppServiceProvider extends ServiceProvider
@@ -110,7 +129,63 @@ public function register()
$this->app->singleton(EmployeeService::class, function (){
return new EmployeeServiceImpl();
});
+
+ $this->app->singleton(CashService::class, function (){
+ return new CashServiceImpl();
+ });
+
+ $this->app->singleton(InvestorService::class, function (){
+ return new InvestorServiceImpl();
+ });
+
+ $this->app->singleton(CapitalService::class, function (){
+ return new CapitalServiceImpl();
+ });
+
+ $this->app->singleton(CapitalGroupService::class, function (){
+ return new CapitalGroupServiceImpl();
+ });
+
+ $this->app->singleton(IncomeGroupService::class, function (){
+ return new IncomeGroupServiceImpl();
+ });
+
+ $this->app->singleton(IncomeService::class, function (){
+ return new IncomeServiceImpl();
+ });
+
+ $this->app->singleton(ExpenseGroupService::class, function (){
+ return new ExpenseGroupServiceImpl();
+ });
+
+ $this->app->singleton(ExpenseService::class, function (){
+ return new ExpenseServiceImpl();
+ });
+
+ $this->app->singleton(CustomerGroupService::class, function (){
+ return new CustomerGroupServiceImpl();
+ });
+
+ $this->app->singleton(CustomerService::class, function (){
+ return new CustomerServiceImpl();
+ });
+
+ $this->app->singleton(RoleService::class, function (){
+ return new RoleServiceImpl();
+ });
+
+ $this->app->singleton(UserService::class, function (){
+ return new UserServiceImpl();
+ });
+ $this->app->singleton(ActivityLogService::class, function (){
+ return new ActivityLogServiceImpl();
+ });
+
+ $this->app->singleton(InboxService::class, function (){
+ return new InboxServiceImpl();
+ });
+
#endregion
}
diff --git a/app/Services/Impls/CashServiceImpl.php b/app/Services/Impls/CashServiceImpl.php
new file mode 100644
index 0000000..1a39dc7
--- /dev/null
+++ b/app/Services/Impls/CashServiceImpl.php
@@ -0,0 +1,160 @@
+generateUniqueCode($company_id);
+ }
+
+ $cash = new Cash();
+ $cash->company_id = $company_id;
+ $cash->code = $code;
+ $cash->name = $name;
+ $cash->is_bank = $is_bank;
+ $cash->status = $status;
+
+ $cash->save();
+
+ DB::commit();
+
+ return $cash;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function read(
+ int $companyId,
+ string $search = '',
+ bool $paginate = true,
+ int $perPage = 10
+ )
+ {
+ if (!$companyId) return null;
+
+ $cash = Cash::with('company')
+ ->whereCompanyId($companyId);
+
+ if (empty($search)) {
+ $cash = $cash->latest();
+ } else {
+ $cash = $cash->where('name', 'like', '%'.$search.'%')->latest();
+ }
+
+ if ($paginate) {
+ $perPage = is_numeric($perPage) ? $perPage : Config::get('const.DEFAULT.PAGINATION_LIMIT');
+ return $cash->paginate($perPage);
+ } else {
+ return $cash->get();
+ }
+ }
+
+ public function update(
+ int $id,
+ int $company_id,
+ string $code,
+ string $name,
+ ?int $is_bank = null,
+ int $status,
+ ): ?Cash
+ {
+ DB::beginTransaction();
+
+ try {
+ $cash = Cash::find($id);
+
+ if ($code == Config::get('const.DEFAULT.KEYWORDS.AUTO')) {
+ $code = $this->generateUniqueCode($company_id);
+ }
+
+ $cash->update([
+ 'company_id' => $company_id,
+ 'code' => $code,
+ 'name' => $name,
+ 'is_bank' => $is_bank,
+ 'status' => $status,
+ ]);
+
+ DB::commit();
+
+ return $cash->refresh();
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function delete(int $id): bool
+ {
+ DB::beginTransaction();
+
+ $retval = false;
+ try {
+ $cash = Cash::find($id);
+
+ if ($cash) {
+ $retval = $cash->delete();
+ }
+
+ DB::commit();
+
+ return $retval;
+ } catch (Exception $e) {
+ DB::rollBack();
+ Log::debug($e);
+ return Config::get('const.ERROR_RETURN_VALUE');
+ }
+ }
+
+ public function generateUniqueCode(int $companyId): string
+ {
+ $rand = new RandomGenerator();
+ $code = '';
+
+ do {
+ $code = $rand->generateAlphaNumeric(3).$rand->generateFixedLengthNumber(3);
+ } while (!$this->isUniqueCode($code, $companyId));
+
+ return $code;
+ }
+
+ public function isUniqueCode(string $code, int $companyId, ?int $exceptId = null): bool
+ {
+ $result = Cash::whereCompanyId($companyId)->where('code', '=' , $code);
+
+ if($exceptId)
+ $result = $result->where('id', '<>', $exceptId);
+
+ return $result->count() == 0 ? true:false;
+ }
+}
\ No newline at end of file
diff --git a/app/Services/Impls/DashboardServiceImpl.php b/app/Services/Impls/DashboardServiceImpl.php
index 199d8d3..e42ae45 100644
--- a/app/Services/Impls/DashboardServiceImpl.php
+++ b/app/Services/Impls/DashboardServiceImpl.php
@@ -29,10 +29,11 @@ public function createMenu(): array
if($hasCompany) {
array_push($menu, $this->createMenu_Product());
+ array_push($menu, $this->createMenu_Cash());
array_push($menu, $this->createMenu_Supplier());
- //array_push($menu, $this->createMenu_Customer());
+ array_push($menu, $this->createMenu_Customer());
array_push($menu, $this->createMenu_PurchaseOrder());
- //array_push($menu, $this->createMenu_SalesOrder());
+ //array_push($menu, $this->createMenu_SalesOrder());
}
if ($usrRoles->where('name', Config::get('const.DEFAULT.ROLE.ADMIN'))->isNotEmpty() || $openAllMenu)
@@ -198,6 +199,69 @@ private function createMenu_Product(): array
return $root_array;
}
+ private function createMenu_Cash(): array
+ {
+ $cashes = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-cash',
+ 'title' => 'components.menu.cash-cash'
+ );
+
+ $capitals = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-capital-capital',
+ 'title' => 'components.menu.cash-capital-capital'
+ );
+
+ $capitalgroups = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-capital-capitalgroup',
+ 'title' => 'components.menu.cash-capital-capitalgroup'
+ );
+
+ $expenses = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-expense-expense',
+ 'title' => 'components.menu.cash-expense-expense'
+ );
+
+ $expensegroups = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-expense-expensegroup',
+ 'title' => 'components.menu.cash-expense-expensegroup'
+ );
+
+ $incomes = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-income-income',
+ 'title' => 'components.menu.cash-income-income'
+ );
+
+ $incomegroups = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-income-incomegroup',
+ 'title' => 'components.menu.cash-income-incomegroup'
+ );
+
+ $investors = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-cash-employee',
+ 'title' => 'components.menu.cash-employee'
+ );
+
+ $root_array = array(
+ 'icon' => 'UmbrellaIcon',
+ 'pageName' => 'side-menu-cash',
+ 'title' => 'components.menu.cash',
+ 'subMenu' => [
+ ]
+ );
+
+ array_push($root_array['subMenu'], $cashes, $capitals, $capitalgroups, $expenses, $expensegroups, $incomes, $incomegroups, $investors);
+
+ return $root_array;
+ }
+
private function createMenu_Supplier(): array
{
$supplier = array(
@@ -221,9 +285,29 @@ private function createMenu_Supplier(): array
private function createMenu_Customer(): array
{
- return array(
+ $customers = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-customer-customer',
+ 'title' => 'components.menu.customer-customer'
+ );
+
+ $customergroups = array(
+ 'icon' => '',
+ 'pageName' => 'side-menu-customer-customergroup',
+ 'title' => 'components.menu.customer-customergroup'
+ );
+ $root_array = array(
+ 'icon' => 'PackageIcon',
+ 'pageName' => 'side-menu-customer',
+ 'title' => 'components.menu.customer',
+ 'subMenu' => [
+ ]
);
+
+ array_push($root_array['subMenu'], $customers, $customergroups);
+
+ return $root_array;
}
private function createMenu_PurchaseOrder(): array
diff --git a/resources/js/midone/router/index.js b/resources/js/midone/router/index.js
index 24c3046..f922171 100644
--- a/resources/js/midone/router/index.js
+++ b/resources/js/midone/router/index.js
@@ -9,16 +9,20 @@ import RouteDashboard from "./route-dashboard";
import RouteAdmin from "./route-admin";
import RouteCompany from "./route-company";
+import RouteCash from "./route-cash";
import RouteSupplier from "./route-supplier";
import RouteProduct from "./route-product";
+import RouteCustomer from "./route-customer";
import RoutePurchaseOrder from "./route-purchaseorder";
import RouteError from "./route-error";
const routes = [
RouteDashboard,
RouteCompany,
+ RouteCash,
RouteSupplier,
RouteProduct,
+ RouteCustomer,
RoutePurchaseOrder,
RouteAdmin.Admin(),
RouteAdmin.DevTool(),
diff --git a/resources/js/midone/router/route-cash.js b/resources/js/midone/router/route-cash.js
new file mode 100644
index 0000000..cb7e0aa
--- /dev/null
+++ b/resources/js/midone/router/route-cash.js
@@ -0,0 +1,91 @@
+import SideMenu from "@/layouts/side-menu/Main.vue";
+
+import Cash from "@/views/cash/Cash.vue";
+import Capital from "@/views/capital/Capital.vue";
+import CapitalGroup from "@/views/capitalgroup/CapitalGroup.vue";
+import Expense from "@/views/expense/Expense.vue";
+import ExpenseGroup from "@/views/expensegroup/ExpenseGroup.vue";
+import Income from "@/views/income/Income.vue";
+import IncomeGroup from "@/views/incomegroup/IncomeGroup.vue";
+import Investor from "@/views/investor/Investor.vue";
+
+const root = '/dashboard';
+
+export default {
+ path: root + '/cash',
+ component: SideMenu,
+ children: [
+ {
+ path: root + '/cash' + '/cash',
+ name: 'side-menu-cash-cash',
+ component: Company,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/capital' + '/capital',
+ name: 'side-menu-cash-capital-capital',
+ component: Capital,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/capital' + '/capitalgroup',
+ name: 'side-menu-cash-capital-capitalgroup',
+ component: CapitalGroup,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/expense' + '/expense',
+ name: 'side-menu-cash-expense',
+ component: Expense,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/expense' + '/expensegroup',
+ name: 'side-menu-cash-expense-expensegroup',
+ component: ExpenseGroup,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/income' + '/income',
+ name: 'side-menu-cash-income-income',
+ component: Income,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/income' + '/incomegroup',
+ name: 'side-menu-cash-income-incomegroup',
+ component: ExpenseGroup,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/cash' + '/investor' + '/investor',
+ name: 'side-menu-cash-investor-investor',
+ component: Investor,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ ]
+};
\ No newline at end of file
diff --git a/resources/js/midone/router/route-customer.js b/resources/js/midone/router/route-customer.js
new file mode 100644
index 0000000..d7cd97a
--- /dev/null
+++ b/resources/js/midone/router/route-customer.js
@@ -0,0 +1,31 @@
+import SideMenu from "@/layouts/side-menu/Main.vue";
+
+import Customer from "@/views/customer/Customer.vue";
+import CustpmerGroup from "@/views/branch/CustpmerGroup.vue";
+
+const root = '/dashboard';
+
+export default {
+ path: root + '/customer',
+ component: SideMenu,
+ children: [
+ {
+ path: root + '/customer' + '/customer',
+ name: 'side-menu-customer-customer',
+ component: Customer,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ {
+ path: root + '/customer' + '/customergroup',
+ name: 'side-menu-customer-customergroup',
+ component: CustomerGroup,
+ meta: {
+ remember: true,
+ log_route: true
+ }
+ },
+ ]
+};
\ No newline at end of file
diff --git a/resources/js/midone/views/capital/Capital.vue b/resources/js/midone/views/capital/Capital.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/capitalgroup/CapitalGroup.vue b/resources/js/midone/views/capitalgroup/CapitalGroup.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/cash/Cash.vue b/resources/js/midone/views/cash/Cash.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/customer/Customer.vue b/resources/js/midone/views/customer/Customer.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/customergroup/CustomerGroup.vue b/resources/js/midone/views/customergroup/CustomerGroup.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/expense/Expense.vue b/resources/js/midone/views/expense/Expense.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/expensegroup/ExpenseGroup.vue b/resources/js/midone/views/expensegroup/ExpenseGroup.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/income/Income.vue b/resources/js/midone/views/income/Income.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/incomegroup/IncomeGroup.vue b/resources/js/midone/views/incomegroup/IncomeGroup.vue
new file mode 100644
index 0000000..e69de29
diff --git a/resources/js/midone/views/investor/Investor.vue b/resources/js/midone/views/investor/Investor.vue
new file mode 100644
index 0000000..e69de29
From 1388f264f6d1f88e8c8e6edadb8ccf1fc939e3d9 Mon Sep 17 00:00:00 2001
From: Hartanto119 <80240259+Hartanto119@users.noreply.github.com>
Date: Mon, 25 Apr 2022 17:01:22 +0700
Subject: [PATCH 4/4] asd
---
resources/js/midone/views/capital/Capital.vue | 422 ++++++++++++++++++
.../views/capitalgroup/CapitalGroup.vue | 417 +++++++++++++++++
resources/js/midone/views/cash/Cash.vue | 417 +++++++++++++++++
.../js/midone/views/customer/Customer.vue | 417 +++++++++++++++++
.../views/customergroup/CustomerGroup.vue | 417 +++++++++++++++++
resources/js/midone/views/expense/Expense.vue | 417 +++++++++++++++++
.../views/expensegroup/ExpenseGroup.vue | 417 +++++++++++++++++
resources/js/midone/views/income/Income.vue | 417 +++++++++++++++++
.../midone/views/incomegroup/IncomeGroup.vue | 417 +++++++++++++++++
.../js/midone/views/investor/Investor.vue | 417 +++++++++++++++++
routes/api.php | 89 ++++
11 files changed, 4264 insertions(+)
diff --git a/resources/js/midone/views/capital/Capital.vue b/resources/js/midone/views/capital/Capital.vue
index e69de29..f3df8b9 100644
--- a/resources/js/midone/views/capital/Capital.vue
+++ b/resources/js/midone/views/capital/Capital.vue
@@ -0,0 +1,422 @@
+
+
+
+
+
+
+
+
+
{{ t('views.capital.actions.create') }}
+ {{ t('views.capital.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/capitalgroup/CapitalGroup.vue b/resources/js/midone/views/capitalgroup/CapitalGroup.vue
index e69de29..b4f0fdf 100644
--- a/resources/js/midone/views/capitalgroup/CapitalGroup.vue
+++ b/resources/js/midone/views/capitalgroup/CapitalGroup.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.capitalgroup.actions.create') }}
+ {{ t('views.capitalgroup.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/cash/Cash.vue b/resources/js/midone/views/cash/Cash.vue
index e69de29..515b37c 100644
--- a/resources/js/midone/views/cash/Cash.vue
+++ b/resources/js/midone/views/cash/Cash.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.cash.actions.create') }}
+ {{ t('views.cash.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/customer/Customer.vue b/resources/js/midone/views/customer/Customer.vue
index e69de29..384203b 100644
--- a/resources/js/midone/views/customer/Customer.vue
+++ b/resources/js/midone/views/customer/Customer.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.customer.actions.create') }}
+ {{ t('views.customer.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/customergroup/CustomerGroup.vue b/resources/js/midone/views/customergroup/CustomerGroup.vue
index e69de29..9f4780b 100644
--- a/resources/js/midone/views/customergroup/CustomerGroup.vue
+++ b/resources/js/midone/views/customergroup/CustomerGroup.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.customergroup.actions.create') }}
+ {{ t('views.customergroup.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/expense/Expense.vue b/resources/js/midone/views/expense/Expense.vue
index e69de29..42627e6 100644
--- a/resources/js/midone/views/expense/Expense.vue
+++ b/resources/js/midone/views/expense/Expense.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.expense.actions.create') }}
+ {{ t('views.expense.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/expensegroup/ExpenseGroup.vue b/resources/js/midone/views/expensegroup/ExpenseGroup.vue
index e69de29..366c909 100644
--- a/resources/js/midone/views/expensegroup/ExpenseGroup.vue
+++ b/resources/js/midone/views/expensegroup/ExpenseGroup.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.expensegroup.actions.create') }}
+ {{ t('views.expensegroup.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/income/Income.vue b/resources/js/midone/views/income/Income.vue
index e69de29..09d5f5b 100644
--- a/resources/js/midone/views/income/Income.vue
+++ b/resources/js/midone/views/income/Income.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.income.actions.create') }}
+ {{ t('views.income.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/incomegroup/IncomeGroup.vue b/resources/js/midone/views/incomegroup/IncomeGroup.vue
index e69de29..72d4356 100644
--- a/resources/js/midone/views/incomegroup/IncomeGroup.vue
+++ b/resources/js/midone/views/incomegroup/IncomeGroup.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.incomegroup.actions.create') }}
+ {{ t('views.incomegroup.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/js/midone/views/investor/Investor.vue b/resources/js/midone/views/investor/Investor.vue
index e69de29..0b2935f 100644
--- a/resources/js/midone/views/investor/Investor.vue
+++ b/resources/js/midone/views/investor/Investor.vue
@@ -0,0 +1,417 @@
+
+
+
+
+
+
+
+
+
{{ t('views.investor.actions.create') }}
+ {{ t('views.investor.actions.edit') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/routes/api.php b/routes/api.php
index b61cb3e..6db9bca 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -17,7 +17,17 @@
use App\Http\Controllers\SupplierController;
use App\Http\Controllers\ProductController;
use App\Http\Controllers\BrandController;
+use App\Http\Controllers\CapitalController;
+use App\Http\Controllers\CapitalGroupController;
+use App\Http\Controllers\CashController;
+use App\Http\Controllers\CustomerController;
+use App\Http\Controllers\CustomerGroupController;
use App\Http\Controllers\EmployeeController;
+use App\Http\Controllers\ExpenseController;
+use App\Http\Controllers\ExpenseGroupController;
+use App\Http\Controllers\IncomeController;
+use App\Http\Controllers\IncomeGroupController;
+use App\Http\Controllers\InvestorController;
use App\Http\Controllers\ProductGroupController;
use App\Http\Controllers\UnitController;
use App\Http\Controllers\WarehouseController;
@@ -60,6 +70,33 @@
});
});
+ Route::group(['prefix' => 'cash', 'as' => '.cash'], function() {
+ Route::group(['prefix' => 'cash', 'as' => '.cash'], function() {
+ Route::get('read', [CashController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'capital', 'as' => '.capital'], function() {
+ Route::get('read', [CapitalController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'capital_group', 'as' => '.capital_group'], function() {
+ Route::get('read', [CapitalGroupController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'expense', 'as' => '.expense'], function() {
+ Route::get('read', [ExpenseController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'expense_group', 'as' => '.expense_group'], function() {
+ Route::get('read', [ExpenseGroupController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'income', 'as' => '.income'], function() {
+ Route::get('read', [IncomeController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'income_group', 'as' => '.income_group'], function() {
+ Route::get('read', [IncomeGroupController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'investor', 'as' => '.investor'], function() {
+ Route::get('read', [InvestorController::class, 'read'])->name('.read');
+ });
+ });
+
Route::group(['prefix' => 'product', 'as' => '.product'], function() {
Route::group(['prefix' => 'brand', 'as' => '.brand'], function() {
Route::get('read', [BrandController::class, 'read'])->name('.read');
@@ -81,6 +118,15 @@
Route::get('list/product_type', [ProductController::class, 'getProductType'])->name('.list.product_type');
});
});
+
+ Route::group(['prefix' => 'customer', 'as' => '.customer'], function() {
+ Route::group(['prefix' => 'customer', 'as' => '.customer'], function() {
+ Route::get('read', [CustomerController::class, 'read'])->name('.read');
+ });
+ Route::group(['prefix' => 'customer_group', 'as' => '.customer_group'], function() {
+ Route::get('read', [CustomerGroupController::class, 'read'])->name('.read');
+ });
+ });
#endregion
@@ -162,6 +208,49 @@
});
});
+ Route::group(['prefix' => 'cash', 'as' => '.cash'], function() {
+ Route::group(['prefix' => 'cash', 'as' => '.cash'], function() {
+ Route::post('save', [CashController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [CashController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [CashController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'capital', 'as' => '.capital'], function() {
+ Route::post('save', [CapitalController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [CapitalController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [CapitalController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'capital_group', 'as' => '.capital_group'], function() {
+ Route::post('save', [CapitalGroupController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [CapitalGroupController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [CapitalGroupController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'expense', 'as' => '.expense'], function() {
+ Route::post('save', [ExpenseController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [ExpenseController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [ExpenseController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'expense_group', 'as' => '.expense_group'], function() {
+ Route::post('save', [ExpenseGroupController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [ExpenseGroupController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [ExpenseGroupController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'income', 'as' => '.income'], function() {
+ Route::post('save', [IncomeController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [IncomeController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [IncomeController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'income_group', 'as' => '.income_group'], function() {
+ Route::post('save', [IncomeGroupController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [IncomeGroupController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [IncomeGroupController::class, 'delete'])->name('.delete');
+ });
+ Route::group(['prefix' => 'investor', 'as' => '.investor'], function() {
+ Route::post('save', [InvestorController::class, 'store'])->name('.save');
+ Route::post('edit/{id}', [InvestorController::class, 'update'])->name('.edit');
+ Route::post('delete/{id}', [InvestorController::class, 'delete'])->name('.delete');
+ });
+ });
+
Route::group(['prefix' => 'product', 'as' => '.product'], function() {
Route::group(['prefix' => 'product', 'as' => '.product'], function() {
Route::post('save', [ProductController::class, 'store'])->name('.save');