Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiloysss committed Feb 6, 2019
1 parent def247a commit 88ee5eb
Showing 1 changed file with 136 additions and 135 deletions.
271 changes: 136 additions & 135 deletions src/container/ShiftContainer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,74 +169,73 @@ export default class ShiftContainer extends React.Component {
Promise.all(writePromises);
})
.catch(e => {
BluetoothSerial.connect(
this.props.printerStore.rows[i].macAddress,
)
.then(() => {
const writePromises = [];

writePromises.push(BluetoothSerial.write(TinyPOS.init()));
// Header
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Date: " +
`${moment().format("YYYY/MM/D hh:mm:ss SSS")}`,
{ size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Cashier: " + `${defaultShift.attendant}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Type: " + `${money.type}`,
{ align: "left", size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Amount: " + `${money.pay}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Reason: " + `${money.reason}` + "\n\n\n",
{ align: "left", size: "normal" },
true,
),
),
);
Promise.all(writePromises);
})
.catch(err => {

Toast.show({
text: err.message,
buttonText: "Okay",
type: "danger",
position: "bottom",
duration: 3000,
});
});
BluetoothSerial.connect(
this.props.printerStore.rows[i].macAddress,
)
.then(() => {
const writePromises = [];

writePromises.push(BluetoothSerial.write(TinyPOS.init()));
// Header
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Date: " +
`${moment().format("YYYY/MM/D hh:mm:ss SSS")}`,
{ size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Cashier: " + `${defaultShift.attendant}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Type: " + `${money.type}`,
{ align: "left", size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Amount: " + `${money.pay}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Reason: " + `${money.reason}` + "\n\n\n",
{ align: "left", size: "normal" },
true,
),
),
);
Promise.all(writePromises);
})
.catch(err => {
Toast.show({
text: err.message,
buttonText: "Okay",
type: "danger",
position: "bottom",
duration: 3000,
});
});
});
}
}
Expand Down Expand Up @@ -357,73 +356,75 @@ export default class ShiftContainer extends React.Component {
Promise.all(writePromises);
})
.catch(e => {
BluetoothSerial.connect(
this.props.printerStore.rows[i].macAddress,
)
.then(() => {
const writePromises = [];

writePromises.push(BluetoothSerial.write(TinyPOS.init()));
// Header
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Date: " +
`${moment().format("YYYY/MM/D hh:mm:ss SSS")}`,
{ size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Cashier: " + `${defaultShift.attendant}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Type: " + `${money.type}`,
{ align: "left", size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Amount: " + `${money.pay}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Reason: " + `${money.reason}` + "\n\n\n",
{ align: "left", size: "normal" },
true,
),
),
);
Promise.all(writePromises);
})
.catch(err => {
Toast.show({
text: err.message,
buttonText: "Okay",
type: "danger",
position: "bottom",
duration: 3000,
});
});
BluetoothSerial.connect(
this.props.printerStore.rows[i].macAddress,
)
.then(() => {
const writePromises = [];

writePromises.push(
BluetoothSerial.write(TinyPOS.init()),
);
// Header
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Date: " +
`${moment().format("YYYY/MM/D hh:mm:ss SSS")}`,
{ size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Cashier: " + `${defaultShift.attendant}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Type: " + `${money.type}`,
{ align: "left", size: "normal" },
true,
),
),
);
writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Amount: " + `${money.pay}`,
{ align: "left", size: "normal" },
true,
),
),
);

writePromises.push(
BluetoothSerial.write(
TinyPOS.bufferedText(
"Reason: " + `${money.reason}` + "\n\n\n",
{ align: "left", size: "normal" },
true,
),
),
);
Promise.all(writePromises);
})
.catch(err => {
Toast.show({
text: err.message,
buttonText: "Okay",
type: "danger",
position: "bottom",
duration: 3000,
});
});
});
}
}
Expand Down

0 comments on commit 88ee5eb

Please sign in to comment.