From: Vincent Vanwaelscappel Date: Tue, 14 Mar 2023 17:15:09 +0000 (+0100) Subject: wip #5803 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=da4e9ea0bf12d29be59fe0764ff9a885dfa59070;p=cubedesigners_userdatabase.git wip #5803 @1 --- diff --git a/src/app/Jobs/ApplyPermissionsToUsers.php b/src/app/Jobs/ApplyPermissionsToUsers.php new file mode 100644 index 0000000..f5979e5 --- /dev/null +++ b/src/app/Jobs/ApplyPermissionsToUsers.php @@ -0,0 +1,19 @@ +all() as $company) { + if ($company->id == 7) { + continue; + } + dd($company); + } + } +} diff --git a/src/app/Models/Company.php b/src/app/Models/Company.php index 71685da..6e8400b 100644 --- a/src/app/Models/Company.php +++ b/src/app/Models/Company.php @@ -32,17 +32,6 @@ class Company extends CubistMagicAbstractModel 'column' => true, 'tab' => __('Informations')]); - $this->addField(['name' => 'address', - 'type' => 'BunchOfFields', - 'bunch' => Address::class, - 'label' => __('Adresse'), - 'tab' => __('Adresses')]); - - $this->addField(['name' => 'billing_address', - 'type' => 'BunchOfFields', - 'bunch' => Address::class, - 'label' => __('Adresse de facturation'), - 'tab' => __('Adresses')]); $this->addField(['name' => 'vat_number', 'type' => 'VATNumber', @@ -75,10 +64,51 @@ class Company extends CubistMagicAbstractModel 'optionsmodel' => User::class, 'attribute' => 'nameWithCompany', 'label' => __('Administrateur'), - 'tab' => __('Informations'), + 'tab' => __('Permissions'), + 'column' => true, 'default' => $buid, ]); + $this->addField(['name' => 'e1_ws_grade', + 'label' => __('Permissions Fluidbook'), + 'type' => 'SelectFromArray', + 'options' => [0 => __('Pas d\'accès'), + 1 => __('Client'), + 2 => __('Client (création)'), + 3 => __('Revendeur'), + 4 => __('Revendeur (création)'), + 5 => __('Admin'), + ], + 'default' => 0, + 'database_default' => 0, + 'allows_empty' => false, + 'column' => true, + 'tab' => __('Permissions')] + ); + + $this->addField(['name' => 'permissions_elearning', + 'label' => __('Permissions e-Learning'), + 'type' => 'Checkbox', + 'default' => 0, + 'database_default' => 0, + 'allows_empty' => false, + 'column' => true, + 'tab' => __('Permissions')] + ); + + $this->addField(['name' => 'address', + 'type' => 'BunchOfFields', + 'bunch' => Address::class, + 'label' => __('Adresse'), + 'tab' => __('Adresses')]); + + $this->addField(['name' => 'billing_address', + 'type' => 'BunchOfFields', + 'bunch' => Address::class, + 'label' => __('Adresse de facturation'), + 'tab' => __('Adresses')]); + + $this->addField([ 'name' => 'users', 'type' => Users::class, @@ -130,17 +160,7 @@ class Company extends CubistMagicAbstractModel $this->addField(['name' => 'e1_ws_signatures', 'type' => 'Hidden']); - $this->addField(['name' => 'e1_ws_grade', - 'label' => 'Grade Workshop V2', - 'type' => 'SelectFromArray', - 'options' => [0 => __('Pas d\'accès'), - 1 => __('Client'), - 2 => __('Client (création)'), - 3 => __('Revendeur'), - 4 => __('Revendeur (création)'), - 5 => __('Admin'), - ], - 'tab' => 'Workshop V2']); + } public function isOwner($user) diff --git a/src/resources/views/fields/users.blade.php b/src/resources/views/fields/users.blade.php index 34c90fe..370e79d 100644 --- a/src/resources/views/fields/users.blade.php +++ b/src/resources/views/fields/users.blade.php @@ -7,12 +7,16 @@ class="btn btn-light btn-small"> {{__('Ajouter un contact')}} - @foreach($entry->getUsers() as $id=>$name) + @foreach($entry->getUsers() as $id=>$user) - - - + + +
{{$id}}{{$name}} {{__('Se connecter comme')}}{{$id}}{{($user['name']?:'-')}} + @if($user['enabled']) + {{__('Se connecter comme')}} + @endif + @endpush