Skip to content

Commit

Permalink
Add order number to factor and make notif sound static
Browse files Browse the repository at this point in the history
  • Loading branch information
mrafei committed Jul 15, 2020
1 parent aafbf28 commit d386dc6
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 10 deletions.
Binary file added assets/audio/pristine.mp3
Binary file not shown.
9 changes: 9 additions & 0 deletions assets/printStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ body {
padding-right: 10px;
padding-left: 10px;
}
.px-1 {
padding-left: 5px;
padding-right: 5px;
}

.py-2 {
padding-top: 10px;
padding-bottom: 10px;
}

.d-flex {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vitrin-pos",
"productName": "vitrin-pos",
"version": "0.4.1",
"version": "0.5.0",
"description": "Application for vitrin POS",
"license": "Vitrin",
"private": false,
Expand Down
27 changes: 20 additions & 7 deletions src/components/ComponentToPrint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,29 @@ export default class ComponentToPrint extends React.Component {
className="bg-white w-100 u-text-black printable px-3 u-fontVerySmall"
style={{ minWidth: 300 }}>
<div className="py-1 px-2 u-border-bottom-dark">
<div className="d-flex justify-content-between">
<div className="d-flex flex-column justify-content-center align-items-center">
{!printOptions.hideTitle && (
<div className="u-fontLarge u-fontWeightBold">{title}</div>
)}
<div className="mt-1">{englishNumberToPersianNumber(date)}</div>
</div>
<div className="d-flex justify-content-between align-items-center">
<span
className="d-flex px-1 py-2 flex-column justify-content-center align-items-center"
style={{ border: "1px solid black", height: "fit-content", borderRadius: 4 }}>
<span className="u-fontVerySmall">شماره فاکتور</span>
<span className="u-fontLarge u-fontWeightBold">
{englishNumberToPersianNumber(order.order_number) || "۱۰۱"}
</span>
</span>
{!printOptions.hideTitle && (
<div className="u-fontLarge text-center u-fontWeightBold" style={{ width: 160 }}>
{title}
</div>
)}
{!printOptions.hideQR && <QRCode value={url} size={100} id="qr" />}
</div>
</div>
<div className="d-flex flex-column justify-content-between px-3 pb-1">
<div className="mt-1">
<span>تاریخ و ساعت: </span>
<span className="u-fontWeightBold">{englishNumberToPersianNumber(date)}</span>
</div>

{!printOptions.hideCustomerName && (
<div className="mt-1">
<span> مشترک گرامی: </span>
Expand All @@ -40,6 +52,7 @@ export default class ComponentToPrint extends React.Component {
)}
</div>
)}

{!printOptions.hideOrderNumber && (
<div className="mt-1">
<span>شماره سفارش: </span>
Expand Down
3 changes: 2 additions & 1 deletion src/containers/pushNotification.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { PUSH_NOTIFICATION_API } from "../../utils/api";
import request from "../../utils/request";
import pristine from "../../assets/audio/pristine.mp3";

export default function initPushNotification(showSnackBar, history, updateOrders, siteDomain) {
const { ipcRenderer, remote } = require("electron");
Expand Down Expand Up @@ -36,7 +37,7 @@ export default function initPushNotification(showSnackBar, history, updateOrders
console.log("display notification", serverNotificationPayload);
updateOrders();
ipcRenderer.send("orderReceived", serverNotificationPayload.notification);
const audio = new Audio(`https://hs3-cf.behtarino.com/static/pristine.mp3`);
const audio = new Audio(pristine);
audio.play();
} else {
// payload has no body, so consider it silent (and just consider the data portion)
Expand Down
7 changes: 6 additions & 1 deletion webpack.build.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const webpack = require('webpack')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const BabiliPlugin = require('babili-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const SRC = path.resolve(__dirname, 'assets');

// Any directories you will be adding code/files into, need to be added to this array so webpack will pick them up

Expand Down Expand Up @@ -55,6 +55,11 @@ module.exports = {
test: /\.(eot|otf|ttf|woff|woff2)$/,
use: 'file-loader'
},
{
test: /\.mp3$/,
include: SRC,
loader: 'file-loader'
},
{
test: /\.svg$/,
use: [
Expand Down
6 changes: 6 additions & 0 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { spawn } = require('child_process');
const SRC = path.resolve(__dirname, 'assets');

// Any directories you will be adding code/files into, need to be added to this array so webpack will pick them up

Expand Down Expand Up @@ -54,6 +55,11 @@ module.exports = {
test: /\.(eot|otf|ttf|woff|woff2)$/,
use: 'file-loader'
},
{
test: /\.mp3$/,
include: SRC,
loader: 'file-loader'
},
{
test: /\.svg$/,
use: [
Expand Down

0 comments on commit d386dc6

Please sign in to comment.