diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index effc8f6..0984756 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -92,7 +92,7 @@ class HomeController extends Controller public function service(Service $o): View { $breadcrumb = collect(); - $breadcrumb->put($o->account->user->name,url('u/home',$o->account->user_id)); + $breadcrumb->put($o->account->user->full_name,url('u/home',$o->account->user_id)); return View('u.service.home') ->with('breadcrumb',$breadcrumb) diff --git a/app/Http/Controllers/ResellerServicesController.php b/app/Http/Controllers/ResellerServicesController.php deleted file mode 100644 index bbedf5d..0000000 --- a/app/Http/Controllers/ResellerServicesController.php +++ /dev/null @@ -1,39 +0,0 @@ -Auth::user()->all_accounts()->values()]; - } - - public function agents() - { - return ['data'=>Auth::user()->all_agents()->values()]; - } - - public function clients() - { - return ['data'=>Auth::user()->all_clients()->values()]; - } - - public function services(Request $request,Account $o) - { - return $o->services - ->filter(function($item) use ($request) { - return $item->active || ($item->id == $request->include); - }); - } - - public function service_inactive() - { - return ['data'=>Auth::user()->all_client_service_inactive()->values()]; - } -} \ No newline at end of file diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 114fd77..4cbdbcf 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -25,31 +25,31 @@ class SearchController extends Controller if (! $request->input('term')) return $result; - $accounts = ($x=Auth::user()->all_accounts())->pluck('id'); - $users = $x->transform(function($item) { return $item->user;}); + $account_ids = ($x=Auth::user()->accounts)->pluck('id'); + $user_ids = $x->transform(function($item) { return $item->user;})->pluck('id'); # Look for User foreach (User::Search($request->input('term')) - ->whereIN('id',$users->pluck('id')) + ->whereIN('id',$user_ids) ->orderBy('lastname') ->orderBy('firstname') ->limit(10)->get() as $o) { - $result->push(['name'=>sprintf('%s %s',$o->aid,$o->name),'value'=>'/u/home/'.$o->id,'category'=>'Users']); + $result->push(['name'=>sprintf('%s %s',$o->sid,$o->name),'value'=>'/u/home/'.$o->id,'category'=>'Users']); } # Look for Account foreach (Account::Search($request->input('term')) - ->whereIN('user_id',$users->pluck('id')) + ->whereIN('user_id',$user_ids) ->orderBy('company') ->limit(10)->get() as $o) { - $result->push(['name'=>sprintf('%s %s',$o->aid,$o->company),'value'=>'/u/home/'.$o->user_id,'category'=>'Accounts']); + $result->push(['name'=>sprintf('%s %s',$o->sid,$o->company),'value'=>'/u/home/'.$o->user_id,'category'=>'Accounts']); } # Look for a Service foreach (Service::Search($request->input('term')) - ->whereIN('account_id',$accounts) + ->whereIN('account_id',$account_ids) ->orderBy('id') ->limit(10)->get() as $o) { @@ -58,7 +58,7 @@ class SearchController extends Controller # Look for an Invoice foreach (Invoice::Search($request->input('term')) - ->whereIN('account_id',$accounts) + ->whereIN('account_id',$account_ids) ->orderBy('id') ->limit(10)->get() as $o) { @@ -67,7 +67,7 @@ class SearchController extends Controller # Look for an Broadband Service foreach (Broadband::Search($request->input('term')) - ->whereIN('account_id',$accounts) + ->whereIN('account_id',$account_ids) ->orderBy('service_number') ->limit(10)->get() as $o) { @@ -76,7 +76,7 @@ class SearchController extends Controller # Look for an Phone Service foreach (Phone::Search($request->input('term')) - ->whereIN('account_id',$accounts) + ->whereIN('account_id',$account_ids) ->orderBy('service_number') ->limit(10)->get() as $o) { @@ -85,7 +85,7 @@ class SearchController extends Controller # Look for Domain Name foreach (Service\Domain::Search($request->input('term')) - ->whereIN('account_id',$accounts) + ->whereIN('account_id',$account_ids) ->orderBy('domain_name') ->limit(10)->get() as $o) { @@ -95,7 +95,7 @@ class SearchController extends Controller if (Gate::any(['wholesaler'],new Payment)) { # Look for Payments foreach (Payment::Search($request->input('term')) - ->whereIN('account_id',$accounts) + ->whereIN('account_id',$account_ids) ->limit(10)->get() as $o) { $result->push(['name'=>sprintf('%s ($%s)',$o->id,number_format($o->total,2)),'value'=>'/a/payment/addedit/'.$o->id,'category'=>'Payments']); diff --git a/app/Models/Account.php b/app/Models/Account.php index bb70aa7..3f9670b 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -131,24 +131,6 @@ class Account extends Model implements IDs return sprintf('%s',$this->active ? 'success' : 'danger',$this->active ? 'Active' : 'Inactive'); } - /** - * @deprecated use getAIDAttribute() - */ - public function getAccountIdAttribute() - { - abort(500,'deprecated'); - return $this->getAIDAttribute(); - } - - /** - * @deprecated use getUrlAdminAttribute() - */ - public function getAccountIdUrlAttribute() - { - abort(500,'deprecated'); - return $this->getUrlAdminAttribute(); - } - /** * Get the address for the account * @@ -163,17 +145,6 @@ class Account extends Model implements IDs ]; } - /** - * Return the Account Unique Identifier - * @return string - * @deprecated use getSIDAttribute() - */ - public function getAIDAttribute() - { - abort(500,'deprecated'); - return $this->getSIDAttribute(); - } - /** * Return the account name * @@ -181,19 +152,7 @@ class Account extends Model implements IDs */ public function getNameAttribute(): string { - return $this->company ?: ($this->user_id ? $this->user->SurFirstName : 'AID:'.$this->id); - } - - public function getServicesCountHtmlAttribute() - { - abort(500,'deprecated'); - return sprintf('%s /%s',$this->services()->noEagerLoads()->where('active',TRUE)->count(),$this->services()->noEagerLoads()->count()); - } - - public function getSwitchUrlAttribute() - { - abort(500,'deprecated'); - return sprintf('',$this->user_id); + return $this->company ?: ($this->user_id ? $this->user->getSurFirstNameAttribute() : 'LID:'.$this->id); } public function getTypeAttribute() @@ -205,6 +164,7 @@ class Account extends Model implements IDs * Return the Admin URL to manage the account * * @return string + * @deprecated */ public function getUrlAdminAttribute(): string { @@ -216,6 +176,7 @@ class Account extends Model implements IDs * Return the User URL to manage the account * * @return string + * @deprecated */ public function getUrlUserAttribute(): string { diff --git a/app/Models/Policies/AccountPolicy.php b/app/Models/Policies/AccountPolicy.php index b8a3a1f..76c6875 100644 --- a/app/Models/Policies/AccountPolicy.php +++ b/app/Models/Policies/AccountPolicy.php @@ -26,7 +26,7 @@ class AccountPolicy OR $uo->isWholesaler() // The user is the reseller - OR ($uo->all_accounts()->pluck('id')->search($ao->id) !== FALSE); + OR $uo->isReseller(); } /** diff --git a/app/Models/Policies/InvoicePolicy.php b/app/Models/Policies/InvoicePolicy.php index 59bb541..056750e 100644 --- a/app/Models/Policies/InvoicePolicy.php +++ b/app/Models/Policies/InvoicePolicy.php @@ -26,7 +26,7 @@ class InvoicePolicy OR $uo->isWholesaler() // The user is the reseller - OR ($uo->all_accounts()->pluck('id')->search($io->account_id) !== FALSE); + OR $uo->isReseller(); } /** diff --git a/app/Models/Policies/ServicePolicy.php b/app/Models/Policies/ServicePolicy.php index 9c2bb9d..aa55a3f 100644 --- a/app/Models/Policies/ServicePolicy.php +++ b/app/Models/Policies/ServicePolicy.php @@ -26,7 +26,7 @@ class ServicePolicy OR $uo->isWholesaler() // The user is the reseller - OR ($uo->all_accounts()->pluck('id')->search($so->account_id) !== FALSE); + OR $uo->isReseller(); } /** diff --git a/app/Models/Policies/UserPolicy.php b/app/Models/Policies/UserPolicy.php index a037301..c72c127 100644 --- a/app/Models/Policies/UserPolicy.php +++ b/app/Models/Policies/UserPolicy.php @@ -26,7 +26,7 @@ class UserPolicy OR $uo->isWholesaler() // The user is the reseller - OR ($uo->all_clients()->pluck('id')->search($o->id) !== FALSE); + OR $uo->isReseller(); } /** diff --git a/app/Models/Service.php b/app/Models/Service.php index f78c7ac..a7919e5 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -49,17 +49,6 @@ class Service extends Model implements IDs { use HasFactory,ScopeServiceUserAuthorised; - protected $appends = [ - 'account_name', - 'admin_service_id_url', - 'billing_price', - 'name_short', - 'next_invoice', - 'service_id', - 'service_id_url', - 'status', - ]; - protected $casts = [ 'order_info'=>AsCollection::class, ]; @@ -71,35 +60,12 @@ class Service extends Model implements IDs 'stop_at', ]; - protected $visible = [ - 'account_name', - 'admin_service_id_url', - 'active', - 'billing_price', - 'data_orig', - 'id', - 'name_short', - 'next_invoice', - 'product_category', - 'product_name', - 'service_id', - 'service_id_url', - 'status', - ]; - protected $with = [ 'invoice_items', 'product.type.supplied', 'type', ]; - // @todo Change to self::INACTIVE_STATUS - private $inactive_status = [ - 'CANCELLED', - 'ORDER-REJECTED', - 'ORDER-CANCELLED', - ]; - public const INACTIVE_STATUS = [ 'CANCELLED', 'ORDER-REJECTED', @@ -406,7 +372,7 @@ class Service extends Model implements IDs { return $query->where(function () use ($query) { $query->where($this->getTable().'.active',TRUE) - ->orWhereNotIn('order_status',$this->inactive_status); + ->orWhereNotIn('order_status',self::INACTIVE_STATUS); }); } @@ -420,7 +386,7 @@ class Service extends Model implements IDs { return $query->where(function () use ($query) { $query->where($this->getTable().'.active',FALSE) - ->orWhereIn('order_status',$this->inactive_status); + ->orWhereIn('order_status',self::INACTIVE_STATUS); }); } @@ -459,14 +425,6 @@ class Service extends Model implements IDs return $this->account->name; } - /** - * @deprecated Use getUrlAdminAttribute() - */ - public function getAdminServiceIdUrlAttribute() - { - return $this->getUrlAdminAttribute(); - } - /** * Return the auto billing details * @@ -1170,7 +1128,7 @@ class Service extends Model implements IDs public function getStageParameters(string $stage): Collection { $result = Arr::get(self::ACTION_PROGRESS,$stage); - $myrole = array_search(Auth::user()->role(),User::$role_order); + $myrole = array_search(Auth::user()->role(),User::role_order); // If we have no valid next stage, return an empty collection. if (($myrole === FALSE) || (! $result)) @@ -1185,7 +1143,7 @@ class Service extends Model implements IDs $cando = FALSE; foreach ($roles as $role) { - if ($myrole <= array_search($role,User::$role_order)) { + if ($myrole <= array_search($role,User::role_order)) { $cando = TRUE; break; @@ -1234,14 +1192,14 @@ class Service extends Model implements IDs } /** - * Determine if a service is active. It is active, if active=1, or the order_status is not in inactive_status[] + * Determine if a service is active. It is active, if active=1, or the order_status is not in self::INACTIVE_STATUS[] * * @return bool * @todo Remove active and have order_status reflect whether active or not */ public function isActive(): bool { - return $this->active OR ($this->order_status AND ! in_array($this->order_status,$this->inactive_status)); + return $this->active OR ($this->order_status AND ! in_array($this->order_status,self::INACTIVE_STATUS)); } /** @@ -1323,7 +1281,7 @@ class Service extends Model implements IDs { return ! $this->active AND ! is_null($this->order_status) - AND ! in_array($this->order_status,array_merge($this->inactive_status,['INACTIVE'])); + AND ! in_array($this->order_status,array_merge(self::INACTIVE_STATUS,['INACTIVE'])); } /** @@ -1464,6 +1422,6 @@ class Service extends Model implements IDs */ public function wasCancelled(): bool { - return in_array($this->order_status,$this->inactive_status); + return in_array($this->order_status,self::INACTIVE_STATUS); } } diff --git a/app/Models/User.php b/app/Models/User.php index 0a1a310..6142ca4 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Session; use Laravel\Passport\HasApiTokens; -use Leenooks\Carbon; +use Leenooks\Traits\ScopeActive; use Leenooks\Traits\UserSwitch; use App\Notifications\ResetPassword as ResetPasswordNotification; @@ -25,7 +25,7 @@ use App\Traits\{QueryCacheableConfig,SiteID}; */ class User extends Authenticatable { - use HasFactory,HasApiTokens,Notifiable,UserSwitch,QueryCacheableConfig,SiteID; + use HasFactory,HasApiTokens,Notifiable,UserSwitch,QueryCacheableConfig,SiteID,ScopeActive; private const CACHE_TIME = 3600; @@ -41,7 +41,9 @@ class User extends Authenticatable * @var array */ protected $fillable = [ - 'name', 'email', 'password', + 'name', + 'email', + 'password', ]; /** @@ -56,14 +58,27 @@ class User extends Authenticatable /** * Role hierarchy order + * * @var array */ - public static $role_order = [ + public const role_order = [ 'wholesaler', 'reseller', 'customer', ]; + /* OVERRIDES */ + + /** + * Users password reset email notification + * + * @param string $token + */ + public function sendPasswordResetNotification($token) + { + $this->notify((new ResetPasswordNotification($token))->onQueue('high')); + } + /* RELATIONS */ /** @@ -81,23 +96,14 @@ class User extends Authenticatable } /** - * The agents that this users manages + * This users invoices * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough */ - public function agents() { - return $this->hasMany(static::class,'parent_id','id')->with('agents'); - } - - /** - * The clients that this user has - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function clients() { - return $this - ->hasMany(static::class,'parent_id','id') - ->with('clients'); + public function invoices() + { + return $this->hasManyThrough(Invoice::class,Account::class) + ->active(); } /** @@ -110,17 +116,6 @@ class User extends Authenticatable return $this->belongsTo(Language::class); } - /** - * This users invoices - * - * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough - */ - public function invoices() - { - return $this->hasManyThrough(Invoice::class,Account::class) - ->active(); - } - /** * The payments this user has made * @@ -153,41 +148,16 @@ class User extends Authenticatable ->active(); } - /** - * The site this user is configured to access - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function site() - { - return $this->belongsTo(Site::class); - } - - /** - * This users supplier/reseller - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - protected function supplier() - { - return $this->belongsTo(static::class,'parent_id','id'); - } - - /** - * Who this user supplies to - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - protected function suppliers() { - return $this->hasMany(static::class,'parent_id','id'); - } - /* ATTRIBUTES */ - public function getActiveDisplayAttribute($value) + /** + * This is an alias method, as it is used by the framework + * + * @return string + */ + public function getNameAttribute(): string { - abort(500,'deprecated:'.__METHOD__); - return sprintf('%s',$this->active ? 'primary' : 'danger',$this->active ? 'Active' : 'Inactive'); + return $this->getFullNameAttribute(); } /** @@ -200,35 +170,6 @@ class User extends Authenticatable return sprintf('%s %s',$this->firstname,$this->lastname); } - /** - * A list of all invoices currently unpaid - * - * @return mixed - */ - public function getInvoicesDueAttribute() - { - return $this->invoices - ->where('active',TRUE) - ->sortBy('id') - ->transform(function ($item) { if ($item->due > 0) return $item; }) - ->reverse() - ->filter(); - } - - /** - * Return a Carbon Date if it has a value. - * - * @param $value - * @return Carbon - * @throws \Exception - * @todo This attribute is not in the schema - */ - public function getLastAccessAttribute($value) - { - if (! is_null($value)) - return new Carbon($value); - } - /** * Return my accounts * @@ -239,28 +180,6 @@ class User extends Authenticatable return $this->accounts->where('user_id',$this->id); } - /** - * @deprecated Use static::getFullNameAttribute() - * @return mixed - */ - public function getNameAttribute() - { - return $this->full_name; - } - - /** - * Return a list of the payments that the user has made - * - * @return mixed - * @todo Merge this with payments() - */ - public function getPaymentHistoryAttribute() - { - return $this->payments - ->sortBy('payment_date') - ->reverse(); - } - /** * Return a friendly string of this persons role * @return string @@ -270,61 +189,18 @@ class User extends Authenticatable return ucfirst($this->role()); } - public function getServicesCountHtmlAttribute() - { - abort(500,'deprecated:'.__METHOD__); - return sprintf('%s /%s',$this->services->where('active',TRUE)->count(),$this->services->count()); - } - public function getSurFirstNameAttribute() { return sprintf('%s, %s',$this->lastname,$this->firstname); } - public function getSwitchUrlAttribute() - { - abort(500,'deprecated:'.__METHOD__); - return sprintf('',$this->id); - } - - public function getUserIdAttribute() - { - abort(500,'deprecated:'.__METHOD__); - return sprintf('%02s-%04s',$this->site_id,$this->id); - } - - public function getUserIdUrlAttribute() - { - abort(500,'deprecated:'.__METHOD__); - return sprintf('%s',$this->id,$this->user_id); - } - - /* METHODS */ - - /** - * Users password reset email notification - * - * @param string $token - */ - public function sendPasswordResetNotification($token) - { - $this->notify((new ResetPasswordNotification($token))->onQueue('high')); - } - /* SCOPES */ - // @todo use trait - public function scopeActive() - { - return $this->where('active',TRUE); - } - /** * Search for a record * * @param $query * @param string $term - * @return */ public function scopeSearch($query,string $term) { @@ -358,120 +234,6 @@ class User extends Authenticatable /* METHODS */ - /** - * Determine if the user is an admin of the user with $id - * - * @param $id - * @return bool - */ - public function isAdmin($id): bool - { - return $id AND $this->isReseller() AND $this->accounts->pluck('user_id')->contains($id); - } - - /** - * Get a list of accounts for the clients of this user - * - * @return DatabaseCollection - * @deprecated Use rtm_accounts() - */ - public function all_accounts(): DatabaseCollection - { - throw new \Exception('deprecated'); - abort(500,'deprecated:'.__METHOD__); - $result = new DatabaseCollection(); - $clients = $this->all_clients(); - - foreach ($clients->pluck('accounts') as $accounts) { - foreach ($accounts as $o) { - if (! $o->active) - continue; - - $result->push($o); - } - } - - // Include my accounts - foreach ($this->accounts as $o) { - if (! $o->active) - continue; - - $result->push($o); - } - - $result->load('user.accounts'); - - return $result; - } - - /** - * Get a list of clients that this user is responsible for. - * - * @param int $level - * @param DatabaseCollection|null $clients - * @return DatabaseCollection - * @deprecated Use rtm_accounts() to determine this - */ - public function all_clients($level=0,DatabaseCollection $clients=NULL): DatabaseCollection - { - $result = is_null($clients) ? $this->clients : $clients; - - $result - ->filter(function($item) { return $item->active; }) - ->transform(function($item) use ($level) { $item->level = $level; return $item; }); - - foreach ($result->pluck('clients') as $clients) { - foreach ($this->all_clients($level+1,$clients) as $o) { - if (! $o->active) - continue; - - $result->push($o); - } - } - - return $result; - } - - /** - * @return mixed - * @deprecated Use rtm_accounts() to determine this list - */ - public function all_client_service_inactive() - { - $s = Service::InActive(); - $aa = $this->all_accounts()->pluck('id')->unique()->toArray(); - - return $s->get()->filter(function($item) use ($aa) { - return in_array($item->account_id,$aa); - }); - } - - /** - * List of all this users agents, recursively - * - * @param int $level - * @return Collection - * @deprecated Use rtm_accounts() - */ - public function all_agents($level=0) - { - $result = collect(); - - foreach ($this->agents as $o) { - if (! $o->active OR ! $o->agents->count()) - continue; - - $o->level = $level; - - $result->push($o); - - // Include agents of agents - $result->push($o->all_agents($level+1)); - } - - return $result->flatten(); - } - /** * Show this user's clients with service movements * @@ -488,6 +250,17 @@ class User extends Authenticatable ->get(); } + /** + * Determine if the user is an admin of the user with $id + * + * @param $id + * @return bool + */ + public function isAdmin($id): bool + { + return $id AND $this->isReseller() AND $this->accounts->pluck('user_id')->contains($id); + } + /** * Determine if the logged in user is a reseller or wholesaler * @@ -649,33 +422,6 @@ class User extends Authenticatable ->from($summary,'summary'); } - public function query_payment_summary() - { - $payment = (new Payment) - ->select([ - DB::raw('payment_id AS id'), - DB::raw('SUM(allocate) AS allocate'), - - ]) - ->from($this->query_payment_items(),'PI') - //->where('payments.active',TRUE) // @todo To implement - ->groupBy(['payment_id']); - - return (new Payment) - ->select([ - DB::raw('payments.id AS id'), - 'date_orig', - 'payment_date', - 'total_amt', - //'fees_amt', - DB::raw('total_amt-allocate AS balance'), - ]) - ->rightJoin('payments',['payments.id'=>'summary.id']) - //->where('payments.active',TRUE) // @todo To implement - ->whereIN('account_id',$this->all_accounts()->pluck('id')->unique()->toArray()) - ->from($payment,'summary'); - } - /** * Determine what the logged in user's role is * + Wholesaler - aka Super User diff --git a/resources/views/email/admin/order/approve.blade.php b/resources/views/email/admin/order/approve.blade.php index ca4b9c5..3a9aeb4 100644 --- a/resources/views/email/admin/order/approve.blade.php +++ b/resources/views/email/admin/order/approve.blade.php @@ -5,8 +5,8 @@ Please order the following... | Service | Details | | :---------- | :---------------- | | Logged User | {{ Auth::user()->id }} | -| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) | -| Service ID | {!! $service->service_id_url !!} | +| Account | {{ $service->account_name }} | +| Service ID | {{ $service->sid }} | | Product | {{ $service->product_name }} | @switch($service->product_category) @case('BROADBAND') diff --git a/resources/views/email/admin/order/reject.blade.php b/resources/views/email/admin/order/reject.blade.php index 8f9bb23..660678f 100644 --- a/resources/views/email/admin/order/reject.blade.php +++ b/resources/views/email/admin/order/reject.blade.php @@ -6,8 +6,8 @@ @component('mail::table') | Service | Details | | :---------- | :---------------- | -| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) | -| Service ID | {!! $service->service_id_url !!} | +| Account | {{ $service->account_name }} | +| Service ID | {{ $service->sid }} | | Product | {{ $service->product_name }} | @switch($service->category) @case('BROADBAND') diff --git a/resources/views/email/admin/service/cancel.blade.php b/resources/views/email/admin/service/cancel.blade.php index 6c62f9e..d78301a 100644 --- a/resources/views/email/admin/service/cancel.blade.php +++ b/resources/views/email/admin/service/cancel.blade.php @@ -5,8 +5,8 @@ Please cancel the following... | Service | Details | | :---------- | :---------------- | | Logged User | {{ Auth::user()->id }} | -| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) | -| Service ID | {!! $service->service_id_url !!} | +| Account | {{ $service->account_name }} | +| Service ID | {{ $service->sid }} | | Product | {{ $service->product_name }} | @switch($service->product_category) @case('BROADBAND') diff --git a/resources/views/email/admin/service/change.blade.php b/resources/views/email/admin/service/change.blade.php index e098aab..7ef557a 100644 --- a/resources/views/email/admin/service/change.blade.php +++ b/resources/views/email/admin/service/change.blade.php @@ -5,8 +5,8 @@ Please change the following... | Service | Details | | :---------- | :---------------- | | Logged User | {{ Auth::user()->id }} -| Account | {{ $service->account_name }} ({!! $service->account->account_id_url !!}) | -| Service ID | {!! $service->service_id_url !!} | +| Account | {{ $service->account_name }} | +| Service ID | {{ $service->sid }} | | Product | {{ $service->product_name }} | @switch($service->product_category) @case('BROADBAND') diff --git a/resources/views/email/system/broadband_traffic_mismatch.blade.php b/resources/views/email/system/broadband_traffic_mismatch.blade.php index 4a141b0..aa2eaa3 100644 --- a/resources/views/email/system/broadband_traffic_mismatch.blade.php +++ b/resources/views/email/system/broadband_traffic_mismatch.blade.php @@ -1,5 +1,5 @@ @component('mail::message',['site'=>$site,'heading'=>'Traffic Mismatch: '.$date]) -Hi {{ isset($user) ? $user->name.',' : '' }} +Hi {{ isset($user) ? $user->full_name.',' : '' }} The traffic import today, had mismatching records. A request to have those login removed has been generated. diff --git a/resources/views/email/system/social_link.blade.php b/resources/views/email/system/social_link.blade.php index 58f482a..f4de80b 100644 --- a/resources/views/email/system/social_link.blade.php +++ b/resources/views/email/system/social_link.blade.php @@ -1,5 +1,5 @@ @component('mail::message',['site'=>$site,'heading'=>'Link Your Account']) -Hi {{ isset($user) ? $user->name.',' : '' }} +Hi {{ isset($user) ? $user->full_name.',' : '' }} A request was made to link your account to a social login. If you didnt make this request, you can ignore this, and the request will be ignored. diff --git a/resources/views/email/system/test_email.blade.php b/resources/views/email/system/test_email.blade.php index 1f6c100..d3abfe1 100644 --- a/resources/views/email/system/test_email.blade.php +++ b/resources/views/email/system/test_email.blade.php @@ -1,5 +1,5 @@ @component('mail::message',['site'=>$site,'heading'=>'System Test Email']) -Hi {{ isset($user) ? $user->name.',' : '' }} +Hi {{ isset($user) ? $user->full_name.',' : '' }} This is just a test email to validate that you can receive emails from us. diff --git a/resources/views/email/user/invoice.blade.php b/resources/views/email/user/invoice.blade.php index 07cb466..d9e79bc 100644 --- a/resources/views/email/user/invoice.blade.php +++ b/resources/views/email/user/invoice.blade.php @@ -1,5 +1,5 @@ @component('mail::message',['site'=>$site,'heading'=>'Invoice: '.$invoice->id]) -Hi {{ isset($user) ? $user->name.',' : '' }} +Hi {{ isset($user) ? $user->full_name.',' : '' }} A new invoice has been generated on your account. A summary of that invoice is below. diff --git a/resources/views/email/user/passwordreset.blade.php b/resources/views/email/user/passwordreset.blade.php index d256bb3..800b6a7 100644 --- a/resources/views/email/user/passwordreset.blade.php +++ b/resources/views/email/user/passwordreset.blade.php @@ -1,5 +1,5 @@ @component('mail::message',['site'=>$site,'heading'=>'Password Reset']) -Hi {{ isset($user) ? $user->name.',' : '' }} +Hi {{ isset($user) ? $user->full_name.',' : '' }} You are receiving this email because we received a password reset request for your account. diff --git a/resources/views/theme/backend/adminlte/r/agents.blade.php b/resources/views/theme/backend/adminlte/r/agents.blade.php deleted file mode 100644 index cce9558..0000000 --- a/resources/views/theme/backend/adminlte/r/agents.blade.php +++ /dev/null @@ -1,67 +0,0 @@ -
ID | -Name | -Level | -
---|---|---|
Count {{ $user->all_agents()->count() }} | -- |
No Agents Active
- @endif -Profile | -ID | -Name | -Active | -Services | -Level | -
---|---|---|---|---|---|
Count {{ $user->all_clients()->count() }} | -- |
No Clients Active
- @endif -Account | -{{ $o->account->aid }} | +{{ $o->account->sid }} |
---|---|---|
Status | diff --git a/resources/views/theme/frontend/metronic/order/home.blade.php b/resources/views/theme/frontend/metronic/order/home.blade.php index 49b0e72..e93644a 100644 --- a/resources/views/theme/frontend/metronic/order/home.blade.php +++ b/resources/views/theme/frontend/metronic/order/home.blade.php @@ -51,7 +51,7 @@ diff --git a/routes/api.php b/routes/api.php index a4d0fbf..d1d83b7 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,9 +1,6 @@ ['auth:api','role:wholesaler']], function() { Route::get('a/supplier_products',[ProductController::class,'api_supplier_products']); }); -// Reseller API calls -Route::group(['middleware'=>['auth:api','role:reseller']], function() { -// Route::get('/r/agents','ResellerServicesController@agents'); - Route::get('/r/accounts',[ResellerServicesController::class,'accounts']); - Route::get('/r/services/{o}',[ResellerServicesController::class,'services']) - ->where('o','[0-9]+'); -// Route::get('/r/clients','ResellerServicesController@clients'); -// Route::get('/r/service_inactive','ResellerServicesController@service_inactive'); - Route::post('r/invoices/{o}',[AdminController::class,'pay_invoices']) - ->where('o','[0-9]+') - ->middleware(['theme:adminlte-be','role:wholesaler']); -}); - Route::group(['middleware'=>'auth:api'], function() { Route::post('/u/checkout/fee/{o}',[CheckoutController::class,'fee']) ->where('o','[0-9]+');