Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
- WIP: report datetime.
  • Loading branch information
Blair2004 committed Aug 17, 2023
1 parent 8449a42 commit c301832
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
10 changes: 8 additions & 2 deletions app/Settings/GeneralSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,16 @@ public function __construct()
'label' => __( 'Date Format' ),
'name' => 'ns_date_format',
'value' => ns()->option->get( 'ns_date_format' ),
'type' => 'text',
'type' => 'select',
'options' => Helper::kvToJsOptions([
'Y-m-d' => ns()->date->format( 'Y-m-d' ),
'Y/m/d' => ns()->date->format( 'Y/m/d' ),
'd-m-y' => ns()->date->format( 'd-m-Y' ),
'd/m/y' => ns()->date->format( 'd/m/Y' ),
]),
'description' => __( 'This define how the date should be defined. The default format is "Y-m-d".' ),
], [
'label' => __( 'Date Format' ),
'label' => __( 'Date Time Format' ),
'name' => 'ns_datetime_format',
'value' => ns()->option->get( 'ns_datetime_format' ),
'type' => 'text',
Expand Down
22 changes: 15 additions & 7 deletions resources/ts/pages/dashboard/reports/ns-best-products-report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<div id="report-section" class="px-4">
<div class="flex -mx-2">
<div class="px-2">
<ns-date-time-picker :date="startDate" @change="setStartDate( $event )"></ns-date-time-picker>
<ns-date-time-picker :field="startDateField"></ns-date-time-picker>
</div>
<div class="px-2">
<ns-date-time-picker :date="endDate" @change="setEndDate( $event )"></ns-date-time-picker>
<ns-date-time-picker :field="endDateField"></ns-date-time-picker>
</div>
<div class="px-2">
<div class="ns-button">
Expand Down Expand Up @@ -42,7 +42,7 @@
<div class="my-4 flex justify-between w-full">
<div class="text-primary">
<ul>
<li class="pb-1 border-b border-dashed">{{ __( 'Date : {date}' ).replace( '{date}', ns.date.current ) }}</li>
<li class="pb-1 border-b border-dashed">{{ __( 'Date Range : {date1} - {date2}' ).replace( '{date1}', startDate ).replace( '{date2}', endDate ) }}</li>
<li class="pb-1 border-b border-dashed">{{ __( 'Document : Best Products' ) }}</li>
<li class="pb-1 border-b border-dashed">{{ __( 'By : {user}' ).replace( '{user}', ns.user.username ) }}</li>
</ul>
Expand Down Expand Up @@ -142,8 +142,16 @@ export default {
data() {
return {
ns: window.ns,
startDate: moment(),
endDate: moment(),
startDateField: {
name: 'start_date',
type: 'datetime',
value: ns.date.moment.startOf( 'day' ).format()
},
endDateField: {
name: 'end_date',
type: 'datetime',
value: ns.date.moment.endOf( 'day' ).format()
},
report: null,
sort : '',
}
Expand Down Expand Up @@ -174,8 +182,8 @@ export default {
const endDate = moment( this.endDate );
nsHttpClient.post( '/api/reports/products-report', {
startDate : startDate.format( 'YYYY/MM/DD HH:mm' ),
endDate : endDate.format( 'YYYY/MM/DD HH:mm' ),
startDate : this.startDateField.value,
endDate : this.endDateField.value,
sort: this.sort
})
.subscribe({
Expand Down
6 changes: 3 additions & 3 deletions resources/ts/pages/dashboard/reports/ns-sale-report.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="my-4 flex justify-between w-full">
<div class="text-secondary">
<ul>
<li class="pb-1 border-b border-dashed">{{ __( 'Date : {date}' ).replace( '{date}', ns.date.current ) }}</li>
<li class="pb-1 border-b border-dashed" v-html="__( 'Range : {date1} &mdash; {date2}' ).replace( '{date1}', startDateField.value ).replace( '{date2}', endDateField.value )"></li>
<li class="pb-1 border-b border-dashed">{{ __( 'Document : Sale Report' ) }}</li>
<li class="pb-1 border-b border-dashed">{{ __( 'By : {user}' ).replace( '{user}', ns.user.username ) }}</li>
</ul>
Expand Down Expand Up @@ -252,12 +252,12 @@ export default {
startDateField: {
name: 'start_date',
type: 'datetime',
value: moment()
value: ns.date.moment.startOf( 'day' ).format()
},
endDateField: {
name: 'end_date',
type: 'datetime',
value: moment()
value: ns.date.moment.endOf( 'day' ).format()
},
result: [],
users: [],
Expand Down
1 change: 1 addition & 0 deletions resources/ts/pages/setup/setup-configuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ns-spinner size="12" border="4" animation="fast" v-if="fields.length === 0"></ns-spinner>
<div class="bg-white rounded shadow my-2" v-if="fields.length > 0">
<div class="welcome-box border-b border-gray-300 p-3 text-gray-700">
<div class="border-b pb-3 mb-3" v-html="__( '<strong>NexoPOS</strong> is now able to connect to the database. Start by creating the administrator account and giving a name to your installation. Once installed, this page will no longer be accessible.' )"></div>
<ns-field v-for="( field, key ) of fields" :key="key" :field="field"></ns-field>
</div>
<div class="bg-gray-200 p-3 flex justify-between items-center">
Expand Down

0 comments on commit c301832

Please sign in to comment.