mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +01:00
Added labels for reseller services
Added labels for reseller services
This commit is contained in:
parent
53a1059e69
commit
8dd2ee6393
@ -109,6 +109,14 @@ class ResellerController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$labels_array = [$request->label1, $request->label2, $request->label3, $request->label4];
|
||||||
|
|
||||||
|
for ($i = 1; $i <= 4; $i++) {
|
||||||
|
if (!is_null($labels_array[($i - 1)])) {
|
||||||
|
DB::insert('INSERT IGNORE INTO labels_assigned (label_id, service_id) values (?, ?)', [$labels_array[($i - 1)], $reseller_id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Cache::forget('services_count');//Main page services_count cache
|
Cache::forget('services_count');//Main page services_count cache
|
||||||
Cache::forget('due_soon');//Main page due_soon cache
|
Cache::forget('due_soon');//Main page due_soon cache
|
||||||
Cache::forget('recently_added');//Main page recently_added cache
|
Cache::forget('recently_added');//Main page recently_added cache
|
||||||
@ -144,6 +152,11 @@ class ResellerController extends Controller
|
|||||||
$locations = DB::table('locations')->get(['*']);
|
$locations = DB::table('locations')->get(['*']);
|
||||||
$providers = json_decode(DB::table('providers')->get(['*']), true);
|
$providers = json_decode(DB::table('providers')->get(['*']), true);
|
||||||
|
|
||||||
|
$labels = DB::table('labels_assigned as l')
|
||||||
|
->join('labels', 'l.label_id', '=', 'labels.id')
|
||||||
|
->where('l.service_id', '=', $reseller->id)
|
||||||
|
->get(['labels.id', 'labels.label']);
|
||||||
|
|
||||||
$ip_address = json_decode(DB::table('ips as i')
|
$ip_address = json_decode(DB::table('ips as i')
|
||||||
->where('i.service_id', '=', $reseller->id)
|
->where('i.service_id', '=', $reseller->id)
|
||||||
->get(), true);
|
->get(), true);
|
||||||
@ -153,7 +166,7 @@ class ResellerController extends Controller
|
|||||||
->where('s.id', '=', $reseller->id)
|
->where('s.id', '=', $reseller->id)
|
||||||
->get(['s.*', 'p.*']);
|
->get(['s.*', 'p.*']);
|
||||||
|
|
||||||
return view('reseller.edit', compact(['reseller', 'locations', 'providers', 'ip_address']));
|
return view('reseller.edit', compact(['reseller', 'locations', 'providers', 'ip_address', 'labels']));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(Request $request, Reseller $reseller)
|
public function update(Request $request, Reseller $reseller)
|
||||||
@ -215,6 +228,16 @@ class ResellerController extends Controller
|
|||||||
'next_due_date' => $request->next_due_date,
|
'next_due_date' => $request->next_due_date,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$deleted = DB::table('labels_assigned')->where('service_id', '=', $request->id)->delete();
|
||||||
|
|
||||||
|
$labels_array = [$request->label1, $request->label2, $request->label3, $request->label4];
|
||||||
|
|
||||||
|
for ($i = 1; $i <= 4; $i++) {
|
||||||
|
if (!is_null($labels_array[($i - 1)])) {
|
||||||
|
DB::insert('INSERT IGNORE INTO labels_assigned ( label_id, service_id) values (?, ?)', [$labels_array[($i - 1)], $request->id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$delete_ip = DB::table('ips')->where('service_id', '=', $request->id)->delete();
|
$delete_ip = DB::table('ips')->where('service_id', '=', $request->id)->delete();
|
||||||
|
|
||||||
if (isset($request->dedicated_ip)) {
|
if (isset($request->dedicated_ip)) {
|
||||||
|
@ -188,6 +188,32 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label1</x-slot>
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label2</x-slot>
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label3</x-slot>
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label4</x-slot>
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="submit"
|
<button type="submit"
|
||||||
class="btn btn-success py-0 px-4 mt-2">
|
class="btn btn-success py-0 px-4 mt-2">
|
||||||
|
@ -253,6 +253,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label1</x-slot>
|
||||||
|
@if(isset($labels[0]->id))
|
||||||
|
<x-slot name="current">{{$labels[0]->id}}</x-slot>
|
||||||
|
@endif
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label2</x-slot>
|
||||||
|
@if(isset($labels[1]->id))
|
||||||
|
<x-slot name="current">{{$labels[1]->id}}</x-slot>
|
||||||
|
@endif
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label3</x-slot>
|
||||||
|
@if(isset($labels[2]->id))
|
||||||
|
<x-slot name="current">{{$labels[2]->id}}</x-slot>
|
||||||
|
@endif
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-lg-3 mb-4">
|
||||||
|
<x-labels-select>
|
||||||
|
<x-slot name="title">label</x-slot>
|
||||||
|
<x-slot name="name">label4</x-slot>
|
||||||
|
@if(isset($labels[3]->id))
|
||||||
|
<x-slot name="current">{{$labels[3]->id}}</x-slot>
|
||||||
|
@endif
|
||||||
|
</x-labels-select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-check mt-2">
|
<div class="form-check mt-2">
|
||||||
<input class="form-check-input" name="is_active" type="checkbox"
|
<input class="form-check-input" name="is_active" type="checkbox"
|
||||||
value="1" {{ ($reseller[0]->active === 1) ? 'checked' : '' }}>
|
value="1" {{ ($reseller[0]->active === 1) ? 'checked' : '' }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user