Browse Source

modifiche

Roberto Santini 3 years ago
parent
commit
45454522dc

+ 1
- 1
app/Http/Controllers/UserController.php View File

27
 
27
 
28
     $sign_path_tecnico = 'sign_tecnico_'.time().'.png';
28
     $sign_path_tecnico = 'sign_tecnico_'.time().'.png';
29
     $encoded_image = explode(",", $request->signature_image_tecnico)[1];
29
     $encoded_image = explode(",", $request->signature_image_tecnico)[1];
30
-    $user->firma = base64_decode($encoded_image);
30
+    $user->firma = pg_escape_bytea($encoded_image);
31
     $user->save();
31
     $user->save();
32
 
32
 
33
     Session::flash('flash_message', 'Profilo aggiornato');
33
     Session::flash('flash_message', 'Profilo aggiornato');

+ 13
- 13
app/Models/AbstractModels/AbstractUser.php View File

10
 
10
 
11
 abstract class AbstractUser extends Model
11
 abstract class AbstractUser extends Model
12
 {
12
 {
13
-    /**  
13
+    /**
14
      * The table associated with the model.
14
      * The table associated with the model.
15
-     * 
15
+     *
16
      * @var string
16
      * @var string
17
      */
17
      */
18
     protected $table = 'user';
18
     protected $table = 'user';
19
-    
20
-    /**  
19
+
20
+    /**
21
      * Primary key type.
21
      * Primary key type.
22
-     * 
22
+     *
23
      * @var string
23
      * @var string
24
      */
24
      */
25
     protected $keyType = 'bigInteger';
25
     protected $keyType = 'bigInteger';
26
-    
27
-    /**  
26
+
27
+    /**
28
      * The attributes that should be cast to native types.
28
      * The attributes that should be cast to native types.
29
-     * 
29
+     *
30
      * @var array
30
      * @var array
31
      */
31
      */
32
     protected $casts = [
32
     protected $casts = [
33
         'id' => 'integer',
33
         'id' => 'integer',
34
         'redmine_id' => 'integer',
34
         'redmine_id' => 'integer',
35
         'azienda_id' => 'integer',
35
         'azienda_id' => 'integer',
36
-        'firma' => 'string',
36
+        // 'firma' => 'string',
37
         'created_at' => 'datetime',
37
         'created_at' => 'datetime',
38
         'updated_at' => 'datetime'
38
         'updated_at' => 'datetime'
39
     ];
39
     ];
40
-    
41
-    /**  
40
+
41
+    /**
42
      * The attributes that are mass assignable.
42
      * The attributes that are mass assignable.
43
-     * 
43
+     *
44
      * @var array
44
      * @var array
45
      */
45
      */
46
     protected $fillable = [
46
     protected $fillable = [
51
         'created_at',
51
         'created_at',
52
         'updated_at'
52
         'updated_at'
53
     ];
53
     ];
54
-    
54
+
55
     public function azienda()
55
     public function azienda()
56
     {
56
     {
57
         return $this->belongsTo('\App\Models\Azienda', 'azienda_id', 'id');
57
         return $this->belongsTo('\App\Models\Azienda', 'azienda_id', 'id');

+ 15
- 11
database/seeders/ConfigSeeder.php View File

4
 
4
 
5
 use Illuminate\Database\Seeder;
5
 use Illuminate\Database\Seeder;
6
 use App\Models\Config;
6
 use App\Models\Config;
7
+use App\Models\Azienda;
7
 
8
 
8
 class ConfigSeeder extends Seeder
9
 class ConfigSeeder extends Seeder
9
 {
10
 {
15
   public function run()
16
   public function run()
16
   {
17
   {
17
     // Configurazione
18
     // Configurazione
18
-    foreach(Config::getConfig() as $key => $group){
19
-      $order = 1;
20
-      foreach($group as $key2 => $c){
21
-        $config = Config::find($c['key']);
22
-        if($config == null){
23
-          $config = new Config;
24
-          $config->fill($c);
25
-          $config->order = $order;
26
-          $config->group = $key;
27
-          $config->save();
28
-          $order++;
19
+    foreach(Azienda::all() as $azienda){
20
+      foreach(Config::getConfig() as $key => $group){
21
+        $order = 1;
22
+        foreach($group as $key2 => $c){
23
+          $config = Config::where([['key', $c['key']], ['azienda_id', $azienda->id]])->first();
24
+          if($config == null){
25
+            $config = new Config;
26
+            $config->fill($c);
27
+            $config->azienda_id = $azienda->id;
28
+            $config->order = $order;
29
+            $config->group = $key;
30
+            $config->save();
31
+            $order++;
32
+          }
29
         }
33
         }
30
       }
34
       }
31
     }
35
     }

+ 1
- 1
resources/views/components/application-logo.blade.php View File

1
 @if(session('azienda') != null && session('azienda')->path_logo != null)
1
 @if(session('azienda') != null && session('azienda')->path_logo != null)
2
 <img src="{{ Storage::disk('azienda')->url(session('azienda')->path_logo) }}" {{ $attributes }}/>
2
 <img src="{{ Storage::disk('azienda')->url(session('azienda')->path_logo) }}" {{ $attributes }}/>
3
 @else
3
 @else
4
-<img src="{{ assets('logo_rm.png') }}" {{ $attributes }}/>
4
+<img src="{{ asset('logo_rm.png') }}" {{ $attributes }}/>
5
 @endif
5
 @endif

+ 1
- 1
resources/views/issue/pdf.blade.php View File

76
       <div style="height: 130px; width: 100%; position: fixed; left: 0; bottom: 0px;">
76
       <div style="height: 130px; width: 100%; position: fixed; left: 0; bottom: 0px;">
77
         <div class="box_sx">
77
         <div class="box_sx">
78
           <h2>Firma tecnico</h2>
78
           <h2>Firma tecnico</h2>
79
-          <img src="data:image/png;base64,{{ chunk_split(base64_encode($firmaTecnico)) }}" style="width: 80%"/>
79
+          <img src="data:image/png;base64,{!! stream_get_contents($firmaTecnico) !!}" style="width: 80%"/>
80
         </div>
80
         </div>
81
         <div class="box_dx">
81
         <div class="box_dx">
82
           <h2>Firma cliente</h2>
82
           <h2>Firma cliente</h2>

+ 4
- 1
resources/views/user/profilo.blade.php View File

2
 use App\Models\Config;
2
 use App\Models\Config;
3
 use App\Models\Issue;
3
 use App\Models\Issue;
4
 
4
 
5
+
6
+// dd(stream_get_contents($user->firma));
7
+
5
 ?>
8
 ?>
6
 <x-app-layout>
9
 <x-app-layout>
7
   <x-slot name="header">
10
   <x-slot name="header">
44
               @else
47
               @else
45
               {!! Form::label('', 'Firma salvata', ['style' => 'display: inline']) !!}
48
               {!! Form::label('', 'Firma salvata', ['style' => 'display: inline']) !!}
46
               <button type="submit" class="btn btn-sm btn-danger" name='elimina_firma'><i class="fas fa-trash"></i>Elimina</button>
49
               <button type="submit" class="btn btn-sm btn-danger" name='elimina_firma'><i class="fas fa-trash"></i>Elimina</button>
47
-              <img src="data:image/png;base64,{{ chunk_split(base64_encode($user->firma)) }}" />
50
+              <img src="data:image/png;base64,{!! stream_get_contents($user->firma) !!}" />
48
               @endif
51
               @endif
49
             </div>
52
             </div>
50
           </div>
53
           </div>

Loading…
Cancel
Save