suppression de cellule
This commit is contained in:
parent
75db2ac0af
commit
b4841560bd
4 changed files with 47 additions and 6 deletions
|
|
@ -152,4 +152,11 @@ class ScheduleController extends Controller
|
|||
|
||||
return \response()->json(['status' => true, 'sched'=>$arSchd]);
|
||||
}
|
||||
|
||||
public function eraseCellContent(Request $request)
|
||||
{
|
||||
$schedule = Schedule::findOrFail($request->id);
|
||||
$schedule->delete();
|
||||
return \response()->json(['status' => true]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
{{user[key][day.key]['text']}}
|
||||
<button class="btn btn-edit" type="button" data-bs-toggle="modal"
|
||||
data-bs-target="#editModal" @click="setModalData(index,key,day.key,user[key][day.key]['id'])">✎</button>
|
||||
<button class="btn btn-clear" @click="eraseCell(user[key][day.key]['id'])">⌫</button>
|
||||
<button v-if="user[key][day.key]['id']" class="btn btn-clear" @click="eraseCell(index,key,day.key,user[key][day.key]['id'])">⌫</button>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
|
@ -217,7 +217,23 @@ export default {
|
|||
page: 1,
|
||||
perPage: 15,
|
||||
hasNextPage: true,
|
||||
hasPrevPage: false
|
||||
hasPrevPage: false,
|
||||
emptyCell: {
|
||||
"type": {
|
||||
"label":"",
|
||||
"value":""
|
||||
},
|
||||
"text":"",
|
||||
"id_lie": {
|
||||
"label":"",
|
||||
"value":""
|
||||
},
|
||||
"model_lie": {
|
||||
"label":"",
|
||||
"value":""
|
||||
},
|
||||
"id":null
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -486,6 +502,25 @@ export default {
|
|||
this.error = error
|
||||
})
|
||||
},
|
||||
eraseCell(userid,slotkey,day,id) {
|
||||
const data = {
|
||||
'id': id,
|
||||
}
|
||||
axios.post(this.route('schedule.eraseCellContent'), data)
|
||||
.then(response => {
|
||||
if(response.data.status) {
|
||||
this.$set(this.schedules[userid][slotkey], day, this.emptyCell);
|
||||
} else {
|
||||
console.error('Unknown response')
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
if(error.response.status === 429) {
|
||||
location.reload()
|
||||
}
|
||||
console.error(error)
|
||||
})
|
||||
},
|
||||
selectChange() {
|
||||
this.value = {
|
||||
label: null,
|
||||
|
|
@ -500,9 +535,6 @@ export default {
|
|||
break
|
||||
default: this.modale.dDisplay = false
|
||||
}
|
||||
},
|
||||
eraseCell(id) {
|
||||
|
||||
},
|
||||
limitLines(e) {
|
||||
let keynum, lines = this.$refs.text.value.split('\n').length;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
"projects.index": "{{ route('projects.index') }}",
|
||||
"sites.index": "{{ route('sites.index') }}",
|
||||
"schedule.setCellContent": "{{ route('schedule.setCellContent') }}",
|
||||
"planning.eraseCellContent": "{{ route('planning.eraseCellContent') }}"
|
||||
"schedule.eraseCellContent": "{{ route('schedule.eraseCellContent') }}"
|
||||
};
|
||||
</script>
|
||||
@endpush
|
||||
|
|
|
|||
|
|
@ -88,5 +88,7 @@ Route::middleware(['auth'])->group(function () {
|
|||
Route::get('/', [ScheduleController::class, 'index'])->name('index');
|
||||
Route::post('/setCellContent', [ScheduleController::class, 'setCellContent'])
|
||||
->name('setCellContent');
|
||||
Route::post('/eraseCellContent', [ScheduleController::class, 'eraseCellContent'])
|
||||
->name('eraseCellContent');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue