Merge branch 'develop' into trunk
This commit is contained in:
commit
09803e015c
4 changed files with 52 additions and 22 deletions
|
|
@ -7,6 +7,7 @@ use App\Lib\Helpers\FileStorageHelper;
|
|||
use App\Lib\Helpers\ToolboxHelper;
|
||||
use App\Traits\Models\HasTranslations;
|
||||
use App\Traits\Models\MiniCrudModel;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
|
|
@ -61,8 +62,8 @@ class News extends Model
|
|||
'data' => 'object',
|
||||
'locales' => 'array',
|
||||
'status' => 'bool',
|
||||
'publish_at' => 'timestamp',
|
||||
'unpublish_at' => 'timestamp'
|
||||
'publish_at' => 'datetime',
|
||||
'unpublish_at' => 'datetime'
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -191,6 +192,29 @@ class News extends Model
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter the current status following planification dates planificated_status
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPlanificatedStatusAttribute(): bool
|
||||
{
|
||||
/** @var \Carbon\Carbon|null */
|
||||
$publish_at = $this->publish_at;
|
||||
/** @var \Carbon\Carbon|null */
|
||||
$unpublish_at = $this->unpublish_at;
|
||||
if ($publish_at and $unpublish_at) {
|
||||
return $unpublish_at->greaterThanOrEqualTo(now()) and $publish_at->lessThan(now());
|
||||
}
|
||||
if ($publish_at) {
|
||||
return $publish_at->lessThan(now());
|
||||
}
|
||||
if ($unpublish_at) {
|
||||
return $unpublish_at->greaterThanOrEqualTo(now());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash boolean attributes modification messages
|
||||
*
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@
|
|||
"only with": "nur bei",
|
||||
"Our commitments": "Unsere verpflichtungen",
|
||||
"Our concept": "Unser Konzept",
|
||||
"Our free range ": "Usere Freiland",
|
||||
"Our Free-Range": "Usere Freiland",
|
||||
"Our free range ": "Unsere Freiland",
|
||||
"Our Free-Range": "Unsere Freiland",
|
||||
"Our products": "Unsere Produkte",
|
||||
"Our recipes": "Unsere Rezepte",
|
||||
"Page Expired": "Seite abgelaufen",
|
||||
|
|
|
|||
|
|
@ -12,11 +12,7 @@
|
|||
class="table-action"
|
||||
>
|
||||
<button
|
||||
v-if="
|
||||
displayHeaders.filter((header) => {
|
||||
return header;
|
||||
}).length > 1 && itemList.length > 1
|
||||
"
|
||||
v-if="hasHeader"
|
||||
@click.prevent="removeAllHeaders()"
|
||||
class="btn btn-sm btn-danger"
|
||||
:title="__('Remove all headers')"
|
||||
|
|
@ -30,11 +26,7 @@
|
|||
class="col-6 align-middle"
|
||||
>
|
||||
{{ __("Header") }}
|
||||
({{
|
||||
displayHeaders.filter((header) => {
|
||||
return header;
|
||||
}).length
|
||||
}})
|
||||
({{ countHeaders }})
|
||||
</th>
|
||||
<th
|
||||
v-for="(column, columnIndex) of itemColumns"
|
||||
|
|
@ -107,7 +99,7 @@
|
|||
:name="`${inputName}[${String(itemIndex)}][header]`"
|
||||
type="text"
|
||||
:placeholder="__('Recipe of chocolate cookies')"
|
||||
v-model="item['header' as keyof typeof item]"
|
||||
v-model="item['header']"
|
||||
>
|
||||
<FontAwesomeIcon
|
||||
icon="fa-solid fa-angles-right"
|
||||
|
|
@ -133,7 +125,7 @@
|
|||
class="form-control form-control-sm"
|
||||
:name="`${inputName}[${String(itemIndex)}][${column[0]}]`"
|
||||
:type="itemType[columnIndex]"
|
||||
v-model="item[column[0] as keyof typeof item]"
|
||||
v-model="item[column[0]]"
|
||||
:placeholder="inputPlaceholder[columnIndex]"
|
||||
:min="itemType[columnIndex] == 'number' ? '0' : undefined"
|
||||
>
|
||||
|
|
@ -195,7 +187,7 @@ export default defineComponent({
|
|||
},
|
||||
mixins: [trans, parseLaravelErrorMessages],
|
||||
data(): {
|
||||
itemList: Object[];
|
||||
itemList: Array<Record<string,string>>;
|
||||
itemColumns: string[][];
|
||||
itemLimit: number[];
|
||||
inputName: string;
|
||||
|
|
@ -207,11 +199,11 @@ export default defineComponent({
|
|||
displayBtnAdd: boolean;
|
||||
displayBtnRemove: boolean;
|
||||
displayHeader: boolean;
|
||||
displayHeaders: boolean[];
|
||||
displayHeaders: Array<boolean>;
|
||||
tooltipList: HTMLButtonElement[];
|
||||
} {
|
||||
return {
|
||||
itemList: [{}],
|
||||
itemList: [],
|
||||
itemColumns: [[""]],
|
||||
itemLimit: [0, 0],
|
||||
inputName: "",
|
||||
|
|
@ -227,6 +219,18 @@ export default defineComponent({
|
|||
tooltipList: [],
|
||||
};
|
||||
},
|
||||
computed : {
|
||||
hasHeader() {
|
||||
return this.displayHeaders.filter((header : boolean) => {
|
||||
return header;
|
||||
}).length > 1 && this.itemList.length > 1;
|
||||
},
|
||||
countHeaders() {
|
||||
return this.displayHeaders.filter((header: boolean) => {
|
||||
return header;
|
||||
}).length;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const json = String(this.$attrs.json ?? "{}");
|
||||
const data = JSON.parse(json);
|
||||
|
|
@ -258,7 +262,9 @@ export default defineComponent({
|
|||
}
|
||||
} else {
|
||||
this.itemList.forEach((item: { header?: string }, key) => {
|
||||
if (item.header) this.displayHeaders[key] = true;
|
||||
if (item.header) {
|
||||
this.displayHeaders[key] = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
type="datetime-local"
|
||||
data-form-type="date"
|
||||
aria-describedby="{{ $id }}Help"
|
||||
value="{{ old($name, ((isset($sliderModel) and $sliderModel->{$name}) ? $sliderModel->{$name}->format('Y-m-d\TH:i') : '')) }}">
|
||||
value="{{ old($name, ((isset($model) and $model->{$name}) ? $model->{$name}->format('Y-m-d\TH:i') : '')) }}">
|
||||
@include('modules.input-error', [
|
||||
'inputName' => $name,
|
||||
'helperId' => $id . 'Help',
|
||||
'helper' => (isset($sliderModel) and $sliderModel->{$name}) ? __('Leave empty for immediate display of the slider.') : __('Empty for immediate display of the slider.')
|
||||
'helper' => (isset($model) and $model->{$name}) ? __('Leave empty for immediate display of the slider.') : __('Empty for immediate display of the slider.')
|
||||
])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue