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/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/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 @@ +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 new file mode 100644 index 0000000..1d1c5a3 --- /dev/null +++ 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/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/CustomerGroupServiceImpl.php b/app/Services/Impls/CustomerGroupServiceImpl.php new file mode 100644 index 0000000..113501b --- /dev/null +++ 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 new file mode 100644 index 0000000..e47ab57 --- /dev/null +++ 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/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/app/Services/Impls/ExpenseGroupServiceImpl.php b/app/Services/Impls/ExpenseGroupServiceImpl.php new file mode 100644 index 0000000..fab08d7 --- /dev/null +++ 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 new file mode 100644 index 0000000..83a4af0 --- /dev/null +++ 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 new file mode 100644 index 0000000..72b7ea6 --- /dev/null +++ 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 new file mode 100644 index 0000000..60ae85b --- /dev/null +++ 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 new file mode 100644 index 0000000..c4c2561 --- /dev/null +++ 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 new file mode 100644 index 0000000..f885820 --- /dev/null +++ b/app/Services/IncomeGroupService.php @@ -0,0 +1,36 @@ +
{{ 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 diff --git a/resources/js/midone/views/capital/Capital.vue b/resources/js/midone/views/capital/Capital.vue new file mode 100644 index 0000000..f3df8b9 --- /dev/null +++ b/resources/js/midone/views/capital/Capital.vue @@ -0,0 +1,422 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/capitalgroup/CapitalGroup.vue b/resources/js/midone/views/capitalgroup/CapitalGroup.vue new file mode 100644 index 0000000..b4f0fdf --- /dev/null +++ b/resources/js/midone/views/capitalgroup/CapitalGroup.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/cash/Cash.vue b/resources/js/midone/views/cash/Cash.vue new file mode 100644 index 0000000..515b37c --- /dev/null +++ b/resources/js/midone/views/cash/Cash.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/customer/Customer.vue b/resources/js/midone/views/customer/Customer.vue new file mode 100644 index 0000000..384203b --- /dev/null +++ b/resources/js/midone/views/customer/Customer.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/customergroup/CustomerGroup.vue b/resources/js/midone/views/customergroup/CustomerGroup.vue new file mode 100644 index 0000000..9f4780b --- /dev/null +++ b/resources/js/midone/views/customergroup/CustomerGroup.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/expense/Expense.vue b/resources/js/midone/views/expense/Expense.vue new file mode 100644 index 0000000..42627e6 --- /dev/null +++ b/resources/js/midone/views/expense/Expense.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/expensegroup/ExpenseGroup.vue b/resources/js/midone/views/expensegroup/ExpenseGroup.vue new file mode 100644 index 0000000..366c909 --- /dev/null +++ b/resources/js/midone/views/expensegroup/ExpenseGroup.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/income/Income.vue b/resources/js/midone/views/income/Income.vue new file mode 100644 index 0000000..09d5f5b --- /dev/null +++ b/resources/js/midone/views/income/Income.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/incomegroup/IncomeGroup.vue b/resources/js/midone/views/incomegroup/IncomeGroup.vue new file mode 100644 index 0000000..72d4356 --- /dev/null +++ b/resources/js/midone/views/incomegroup/IncomeGroup.vue @@ -0,0 +1,417 @@ + + + \ No newline at end of file diff --git a/resources/js/midone/views/investor/Investor.vue b/resources/js/midone/views/investor/Investor.vue new file mode 100644 index 0000000..0b2935f --- /dev/null +++ b/resources/js/midone/views/investor/Investor.vue @@ -0,0 +1,417 @@ + + + \ 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');