Skip to content

Commit 3ff5161

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 0d6baa1 + 0c8ca6d commit 3ff5161

File tree

5 files changed

+86
-100
lines changed

5 files changed

+86
-100
lines changed

app/Models/Asset.php

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,51 +1946,44 @@ function ($query) use ($search_val) {
19461946
}
19471947

19481948
if ($fieldname == 'model') {
1949-
$query->where(
1950-
function ($query) use ($search_val) {
1951-
$query->whereHas(
1952-
'model', function ($query) use ($search_val) {
1953-
$query->where('models.name', 'LIKE', '%'.$search_val.'%');
1954-
}
1955-
);
1956-
}
1949+
$query->whereHas(
1950+
'model', function ($query) use ($search_val) {
1951+
$query->where('models.name', 'LIKE', '%'.$search_val.'%');
1952+
}
19571953
);
19581954
}
19591955

1956+
19601957
if ($fieldname == 'model_number') {
1961-
$query->where(
1962-
function ($query) use ($search_val) {
1963-
$query->whereHas(
1964-
'model', function ($query) use ($search_val) {
1965-
$query->where('models.model_number', 'LIKE', '%'.$search_val.'%');
1966-
}
1967-
);
1968-
}
1958+
$query->whereHas(
1959+
'model', function ($query) use ($search_val) {
1960+
$query->where('models.model_number', 'LIKE', '%'.$search_val.'%');
1961+
}
19691962
);
19701963
}
19711964

19721965

19731966
if ($fieldname == 'company') {
1974-
$query->where(
1975-
function ($query) use ($search_val) {
1976-
$query->whereHas(
1977-
'company', function ($query) use ($search_val) {
1978-
$query->where('companies.name', 'LIKE', '%'.$search_val.'%');
1979-
}
1980-
);
1981-
}
1967+
$query->whereHas(
1968+
'company', function ($query) use ($search_val) {
1969+
$query->where('companies.name', 'LIKE', '%'.$search_val.'%');
1970+
}
19821971
);
19831972
}
19841973

19851974
if ($fieldname == 'supplier') {
1986-
$query->where(
1987-
function ($query) use ($search_val) {
1988-
$query->whereHas(
1989-
'supplier', function ($query) use ($search_val) {
1990-
$query->where('suppliers.name', 'LIKE', '%'.$search_val.'%');
1991-
}
1992-
);
1993-
}
1975+
$query->whereHas(
1976+
'supplier', function ($query) use ($search_val) {
1977+
$query->where('suppliers.name', 'LIKE', '%'.$search_val.'%');
1978+
}
1979+
);
1980+
}
1981+
1982+
if ($fieldname == 'status_label') {
1983+
$query->whereHas(
1984+
'assetstatus', function ($query) use ($search_val) {
1985+
$query->where('status_labels.name', 'LIKE', '%'.$search_val.'%');
1986+
}
19941987
);
19951988
}
19961989

resources/macros/macros.php

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -39,71 +39,6 @@
3939
return $select;
4040
});
4141

42-
Form::macro('date_display_format', function ($name = 'date_display_format', $selected = null, $class = null) {
43-
$formats = [
44-
'Y-m-d',
45-
'D M d, Y',
46-
'M j, Y',
47-
'd M, Y',
48-
'm/d/Y',
49-
'n/d/y',
50-
'd/m/Y',
51-
'd.m.Y',
52-
'Y.m.d.',
53-
];
54-
55-
foreach ($formats as $format) {
56-
$date_display_formats[$format] = Carbon::parse(date('Y-m-d'))->format($format);
57-
}
58-
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:100%" aria-label="'.$name.'">';
59-
foreach ($date_display_formats as $format => $date_display_format) {
60-
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'">'.$date_display_format.'</option> ';
61-
}
62-
63-
$select .= '</select>';
64-
65-
return $select;
66-
});
67-
68-
Form::macro('time_display_format', function ($name = 'time_display_format', $selected = null, $class = null) {
69-
$formats = [
70-
'g:iA',
71-
'h:iA',
72-
'H:i',
73-
];
74-
75-
$datetime = date("y-m-d").' 14:00:00';
76-
foreach ($formats as $format) {
77-
$time_display_formats[$format] = Carbon::parse($datetime)->format($format);
78-
}
79-
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:150px" aria-label="'.$name.'">';
80-
foreach ($time_display_formats as $format => $time_display_format) {
81-
$select .= '<option value="'.$format.'"'.($selected == $format ? ' selected="selected" role="option" aria-selected="true"' : ' aria-selected="false"').'>'.$time_display_format.'</option> ';
82-
}
83-
84-
$select .= '</select>';
85-
86-
return $select;
87-
});
88-
89-
Form::macro('digit_separator', function ($name = 'digit_separator', $selected = null, $class = null) {
90-
$formats = [
91-
'1,234.56',
92-
'1.234,56',
93-
];
94-
95-
foreach ($formats as $format) {
96-
}
97-
$select = '<select name="'.$name.'" class="'.$class.'" style="min-width:120px">';
98-
foreach ($formats as $format_inner) {
99-
$select .= '<option value="'.$format_inner.'"'.($selected == $format_inner ? ' selected="selected"' : '').'>'.$format_inner.'</option> ';
100-
}
101-
102-
$select .= '</select>';
103-
104-
return $select;
105-
});
106-
10742
/**
10843
* Barcode macro
10944
* Generates the dropdown menu of available 1D barcodes
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@php
2+
$formats = [
3+
'Y-m-d',
4+
'D M d, Y',
5+
'M j, Y',
6+
'd M, Y',
7+
'm/d/Y',
8+
'n/d/y',
9+
'd/m/Y',
10+
'd.m.Y',
11+
'Y.m.d.',
12+
];
13+
14+
foreach ($formats as $format) {
15+
$date_display_formats[$format] = Carbon::parse(date('Y-m-d'))->format($format);
16+
}
17+
@endphp
18+
19+
<x-input.select {{ $attributes }}>
20+
@foreach($date_display_formats as $format => $date_display_format)
21+
<option
22+
value="{{ $format }}"
23+
@selected($selected == $format)
24+
role="option"
25+
>
26+
{{ $date_display_format }}
27+
</option>
28+
@endforeach
29+
</x-input.select>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@php
2+
$formats = [
3+
'g:iA',
4+
'h:iA',
5+
'H:i',
6+
];
7+
8+
$datetime = date("y-m-d").' 14:00:00';
9+
10+
foreach ($formats as $format) {
11+
$time_display_formats[$format] = Carbon::parse($datetime)->format($format);
12+
}
13+
@endphp
14+
15+
<x-input.select {{ $attributes }}>
16+
@foreach ($time_display_formats as $format => $time_display_format)
17+
<option
18+
value="{{ $format }}"
19+
@selected($selected == $format)
20+
>
21+
{{ $time_display_format }}
22+
</option>
23+
@endforeach
24+
</x-input.select>

resources/views/settings/localization.blade.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@
7676
<label for="time_display_format">{{ trans('general.time_and_date_display') }}</label>
7777
</div>
7878
<div class="col-md-5 col-xs-12">
79-
{!! Form::date_display_format('date_display_format', old('date_display_format', $setting->date_display_format), 'select2') !!}
79+
<x-input.date-display-format name="date_display_format" :selected="old('date_display_format', $setting->date_display_format)" style="min-width:100%" />
8080
</div>
8181
<div class="col-md-3 col-xs-12">
82-
{!! Form::time_display_format('time_display_format', old('time_display_format', $setting->time_display_format), 'select2') !!}
82+
<x-input.time-display-format name="time_display_format" :selected="old('time_display_format', $setting->time_display_format)" style="min-width:150px" />
8383
</div>
8484

8585
{!! $errors->first('time_display_format', '<div class="col-md-9 col-md-offset-3"><span class="alert-msg" aria-hidden="true">:message</span> </div>') !!}
@@ -103,7 +103,12 @@ class="form-control select2-container"
103103
id="default_currency"
104104
>
105105

106-
{!! Form::digit_separator('digit_separator', old('digit_separator', $setting->digit_separator), 'select2') !!}
106+
<x-input.select
107+
name="digit_separator"
108+
:options="['1,234.56', '1.234,56']"
109+
:selected="old('digit_separator', $setting->digit_separator)"
110+
style="min-width:120px"
111+
/>
107112

108113
{!! $errors->first('default_currency', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
109114
</div>

0 commit comments

Comments
 (0)