Skip to content

Commit

Permalink
Merge branch 'build-version300' into 'master'
Browse files Browse the repository at this point in the history
Build version300

See merge request mohit.panjvani/crater-web!162
  • Loading branch information
mohitpanjwani committed Jan 27, 2020
2 parents 824d2e3 + 7ab0419 commit 06a538b
Show file tree
Hide file tree
Showing 35 changed files with 121 additions and 124 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DB_HOST=db
DB_PORT=3306
DB_DATABASE=crater
DB_USERNAME=crater
DB_PASSWORD=crater
DB_PASSWORD="crater"

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function index(Request $request)
$start = Carbon::now();
$end = Carbon::now();
$terms = explode('-', $fiscalYear);
if ($terms[0] < $start->month) {

if ($terms[0] <= $start->month) {
$startDate->month($terms[0])->startOfMonth();
$start->month($terms[0])->startOfMonth();
$end->month($terms[0])->endOfMonth();
Expand Down Expand Up @@ -93,6 +94,7 @@ public function index(Request $request)
}

$start->subMonth()->endOfMonth();

$salesTotal = Invoice::whereCompany($request->header('company'))
->whereBetween(
'invoice_date',
Expand Down
20 changes: 6 additions & 14 deletions app/Http/Controllers/EstimatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,24 +168,20 @@ public function store(EstimatesRequest $request)
$data['user'] = User::find($userId)->toArray();
$data['company'] = Company::find($estimate->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);

if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}

if (!$notificationEmail) {
if (!config('mail.from.name')) {
return response()->json([
'error' => 'notification_email_does_not_exist'
'error' => 'from_email_does_not_exist'
]);
}

\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
\Mail::to($email)->send(new EstimatePdf($data));
}

$estimate = Estimate::with([
Expand Down Expand Up @@ -340,24 +336,20 @@ public function sendEstimate(Request $request)
$data['company'] = Company::find($estimate->company_id);

$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);

if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}

if (!$notificationEmail) {
if (!config('mail.from.name')) {
return response()->json([
'error' => 'notification_email_does_not_exist'
'error' => 'from_email_does_not_exist'
]);
}

\Mail::to($email)->send(new EstimatePdf($data, $notificationEmail));
\Mail::to($email)->send(new EstimatePdf($data));

if ($estimate->status == Estimate::STATUS_DRAFT) {
$estimate->status = Estimate::STATUS_SENT;
Expand Down
21 changes: 6 additions & 15 deletions app/Http/Controllers/InvoicesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ public function store(Requests\InvoicesRequest $request)
$data['user'] = User::find($request->user_id)->toArray();
$data['company'] = Company::find($invoice->company_id);

$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);

$email = $data['user']['email'];

if (!$email) {
Expand All @@ -180,13 +175,13 @@ public function store(Requests\InvoicesRequest $request)
]);
}

if (!$notificationEmail) {
if (!config('mail.from.name')) {
return response()->json([
'error' => 'notification_email_does_not_exist'
'error' => 'from_email_does_not_exist'
]);
}

\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
\Mail::to($email)->send(new invoicePdf($data));
}

$invoice = Invoice::with(['items', 'user', 'invoiceTemplate', 'taxes'])->find($invoice->id);
Expand Down Expand Up @@ -408,24 +403,20 @@ public function sendInvoice(Request $request)
$data['user'] = User::find($userId)->toArray();
$data['company'] = Company::find($invoice->company_id);
$email = $data['user']['email'];
$notificationEmail = CompanySetting::getSetting(
'notification_email',
$request->header('company')
);

if (!$email) {
return response()->json([
'error' => 'user_email_does_not_exist'
]);
}

if (!$notificationEmail) {
if (!config('mail.from.name')) {
return response()->json([
'error' => 'notification_email_does_not_exist'
'error' => 'from_email_does_not_exist'
]);
}

\Mail::to($email)->send(new invoicePdf($data, $notificationEmail));
\Mail::to($email)->send(new invoicePdf($data));

if ($invoice->status == Invoice::STATUS_DRAFT) {
$invoice->status = Invoice::STATUS_SENT;
Expand Down
7 changes: 2 additions & 5 deletions app/Mail/EstimatePdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ class EstimatePdf extends Mailable

public $data = [];

public $notificationEmail = '';

/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $notificationEmail)
public function __construct($data)
{
$this->data = $data;
$this->notificationEmail = $notificationEmail;
}

/**
Expand All @@ -32,6 +29,6 @@ public function __construct($data, $notificationEmail)
*/
public function build()
{
return $this->from($this->notificationEmail)->markdown('emails.send.estimate', ['data', $this->data]);
return $this->markdown('emails.send.estimate', ['data', $this->data]);
}
}
7 changes: 2 additions & 5 deletions app/Mail/invoicePdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,14 @@ class invoicePdf extends Mailable

public $data = [];

public $notificationEmail = '';

/**
* Create a new message instance.
*
* @return void
*/
public function __construct($data, $notificationEmail)
public function __construct($data)
{
$this->data = $data;
$this->notificationEmail = $notificationEmail;
}

/**
Expand All @@ -32,6 +29,6 @@ public function __construct($data, $notificationEmail)
*/
public function build()
{
return $this->from($this->notificationEmail)->markdown('emails.send.invoice', ['data', $this->data]);
return $this->markdown('emails.send.invoice', ['data', $this->data]);
}
}
4 changes: 2 additions & 2 deletions app/Space/EnvironmentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public function saveDatabaseVariables(DatabaseEnvironmentRequest $request)
'DB_PORT='.config('database.connections.'.config('database.default').'.port')."\n".
'DB_DATABASE='.config('database.connections.'.config('database.default').'.database')."\n".
'DB_USERNAME='.config('database.connections.'.config('database.default').'.username')."\n".
'DB_PASSWORD='.config('database.connections.'.config('database.default').'.password')."\n\n";
'DB_PASSWORD="'.config('database.connections.'.config('database.default').'.password')."\"\n\n";

$newDatabaseData =
'DB_CONNECTION='.$request->database_connection."\n".
'DB_HOST='.$request->database_hostname."\n".
'DB_PORT='.$request->database_port."\n".
'DB_DATABASE='.$request->database_name."\n".
'DB_USERNAME='.$request->database_username."\n".
'DB_PASSWORD='.$request->database_password."\n\n";
'DB_PASSWORD="'.$request->database_password."\"\n\n";

try {

Expand Down
2 changes: 1 addition & 1 deletion public/assets/css/crater.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/js/app.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/assets/js/app.js": "/assets/js/app.js?id=173ae96baaa64386fe81",
"/assets/css/crater.css": "/assets/css/crater.css?id=52eb9b3d184487e7c842"
"/assets/js/app.js": "/assets/js/app.js?id=397e57d36ef22a2e14fc",
"/assets/css/crater.css": "/assets/css/crater.css?id=616996a79c1df69d18de"
}
1 change: 1 addition & 0 deletions resources/assets/js/plugins/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"update_payment": "تحديث الدفعة",
"payment": "دفعة | مدفوعات",
"no_payments": "لا يوجد مدفوعات حتى الآن!",
"no_matching_payments": "لا توجد مدفوعات مطابقة!",
"list_of_payments": "سوف تحتوي هذه القائمة على مدفوعات الفواتير.",
"select_payment_mode": "اختر طريقة الدفع",

Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/plugins/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@
"list_of_payments": "Dieser Abschnitt enthält die Liste der Zahlungen.",
"new_payment": "Neue Zahlung",
"no_payments": "Keine Zahlungen vorhanden!",
"no_matching_payments": "Es gibt keine passenden Zahlungen!",
"note": "Hinweis",
"payment": "Zahlung | Zahlungen",
"payment_mode": "Zahlungsart",
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/plugins/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@
"update_payment": "Update Payment",
"payment": "Payment | Payments",
"no_payments": "No payments yet!",
"no_matching_payments": "There are no matching payments!",
"list_of_payments": "This section will contain the list of payments.",
"select_payment_mode": "Select payment mode",
"confirm_send_payment": "This payment will be sent via email to the customer",
Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/plugins/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@
"update_payment": "Actualizar pago",
"payment": "Pago | Pagos",
"no_payments": "¡Aún no hay pagos!",
"no_matching_payments": "¡No hay pagos equivalentes!",
"list_of_payments": "Esta sección contendrá la lista de pagos.",
"select_payment_mode": "Seleccionar modo de pago",

Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/plugins/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
"update_payment": "Mettre à jour le paiement",
"payment": "Paiement | Paiements",
"no_payments": "Aucun paiement pour le moment!",
"no_matching_payments": "Il n'y a aucun paiement correspondant!",
"list_of_payments": "Cette section contiendra la liste des paiements",
"select_payment_mode": "Sélectionnez le mode de paiement",

Expand Down
1 change: 1 addition & 0 deletions resources/assets/js/plugins/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@
"update_payment": "Atualizar Pagamento",
"payment": "Pagamento | Pagamentos",
"no_payments": "Ainda sem pagamentos!",
"no_matching_payments": "Não há pagamentos correspondentes!",
"list_of_payments": "Esta seção conterá a lista de pagamentos.",
"select_payment_mode": "Selecione a forma de pagamento",

Expand Down
20 changes: 10 additions & 10 deletions resources/assets/js/store/modules/dashboard/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export const loadData = ({ commit, dispatch, state }, params) => {
})
}

export const getChart = ({ commit, dispatch, state }) => {
return new Promise((resolve, reject) => {
window.axios.get(`/api/dashboard/expense/chart`).then((response) => {
commit(types.SET_INITIAL_DATA, response.data)
resolve(response)
}).catch((err) => {
reject(err)
})
})
}
// export const getChart = ({ commit, dispatch, state }) => {
// return new Promise((resolve, reject) => {
// window.axios.get(`/api/dashboard/expense/chart`).then((response) => {
// commit(types.SET_INITIAL_DATA, response.data)
// resolve(response)
// }).catch((err) => {
// reject(err)
// })
// })
// }
4 changes: 3 additions & 1 deletion resources/assets/js/store/modules/item/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ export const fatchItemUnit = ({ commit, dispatch, state }, id) => {
export const deleteItemUnit = ({ commit, dispatch, state }, id) => {
return new Promise((resolve, reject) => {
window.axios.delete(`/api/units/${id}`).then((response) => {
commit(types.DELETE_ITEM_UNIT, id)
if (!response.data.error) {
commit(types.DELETE_ITEM_UNIT, id)
}
resolve(response)
}).catch((err) => {
reject(err)
Expand Down
4 changes: 3 additions & 1 deletion resources/assets/js/store/modules/payment/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ export const fetchPaymentMode = ({ commit, dispatch, state }, data) => {
export const deletePaymentMode = ({ commit, dispatch, state }, id) => {
return new Promise((resolve, reject) => {
window.axios.delete(`/api/payment-methods/${id}`).then((response) => {
commit(types.DELETE_PAYMENT_MODE, id)
if (!response.data.error) {
commit(types.DELETE_PAYMENT_MODE, id)
}
resolve(response)
}).catch((err) => {
reject(err)
Expand Down
Loading

0 comments on commit 06a538b

Please sign in to comment.