Skip to content

Commit 4f9a656

Browse files
committed
Bugfix
1 parent f050d4f commit 4f9a656

File tree

12 files changed

+97
-43
lines changed

12 files changed

+97
-43
lines changed

assets/admin/core/components/datatable/blocks/tbody.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<template>
22
<tbody>
3-
<tr v-if="data.length" v-for="(item, index) in data">
3+
<tr v-if="data.length" v-for="(item, index) in data" :key="index">
44
<!--Actions Column-->
55
<td v-if="options.actions === true" class="actions end">
66
<div class="dropdown" v-if="$parent.$slots.actions">
77
<a class="dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside"><i class="fas fa-ellipsis-v"></i></a>
88
<ul class="dropdown-menu">
9-
<slot name="actions" :item="item" :index="index" :remove="remove"></slot>
9+
<slot name="actions" :item="item" :index="index" :remove="remove" :key="item.id"></slot>
1010
</ul>
1111
</div>
1212
</td>
@@ -46,7 +46,7 @@
4646
<div class="dropdown" v-if="$parent.$slots.actions">
4747
<a class="dropdown-toggle" href="#" data-bs-toggle="dropdown" data-bs-auto-close="outside"><i class="fas fa-ellipsis-v"></i></a>
4848
<ul class="dropdown-menu">
49-
<slot name="actions" :item="item"></slot>
49+
<slot name="actions" :item="item" :index="index" :remove="remove" :key="item.id"></slot>
5050
</ul>
5151
</div>
5252
</td>
@@ -89,7 +89,11 @@ export default {
8989
}
9090
},
9191
remove(index) {
92-
this.data.splice(index, 1);
92+
if (index instanceof Object && index.hasOwnProperty('id')) {
93+
this.data.splice(this.data.findIndex(item => item.id === index.id), 1);
94+
} else {
95+
this.data.splice(index, 1);
96+
}
9397
this.$parent.pager.total--;
9498
}
9599
}

assets/admin/core/components/datatable/blocks/thead.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</span>
4141

4242
<!--Column Filters-->
43-
<filters v-if="options.filters && column.filters" :column="column" :options="options"></filters>
43+
<filters v-if="options.filters && column.filters" :column="column" :options="options" :key="column.field"></filters>
4444
</div>
4545
</th>
4646

assets/admin/core/components/datepicker/index.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div v-if="!multiple" class="pd-datepicker">
3-
<datepicker v-model="pickedProxy" :input-format="format" :locale="locale" :id="id" :name="$attrs.name"
3+
<datepicker v-model="pickedProxy" :input-format="format" :locale="locale" :id="id" :name="$attrs.name" :readonly="false"
44
:placeholder="placeholder || 'Tarih Seçin..'" class="form-control"/>
55
</div>
66
<div v-else class="pd-datepicker multiple">
@@ -26,7 +26,6 @@ export default {
2626
id: String,
2727
format: {
2828
type: String,
29-
//default: 'dd.MM.yyyy'
3029
},
3130
multiple: {
3231
type: Boolean,
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<div class="pd-picker d-flex">
3+
<input :id="$attrs.id" :name="$attrs.name" v-model="color" @blur="blured" type="text" class="form-control me-2">
4+
<input type="color" v-model="picker" class="form-control form-control-color">
5+
</div>
6+
</template>
7+
8+
<script>
9+
export default {
10+
name: "PdColorPicker",
11+
inheritAttrs: false,
12+
data() {
13+
return {
14+
picker: '#ffffff',
15+
color: null
16+
}
17+
},
18+
mounted() {
19+
let color = this.$attrs.value || this.$attrs.default || null;
20+
if (color) {
21+
this.picker = color;
22+
}
23+
},
24+
methods: {
25+
blured() {
26+
if (this.color) {
27+
this.picker = this.color;
28+
}
29+
}
30+
},
31+
watch: {
32+
picker(val) {
33+
this.color = val;
34+
}
35+
}
36+
}
37+
</script>

assets/admin/core/components/forms/range/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<div class="form-range d-flex align-items-center">
3-
<input class="form-range" type="range" v-model="proxyChecked" :id="id" :min="min" :max="max" :step="step">
4-
<span class="range-counter ms-2">{{ proxyChecked }}</span>
2+
<div className="form-range d-flex align-items-center">
3+
<input className="form-range" type="range" v-model="proxyChecked" :id="id" :min="min" :max="max" :step="step">
4+
<span className="range-counter ms-2">{{ proxyChecked }}</span>
55
</div>
66
</template>
77

assets/admin/core/components/forms/select/index.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
:placeholder="placeholder"
99
:required="required"
1010
v-model="modelProxied"
11-
:options="options"
11+
:open-direction="direction"
12+
:options="option"
1213
/>
13-
<select class="d-none" v-if="current" :multiple="multiple" v-bind="$attrs" v-model="modelValue">
14+
<select class="d-none" v-if="current !== null" :multiple="multiple" v-bind="$attrs" v-model="modelValue">
1415
<option v-for="v in getModelArray" :value="v" selected></option>
1516
</select>
1617
</div>
@@ -36,11 +37,15 @@ export default {
3637
'current': {
3738
type: [Array, Object, String],
3839
default: null
39-
}
40+
},
41+
'direction': {
42+
type: String,
43+
default: 'bottom'
44+
},
4045
},
4146
data() {
4247
return {
43-
options: null,
48+
option: null,
4449
selected: []
4550
}
4651
},
@@ -60,17 +65,17 @@ export default {
6065
} else if (this.opts instanceof Object) {
6166
Object.keys(this.opts).forEach((key) => {
6267
parsed.push({
63-
value: this.opts[key].value ?? key,
64-
label: this.opts[key].label ?? this.opts[key]
68+
value: this.opts[key] ? (this.opts[key].value || key) : key,
69+
label: this.opts[key] ? (this.opts[key].label || this.opts[key]) : this.opts[key]
6570
})
6671
67-
if (this.opts[key].hasOwnProperty('attr') && this.opts[key].attr.hasOwnProperty('selected')) {
72+
if (this.opts[key] && this.opts[key].hasOwnProperty('attr') && this.opts[key].attr.hasOwnProperty('selected')) {
6873
this.selected.push(this.opts[key].value);
6974
}
7075
})
7176
}
7277
73-
this.options = parsed;
78+
this.option = parsed;
7479
}
7580
7681
if (this.multiple) {

assets/admin/core/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default {
2525
app.component('pd-select', require('./forms/select').default);
2626
app.component('pd-input', require('./forms/input').default);
2727
app.component('pd-range', require('./forms/range').default);
28+
app.component('pd-color', require('./forms/colorpicker').default);
2829

2930
app.use(require('vue-slicksort').plugin)
3031
}

assets/admin/core/components/message/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default {
5252
type: 'bg-' + type,
5353
message: message,
5454
paused: false,
55-
duration: duration || 4000
55+
duration: duration || 3000
5656
});
5757
},
5858
remove(id) {
@@ -70,7 +70,7 @@ export default {
7070
showBag(flashBag) {
7171
if (!Array.isArray(flashBag)) {
7272
for (const type in flashBag) {
73-
flashBag[type].forEach((msg) => this.show(type, msg, 5000));
73+
flashBag[type].forEach((msg) => this.show(type, msg, 4000));
7474
}
7575
}
7676
}

assets/admin/core/mixins/dateFormatter.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {parse, parseISO, format, formatDistance} from 'date-fns'
22
import {tr, enUS as en} from 'date-fns/locale';
3+
34
const locales = {tr, en};
45

56
export default {
@@ -10,8 +11,19 @@ export default {
1011
dateISOTime(date) {
1112
return this.dateISO(date, 'dd.MM.yyyy HH:mm');
1213
},
13-
dateRelative(date) {
14-
return date ? formatDistance(parseISO(date), new Date(), { addSuffix: true, includeSeconds: false, locale: locales[document.documentElement.lang] }) : '';
14+
dateRelative(date, message) {
15+
if (!date) return '';
16+
17+
let isoDate = parseISO(date);
18+
if (isoDate < new Date()) {
19+
return message || '-';
20+
}
21+
22+
return formatDistance(isoDate, new Date(), {
23+
addSuffix: true,
24+
includeSeconds: false,
25+
locale: locales[document.documentElement.lang]
26+
});
1527
}
1628
}
1729
}

config/packages/framework.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,13 @@ framework:
2727
base_path: "build/admin"
2828

2929
cache:
30+
prefix_seed: "%env(CACHE_PREFIX)%"
3031
pools:
3132
doctrine.result_cache_pool:
3233
adapter: cache.app
3334
doctrine.system_cache_pool:
3435
adapter: cache.system
3536

36-
# Unique name of your app: used to compute stable namespaces for cache keys.
37-
#prefix_seed: your_vendor_name/app_name
38-
39-
# Redis
40-
#app: cache.adapter.redis
41-
#default_redis_provider: redis://localhost
42-
43-
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
44-
#app: cache.adapter.apcu
45-
4637
when@test:
4738
framework:
4839
test: true

config/packages/monolog.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ when@prod:
2929
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
3030
nested:
3131
type: stream
32-
path: php://stderr
32+
#path: php://stderr
33+
path: "%kernel.logs_dir%/%kernel.environment%.log"
3334
level: debug
3435
formatter: monolog.formatter.json
3536
console:

config/routes.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,35 @@ when@dev:
1111
prefix: /_profiler
1212

1313

14+
#------------------------------------
15+
# API
16+
#------------------------------------
17+
api:
18+
resource: ../src/Controller/Api
19+
type: annotation
20+
prefix: api
21+
22+
1423
#------------------------------------
1524
# Admin
1625
#------------------------------------
1726
auth:
1827
resource: "@PdUserBundle/Resources/config/routing.yaml"
19-
2028
admin:
2129
resource: ../src/Controller/Admin
2230
type: annotation
2331
prefix: 'admin'
2432
admin_widget:
2533
resource: "@PdWidgetBundle/Resources/config/routing.yml"
2634
prefix: 'admin'
35+
36+
37+
#------------------------------------
38+
# Redirect Home
39+
#------------------------------------
2740
redirect_home:
2841
path: /
2942
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction
3043
defaults:
3144
route: security_login
3245
permanent: true
33-
34-
35-
#------------------------------------
36-
# API
37-
#------------------------------------
38-
api:
39-
resource: ../src/Controller/Api
40-
type: annotation
41-
prefix: api

0 commit comments

Comments
 (0)