Skip to content

Commit de65813

Browse files
authored
Merge pull request #1822 from Blair2004/v5.0.x
V5.0.x
2 parents 327da6f + 44bb6c6 commit de65813

File tree

265 files changed

+9916
-8867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+9916
-8867
lines changed

app/Classes/CrudForm.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
namespace App\Classes;
3+
4+
class CrudForm
5+
{
6+
// @todo
7+
}

app/Classes/CrudInput.php

+236
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
<?php
2+
namespace App\Services;
3+
4+
class CrudInput
5+
{
6+
public static function text( $label, $name, $validation = '', $description = '', $readonly = false, $type = 'text' )
7+
{
8+
return compact( 'label', 'name', 'validation', 'description', 'readonly', 'type' );
9+
}
10+
11+
public static function password( $label, $name, $validation = '', $description = '', $readonly = false )
12+
{
13+
return self::text(
14+
label: $label,
15+
name: $name,
16+
validation: $validation,
17+
description: $description,
18+
readonly: $readonly,
19+
type: 'password'
20+
);
21+
}
22+
23+
public static function email( $label, $name, $validation = '', $description = '', $readonly = false )
24+
{
25+
return self::text(
26+
label: $label,
27+
name: $name,
28+
validation: $validation,
29+
description: $description,
30+
readonly: $readonly,
31+
type: 'email'
32+
);
33+
}
34+
35+
public static function number( $label, $name, $validation = '', $description = '', $readonly = false, $type = 'number' )
36+
{
37+
return self::text(
38+
label: $label,
39+
name: $name,
40+
validation: $validation,
41+
description: $description,
42+
readonly: $readonly,
43+
type: 'number'
44+
);
45+
}
46+
47+
public static function tel( $label, $name, $validation = '', $description = '', $readonly = false, $type = 'tel' )
48+
{
49+
return self::text(
50+
label: $label,
51+
name: $name,
52+
validation: $validation,
53+
description: $description,
54+
readonly: $readonly,
55+
type: 'tel'
56+
);
57+
}
58+
59+
public static function hidden( $label, $name, $validation = '', $description = '', $readonly = false, $type = 'hidden' )
60+
{
61+
return self::text(
62+
label: $label,
63+
name: $name,
64+
validation: $validation,
65+
description: $description,
66+
readonly: $readonly,
67+
type: 'hidden'
68+
);
69+
}
70+
71+
public static function date( $label, $name, $validation = '', $description = '', $readonly = false, $type = 'date' )
72+
{
73+
return self::text(
74+
label: $label,
75+
name: $name,
76+
validation: $validation,
77+
description: $description,
78+
readonly: $readonly,
79+
type: 'date'
80+
);
81+
}
82+
83+
public static function select( $label, $name, $options, $validation = '', $description = '', $readonly = false, $type = 'text' )
84+
{
85+
return compact( 'label', 'name', 'validation', 'options', 'description', 'readonly', 'type' );
86+
}
87+
88+
public static function searchSelect( $label, $name, $options = [], $validation = '', $description = '', $readonly = false )
89+
{
90+
return self::select(
91+
label: $label,
92+
name: $name,
93+
validation: $validation,
94+
description: $description,
95+
options: $options,
96+
type: 'search-select',
97+
);
98+
}
99+
100+
public static function textarea( $label, $name, $validation = '', $description = '', $readonly = false )
101+
{
102+
return self::text(
103+
label: $label,
104+
name: $name,
105+
validation: $validation,
106+
description: $description,
107+
readonly: $readonly,
108+
type: 'textarea'
109+
);
110+
}
111+
112+
public static function checkbox( $label, $name, $validation = '', $description = '', $readonly = false )
113+
{
114+
return self::text(
115+
label: $label,
116+
name: $name,
117+
validation: $validation,
118+
description: $description,
119+
readonly: $readonly,
120+
type: 'checkbox'
121+
);
122+
}
123+
124+
public static function multiselect( $label, $name, $options, $validation = '', $description = '', $readonly = false )
125+
{
126+
return self::select(
127+
label: $label,
128+
name: $name,
129+
validation: $validation,
130+
options: $options,
131+
description: $description,
132+
readonly: $readonly,
133+
type: 'multiselect'
134+
);
135+
}
136+
137+
public static function inlineMultiselect( $label, $name, $options, $validation = '', $description = '', $readonly = false )
138+
{
139+
return self::select(
140+
label: $label,
141+
name: $name,
142+
validation: $validation,
143+
options: $options,
144+
description: $description,
145+
readonly: $readonly,
146+
type: 'inline-multiselect'
147+
);
148+
}
149+
150+
public static function selectAudio( $label, $name, $options, $validation = '', $description = '', $readonly = false )
151+
{
152+
return self::select(
153+
label: $label,
154+
name: $name,
155+
validation: $validation,
156+
options: $options,
157+
description: $description,
158+
readonly: $readonly,
159+
type: 'select-audio'
160+
);
161+
}
162+
163+
public static function switch( $label, $name, $options, $validation = '', $description = '', $readonly = false )
164+
{
165+
return self::select(
166+
label: $label,
167+
name: $name,
168+
validation: $validation,
169+
options: $options,
170+
description: $description,
171+
readonly: $readonly,
172+
type: 'switch'
173+
);
174+
}
175+
176+
public static function media( $label, $name, $validation = '', $description = '', $readonly = false )
177+
{
178+
return self::text(
179+
label: $label,
180+
name: $name,
181+
validation: $validation,
182+
description: $description,
183+
readonly: $readonly,
184+
type: 'media'
185+
);
186+
}
187+
188+
public static function ckeditor( $label, $name, $validation = '', $description = '', $readonly = false )
189+
{
190+
return self::text(
191+
label: $label,
192+
name: $name,
193+
validation: $validation,
194+
description: $description,
195+
readonly: $readonly,
196+
type: 'ckeditor'
197+
);
198+
}
199+
200+
public static function datetime( $label, $name, $validation = '', $description = '', $readonly = false )
201+
{
202+
return self::text(
203+
label: $label,
204+
name: $name,
205+
validation: $validation,
206+
description: $description,
207+
readonly: $readonly,
208+
type: 'datetimepicker'
209+
);
210+
}
211+
212+
public static function daterange( $label, $name, $validation = '', $description = '', $readonly = false )
213+
{
214+
return self::text(
215+
label: $label,
216+
name: $name,
217+
validation: $validation,
218+
description: $description,
219+
readonly: $readonly,
220+
type: 'daterangepicker'
221+
);
222+
}
223+
224+
public static function custom( $label, $name, $type, $validation = '', $description = '', $readonly = false, $options = [] )
225+
{
226+
return self::select(
227+
label: $label,
228+
name: $name,
229+
validation: $validation,
230+
description: $description,
231+
readonly: $readonly,
232+
options: $options,
233+
type: $type
234+
);
235+
}
236+
}

app/Classes/CrudTable.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace App\Classes;
3+
4+
class CrudTable
5+
{
6+
public static function columns( ...$args )
7+
{
8+
return collect( $args )->mapWithKeys( function( $column ) {
9+
return [
10+
$column[ 'identifier' ] => $column
11+
];
12+
})->toArray();
13+
}
14+
15+
public static function column( $label, $identifier, $sort = false, $attributes = [] )
16+
{
17+
return compact( 'identifier', 'label', 'sort', 'attributes' );
18+
}
19+
20+
public static function attribute( $label, $column )
21+
{
22+
return compact( 'label', 'column' );
23+
}
24+
}

app/Classes/JsonResponse.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
namespace App\Classes;
3+
4+
class JsonResponse
5+
{
6+
public static function success( $data = null, $message = null )
7+
{
8+
return response()->json([
9+
'success' => true,
10+
'data' => $data,
11+
'message' => $message
12+
]);
13+
}
14+
15+
public static function error( $message = null, $data = null )
16+
{
17+
return response()->json([
18+
'success' => false,
19+
'data' => $data,
20+
'message' => $message
21+
], 403 );
22+
}
23+
}

app/Console/Commands/DoctorCommand.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class DoctorCommand extends Command
2525
{--fix-transactions-orders}
2626
{--set-unit-visibility=}
2727
{--products=}
28-
{--fix-duplicate-options}';
28+
{--fix-duplicate-options}
29+
{--fix-products-cogs}';
2930

3031
/**
3132
* The console command description.
@@ -91,6 +92,10 @@ public function handle()
9192
return $doctorService->fixTransactionsOrders();
9293
}
9394

95+
if ( $this->option( 'fix-products-cogs' ) ) {
96+
return $doctorService->fixProductsCogs();
97+
}
98+
9499
if ( $this->option( 'clear-modules-temp' ) ) {
95100
return $doctorService->clearTemporaryFiles();
96101
}

app/Crud/CouponCrud.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ public function bulkAction( Request $request ): bool|array
726726

727727
$status = [
728728
'success' => 0,
729-
'failed' => 0,
729+
'error' => 0,
730730
];
731731

732732
foreach ( $request->input( 'entries' ) as $id ) {
@@ -736,7 +736,7 @@ public function bulkAction( Request $request ): bool|array
736736
$entity->delete();
737737
$status[ 'success' ]++;
738738
} else {
739-
$status[ 'failed' ]++;
739+
$status[ 'error' ]++;
740740
}
741741
}
742742

app/Crud/CouponOrderHistoryCrud.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ public function bulkAction( Request $request )
505505

506506
$status = [
507507
'success' => 0,
508-
'failed' => 0,
508+
'error' => 0,
509509
];
510510

511511
foreach ( $request->input( 'entries' ) as $id ) {
@@ -514,7 +514,7 @@ public function bulkAction( Request $request )
514514
$entity->delete();
515515
$status[ 'success' ]++;
516516
} else {
517-
$status[ 'failed' ]++;
517+
$status[ 'error' ]++;
518518
}
519519
}
520520

app/Crud/CustomerAccountCrud.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ public function bulkAction( Request $request )
545545

546546
$status = [
547547
'success' => 0,
548-
'failed' => 0,
548+
'error' => 0,
549549
];
550550

551551
foreach ( $request->input( 'entries' ) as $id ) {
@@ -554,7 +554,7 @@ public function bulkAction( Request $request )
554554
$entity->delete();
555555
$status[ 'success' ]++;
556556
} else {
557-
$status[ 'failed' ]++;
557+
$status[ 'error' ]++;
558558
}
559559
}
560560

app/Crud/CustomerCouponCrud.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public function bulkAction( Request $request )
431431

432432
$status = [
433433
'success' => 0,
434-
'failed' => 0,
434+
'error' => 0,
435435
];
436436

437437
foreach ( $request->input( 'entries' ) as $id ) {
@@ -440,7 +440,7 @@ public function bulkAction( Request $request )
440440
$entity->delete();
441441
$status[ 'success' ]++;
442442
} else {
443-
$status[ 'failed' ]++;
443+
$status[ 'error' ]++;
444444
}
445445
}
446446

0 commit comments

Comments
 (0)