1
0
mirror of https://github.com/cp6/my-idlers.git synced 2024-11-16 23:42:32 +01:00

Updated Reseller controller and create & edit views

Uses the resource id now
No passing hidden input id
Uses alert component for response
This commit is contained in:
cp6 2022-10-31 16:00:43 +11:00
parent d79c571505
commit 9d33f8ad6e
3 changed files with 11 additions and 14 deletions

View File

@ -136,6 +136,7 @@ class ResellerController extends Controller
'reseller_type' => $request->reseller_type, 'reseller_type' => $request->reseller_type,
'provider_id' => $request->provider_id, 'provider_id' => $request->provider_id,
'location_id' => $request->location_id, 'location_id' => $request->location_id,
'accounts' => $request->accounts,
'disk' => $request->disk, 'disk' => $request->disk,
'disk_type' => 'GB', 'disk_type' => 'GB',
'disk_as_gb' => $request->disk, 'disk_as_gb' => $request->disk,
@ -150,19 +151,20 @@ class ResellerController extends Controller
]); ]);
$pricing = new Pricing(); $pricing = new Pricing();
$pricing->updatePricing($request->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date); $pricing->updatePricing($reseller->id, $request->currency, $request->price, $request->payment_term, $request->next_due_date);
Labels::deleteLabelsAssignedTo($request->id); Labels::deleteLabelsAssignedTo($reseller->id);
Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $request->id); Labels::insertLabelsAssigned([$request->label1, $request->label2, $request->label3, $request->label4], $reseller->id);
IPs::deleteIPsAssignedTo($request->id); IPs::deleteIPsAssignedTo($reseller->id);
if (isset($request->dedicated_ip)) { if (!is_null($request->dedicated_ip)) {
IPs::insertIP($request->id, $request->dedicated_ip); IPs::insertIP($reseller->id, $request->dedicated_ip);
} }
Cache::forget("reseller_hosting.{$request->id}"); Cache::forget("all_reseller");
Cache::forget("labels_for_service.{$request->id}"); Cache::forget("reseller_hosting.{$reseller->id}");
Cache::forget("labels_for_service.{$reseller->id}");
Home::homePageCacheForget(); Home::homePageCacheForget();

View File

@ -20,7 +20,6 @@
<x-text-input title="Domain" name="domain" value="{{$reseller->main_domain}}"></x-text-input> <x-text-input title="Domain" name="domain" value="{{$reseller->main_domain}}"></x-text-input>
</div> </div>
<div class="col-12 col-lg-3 mb-4"> <div class="col-12 col-lg-3 mb-4">
<input type="hidden" name="id" value="{{$reseller->id}}">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div> <div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" name="reseller_type"> <select class="form-control" name="reseller_type">

View File

@ -12,11 +12,7 @@
<div class="card shadow mt-3"> <div class="card shadow mt-3">
<div class="card-body"> <div class="card-body">
<a href="{{ route('reseller.create') }}" class="btn btn-primary mb-3">Add a reseller</a> <a href="{{ route('reseller.create') }}" class="btn btn-primary mb-3">Add a reseller</a>
@if ($message = Session::get('success')) <x-response-alerts></x-response-alerts>
<div class="alert alert-success" role="alert">
<p class="my-1">{{ $message }}</p>
</div>
@endif
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-bordered"> <table class="table table-bordered">
<thead class="table-light"> <thead class="table-light">