ソースを参照

Add delivery notes page

Alan Lam 3 年 前
親
コミット
a479965807
4 ファイル変更、24 行追加、5 行削除
  1. 11 0
      controllers/documents.php
  2. 1 1
      routes/default.php
  3. 11 4
      views/documents.php
  4. 1 0
      views/header.php

+ 11 - 0
controllers/documents.php

@@ -25,6 +25,7 @@ switch($type_string) {
 		$plural = __("%s invoices");
 		$status_field = "invoice_status";
 		break;
+
 	case "goods-in":
 		$title = __("Goods-In");
 		$type = DocumentTypes::GOODS_IN;
@@ -32,6 +33,7 @@ switch($type_string) {
 		$plural = __("%s goods-in documents");
 		$status_field = null;
 		break;
+
 	case "arus":
 		$title = __("ARUs");
 		$type = DocumentTypes::ADVANCE_REPLACEMENT_UNIT;
@@ -39,6 +41,15 @@ switch($type_string) {
 		$plural = __("%s ARUs");
 		$status_field = "aru_status";
 		break;
+
+	case "delivery-notes":
+		$title = __("Delivery Notes");
+		$type = DocumentTypes::DELIVERY_NOTE;
+		$singular = __("%s delivery note");
+		$plural = __("%s delivery notes");
+		$status_field = null;
+		break;
+
 	default:
 		throw new RuntimeException(__("Invalid type string."));
 }

+ 1 - 1
routes/default.php

@@ -66,7 +66,7 @@ $this->addRoute("/^tickets\/(\d+)$/", "ticket", ["id"], ["requireUser" => true])
 
 $this->addRoute("/^(goods-in|arus)\/(create)$/", "document", ["document_type_string", "action"], ["requireUser" => true]);
 
-$this->addRoute("/^(goods-in|arus|invoices)$/", "documents", ["type_string"], ["requireUser" => true]);
+$this->addRoute("/^(goods-in|arus|invoices|delivery-notes)$/", "documents", ["type_string"], ["requireUser" => true]);
 
 $this->addRoute("/^(goods-in|arus)\/(\d+)$/", "document", ["document_type_string", "document_number"], ["requireUser" => true]);
 $this->addRoute("/^(goods-in|arus)\/(\d+)\/(submit|submit-item|delete-item|items-batch-action|download-pdf)$/", "document", ["document_type_string", "document_number", "action"], ["requireUser" => true]);

+ 11 - 4
views/documents.php

@@ -24,6 +24,7 @@ use App\Helpers\HtmlHelper;
 $is_invoice = ($type === DocumentTypes::INVOICE);
 $is_goods_in = ($type === DocumentTypes::GOODS_IN);
 $is_aru = ($type === DocumentTypes::ADVANCE_REPLACEMENT_UNIT);
+$is_delivery_note = ($type === DocumentTypes::DELIVERY_NOTE);
 
 $status_options = [];
 $custom_filter_options = [];
@@ -154,7 +155,7 @@ else {
 		<colgroup>
 			<col style="width: 1%"/>
 			<?php
-			if($is_goods_in) {
+			if(!$status_options) {
 				?>
 				<col style="width: 20%"/>
 				<?php
@@ -173,9 +174,15 @@ else {
 		<tr>
 			<th><?=htmlspecialchars(__("No."))?></th>
 			<?php
-			if($is_goods_in) {
+			if(!$status_options) {
+				if($is_goods_in) {
+					$column_name = __("Location / Supplier");
+				}
+				else {
+					$column_name = __("Location");
+				}
 				?>
-				<th><?=htmlspecialchars(__("Location / Supplier"))?></th>
+				<th><?=htmlspecialchars($column_name)?></th>
 				<?php
 			}
 			else {
@@ -219,7 +226,7 @@ else {
 					?>
 				</td>
 				<?php
-				if(!$is_goods_in) {
+				if($status_options) {
 					if($is_invoice) {
 						?>
 						<td>

+ 1 - 0
views/header.php

@@ -110,6 +110,7 @@ $google_api_key = $_ENV["GOOGLE_API_KEY"] ?? null;
 						<a class="list-group-item list-group-item-action" href="/goods-in"><?=htmlspecialchars(__("Goods-In"))?></a>
 						<a class="list-group-item list-group-item-action" href="/arus"><?=htmlspecialchars(__("ARUs"))?></a>
 						<a class="list-group-item list-group-item-action" href="/invoices"><?=htmlspecialchars(__("Invoices"))?></a>
+						<a class="list-group-item list-group-item-action" href="/delivery-notes"><?=htmlspecialchars(__("Delivery Notes"))?></a>
 					</div>
 				</div>