|
new Vue({ |
|
el: '#app', |
|
data () { |
|
return { |
|
dataListHeaders: [ |
|
{ text: 'Hp', value: 'in_hpnumber' }, |
|
{ text: 'Pesan', value: 'in_message' }, |
|
{ text: 'Agen', value: 'agenid' }, |
|
{ text: 'Tanggal', value: 'date_message' } |
|
], |
|
dataListz: [ |
|
{ |
|
"in_hpnumber": "+62823456789", |
|
"in_message": "[xMet] ID: SDPONSEL, NAMA: Counter Pusat. Saldo Anda: 500000", |
|
"agenid": "SDPONSEL", |
|
"date_message": "2018-12-01T14:55:31.690Z" |
|
}, |
|
{ |
|
"in_hpnumber": "+62823456789", |
|
"in_message": "[xMet] No. Tiket: 089. Silahkan transfer ke KTR sejumlah 300000, No. Rek: 1234567891 AN: ADMIN Xmetrik.", |
|
"agenid": "SDPONSEL", |
|
"date_message": "2018-10-17T15:09:09.782Z" |
|
}, |
|
{ |
|
"in_hpnumber": "+62823456789", |
|
"in_message": "xMet> Deposit sejumlah 300000 berhasil via KTR. Saldo Anda: 800000. Silahkan bertransaksi.", |
|
"agenid": "SDPONSEL", |
|
"date_message": "2018-10-17T15:11:21.613Z" |
|
}, |
|
{ |
|
"in_hpnumber": "+62813456789", |
|
"in_message": "[xMet] ID: SMPPONSEL, NAMA: Counter Cabang. Saldo Anda: 3500000", |
|
"agenid": "SMPPONSEL", |
|
"date_message": "2018-10-19T15:12:07.598Z" |
|
}, |
|
{ |
|
"in_hpnumber": "+62813456790", |
|
"in_message": "[xMet] ID: SDPONSEL, NAMA: Counter Pusat. Saldo Anda: 1915630", |
|
"agenid": "SDPONSEL", |
|
"date_message": "2018-11-06T15:12:47.210Z" |
|
}, |
|
{ |
|
"in_hpnumber": "+62813456789", |
|
"in_message": "[xMet] No. Tiket: 090. Silahkan transfer ke KTR sejumlah 500000, No. Rek: 321456987 AN: ADMIN Xastro.", |
|
"agenid": "SMPPONSEL", |
|
"date_message": "2018-12-01T15:13:30.963Z" |
|
}, |
|
{ |
|
"in_hpnumber": "+62813456789", |
|
"in_message": "xMet> Deposit sejumlah 500000 berhasil via KTR. Saldo Anda: 4000000. Silahkan bertransaksi.", |
|
"agenid": "SMPPONSEL", |
|
"date_message": "2018-12-01T15:15:08.766Z" |
|
} |
|
], |
|
picker99: '2018-11-01', |
|
picker99s: '2018.11.01', |
|
picker100: '2018-12-31', |
|
picker100s: '2018.12.31', |
|
newDataFilters: '', |
|
models: { |
|
_id : '', |
|
agenid :'', |
|
name :'', |
|
nohp :'', |
|
pin :'', |
|
address :'', |
|
hrg_khs :'' |
|
} |
|
} |
|
}, |
|
methods: { |
|
getformatDate(t) { |
|
let nt = t |
|
let nDate = nt.substring(0, 2) |
|
let nMonth = nt.substring(3, 5) |
|
let nYear = '' |
|
if(nt.substring(1, 2) === '/'){ |
|
nDate = "0"+nt.substring(0, 1) |
|
|
|
if(nt.substring(3, 4) === '/'){ |
|
nMonth = "0"+nt.substring(2, 3) |
|
nYear = nt.substring(4, 8) |
|
}else{ |
|
nMonth = nt.substring(2, 4) |
|
nYear = nt.substring(5, 9) |
|
} |
|
}else{ |
|
if(nt.substring(4, 5) === '/'){ |
|
nMonth = "0"+nt.substring(3, 4) |
|
nYear = nt.substring(6, 9) |
|
}else{ |
|
nYear = nt.substring(6, 10) |
|
} |
|
} |
|
|
|
return [nYear,nMonth,nDate].join(".") |
|
}, |
|
dataUpdates(items) { |
|
this.models.agenid = items.agenid |
|
this.models.nohp = items.in_hpnumber |
|
this.models.address = items.in_message |
|
} |
|
}, |
|
created(){ |
|
this.newDataFilters = this.dataListz |
|
for(let i=0;i<this.dataListz.length;i++){ |
|
this.newDataFilters[i].in_hpnumber = this.dataListz[i].in_hpnumber |
|
this.newDataFilters[i].in_message = this.dataListz[i].in_message |
|
this.newDataFilters[i].agenid = this.dataListz[i].agenid |
|
let cdt = new Date(this.dataListz[i].date_message).toLocaleDateString('id-ID') |
|
this.newDataFilters[i].date_message = this.getformatDate(cdt) |
|
} |
|
}, |
|
computed: { |
|
filteredDataList() { |
|
return this.newDataFilters.filter((fields) => fields.date_message >= this.picker99s && fields.date_message <= this.picker100s) |
|
} |
|
}, |
|
watch: { |
|
picker99:function(val) { |
|
if (val != null) { |
|
let dd2 = new Date(val).toLocaleDateString('id-ID') |
|
this.picker99s = this.getformatDate(dd2) |
|
return this.picker99s |
|
} |
|
this.picker99s = '' |
|
return this.picker99s |
|
}, |
|
picker99s:function() { |
|
return (!this.picker99s) ? (this.picker99='') : this.picker99s |
|
}, |
|
picker100:function(val) { |
|
if (val != null) { |
|
let dd2 = new Date(val).toLocaleDateString('id-ID') |
|
this.picker100s = this.getformatDate(dd2) |
|
return this.picker100s |
|
} |
|
this.picker100s = '' |
|
return this.picker100s |
|
}, |
|
picker100s:function() { |
|
return (!this.picker100s) ? (this.picker100='') : this.picker100s |
|
} |
|
} |
|
}) |