first commit
This commit is contained in:
81
one-new-ticket-support-v3/api/ticket.js
Normal file
81
one-new-ticket-support-v3/api/ticket.js
Normal file
@@ -0,0 +1,81 @@
|
||||
const URL = "/one-api-support/support/ticketing_v3/";
|
||||
|
||||
export async function search_branch(search, client_id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "search_branch", {
|
||||
search: search,
|
||||
client_id: client_id,
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function search_client(search, client_id) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "search_client", {
|
||||
search: search,
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function new_ticket(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "new_ticket", prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function uploadimage(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "uploadimage", prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
586
one-new-ticket-support-v3/components/oneNewTicketSupport.vue
Normal file
586
one-new-ticket-support-v3/components/oneNewTicketSupport.vue
Normal file
@@ -0,0 +1,586 @@
|
||||
<template>
|
||||
<v-layout column>
|
||||
<v-dialog v-model="dialog" width="500">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
|
||||
Ticket Berhasil Dibuat
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<h6 class="display-1 text-center">
|
||||
Number <span class="blue--text">{{ text_ticket_no }}</span>
|
||||
</h6>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-btn color="primary" flat @click="finish"> Tutup </v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- Alert dialog -->
|
||||
<v-dialog v-model="dialogalert" max-width="30%">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2 pt-2 pb-2" primary-title>
|
||||
Peringatan !
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs12 d-flex>
|
||||
<v-layout row>
|
||||
<v-flex pb-1 xs12>
|
||||
<v-layout row>
|
||||
<v-flex pt-2 pr-2 xs12>
|
||||
{{ msgalert }}
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" flat @click="dialogalert = false">
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn color="primary" flat @click="saveForm()"> Yakin lah </v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- End alert dialog -->
|
||||
<!-- ERROR DIALOG -->
|
||||
<v-dialog v-model="dialog_error" max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span>ERROR !</span>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<div class="ma-3 red--text">{{ msgError }}</div>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" flat @click="dialog_error = false"
|
||||
>Close</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- END ERROR DIALOG -->
|
||||
<!-- Snackbar -->
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
:timeout="5000"
|
||||
:multi-line="false"
|
||||
:vertical="false"
|
||||
:top="true"
|
||||
:color="clr"
|
||||
:value="snackbar"
|
||||
>
|
||||
{{ msgsnackbar }}
|
||||
<v-btn flat @click="snackbar = false"> Tutup </v-btn>
|
||||
</v-snackbar>
|
||||
<!-- End Snackbar -->
|
||||
|
||||
<v-card>
|
||||
<v-flex xs12>
|
||||
<v-subheader red--text text--lighten-1> BUAT TIKET BARU </v-subheader>
|
||||
<v-divider></v-divider>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pa-2>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-autocomplete
|
||||
auto-select-first
|
||||
:items="xclients"
|
||||
v-model="vclient"
|
||||
:search-input.sync="search_clientx"
|
||||
:loading="loading_client"
|
||||
item-text="clientName"
|
||||
item-value="clientId"
|
||||
label="CLIENT*"
|
||||
return-object
|
||||
outline
|
||||
clearable
|
||||
no-data-text="Pilih Client"
|
||||
>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title
|
||||
v-text="item.clientName"
|
||||
></v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p
|
||||
v-if="checkError('requirevclient')"
|
||||
class="error pl-2 pr-2"
|
||||
style="color: #fff"
|
||||
>
|
||||
Pilih client dulu
|
||||
</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field label="TITLE*" outline v-model="xtitle">
|
||||
</v-text-field>
|
||||
<p
|
||||
v-if="checkError('requirextitle')"
|
||||
class="error pl-2 pr-2"
|
||||
style="color: #fff"
|
||||
>
|
||||
Title belum diisi
|
||||
</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-text-field label="SENDER*" outline v-model="xsender">
|
||||
</v-text-field>
|
||||
<p
|
||||
v-if="checkError('requirexsender')"
|
||||
class="error pl-2 pr-2"
|
||||
style="color: #fff"
|
||||
>
|
||||
Sender belum diisi
|
||||
</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-autocomplete
|
||||
auto-select-first
|
||||
:items="xbranchs"
|
||||
v-model="vbranch"
|
||||
:loading="loading_branch"
|
||||
:search-input.sync="search_branchx"
|
||||
item-text="M_BranchName"
|
||||
item-value="M_BranchID"
|
||||
label="BRANCH*"
|
||||
return-object
|
||||
outline
|
||||
clearable
|
||||
no-data-text="Pilih Branch"
|
||||
>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title
|
||||
v-text="item.M_BranchName"
|
||||
></v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p
|
||||
v-if="checkError('requirevbranch')"
|
||||
class="error pl-2 pr-2"
|
||||
style="color: #fff"
|
||||
>
|
||||
Pilih branch dulu
|
||||
</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-checkbox
|
||||
label="DIRECT MESSAGE"
|
||||
v-model="xdirect"
|
||||
></v-checkbox>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-textarea
|
||||
filled
|
||||
outline
|
||||
label="DESCRIPTION*"
|
||||
rows="3"
|
||||
v-model="xdescription"
|
||||
></v-textarea>
|
||||
<p
|
||||
v-if="checkError('requirexdescription')"
|
||||
class="error pl-2 pr-2"
|
||||
style="color: #fff"
|
||||
>
|
||||
Description belum diisi
|
||||
</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout
|
||||
mr-2
|
||||
ml-2
|
||||
style="border: 1px solid black"
|
||||
align-center
|
||||
row
|
||||
pa-2
|
||||
>
|
||||
<v-flex xs12>
|
||||
<input
|
||||
type="file"
|
||||
id="files"
|
||||
ref="files"
|
||||
multiple
|
||||
v-on:change="handleFileUploads()"
|
||||
/>
|
||||
</v-flex>
|
||||
<!-- <v-flex xs3 class="text-xs-right">
|
||||
<v-btn :disabled="show_progrees_upload" small dark color="blue lighten-1" @click="submitFiles()">Upload</v-btn>
|
||||
</v-flex> -->
|
||||
</v-layout>
|
||||
<!-- <p v-if="error_image" class="mt-1 error pl-2 pr-2" style="color:#fff">Anda belum mengisi</p> -->
|
||||
<v-layout v-if="show_progrees_upload" row align-center mr-2 ml-2>
|
||||
<v-flex xs12>
|
||||
<v-progress-linear :indeterminate="true"></v-progress-linear>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout
|
||||
v-if="urls.length > 0 && !show_progrees_upload"
|
||||
align-center
|
||||
row
|
||||
>
|
||||
<v-flex v-for="(url, index) in urls" :key="index" xs12 pa-2>
|
||||
<v-img :src="url">
|
||||
<div class="fill-height bottom-gradient"></div>
|
||||
</v-img>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<!-- <v-layout v-if="images.length > 0 && !show_progrees_upload" align-center row mr-2 ml-2>
|
||||
|
||||
<v-flex v-for="image in images" xs6 pa-2>
|
||||
<v-img :src="image.image_url">
|
||||
<div class="fill-height bottom-gradient"></div>
|
||||
</v-img>
|
||||
</v-flex>
|
||||
|
||||
</v-layout> -->
|
||||
|
||||
<v-flex text-md-right class="mt-3">
|
||||
<v-btn color="info" small @click="openAddForm()"> SIMPAN </v-btn>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.searchbox .v-input.v-text-field .v-input__slot {
|
||||
min-height: 60px;
|
||||
}
|
||||
.searchbox .v-btn {
|
||||
min-height: 60px;
|
||||
}
|
||||
table.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
search_branchx: "",
|
||||
search_clientx: "",
|
||||
xtitle: "",
|
||||
xsender: "",
|
||||
dialogalert: false,
|
||||
msgalert: "",
|
||||
clr: "success",
|
||||
xdescription: "",
|
||||
xdirect: false,
|
||||
// error_image:false,
|
||||
// url: null,
|
||||
urls: [],
|
||||
filesToUpload: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// this.$store.dispatch("ticket/search_client", {
|
||||
// qry: this.search_clientx,
|
||||
// });
|
||||
},
|
||||
computed: {
|
||||
selected_client_id() {
|
||||
return this.$store.state.ticket.selected_clients.clientId;
|
||||
},
|
||||
xbranchs() {
|
||||
return this.$store.state.ticket.branchs;
|
||||
},
|
||||
xclients() {
|
||||
return this.$store.state.ticket.clients;
|
||||
},
|
||||
vbranch: {
|
||||
get() {
|
||||
return this.$store.state.ticket.selected_branch;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_selected_branch", val);
|
||||
},
|
||||
},
|
||||
vclient: {
|
||||
get() {
|
||||
return this.$store.state.ticket.selected_clients;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_selected_clients", val);
|
||||
},
|
||||
},
|
||||
loading_branch() {
|
||||
return this.$store.state.ticket.loading;
|
||||
},
|
||||
loading_client() {
|
||||
return this.$store.state.ticket.loading_client;
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.ticket.alert_success;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_alert_success", val);
|
||||
},
|
||||
},
|
||||
msgsnackbar() {
|
||||
return this.$store.state.ticket.msg_success;
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.ticket.alert_error;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_alert_error", val);
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.ticket.error_message;
|
||||
},
|
||||
show_progrees_upload: {
|
||||
get() {
|
||||
return this.$store.state.ticket.show_progrees_upload;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_show_progrees_upload", val);
|
||||
},
|
||||
},
|
||||
images() {
|
||||
return this.$store.state.ticket.images;
|
||||
},
|
||||
lastInsertId: {
|
||||
get() {
|
||||
return this.$store.state.ticket.lastInsertId;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_lastInsertId", val);
|
||||
},
|
||||
},
|
||||
text_ticket_no() {
|
||||
return this.$store.state.ticket.ticket_number;
|
||||
},
|
||||
dialog: {
|
||||
get() {
|
||||
return this.$store.state.ticket.dialog_is_active;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("ticket/update_dialog_is_active", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
finish: function () {
|
||||
this.dialog = false;
|
||||
// location.reload()
|
||||
},
|
||||
handleFileUploads() {
|
||||
// this.files = this.$refs.files.files
|
||||
|
||||
const files = this.$refs.files.files;
|
||||
this.urls = [];
|
||||
this.filesToUpload = [];
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
const url = URL.createObjectURL(file);
|
||||
this.urls.push(url);
|
||||
this.filesToUpload.push(file);
|
||||
}
|
||||
// console.log('urls', this.urls)
|
||||
console.log("filesToUpload", this.filesToUpload);
|
||||
},
|
||||
submitFiles() {
|
||||
// this.error_image = false
|
||||
let formData = new FormData();
|
||||
|
||||
for (var i = 0; i < this.filesToUpload.length; i++) {
|
||||
let file = this.filesToUpload[i];
|
||||
console.log(file);
|
||||
formData.append("files[" + i + "]", file);
|
||||
}
|
||||
if (this.filesToUpload.length > 0) {
|
||||
this.show_progrees_upload = true;
|
||||
let insertId = this.$store.state.ticket.lastInsertId;
|
||||
console.log("insertId submit", insertId);
|
||||
formData.append("ticketid", insertId);
|
||||
this.$store.dispatch("ticket/uploadimage", formData);
|
||||
}
|
||||
},
|
||||
thr_search_branch: _.debounce(function () {
|
||||
this.$store.dispatch("ticket/search_branch", {
|
||||
search: this.search_branchx,
|
||||
});
|
||||
}, 1000),
|
||||
thr_search_client: _.debounce(function () {
|
||||
this.$store.dispatch("ticket/search_client", {
|
||||
search: this.search_clientx,
|
||||
});
|
||||
}, 1000),
|
||||
checkError(value) {
|
||||
var errors = this.$store.state.ticket.errors;
|
||||
if (errors.includes(value)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
resetAllInput() {
|
||||
this.xtitle = "";
|
||||
this.xsender = "";
|
||||
this.vbranch = "";
|
||||
this.vclient = "";
|
||||
this.xdirect = "";
|
||||
this.xdescription = "";
|
||||
this.urls = [];
|
||||
this.filesToUpload = [];
|
||||
},
|
||||
openAddForm() {
|
||||
this.$store.commit("ticket/update_errors", []);
|
||||
var errors = this.$store.state.ticket.errors;
|
||||
|
||||
if (_.isEmpty(this.vclient)) {
|
||||
errors.push("requirevclient");
|
||||
}
|
||||
if (_.isEmpty(this.xtitle)) {
|
||||
errors.push("requirextitle");
|
||||
}
|
||||
if (_.isEmpty(this.xsender)) {
|
||||
errors.push("requirexsender");
|
||||
}
|
||||
if (_.isEmpty(this.vbranch)) {
|
||||
errors.push("requirevbranch");
|
||||
}
|
||||
if (_.isEmpty(this.xdescription)) {
|
||||
errors.push("requirexdescription");
|
||||
}
|
||||
|
||||
if (errors.length === 0) {
|
||||
this.msgalert =
|
||||
"Yakin, Mau Buat Ticket Baru " + "(" + this.xtitle + ")" + " ?";
|
||||
this.dialogalert = true;
|
||||
} else {
|
||||
this.dialogalert = false;
|
||||
}
|
||||
},
|
||||
saveForm() {
|
||||
this.$store.commit("ticket/update_errors", []);
|
||||
var errors = this.$store.state.ticket.errors;
|
||||
|
||||
if (_.isEmpty(this.vclient)) {
|
||||
errors.push("requirevclient");
|
||||
}
|
||||
if (_.isEmpty(this.xtitle)) {
|
||||
errors.push("requirextitle");
|
||||
}
|
||||
if (_.isEmpty(this.xsender)) {
|
||||
errors.push("requirexsender");
|
||||
}
|
||||
if (_.isEmpty(this.vbranch)) {
|
||||
errors.push("requirevbranch");
|
||||
}
|
||||
if (_.isEmpty(this.xdescription)) {
|
||||
errors.push("requirexdescription");
|
||||
}
|
||||
|
||||
if (errors.length === 0) {
|
||||
var formData = new FormData();
|
||||
console.log(this.filesToUpload.length);
|
||||
for (var i = 0; i < this.filesToUpload.length; i++) {
|
||||
let file = this.filesToUpload[i];
|
||||
|
||||
formData.append("files[" + i + "]", file);
|
||||
console.log(formData);
|
||||
}
|
||||
|
||||
/*let prm = {}
|
||||
prm.title = this.xtitle
|
||||
prm.sender = this.xsender
|
||||
prm.branch_code = this.vbranch.M_BranchCode
|
||||
prm.description = this.xdescription
|
||||
prm.is_direct = this.xdirect ? 'Y' : 'N'
|
||||
prm.images = formData*/
|
||||
formData.append("client_id", this.vclient.clientId);
|
||||
formData.append("title", this.xtitle);
|
||||
formData.append("sender", this.xsender);
|
||||
formData.append("branch_code", this.vbranch.M_BranchCode);
|
||||
formData.append("branch_name", this.vbranch.M_BranchName);
|
||||
formData.append("description", this.xdescription);
|
||||
formData.append("is_direct", this.xdirect ? "Y" : "N");
|
||||
|
||||
this.$store.dispatch("ticket/new_ticket", formData);
|
||||
//this.submitFiles();
|
||||
this.resetAllInput();
|
||||
this.dialogalert = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
search_clientx(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length > 0) {
|
||||
this.$store.dispatch("ticket/search_client", {
|
||||
search: this.search_clientx,
|
||||
});
|
||||
this.thr_search_client;
|
||||
// this.$store.dispatch("ticket/search_branch", {
|
||||
// search: this.search_branchx,
|
||||
// client_id: this.$store.state.ticket.selected_clients.clientId,
|
||||
// });
|
||||
// this.thr_search_branch;
|
||||
}
|
||||
},
|
||||
search_branchx(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length > 0) {
|
||||
this.$store.dispatch("ticket/search_branch", {
|
||||
search: this.search_branchx,
|
||||
client_id: this.$store.state.ticket.selected_clients.clientId,
|
||||
});
|
||||
this.thr_search_branch;
|
||||
}
|
||||
},
|
||||
selected_client_id(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length > 0) {
|
||||
this.$store.dispatch("ticket/search_branch", {
|
||||
search: this.search_branchx,
|
||||
client_id: val,
|
||||
});
|
||||
this.thr_search_branch;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
74
one-new-ticket-support-v3/index.php
Normal file
74
one-new-ticket-support-v3/index.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content class="blue lighten-5">
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 class="left" fill-height pa-1>
|
||||
<!-- komponen kiri -->
|
||||
<one-new-ticket-support></one-new-ticket-support>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
<!-- App Script -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
import {
|
||||
store
|
||||
} from './store.js<?php echo $ts ?>';
|
||||
//for testing
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-new-ticket-support': httpVueLoader('./components/oneNewTicketSupport.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
|
||||
.left {}
|
||||
|
||||
.right {}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
193
one-new-ticket-support-v3/modules/ticket.js
Normal file
193
one-new-ticket-support-v3/modules/ticket.js
Normal file
@@ -0,0 +1,193 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/ticket.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
clients: [],
|
||||
branchs: [],
|
||||
selected_clients: {
|
||||
clientId: null, // atau nilai default yang sesuai
|
||||
clientName: null,
|
||||
},
|
||||
selected_branch: {},
|
||||
loading: false,
|
||||
loading_client: false,
|
||||
error: "",
|
||||
save_status: 2,
|
||||
error_message: "",
|
||||
loading_save: false,
|
||||
alert_error: false,
|
||||
dialog_error: false,
|
||||
msg_success: "",
|
||||
alert_success: false,
|
||||
errors: [],
|
||||
show_progrees_upload: false,
|
||||
images: [],
|
||||
lastInsertId: "",
|
||||
ticket_number: "",
|
||||
dialog_is_active: false,
|
||||
},
|
||||
mutations: {
|
||||
update_branchs(state, val) {
|
||||
state.branchs = val;
|
||||
},
|
||||
update_clients(state, val) {
|
||||
state.clients = val;
|
||||
},
|
||||
update_selected_branch(state, val) {
|
||||
state.selected_branch = val;
|
||||
},
|
||||
update_selected_clients(state, val) {
|
||||
state.selected_clients = val;
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val;
|
||||
},
|
||||
update_loading_client(state, val) {
|
||||
state.loading_client = val;
|
||||
},
|
||||
update_error(state, val) {
|
||||
state.error = val;
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val;
|
||||
},
|
||||
update_error_message(state, val) {
|
||||
state.error_message = val;
|
||||
},
|
||||
update_loading_save(state, val) {
|
||||
state.loading_save = val;
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val;
|
||||
},
|
||||
update_dialog_error(state, val) {
|
||||
state.dialog_error = val;
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val;
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val;
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val;
|
||||
},
|
||||
update_show_progrees_upload(state, val) {
|
||||
state.show_progrees_upload = val;
|
||||
},
|
||||
update_images(state, val) {
|
||||
state.images = val;
|
||||
},
|
||||
update_lastInsertId(state, id) {
|
||||
state.lastInsertId = id;
|
||||
},
|
||||
update_ticket_number(state, val) {
|
||||
state.ticket_number = val;
|
||||
},
|
||||
update_dialog_is_active(state, val) {
|
||||
state.dialog_is_active = val;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async search_branch(context, { search, client_id }) {
|
||||
context.commit("update_loading", true);
|
||||
try {
|
||||
let resp = await api.search_branch(search, client_id);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_error", resp.message);
|
||||
} else {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_error", "");
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
};
|
||||
context.commit("update_branchs", resp.data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_error", e.message);
|
||||
}
|
||||
},
|
||||
async search_client(context, { search }) {
|
||||
context.commit("update_loading", true);
|
||||
try {
|
||||
let resp = await api.search_client(search);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_error", resp.message);
|
||||
} else {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_error", "");
|
||||
context.commit("update_clients", resp.data.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false);
|
||||
context.commit("update_error", e.message);
|
||||
}
|
||||
},
|
||||
|
||||
async new_ticket(context, prm) {
|
||||
context.commit("update_save_status", 1);
|
||||
try {
|
||||
// prm.token = one_token()
|
||||
let resp = await api.new_ticket(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3);
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
context.commit("update_dialog_error", true);
|
||||
} else {
|
||||
var data = {
|
||||
status: resp.status,
|
||||
};
|
||||
if (data.status == "OK") {
|
||||
context.commit("update_save_status", 2);
|
||||
context.commit("update_error_message", "");
|
||||
context.commit("update_dialog_error", false);
|
||||
let msg = "Data berhasil disimpan";
|
||||
context.commit("update_msg_success", resp.msg);
|
||||
context.commit("update_alert_success", true);
|
||||
context.commit("update_lastInsertId", resp.data.id);
|
||||
context.commit("update_ticket_number", resp.data.number);
|
||||
context.commit("update_dialog_is_active", true);
|
||||
console.log(resp.data.id);
|
||||
} else {
|
||||
context.commit("update_errors", resp.errors);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3);
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async uploadimage(context, prm) {
|
||||
context.commit("update_save_status", 1);
|
||||
try {
|
||||
let resp = await api.uploadimage(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_show_progrees_upload", false);
|
||||
context.commit("update_save_status", 3);
|
||||
} else {
|
||||
context.commit("update_save_status", 2);
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
};
|
||||
context.commit("update_show_progrees_upload", false);
|
||||
context.commit("update_images", data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_show_progrees_upload", false);
|
||||
context.commit("update_save_status", 3);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
23
one-new-ticket-support-v3/store.js
Normal file
23
one-new-ticket-support-v3/store.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// State
|
||||
// data ...
|
||||
// Mutations
|
||||
//
|
||||
//
|
||||
// Actions
|
||||
import ticket from "./modules/ticket.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
ticket:ticket,
|
||||
system:system
|
||||
},
|
||||
state: {
|
||||
|
||||
},
|
||||
mutations: {
|
||||
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user