mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
bugfix format date vuedatepicker
This commit is contained in:
@@ -77,8 +77,6 @@ class Notiz extends FHC_Controller
|
||||
$dms_id = [];
|
||||
foreach ($_FILES as $k => $file)
|
||||
{
|
||||
/* var_dump($file["name"]);
|
||||
var_dump($file);*/
|
||||
$dms = array(
|
||||
'kategorie_kurzbz' => 'notiz',
|
||||
'version' => 0,
|
||||
@@ -92,7 +90,6 @@ class Notiz extends FHC_Controller
|
||||
|
||||
if (isSuccess($result))
|
||||
{
|
||||
//TODO(Manu) change to array
|
||||
$dms_id[] = $result->retval['dms_id'];
|
||||
}
|
||||
/* else {
|
||||
@@ -117,49 +114,12 @@ class Notiz extends FHC_Controller
|
||||
$erledigt = $_POST['erledigt'];
|
||||
$type = $_POST['typeId'];
|
||||
|
||||
/* $start = isset($_POST['bis']) ? ($_POST['bis'] : null;
|
||||
$ende = isset($_POST['bis']) ? $_POST['bis'] : null;*/
|
||||
//get rid of null value error
|
||||
$start = $this->input->post(date('von'));
|
||||
$ende = $this->input->post(date('bis'));
|
||||
|
||||
|
||||
if(isset($_POST['von']))
|
||||
{
|
||||
/* $date = $_POST['von'];
|
||||
$date = DateTime::createFromFormat('F-d-Y h:i A',$date);
|
||||
var_dump($date);
|
||||
$timestamp = strtotime($_POST['von']);
|
||||
$start = date('Y-m-d', $timestamp);*/
|
||||
|
||||
/* $dateString = $_POST['von'];
|
||||
$myDateTime = DateTime::createFromFormat('Y-m-d', $dateString);
|
||||
$start= $myDateTime->format('Y-m-d');*/
|
||||
|
||||
//Todo(manu) check input format datepicker.. auch ohne null!!!
|
||||
$start = '2023-01-01';
|
||||
}
|
||||
else
|
||||
$start = null;
|
||||
|
||||
|
||||
if(isset($_POST['bis']))
|
||||
{
|
||||
//Todo(manu) check input format datepicker
|
||||
/* $ende = strtotime($_POST['bis']);
|
||||
$ende = new DateTime($ende);
|
||||
$ende = $ende->format('Y-m-d');*/
|
||||
|
||||
$ende = '2023-01-01';
|
||||
}
|
||||
else
|
||||
$ende = null;
|
||||
|
||||
|
||||
//Todo(manu) multiple files
|
||||
// mit id_type
|
||||
$result = $this->NotizModel->addNotizForType($type, $id, $titel, $text, $uid, $dms_id, $start, $ende, $erledigt, $verfasser_uid, $bearbeiter_uid);
|
||||
|
||||
//vorher
|
||||
//$result = $this->NotizModel->addNotizForPersonWithDoc($id, $titel, $text, $erledigt, $verfasser_uid, $start, $ende, $dms_id);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
$this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR);
|
||||
@@ -172,7 +132,7 @@ class Notiz extends FHC_Controller
|
||||
{
|
||||
$uid = getAuthUID();
|
||||
$this->load->library('form_validation');
|
||||
$_POST = json_decode($this->input->raw_input_stream, true);
|
||||
//$_POST = json_decode($this->input->raw_input_stream, true);
|
||||
|
||||
$this->form_validation->set_rules('titel', 'titel', 'required');
|
||||
$this->form_validation->set_rules('text', 'Text', 'required');
|
||||
@@ -195,9 +155,11 @@ class Notiz extends FHC_Controller
|
||||
$text = isset($_POST['text']) ? $_POST['text'] : null;
|
||||
$verfasser_uid = isset($_POST['verfasser_uid']) ? $_POST['verfasser_uid'] : null;
|
||||
$bearbeiter_uid = $uid;
|
||||
$start = isset($_POST['von']) ? new DateTime($_POST['von']) : null;
|
||||
$ende = isset($_POST['bis']) ? new DateTime($_POST['bis']) : null;
|
||||
$erledigt = $_POST['erledigt'];
|
||||
$start = $this->input->post(date('von'));
|
||||
$ende = $this->input->post(date('bis'));
|
||||
|
||||
|
||||
|
||||
$result = $this->NotizModel->update(
|
||||
[
|
||||
|
||||
@@ -48,7 +48,8 @@ export default {
|
||||
return this.von;
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:von', value);
|
||||
const tempVon = new Date(value).toISOString().split('T')[0];
|
||||
this.$emit('update:von', tempVon);
|
||||
}
|
||||
},
|
||||
intBis: {
|
||||
@@ -56,7 +57,8 @@ export default {
|
||||
return this.bis;
|
||||
},
|
||||
set(value) {
|
||||
this.$emit('update:bis', value);
|
||||
const tempBis = new Date(value).toISOString().split('T')[0];
|
||||
this.$emit('update:bis', tempBis);
|
||||
}
|
||||
},
|
||||
intDocument: {
|
||||
@@ -101,36 +103,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
/* mounted(){
|
||||
showZuordnung(){
|
||||
this.idTyp = 'Person';
|
||||
}
|
||||
},*/
|
||||
methods: {
|
||||
/* handleFileChange(event) {
|
||||
this.intAnhang = event.target.files;
|
||||
},*/
|
||||
reset() {
|
||||
this.$refs.form.reset();
|
||||
//this.$emit('update:anhang', dt.files);
|
||||
},
|
||||
/* deleteFile(id){
|
||||
//console.log("Delete file with id " + id );
|
||||
|
||||
//console.log(this.intAnhang[id]);
|
||||
|
||||
const dt = new DataTransfer();
|
||||
const files = this.$refs.upload.files;
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
if (id !== i)
|
||||
dt.items.add(file); // here you exclude the file. thus removing it.
|
||||
}
|
||||
|
||||
this.$refs.upload.files = dt.files; // Assign the updates list
|
||||
this.$emit('update:anhang', dt.files);
|
||||
}*/
|
||||
},
|
||||
|
||||
template: `
|
||||
@@ -143,9 +120,7 @@ export default {
|
||||
</b><span class="small">[{{this.typeId}}]</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div>
|
||||
<p>Zuordnung {{this.typeId}}</p>
|
||||
</div>-->
|
||||
|
||||
<div class="notizTitle row mb-3">
|
||||
<label for="titel" class="form-label col-sm-2">Titel</label>
|
||||
<div class="col-sm-7">
|
||||
@@ -170,24 +145,7 @@ export default {
|
||||
<div class="col-sm-7">
|
||||
<File ref="upload" id="file" :multiupload="multiupload" v-model:dateien="intAnhang" ></File>
|
||||
</div>
|
||||
|
||||
<!-- <div class="col-sm-7">
|
||||
<span>
|
||||
|
||||
<input ref="upload" type="file" multiple ref="fileInput" @change="handleFileChange" v-model="intAnhang"/>
|
||||
|
||||
</span>
|
||||
|
||||
<span >
|
||||
<ul>
|
||||
<li v-for="(anh,index) in intAnhang">
|
||||
<button>{{anh.name}}</button><button class="text-danger" @click="deleteFile(index)">X {{index}}</button>
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
@@ -196,7 +154,8 @@ export default {
|
||||
|
||||
<div v-if="showErweitert">
|
||||
<slot name="erweitert">
|
||||
<div class="row mb-3">
|
||||
|
||||
<!-- <div class="row mb-3">
|
||||
<label for="bis" class="form-label col-sm-2">VerfasserIn</label>
|
||||
<div class="col-sm-7">
|
||||
<input type="text" v-model="intVerfasser" class="form-control">
|
||||
@@ -209,17 +168,31 @@ export default {
|
||||
<div class="col-sm-7">
|
||||
<input type="text" v-model="intBearbeiter" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="row mb-3">
|
||||
<label for="von" class="form-label col-sm-2">von</label>
|
||||
<div class="col-sm-2">
|
||||
<vue-date-picker id="von" v-model="intVon" clearable="false" auto-apply enable-time-picker="true" format="dd.MM.yyyy" preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
<vue-date-picker
|
||||
id="von"
|
||||
v-model="intVon"
|
||||
clearable="false"
|
||||
auto-apply
|
||||
:enable-time-picker="false"
|
||||
format="dd.MM.yyyy"
|
||||
preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
</div>
|
||||
|
||||
<label for="bis" class="form-label col-sm-1">bis</label>
|
||||
<div class="col-sm-2">
|
||||
<vue-date-picker id="bis" v-model="intBis" clearable="false" auto-apply enable-time-picker="true" format="dd.MM.yyyy" preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
<vue-date-picker
|
||||
id="bis"
|
||||
v-model="intBis"
|
||||
clearable="false"
|
||||
auto-apply
|
||||
:enable-time-picker="false"
|
||||
format="dd.MM.yyyy"
|
||||
preview-format="dd.MM.yyyy"></vue-date-picker>
|
||||
</div>
|
||||
|
||||
<label for="bis" class="form-label col-sm-1">erledigt</label>
|
||||
@@ -233,6 +206,7 @@ export default {
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>`
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export default {
|
||||
columns: [
|
||||
{title: "Titel", field: "titel"},
|
||||
{title: "Text", field: "text", width: 350},
|
||||
{title: "VerfasserIn", field: "verfasser_uid"},
|
||||
{title: "VerfasserIn", field: "verfasser_uid", visible: false},
|
||||
{title: "BearbeiterIn", field: "bearbeiter_uid", visible: false},
|
||||
{title: "Start", field: "start", visible: false},
|
||||
{title: "Ende", field: "ende", visible: false},
|
||||
@@ -71,7 +71,7 @@ export default {
|
||||
bearbeiter: null,
|
||||
anhang: []
|
||||
},
|
||||
showErweitert: false,
|
||||
showErweitert: true,
|
||||
showDocument: true,
|
||||
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export default {
|
||||
},
|
||||
actionNewNotiz(){
|
||||
this.resetFormData();
|
||||
/* this.formData.typeId = 'person';
|
||||
this.formData.typeId = 'person';
|
||||
this.formData.titel = '';
|
||||
this.formData.action = 'Neue Notiz2';
|
||||
this.formData.text = null;
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
this.formData.erledigt = false;
|
||||
this.formData.verfasser = null;
|
||||
this.formData.bearbeiter = null;
|
||||
this.formData.anhang = [];*/
|
||||
this.formData.anhang = [];
|
||||
},
|
||||
addNewNotiz(notizData) {
|
||||
/* console.log("here: anhang noch empty");
|
||||
@@ -134,14 +134,6 @@ export default {
|
||||
});
|
||||
Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v));
|
||||
|
||||
/* for( var i = 0; i < this.formData.anhang.length; i++ ){
|
||||
let file = this.formData.anhang[i];
|
||||
|
||||
formData.append('files[' + i + ']', file);
|
||||
}*/
|
||||
|
||||
/* console.log("after append");
|
||||
console.log(this.formData);*/
|
||||
CoreRESTClient.post('components/stv/Notiz/addNewNotiz/' + this.modelValue.person_id,
|
||||
formData,
|
||||
{ Headers: { "Content-Type": "multipart/form-data" } }
|
||||
@@ -232,7 +224,7 @@ export default {
|
||||
anhang: []
|
||||
};
|
||||
},
|
||||
updateNotiz(notiz_id){
|
||||
/* updateNotiz(notiz_id){
|
||||
CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id,
|
||||
this.formData
|
||||
).then(response => {
|
||||
@@ -254,6 +246,35 @@ export default {
|
||||
window.scrollTo(0, 0);
|
||||
//this.reload();
|
||||
});
|
||||
},*/
|
||||
updateNotiz(notiz_id){
|
||||
const formData = new FormData();
|
||||
Object.entries(this.formData).forEach(([k, v]) => {
|
||||
if(k!= 'anhang')
|
||||
formData.append(k, v);
|
||||
});
|
||||
Object.entries(this.formData.anhang).forEach(([k, v]) => formData.append(k, v));
|
||||
|
||||
CoreRESTClient.post('components/stv/Notiz/updateNotiz/' + notiz_id,
|
||||
formData,
|
||||
{ Headers: { "Content-Type": "multipart/form-data" } }
|
||||
).then(response => {
|
||||
if (!response.data.error) {
|
||||
this.$fhcAlert.alertSuccess('Update von neuer Notiz erfolgreich');
|
||||
this.resetFormData();
|
||||
this.reload();
|
||||
} else {
|
||||
const errorData = response.data.retval;
|
||||
Object.entries(errorData).forEach(entry => {
|
||||
const [key, value] = entry;
|
||||
this.$fhcAlert.alertError(value);
|
||||
});
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$fhcAlert.alertError('Fehler bei Updateroutine aufgetreten');
|
||||
}).finally(() => {
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
},
|
||||
},
|
||||
template: `
|
||||
@@ -305,7 +326,7 @@ export default {
|
||||
</Notiz>
|
||||
|
||||
<button v-if="formData.action === 'Neue Notiz'" type="button" class="btn btn-primary" @click="addNewNotiz()"> Neu anlegen </button>
|
||||
<button v-else type="button" class="btn btn-warning" @click="updateNotiz(notizen.notiz_id)"> Speichern </button>
|
||||
<button v-else type="button" class="btn btn-primary" @click="updateNotiz(notizen.notiz_id)"> Speichern </button>
|
||||
|
||||
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user